ViewportInfo

ViewportInfo

Represents a viewing frustum.

Constructor

new ViewportInfo()

Extends

Members

camera35mmLensLength :double

This property assumes the camera is horizontal and crop the film rather than the image when the aspect of the frustum is not 36/24. (35mm film is 36mm wide and 24mm high.) Setting preserves camera location, changes the frustum, but maintains the frustum's aspect.
Type:
  • double

cameraAngle :double

Gets or sets the 1/2 smallest angle. See for more information.
Type:
  • double

cameraDirection :Array.<x, y, z>

Gets the direction that the camera faces.
Type:
  • Array.<x, y, z>

cameraLocation :Array.<x, y, z>

Gets the camera location (position) point.
Type:
  • Array.<x, y, z>

cameraUp :Array.<x, y, z>

Gets the camera up vector.
Type:
  • Array.<x, y, z>

cameraX :Array.<x, y, z>

Gets the unit "to the right" vector.
Type:
  • Array.<x, y, z>

cameraY :Array.<x, y, z>

Gets the unit "up" vector.
Type:
  • Array.<x, y, z>

cameraZ :Array.<x, y, z>

Gets the unit vector in -CameraDirection.
Type:
  • Array.<x, y, z>

id :Guid

Sets the viewport's id to the value used to uniquely identify this viewport. There is no approved way to change the viewport id once it is set in order to maintain consistency across multiple viewports and those routines that manage them.
Type:
  • Guid

isParallelProjection :bool

Get or set whether this projection is parallel.
Type:
  • bool

isPerspectiveProjection :bool

Get or set whether this projection is perspective.
Type:
  • bool

isTwoPointPerspectiveProjection :bool

Gets a value that indicates whether this projection is a two-point perspective.
Type:
  • bool

isValid :bool

Inherited From:
Tests an object to see if it is valid.
Type:
  • bool

isValidCamer

isValidCameraFrame

isValidFrustum :bool

Gets a value that indicates whether the frustum is valid.
Type:
  • bool

screenPort :System.Drawing.Rectangle

Get or set the screen port. and
Type:
  • System.Drawing.Rectangle

screenPortAspect :double

Gets the screen aspect ratio. This is width / height.
Type:
  • double

userStringCount

Inherited From:

Methods

(static) defaultPerspective()

...

(static) defaultTop()

...

changeToParallelProjection(symmetricFrustum) → {bool}

Use this function to change projections of valid viewports from parallel to perspective. It will make common additional adjustments to the frustum and camera location so the resulting views are similar. The camera direction and target point are not be changed. If the current projection is parallel and symmetricFrustum, FrustumIsLeftRightSymmetric() and FrustumIsTopBottomSymmetric() are all equal, then no changes are made and true is returned.
Parameters:
Name Type Description
symmetricFrustum bool true if you want the resulting frustum to be symmetric.
Returns:
true if the operation succeeded; otherwise, false.
Type
bool

changeToPerspectiveProjection(targetDistance, symmetricFrustum, lensLength) → {bool}

Use this function to change projections of valid viewports from parallel to perspective. It will make common additional adjustments to the frustum and camera location so the resulting views are similar. The camera direction and target point are not changed. If the current projection is perspective and symmetricFrustum, IsFrustumIsLeftRightSymmetric, and IsFrustumIsTopBottomSymmetric are all equal, then no changes are made and true is returned.
Parameters:
Name Type Description
targetDistance double If RhinoMath.UnsetValue this parameter is ignored. Otherwise it must be > 0 and indicates which plane in the current view frustum should be preserved.
symmetricFrustum bool true if you want the resulting frustum to be symmetric.
lensLength double (pass 50.0 when in doubt) 35 mm lens length to use when changing from parallel to perspective projections. If the current projection is perspective or lens_length is <= 0.0, then this parameter is ignored.
Returns:
true if the operation succeeded; otherwise, false.
Type
bool

changeToTwoPointPerspectiveProjection(targetDistance, up, lensLength) → {bool}

Changes projections of valid viewports to a two point perspective. It will make common additional adjustments to the frustum and camera location and direction so the resulting views are similar. If the current projection is perspective and IsFrustumIsLeftRightSymmetric is true and IsFrustumIsTopBottomSymmetric is false, then no changes are made and true is returned.
Parameters:
Name Type Description
targetDistance double If RhinoMath.UnsetValue this parameter is ignored. Otherwise it must be > 0 and indicates which plane in the current view frustum should be preserved.
up Array.<x, y, z> The locked up direction. Pass Vector3d.Zero if you want to use the world axis direction that is closest to the current up direction. Pass CameraY() if you want to preserve the current up direction.
lensLength double (pass 50.0 when in doubt) 35 mm lens length to use when changing from parallel to perspective projections. If the current projection is perspective or lens_length is <= 0.0, then this parameter is ignored.
Returns:
true if the operation succeeded; otherwise, false.
Type
bool

dollyExtents(border) → {bool}

Dolly the camera location and so that the view frustum contains all of the document objects that can be seen in view. If the projection is perspective, the camera angle is not changed.
Parameters:
Name Type Description
border double If border > 1.0, then the frustum in enlarged by this factor to provide a border around the view. 1.1 works well for parallel projections; 0.0 is suggested for perspective projections.
Returns:
True if successful.
Type
bool

encode()

Inherited From:
...

extents(halfViewAngleRadians, bbox) → {bool}

Extends this viewport view to include a bounding box. Use Extents() as a quick way to set a viewport to so that bounding volume is inside of a viewports frustum. The view angle is used to determine the position of the camera.
Parameters:
Name Type Description
halfViewAngleRadians double 1/2 smallest subtended view angle in radians.
bbox BoundingBox A bounding box in 3d world coordinates.
Returns:
true if the operation succeeded; otherwise, false.
Type
bool

frustumCenterPoint(targetDistance) → {Array.<x, y, z>}

Return a point on the central axis of the view frustum. This point is a good choice for a general purpose target point.
Parameters:
Name Type Description
targetDistance double If targetDistance > 0.0, then the distance from the returned point to the camera plane will be targetDistance. Note that if the frustum is not symmetric, the distance from the returned point to the camera location will be larger than targetDistance. If targetDistance == ON_UNSET_VALUE and the frustum is valid with near > 0.0, then 0.5*(near + far) will be used as the targetDistance.
Returns:
A point on the frustum's central axis. If the viewport or input is not valid, then ON_3dPoint::UnsetPoint is returned.
Type
Array.<x, y, z>

getFrustum() → {Array}

Gets the view frustum.
Returns:
[bool, double, double, double, double, double, double]
  • (bool) true if operation succeeded; otherwise, false.
  • (double) A left value that will be filled during the call.
  • (double) A right value that will be filled during the call.
  • (double) A bottom value that will be filled during the call.
  • (double) A top value that will be filled during the call.
  • (double) A near distance value that will be filled during the call.
  • (double) A far distance value that will be filled during the call.
Type
Array

getUserString()

Inherited From:
...

getUserStrings()

Inherited From:
...

getXform(sourceSystem, destinationSystem) → {Transform}

Computes a transform from a coordinate system to another.
Parameters:
Name Type Description
sourceSystem CoordinateSystem The coordinate system to map from.
destinationSystem CoordinateSystem The coordinate system to map into.
Returns:
The 4x4 transformation matrix (acts on the left).
Type
Transform

rdkXml()

Inherited From:
...

setCameraDirection(direction) → {bool}

Sets the direction that the camera faces.
Parameters:
Name Type Description
direction Array.<x, y, z> A new direction.
Returns:
true if the direction was set; otherwise false.
Type
bool

setCameraLocation() → {bool}

Sets the camera location (position) point.
Returns:
true if the operation succeeded; otherwise, false.
Type
bool

setCameraUp(up) → {bool}

Sets the camera up vector.
Parameters:
Name Type Description
up Array.<x, y, z> A new direction.
Returns:
true if the direction was set; otherwise false.
Type
bool

setFrustum(left, right, bottom, top, nearDistance, farDistance) → {bool}

Sets the view frustum. If FrustumSymmetryIsLocked() is true and left != -right or bottom != -top, then they will be adjusted so the resulting frustum is symmetric.
Parameters:
Name Type Description
left double A new left value.
right double A new right value.
bottom double A new bottom value.
top double A new top value.
nearDistance double A new near distance value.
farDistance double A new far distance value.
Returns:
true if operation succeeded; otherwise, false.
Type
bool

setUserString()

Inherited From:
...

targetDistance(useFrustumCenterFallback) → {double}

Gets the distance from the target point to the camera plane. Note that if the frustum is not symmetric, then this distance is shorter than the distance from the target to the camera location.
Parameters:
Name Type Description
useFrustumCenterFallback bool If bUseFrustumCenterFallback is false and the target point is not valid, then ON_UNSET_VALUE is returned. If bUseFrustumCenterFallback is true and the frustum is valid and current target point is not valid or is behind the camera, then 0.5*(near + far) is returned.
Returns:
Shortest signed distance from camera plane to target point. If the target point is on the visible side of the camera, a positive value is returned. ON_UNSET_VALUE is returned when the input of view is not valid.
Type
double

toJSON()

Inherited From:
Create a JSON string representation of this object