Request

Response

    Autodesk.Viewing

    Methods

    setCamera(camera)

    Set or unset the current camera used for navigation. Normally set via the constructor. The camera should be of type Autodesk.Viewing.UnifiedCamera.

    Parameters

    camera*
    Autodesk.Viewing.UnifiedCamera
    the current camera object.
    * Required

    getCamera()

    Returns

    typedescription
    THREE.Camera the current camera object.

    setScreenViewport(viewport)

    Set the current canvas viewport in screen coordinates. Invoked internally on canvas resize.

    Parameters

    viewport*
    Object
    Rectangle with properties left, top, width, height.
    * Required

    getScreenViewport()

    Get the current canvas viewport in screen coordinates.

    Returns

    typedescription
    Object with properties left, top, width, height.

    setView(position, target)

    Sets the cameras position and view direction.

    Parameters

    position*
    THREE.Vector3
    the new position for the camera in world space.
    target*
    THREE.Vector3
    the point in world space that the camera should look towards.
    * Required

    orientCameraUp()

    Orient the camera’s up direction with the current world up direction

    getPivotPoint()

    Returns

    typedescription
    THREE.Vector3 the world space position of the pivot point for orbit navigation.

    setPivotPoint(pivot)

    Sets the Vector3 world space position of the pivot point for orbit navigation.

    Parameters

    pivot*
    THREE.Vector3
    the new pivot position.
    * Required

    getPosition()

    Returns

    typedescription
    THREE.Vector3 the world space position of the camera.

    setPosition(pos)

    Sets the Vector3 world space position of camera.

    Parameters

    pos*
    THREE.Vector3
    the new camera position.
    * Required

    setTarget(target)

    Sets the Vector3 world space position towards which the camera should be pointing.

    Parameters

    target*
    THREE.Vector3
    the new camera look at point.
    * Required

    getTarget()

    Returns

    typedescription
    THREE.Vector3 the world space position towards which the camera is pointing.

    getEyeVector()

    Get the current camera view vector. This vector is not normalized and its length is the distance between the camera position and the camera look at point.

    Returns

    typedescription
    THREE.Vector3 the current camera view vector in world space.

    getEyeToCenterOfBoundsVec(bounds)

    Get a vector from the camera location to the center of the input bounding box.

    Parameters

    bounds*
    THREE.Box3
    Bounding box.
    * Required

    Returns

    typedescription
    THREE.Vector3 The vector from the camera location to the center of the input bounds.

    getFovMin()

    Returns

    typedescription
    number the minimum allowed vertical field of view in degrees.

    getFovMax()

    Returns

    typedescription
    number the maximum allowed vertical field of view in degrees.

    setZoomInLimitFactor(factor)

    Limits zoom in to show 1/factor-th of the entire 2D page. Applies only on 2D vectorized models.

    Parameters

    factor*
    number
    * Required

    getZoomInLimitFactor()

    Returns

    typedescription
    number the current limit when zooming into 2D vectorized models.

    setZoomOutLimitFactor(factor)

    Limits zoom out to a multiplier of the model’s bounding box dimensions. Applies to 2D and 3D models.

    Parameters

    factor*
    number
    * Required

    getZoomOutLimitFactor()

    Returns

    typedescription
    number the current limit when zooming out 2D and 3D models.

    isPointVisible(point)

    Returns true if the point is visible.

    Parameters

    point*
    THREE.Vector3
    The point in world coordinates.
    * Required

    Returns

    typedescription
    boolean True if the point is within the camera’s frustum.

    setVerticalFov(fov, adjustPosition)

    Set the current vertical field of view.

    Parameters

    fov*
    number
    the new field of view in degrees (value is clamped to the minimum and maximum field of view values).
    adjustPosition*
    boolean
    If true, the camera position will be modified to keep either the world space area of the view at the pivot point unchanged (if it is set and visible) or the world space area of view at the camera look at point unchanged.
    * Required

    applyRotation(point, angle, pivot, viewVec)

    Applies a rotation on a single point

    Parameters

    point*
    THREE.Vector3
    Point to rotate
    angle*
    THREE.Vector3
    Angle of rotation (in radians)
    pivot*
    THREE.Vector3
    Pivot of rotation
    viewVec*
    THREE.Vector3
    Front vector
    * Required

    getSignedAngle(v1, v2, viewVec)

    Computes a signed angle between two vectors

    Parameters

    v1*
    THREE.Vector3
    Vector #1
    v2*
    THREE.Vector3
    Vector #2
    viewVec*
    THREE.Vector3
    Front vector
    * Required

    Returns

    typedescription
    number Signed angle between two vectors

    computeFit(oldpos, oldcoi, fov, bounds, aspect)

    Compute camera position and look at point which will fit the given bounding box in the view frustum at the given field of view angle.

    Parameters

    oldpos*
    THREE.Vector3
    existing camera position
    oldcoi*
    THREE.Vector3
    existing camera look at point
    fov*
    number
    field of view (in degrees) to use for fit calculation in degrees
    bounds*
    THREE.Box3
    bounding box to fit
    aspect*
    number
    optional aspect ratio of window, horizontal/vertical
    * Required

    Returns

    typedescription
    Object Object with properties "position" and "target".

    computeOrthogonalUp(pos, coi)

    Compute a vector which is orthogonal to the given view and aligned with the world up direction.

    Parameters

    pos*
    THREE.Vector3
    view position
    coi*
    THREE.Vector3
    center of interest (view look at point)
    * Required

    Returns

    typedescription
    THREE.Vector3 up direction orthogonal to the given view

    fitBounds(immediate, bounds, reorient)

    Causes the current camera position to be changed in order to fit the given bounds into the current view frustum.

    Parameters

    immediate*
    boolean
    if false the camera position will animate to the new location.
    bounds*
    THREE.Box3
    bounding box to fit
    reorient*
    boolean
    if true the camera up direction will be reoriented with the world up.
    * Required

    Returns

    typedescription
    Object Object with properties "position" and "target".

    updateCamera()

    Update the current camera projection matrix and orient the camera to the current look at point. Invoked internally prior to rendering a new frame with the current camera.

    setConstraints2D(viewRegion, maxPixelPerUnit)

    Applies zooming and panning restrictions when viewing 2D models. Invoke without parameters to clear any previous setting.

    Parameters

    viewRegion
    THREE.Box3
    in world space. If specified, navigation is restricted so that this region always spans >= half of the screen extent in x and y.
    maxPixelPerUnit
    Number
    Restrict zoom-In, so that a single unit in world-space never exceeds maxPixelPerUnit on screen.