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.
Setting FrustumAspect changes the larger of the frustum's width/height so that the resulting value of width/height matches the requested aspect. The camera angle is not changed. If you change the shape of the view port with a call SetScreenPort(), then you generally want to call SetFrustumAspect() with the value returned by GetScreenPortAspect().
Gets far clipping plane if camera and frustum are valid. The plane's frame is the same as the camera's frame. The origin is located at the intersection of the camera direction ray and the far clipping plane. The plane's normal points into the frustum towards the camera location.
Gets near clipping plane if camera and frustum are valid. The plane's frame is the same as the camera's frame. The origin is located at the intersection of the camera direction ray and the near clipping plane. The plane's normal points out of the frustum towards the camera location.
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.
If true this object may not be modified. Any properties or functions that attempt to modify this object when it is set to "IsReadOnly" will throw a NotSupportedException.
The current value of the target point. This point does not play a role in the view projection calculations. It can be used as a fixed point when changing the camera so the visible regions of the before and after frustums both contain the region of interest. The default constructor sets this point on ON_3dPoint::UnsetPoint. You must explicitly call one SetTargetPoint() functions to set the target point.
Applies scaling factors to parallel projection clipping coordinates by setting the m_clip_mod transformation. If you want to compress the view projection across the viewing plane, then set x = 0.5, y = 1.0, and z = 1.0.
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.
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.
(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.
If projection is not perspective or target_distance is RhinoMath.UnsetValue, then this parameter is ignored. If the projection is perspective and targetDistance is not RhinoMath.UnsetValue, then it must be > 0.0 and it is used to determine which plane in the old frustum will appear unchanged in the new frustum.
Returns: Returns true if the viewport has now a frustum with the specified symmetries.
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.
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.
(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.
This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.
You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.
Also, you must call the base virtual method within your overriding method.
DollyCamera() does not update the frustum's clipping planes. To update the frustum's clipping planes call DollyFrustum(d) with d = dollyVector o cameraFrameZ. To convert screen locations into a dolly vector, use GetDollyCameraVector(). Does not update frustum. To update frustum use DollyFrustum(d) with d = dollyVector o cameraFrameZ.
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.
If border > 1.0, then the frustum is enlarged by this factor to provide a border around the view. If 0.0 < border < 1.0, then the frustum is shrunk by this factor and the objects will extend past the edges of the view. A border of 0.0 or 1.0 adds no border. 1.1 works well for parallel projections; 0.0 is suggested for perspective projections.
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.
If border > 1.0, then the frustum is enlarged by this factor to provide a border around the view. If 0.0 < border < 1.0, then the frustum is shrunk by this factor and the objects will extend past the edges of the view. A border of 0.0 or 1.0 adds no border. 1.1 works well for parallel projections; 0.0 is suggested for perspective projections.
Returns: true if the operation succeeded; otherwise, false.
EnsurePrivateCopy
publicvoidEnsurePrivateCopy()
If you want to keep a copy of this class around by holding onto it in a variable after a command completes, call EnsurePrivateCopy to make sure that this class is not tied to the document. You can call this function as many times as you want.
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.
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.
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.
Gets near and far clipping distances of a bounding box. This function ignores the current value of the viewport's near and far settings. If the viewport is a perspective projection, the it intersects the semi infinite frustum volume with the bounding box and returns the near and far distances of the intersection. If the viewport is a parallel projection, it intersects the infinite view region with the bounding box and returns the near and far distances of the projection.
Far distance of the box. This value can be equal to near_dist, zero or negative when the camera location is in front of the bounding box.
Returns: true if the bounding box intersects the view frustum and near_dist/far_dist were set. false if the bounding box does not intersect the view frustum.
Gets the corners of the frame plane rectangle at specified depth. 4 points are returned in the order of bottom left, bottom right, top left, top right.
Gets the clipping distance of a point. This function ignores the current value of the viewport's near and far settings. If the viewport is a perspective projection, then it intersects the semi infinite frustum volume with the bounding box and returns the near and far distances of the intersection. If the viewport is a parallel projection, it intersects the infinite view region with the bounding box and returns the near and far distances of the projection.
Returns: true if the bounding box intersects the view frustum and near_dist/far_dist were set. false if the bounding box does not intersect the view frustum.
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.
If min_near_dist <= 0.0, it is ignored. If min_near_dist > 0 and near_dist < min_near_dist, then the frustum's near_dist will be increased to min_near_dist.
If min_near_over_far <= 0.0, it is ignored. If near_dist < far_dist*min_near_over_far, then near_dist is increased and/or far_dist is decreased so that near_dist = far_dist*min_near_over_far. If near_dist < target_dist < far_dist, then near_dist near_dist is increased and far_dist is decreased so that projection precision will be good at target_dist. Otherwise, near_dist is simply set to far_dist*min_near_over_far.
Location of viewport in pixels. These are provided so you can set the port you are using and get the appropriate transformations to and from screen space. // For a Windows window / int width = width of window client area in pixels; / int height = height of window client area in pixels; / port_left = 0; / port_right = width; / port_top = 0; / port_bottom = height; / port_near = 0; / port_far = 1; / SetScreenPort( port_left, port_right, / port_bottom, port_top, / port_near, port_far );
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.
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.