Rhino C++ API  8.6
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
ON_Viewport Class Reference

#include <opennurbs_viewport.h>

Inheritance diagram for ON_Viewport:
ON_Geometry ON_Object

Public Member Functions

 ON_Viewport ()=default
 
 ON_Viewport (const ON_Viewport &)=default
 
 ~ON_Viewport ()=default
 
ON_3dVector CameraDirection () const
 
bool CameraDirectionIsLocked () const
 
ON_3dPoint CameraLocation () const
 
bool CameraLocationIsLocked () const
 
ON_3dVector CameraUp () const
 
bool CameraUpIsLocked () const
 
ON_3dVector CameraX () const
 these do not check for a valid camera orientation More...
 
ON_3dVector CameraY () const
 unit up vector More...
 
ON_3dVector CameraZ () const
 unit vector in -CameraDirection More...
 
bool ChangeToParallelProjection (bool bSymmetricFrustum)
 
bool ChangeToPerspectiveProjection (double target_distance, bool bSymmetricFrustum, double lens_length)
 
bool ChangeToSymmetricFrustum (bool bLeftRightSymmetric, bool bTopBottomSymmetric, double target_distance)
 
bool ChangeToTwoPointPerspectiveProjection (double target_distance, ON_3dVector up, double lens_length)
 
void ChangeViewportId (const ON_UUID &viewport_id)
 
double ClipCoordDepthBias (double relative_depth_bias, double clip_z, double clip_w) const
 
ON_Xform ClipModInverseXform () const
 
ON_Xform ClipModXform () const
 
bool ClipModXformIsIdentity () const
 
int Dimension () const override
 
bool DollyCamera (const ON_3dVector &dolly_vector)
 
bool DollyFrustum (double dolly_distance)
 Moves frustum's clipping planes. More...
 
void Dump (ON_TextLog &) const override
 
bool Extents (double half_view_angle, const ON_3dPoint &center, double radius)
 
bool Extents (double half_view_angle, const ON_BoundingBox &world_bbox)
 
double FrustumBottom () const
 
ON_3dPoint FrustumCenterPoint (double target_distance) const
 
double FrustumFar () const
 
double FrustumHeight () const
 top - bottom More...
 
bool FrustumIsLeftRightSymmetric () const
 
bool FrustumIsTopBottomSymmetric () const
 
double FrustumLeft () const
 
double FrustumMaximumDiameter () const
 
double FrustumMinimumDiameter () const
 
double FrustumNear () const
 
double FrustumRight () const
 
double FrustumTop () const
 
double FrustumWidth () const
 right - left More...
 
bool GetBBox (double *boxmin, double *boxmax, bool bGrowBox=false) const override
 virtual ON_Geometry GetBBox override
More...
 
int GetBoundingBoxDepth (ON_BoundingBox bbox, const ON_Xform *bbox_xform, double *near_dist, double *far_dist, bool bGrowNearFar) const
 
bool GetBoundingBoxDepth (ON_BoundingBox bbox, double *near_dist, double *far_dist, bool bGrowNearFar=false) const
 
bool GetBoundingBoxProjectionExtents (ON_BoundingBox bbox, ON_Interval &x_extents, ON_Interval &y_extents) const
 
bool GetCamera35mmLenseLength (double *lens_length) const
 Same as GetCamera35mmLensLength() with "lens" misspelled. More...
 
bool GetCamera35mmLensLength (double *lens_length) const
 
bool GetCameraAngle (double *half_diagonal_angle, double *half_vertical_angle, double *half_horizontal_angle) const
 
bool GetCameraAngle (double *half_smallest_angle) const
 
bool GetCameraExtents (const ON_BoundingBox &, ON_BoundingBox &cambbox, int bGrowBox=false) const
 
bool GetCameraExtents (int, int, const double *, ON_BoundingBox &cambbox, int bGrowBox=false) const
 
bool GetCameraExtents (ON_3dPoint &, double, ON_BoundingBox &cambox, int bGrowBox=false) const
 
bool GetCameraFrame (class ON_Plane &camera_frame) const
 
bool GetCameraFrame (double *, double *, double *, double *) const
 returns true if current camera orientation is valid More...
 
bool GetClipCoordDepthBiasXform (double relative_depth_bias, ON_Xform &clip_bias) const
 
bool GetCoordinateSprite (int, int, int, int[3], double[3][2]) const
 
bool GetDollyCameraVector (int screen_x0, int screen_y0, int screen_x1, int screen_y1, double proj_plane_dist, ON_3dVector &dolly_vector) const
 
bool GetFarPlane (ON_Plane &far_plane) const
 
bool GetFarPlaneEquation (ON_PlaneEquation &far_plane_equation) const
 
bool GetFarRect (ON_3dPoint &left_bottom, ON_3dPoint &right_bottom, ON_3dPoint &left_top, ON_3dPoint &right_top) const
 
bool GetFrustum (double *left, double *right, double *bottom, double *top, double *near_dist=nullptr, double *far_dist=nullptr) const
 
bool GetFrustumAspect (double &) const
 Returns frustum's width/height. More...
 
bool GetFrustumBottomPlane (ON_Plane &bottom_plane) const
 
bool GetFrustumBottomPlaneEquation (ON_PlaneEquation &bottom_plane_equation) const
 
bool GetFrustumCenter (double *) const
 Returns world coordinates of frustum's center. More...
 
bool GetFrustumLeftPlane (ON_Plane &left_plane) const
 
bool GetFrustumLeftPlaneEquation (ON_PlaneEquation &left_plane_equation) const
 
bool GetFrustumLine (double screenx, double screeny, ON_Line &world_line) const
 
bool GetFrustumRightPlane (ON_Plane &right_plane) const
 
bool GetFrustumRightPlaneEquation (ON_PlaneEquation &right_plane_equation) const
 
bool GetFrustumTopPlane (ON_Plane &top_plane) const
 
bool GetFrustumTopPlaneEquation (ON_PlaneEquation &top_plane_equation) const
 
bool GetNearPlane (ON_Plane &near_plane) const
 
bool GetNearPlaneEquation (ON_PlaneEquation &near_plane_equation) const
 
bool GetNearRect (ON_3dPoint &left_bottom, ON_3dPoint &right_bottom, ON_3dPoint &left_top, ON_3dPoint &right_top) const
 
bool GetPointDepth (ON_3dPoint point, double *near_dist, double *far_dist, bool bGrowNearFar=false) const
 
bool GetPointDepth (ON_3dPoint point, double *view_plane_depth) const
 
bool GetScreenPort (int *left, int *right, int *port_bottom, int *port_top, int *port_near=nullptr, int *port_far=nullptr) const
 
bool GetScreenPortAspect (double &) const
 port's |width/height| More...
 
bool GetSphereDepth (ON_Sphere sphere, double *near_dist, double *far_dist, bool bGrowNearFar=false) const
 
bool GetViewPlane (double view_plane_depth, ON_Plane &view_plane) const
 
bool GetViewPlaneEquation (double view_plane_depth, ON_PlaneEquation &view_plane_equation) const
 
bool GetViewPlaneRect (double view_plane_depth, ON_3dPoint &left_bottom, ON_3dPoint &right_bottom, ON_3dPoint &left_top, ON_3dPoint &right_top) const
 
void GetViewScale (double *x, double *y) const
 
void GetViewScale (double *x, double *y, double *z) const
 
bool GetWorldToScreenScale (double frustum_depth, double *pixels_per_unit) const
 
bool GetWorldToScreenScale (ON_3dPoint world_point, double *pixels_per_unit) const
 display tools More...
 
bool GetXform (ON::coordinate_system srcCS, ON::coordinate_system destCS, ON_Xform &matrix) const
 
void Initialize ()
 
int InViewFrustum (bool bInfiniteFrustum, const ON_BoundingBox &bbox, const ON_Xform *bbox_xform) const
 
int InViewFrustum (const ON_BoundingBox &bbox) const
 
int InViewFrustum (int count, const ON_3dPoint *p) const
 
int InViewFrustum (int count, const ON_3fPoint *p) const
 
int InViewFrustum (int count, const ON_4dPoint *p) const
 
int InViewFrustum (ON_3dPoint P) const
 
bool IsCameraFrameWorldPlan (int *, int *, int *)
 
bool IsParallelProjection () const
 
bool IsPerspectiveProjection () const
 
bool IsTwoPointPerspectiveProjection () const
 
bool IsValid (class ON_TextLog *text_log=nullptr) const override
 
bool IsValidCamera () const
 
bool IsValidCameraFrame () const
 
bool IsValidFrustum () const
 
ON_Viewportoperator= (const ON_Viewport &)=default
 
double PerspectiveMinNearDist () const
 
double PerspectiveMinNearOverFar () const
 
ON::view_projection Projection () const
 
bool Read (ON_BinaryArchive &) override
 
int ScreenPortHeight () const
 
ON_2iSize ScreenPortSize () const
 
int ScreenPortWidth () const
 
bool SetCamera (const ON_Viewport &source_viewport, bool bBreakLocks)
 
bool SetCamera35mmLenseLength (double lens_length)
 Same as SetCamera35mmLensLength() with "lens" misspelled. More...
 
bool SetCamera35mmLensLength (double lens_length)
 
bool SetCameraAngle (double half_smallest_angle)
 
bool SetCameraDirection (const ON_3dVector &)
 
void SetCameraDirectionLock (bool bLockCameraDirection)
 
bool SetCameraLocation (const ON_3dPoint &)
 
void SetCameraLocationLock (bool bLockCameraLocation)
 
bool SetCameraUp (const ON_3dVector &)
 
void SetCameraUpLock (bool bLockCameraUp)
 
bool SetFrustum (const ON_Viewport &source_viewport, bool bBreakLocks)
 
bool SetFrustum (double left, double right, double bottom, double top, double near_dist, double far_dist)
 
bool SetFrustumAspect (double)
 
void SetFrustumLeftRightSymmetry (bool bForceLeftRightSymmetry)
 
bool SetFrustumNearFar (const double *bboxmin, const double *bboxmax)
 
bool SetFrustumNearFar (const double *center, double radius)
 
bool SetFrustumNearFar (double near_dist, double far_dist)
 
bool SetFrustumNearFar (double near_dist, double far_dist, double min_near_dist, double min_near_over_far, double target_dist)
 
bool SetFrustumNearFar (double near_dist, double far_dist, double min_near_dist, double min_near_over_far, double target_dist, double relative_depth_bias)
 
void SetFrustumTopBottomSymmetry (bool bForceTopBottomSymmetry)
 
void SetPerspectiveClippingPlaneConstraints (unsigned int depth_buffer_bit_depth)
 
void SetPerspectiveMinNearDist (double min_near_dist)
 
void SetPerspectiveMinNearOverFar (double min_near_over_far)
 
bool SetProjection (ON::view_projection projection)
 
bool SetScreenPort (int port_left, int port_right, int port_bottom, int port_top, int port_near=0, int port_far=0)
 
bool SetTargetPoint (ON_3dPoint target_point)
 
bool SetViewportId (const ON_UUID &viewport_id)
 
bool SetViewScale (double x, double y)
 
bool SetViewScale (double x, double y, double z)
 
ON_ViewportShallowCopy (ON_Viewport *destination) const
 
double TargetDistance (bool bUseFrustumCenterFallback) const
 
ON_3dPoint TargetPoint () const
 
bool Transform (const ON_Xform &) override
 
void UnlockCamera ()
 sets all camera locks to false More...
 
void UnlockFrustumSymmetry ()
 sets all frustum symmetry locks to false More...
 
ON_UUID ViewportId (void) const
 
ON_SHA1_Hash ViewProjectionContentHash () const
 
bool Write (ON_BinaryArchive &) const override
 
bool ZoomToScreenRect (int screen_x0, int screen_y0, int screen_x1, int screen_y1)
 ZoomToScreenRect() may change camera and frustum settings. More...
 
- Public Member Functions inherited from ON_Geometry
 ON_Geometry ()=default
 
 ON_Geometry (const ON_Geometry &)=default
 
 ~ON_Geometry ()=default
 
ON_BoundingBox BoundingBox () const
 
virtual class ON_BrepBrepForm (class ON_Brep *brep=nullptr) const
 
virtual void ClearBoundingBox ()
 
virtual ON_COMPONENT_INDEX ComponentIndex () const
 
virtual bool EvaluatePoint (const class ON_ObjRef &objref, ON_3dPoint &P) const
 
bool GetBoundingBox (ON_3dPoint &bbox_min, ON_3dPoint &bbox_max, bool bGrowBox=false) const
 
bool GetBoundingBox (ON_BoundingBox &bbox, bool bGrowBox=false) const
 
virtual bool GetTightBoundingBox (class ON_BoundingBox &tight_bbox, bool bGrowBox=false, const class ON_Xform *xform=nullptr) const
 
virtual bool HasBrepForm () const
 
virtual bool IsDeformable () const
 
virtual bool IsMorphable () const
 
virtual bool MakeDeformable ()
 
virtual bool Morph (const class ON_SpaceMorph &morph)
 
ON_Geometryoperator= (const ON_Geometry &)=default
 
bool Rotate (double rotation_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 
bool Scale (double scale_factor)
 
virtual bool SwapCoordinates (int i, int j)
 
const ON_BoundingBox TightBoundingBox () const
 
bool Translate (const ON_3dVector &translation_vector)
 
- Public Member Functions inherited from ON_Object
 ON_Object () ON_NOEXCEPT
 
 ON_Object (const ON_Object &)
 
virtual ~ON_Object ()
 
virtual ON_AggregateComponentStatus AggregateComponentStatus () const
 
bool AttachUserData (class ON_UserData *pUserData)
 
unsigned int ClearAllComponentStates () const
 
virtual unsigned int ClearComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_clear) const
 
virtual unsigned int ClearComponentStates (ON_ComponentStatus states_to_clear) const
 
void CopyUserData (const ON_Object &source_object)
 
unsigned int CopyUserData (const ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution)
 
virtual ON__UINT32 DataCRC (ON__UINT32 current_remainder) const
 
virtual bool DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count)
 
virtual void DestroyRuntimeCache (bool bDelete=true)
 
bool DetachUserData (class ON_UserData *pUserData)
 
void EmergencyDestroy ()
 
class ON_UserDataFirstUserData () const
 
virtual unsigned int GetComponentsWithSetStates (ON_ComponentStatus states_filter, bool bAllEqualStates, ON_SimpleArray< ON_COMPONENT_INDEX > &components) const
 
class ON_UserDataGetUserData (const ON_UUID &userdata_uuid) const
 
bool GetUserString (const wchar_t *key, ON_wString &string_value) const
 
int GetUserStringKeys (ON_ClassArray< ON_wString > &user_string_keys) const
 
int GetUserStrings (ON_ClassArray< ON_UserString > &user_strings) const
 
bool IsCorrupt (bool bRepair, bool bSilentError, class ON_TextLog *text_log) const
 
bool IsKindOf (const ON_ClassId *pClassId) const
 
virtual void MarkAggregateComponentStatusAsNotCurrent () const
 
virtual void MemoryRelocate ()
 
virtual ON_UUID ModelObjectId () const
 
void MoveUserData (ON_Object &source_object)
 
unsigned int MoveUserData (ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution, bool bDeleteAllSourceItems)
 
virtual ON::object_type ObjectType () const
 
ON_Objectoperator= (const ON_Object &)
 
void PurgeUserData ()
 
virtual unsigned int SetComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_set) const
 
virtual unsigned int SetComponentStatus (ON_COMPONENT_INDEX component_index, ON_ComponentStatus status_to_copy) const
 
bool SetUserString (const wchar_t *key, const wchar_t *string_value)
 
int SetUserStrings (int count, const ON_UserString *user_strings, bool bReplace)
 
virtual unsigned int SizeOf () const
 
bool ThisIsNullptr (bool bSilentError) const
 
void TransformUserData (const class ON_Xform &xform)
 
virtual bool UpdateReferencedComponents (const class ON_ComponentManifest &source_manifest, const class ON_ComponentManifest &destination_manifest, const class ON_ManifestMap &manifest_map)
 
int UserStringCount () const
 

Static Public Member Functions

static void GetPerspectiveClippingPlaneConstraints (ON_3dPoint camera_location, unsigned int depth_buffer_bit_depth, double *min_near_dist, double *min_near_over_far)
 
static bool IsValidCameraLocation (ON_3dPoint candidate_point)
 
static bool IsValidCameraUpOrDirection (ON_3dVector candidate_vector)
 

Static Public Attributes

static const ON_3dVector Default3dCameraDirection
 (-0.43301270189221932338186158537647,0.75,-0.5) More...
 
static const ON_3dPoint DefaultCameraLocation
 (0.0,0.0,100.0) More...
 
static const double DefaultFarDist
 1000.0 More...
 
static const double DefaultMinNearDist
 0.0001 More...
 
static const double DefaultMinNearOverFar
 0.0001 More...
 
static const double DefaultNearDist
 0.005 More...
 
static const ON_Viewport DefaultPerspectiveViewZUp
 
static const ON_Viewport DefaultTopViewYUp
 
- Static Public Attributes inherited from ON_Geometry
const static ON_Geometry Unset
 

Protected Attributes

bool m_bLockCamDir = false
 
bool m_bLockCamLoc = false
 
bool m_bLockCamUp = false
 
bool m_bValidCamera = true
 
bool m_bValidCameraFrame = true
 
bool m_bValidFrustum = true
 
bool m_bValidPort = false
 
ON_3dVector m_CamDir = -ON_3dVector::ZAxis
 from camera towards view (nonzero and not parallel to m_CamUp) More...
 
ON_3dPoint m_CamLoc = ON_Viewport::DefaultCameraLocation
 camera location More...
 
ON_3dVector m_CamUp = ON_3dVector::YAxis
 (nonzero and not parallel to m_CamDir) More...
 
ON_3dVector m_CamX = ON_3dVector::XAxis
 The camera frame vectors are properly initialized by SetCamera() More...
 
ON_3dVector m_CamY = ON_3dVector::YAxis
 
ON_3dVector m_CamZ = ON_3dVector::ZAxis
 
double m_frus_bottom = -20.0
 frus_bottom < frus_top More...
 
double m_frus_far = ON_Viewport::DefaultFarDist
 
double m_frus_left = -20.0
 frus_left < frus_right More...
 
double m_frus_near = ON_Viewport::DefaultMinNearDist
 0 < frus_near < frus_far More...
 
double m_frus_right = 20.0
 
double m_frus_top = 20.0
 
unsigned char m_frustum_symmetry_flags = 0
 
int m_port_bottom = 0
 port_bottom != port_top
More...
 
int m_port_far = 1
 
int m_port_left = 0
 port_left != port_right More...
 
int m_port_near = 0
 
int m_port_right = 1000
 
int m_port_top = 1000
 
ON::view_projection m_projection = ON::parallel_view
 Camera Settings: ///////////////////////////////////////////////. More...
 
ON_3dPoint m_target_point = ON_3dPoint::UnsetPoint
 

Additional Inherited Members

- Public Types inherited from ON_Object
enum  UserDataConflictResolution : unsigned char {
  UserDataConflictResolution::destination_object = 0, UserDataConflictResolution::source_object = 1, UserDataConflictResolution::source_copycount_gt = 2, UserDataConflictResolution::source_copycount_ge = 3,
  UserDataConflictResolution::destination_copycount_gt = 4, UserDataConflictResolution::destination_copycount_ge = 5, UserDataConflictResolution::delete_item = 6
}
 

Detailed Description

Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert McNeel & Associates.

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.

For complete openNURBS copyright information see http://www.opennurbs.org. Class ON_Viewport

This object represents a viewing frustum

Constructor & Destructor Documentation

◆ ON_Viewport() [1/2]

ON_Viewport::ON_Viewport ( )
default

Construction Default constructor creates a copy of ON_Viewport::DefaultTopViewYUp;

◆ ~ON_Viewport()

ON_Viewport::~ON_Viewport ( )
default

◆ ON_Viewport() [2/2]

ON_Viewport::ON_Viewport ( const ON_Viewport )
default

Member Function Documentation

◆ CameraDirection()

ON_3dVector ON_Viewport::CameraDirection ( ) const

◆ CameraDirectionIsLocked()

bool ON_Viewport::CameraDirectionIsLocked ( ) const

◆ CameraLocation()

ON_3dPoint ON_Viewport::CameraLocation ( ) const

◆ CameraLocationIsLocked()

bool ON_Viewport::CameraLocationIsLocked ( ) const

◆ CameraUp()

ON_3dVector ON_Viewport::CameraUp ( ) const

◆ CameraUpIsLocked()

bool ON_Viewport::CameraUpIsLocked ( ) const

◆ CameraX()

ON_3dVector ON_Viewport::CameraX ( ) const

these do not check for a valid camera orientation

unit to right vector

◆ CameraY()

ON_3dVector ON_Viewport::CameraY ( ) const

unit up vector

◆ CameraZ()

ON_3dVector ON_Viewport::CameraZ ( ) const

unit vector in -CameraDirection

◆ ChangeToParallelProjection()

bool ON_Viewport::ChangeToParallelProjection ( bool  bSymmetricFrustum)

Description: Use this function to change projections of valid viewports from persective to parallel. It will make common additional adjustments to the frustum so the resulting views are similar. The camera location and direction will not be changed. Parameters: bSymmetricFrustum - [in] True if you want the resulting frustum to be symmetric. Remarks: If the current projection is parallel and bSymmetricFrustum, FrustumIsLeftRightSymmetric() and FrustumIsTopBottomSymmetric() are all equal, then no changes are made and true is returned.

◆ ChangeToPerspectiveProjection()

bool ON_Viewport::ChangeToPerspectiveProjection ( double  target_distance,
bool  bSymmetricFrustum,
double  lens_length 
)

Description: 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. Parameters: target_distance - [in] If ON_UNSET_VALUE this parameter is ignored. Otherwise it must be > 0 and indicates which plane in the current view frustum should be preserved. bSymmetricFrustum - [in] True if you want the resulting frustum to be symmetric. lens_length - in 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. Remarks: If the current projection is perspective and bSymmetricFrustum, FrustumIsLeftRightSymmetric() and FrustumIsTopBottomSymmetric() are all equal, then no changes are made and true is returned.

◆ ChangeToSymmetricFrustum()

bool ON_Viewport::ChangeToSymmetricFrustum ( bool  bLeftRightSymmetric,
bool  bTopBottomSymmetric,
double  target_distance 
)

Description: If needed, adjust the current frustum so it has the specified symmetries and adjust the camera location so the target plane remains visible. Parameters: bLeftRightSymmetric - [in] If true, the frustum will be adjusted so left = -right. bTopBottomSymmetric - [in] If true, the frustum will be adjusted so top = -bottom. target_distance - [in] If projection is not perspective or target_distance is ON_UNSET_VALUE, this this parameter is ignored. If the projection is perspective and target_distance is not ON_UNSET_VALUE, 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. bool Returns true if the returned viewport has a frustum with the specified symmetries.

◆ ChangeToTwoPointPerspectiveProjection()

bool ON_Viewport::ChangeToTwoPointPerspectiveProjection ( double  target_distance,
ON_3dVector  up,
double  lens_length 
)

Description: Use this function to change 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. Parameters: target_distance - [in] If ON_UNSET_VALUE this parameter is ignored. Otherwise it must be > 0 and indicates which plane in the current view frustum should be preserved. up - [in] This direction will be the locked up direction. Pass ON_3dVector::ZeroVector 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. lens_length - in 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. Remarks: If the current projection is perspective and FrustumIsLeftRightSymmetric() is true and FrustumIsTopBottomSymmetric() is false, then no changes are made and true is returned.

◆ ChangeViewportId()

void ON_Viewport::ChangeViewportId ( const ON_UUID viewport_id)

Description: EXPERT USER function to change the viewport's id. If you change the id, you risk damaging display and visibility relationships in the model. Parameters: viewport_id - [in]

◆ ClipCoordDepthBias()

double ON_Viewport::ClipCoordDepthBias ( double  relative_depth_bias,
double  clip_z,
double  clip_w 
) const

Description: Calculate the value to add to homogeneous "z" clipping coordinate that corresponds to moving the corresponding euclidean camera coordinate by relative_depth_bias*(far - near). Parameters: relative_depth_bias - [in] signed relative bias. = 0: no bias, > 0: bias towards frustum's near clipping plane < 0: bias towards frustum's far clipping plane When you have curves and points that are "on" shaded objects, values around 1/256 work well to move the wire objects in front of or behind shaded objects. clip_z [-in] clip_w [-in] clip_z and clip_w are the homogeneous "w" and "w" coordinates of a homogeneous clipping coordinate point. Returns: The clipping coordinate depth bias to add to the z-clipping coordinate that corresponds to adding cam_depth_bias to the z camera coordinate. Remarks: For perspective views, this bias is largest in the vicinity of the frustum's near clipping plane and smallest in the vicinity of the frustum's far clipping plane. For orthographic projectsions, this bias is constant.

◆ ClipModInverseXform()

ON_Xform ON_Viewport::ClipModInverseXform ( ) const

Description: Gets the m_clip_mod_inverse transformation; Returns: value of the m_clip_mod_inverse transformation.

◆ ClipModXform()

ON_Xform ON_Viewport::ClipModXform ( ) const

Description: Gets the m_clip_mod transformation; Returns: value of the m_clip_mod transformation.

◆ ClipModXformIsIdentity()

bool ON_Viewport::ClipModXformIsIdentity ( ) const

Returns: True if clip mod xform is identity.

◆ Dimension()

int ON_Viewport::Dimension ( ) const
overridevirtual

ON_Geometry overrides ////////////////////////////////////////////////////// Description: The dimension of a camera view frustum is 3.

Returns: 3

Remarks: This is virtual ON_Geometry function.

Reimplemented from ON_Geometry.

◆ DollyCamera()

bool ON_Viewport::DollyCamera ( const ON_3dVector dolly_vector)

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().

Parameters
dolly_vectorDoes not update frustum. To update frustum use DollyFrustum(d) with d = dollyVector o cameraFrameZ dolly vector in world coordinates

◆ DollyFrustum()

bool ON_Viewport::DollyFrustum ( double  dolly_distance)

Moves frustum's clipping planes.

Parameters
dolly_distancedistance to move in camera direction

◆ Dump()

void ON_Viewport::Dump ( ON_TextLog ) const
overridevirtual

Description: Dumps debugging text description to a text log.

Parameters: dump_target - [in] text log

Remarks: This overrides the virtual ON_Object::Dump() function.

Reimplemented from ON_Object.

◆ Extents() [1/2]

bool ON_Viewport::Extents ( double  half_view_angle,
const ON_3dPoint center,
double  radius 
)
Parameters
half_view_angle1/2 smallest subtended view angle
center(0 < angle < pi/2) 3d world coordinate bounding sphere center
radius3d sphere radius

◆ Extents() [2/2]

bool ON_Viewport::Extents ( double  half_view_angle,
const ON_BoundingBox world_bbox 
)

Use Extents() as a quick way to set a viewport to so that bounding volume is inside of a viewports frusmtrum. The view angle is used to determine the position of the camera.

Parameters
half_view_angle1/2 smallest subtended view angle
world_bbox(0 < angle < pi/2) 3d world coordinate bounding box

◆ FrustumBottom()

double ON_Viewport::FrustumBottom ( ) const

◆ FrustumCenterPoint()

ON_3dPoint ON_Viewport::FrustumCenterPoint ( double  target_distance) const

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

◆ FrustumFar()

double ON_Viewport::FrustumFar ( ) const

◆ FrustumHeight()

double ON_Viewport::FrustumHeight ( ) const

top - bottom

Returns: frustum right - frustum left

◆ FrustumIsLeftRightSymmetric()

bool ON_Viewport::FrustumIsLeftRightSymmetric ( ) const

◆ FrustumIsTopBottomSymmetric()

bool ON_Viewport::FrustumIsTopBottomSymmetric ( ) const

◆ FrustumLeft()

double ON_Viewport::FrustumLeft ( ) const

The near clipping plane stored in the Rhino 1.0 file is frequently very small and useless for high quality z-buffer based rendering. The far clipping value is not stored in the file. Use these functions to set the frustum's near and far clipping planes to appropriate values.

◆ FrustumMaximumDiameter()

double ON_Viewport::FrustumMaximumDiameter ( ) const

Returns: Maximum of fabs(FrustumWidth()) and fabs(FrustumHeight())

◆ FrustumMinimumDiameter()

double ON_Viewport::FrustumMinimumDiameter ( ) const

Returns: Minimum of fabs(FrustumWidth()) and fabs(FrustumHeight())

◆ FrustumNear()

double ON_Viewport::FrustumNear ( ) const

◆ FrustumRight()

double ON_Viewport::FrustumRight ( ) const

◆ FrustumTop()

double ON_Viewport::FrustumTop ( ) const

◆ FrustumWidth()

double ON_Viewport::FrustumWidth ( ) const

right - left

Returns: frustum right - frustum left

◆ GetBBox()

bool ON_Viewport::GetBBox ( double *  boxmin,
double *  boxmax,
bool  bGrowBox = false 
) const
overridevirtual

virtual ON_Geometry GetBBox override

Reimplemented from ON_Geometry.

◆ GetBoundingBoxDepth() [1/2]

int ON_Viewport::GetBoundingBoxDepth ( ON_BoundingBox  bbox,
const ON_Xform bbox_xform,
double *  near_dist,
double *  far_dist,
bool  bGrowNearFar 
) const

Description: Get near and far clipping distances of a bounding box. Parameters: bbox - [in] bounding box bbox_xform - [in] If not nullptr, this transformation to applied to the corners of bbox. It should have positive determinant for the results to be meaningful. Typically bbox_xform is used to pass an instance reference transformation. near_dist - [out] near distance of the box This value can be zero or negative when the camera location is inside bbox. far_dist - [out] 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. bGrowNearFar - [in] If true and input values of near_dist and far_dist are not ON_UNSET_VALUE, the near_dist and far_dist are enlarged to include bbox. Returns: 0: The bounding box does not intersectthe view frustum. 1: A proper subset of the bounding box is inside the view frustum and near_dist/far_dist were set. 2: The entire bounding box is inside the view frustum and near_dist/far_dist were set. Remarks: 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 instersects the infinite view region with the bounding box and returns the near and far distances of the projection.

◆ GetBoundingBoxDepth() [2/2]

bool ON_Viewport::GetBoundingBoxDepth ( ON_BoundingBox  bbox,
double *  near_dist,
double *  far_dist,
bool  bGrowNearFar = false 
) const

Description: Get near and far clipping distances of a bounding box. Parameters: bbox - [in] bounding box near_dist - [out] near distance of the box This value can be zero or negative when the camera location is inside bbox. far_dist - [out] 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. bGrowNearFar - [in] If true and input values of near_dist and far_dist are not ON_UNSET_VALUE, the near_dist and far_dist are enlarged to include bbox. Returns: True if the bounding box intersects the view frustum and near_dist/far_dist were set. False if the bounding box does not intesect the view frustum. Remarks: 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 instersects the infinite view region with the bounding box and returns the near and far distances of the projection.

◆ GetBoundingBoxProjectionExtents()

bool ON_Viewport::GetBoundingBoxProjectionExtents ( ON_BoundingBox  bbox,
ON_Interval x_extents,
ON_Interval y_extents 
) const

Description: Get the normalized extents of the smallest rectangle that contains the intersection of bbox and the view's frustum. Parameters: bbox - [in] bounding box x_extents - [out] y_extents - [out] 0 <= x_extents[0] <= x_extents[1] <= 1.0 0 <= y_extents[0] <= y_extents[1] <= 1.0 If true is returned, then intersection of the bbox and the view's frustum is not empty and the bounding rectangle of the projection of the intersection set is returned in x_range and y_range. The returned values are normalized image extents. For example, if x_extents[0] = 0.0, x_extents[1] = 0.25, y_extents[0] = 0.75 and y_extents[1] = 1.0, then the portion of bbox in the view's frustum would project to the upper left corner of the image. Returns: True if the bounding box intersects the view frustum and x_range and y_range were set. False if the bounding box does not intersect the view frustum. Remarks: This function takes the viewport's near and far settings into account. Set them to something appropriate before calling this function.

◆ GetCamera35mmLenseLength()

bool ON_Viewport::GetCamera35mmLenseLength ( double *  lens_length) const

Same as GetCamera35mmLensLength() with "lens" misspelled.

◆ GetCamera35mmLensLength()

bool ON_Viewport::GetCamera35mmLensLength ( double *  lens_length) const

These functions assume 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.)

The SetCamera35mmLensLength() preserves camera location, changes the frustum, but maintains the frsutrum's aspect.

◆ GetCameraAngle() [1/2]

bool ON_Viewport::GetCameraAngle ( double *  half_diagonal_angle,
double *  half_vertical_angle,
double *  half_horizontal_angle 
) const
Parameters
half_diagonal_angle1/2 of diagonal subtended angle
half_vertical_angle1/2 of vertical subtended angle
half_horizontal_angle1/2 of horizontal subtended angle

◆ GetCameraAngle() [2/2]

bool ON_Viewport::GetCameraAngle ( double *  half_smallest_angle) const
Parameters
half_smallest_angle1/2 of smallest subtended view angle

◆ GetCameraExtents() [1/3]

bool ON_Viewport::GetCameraExtents ( const ON_BoundingBox ,
ON_BoundingBox cambbox,
int  bGrowBox = false 
) const
Parameters
cambboxbounding box in camera coordinates
bGrowBoxset to true if you want to enlarge an existing camera coordinate box

◆ GetCameraExtents() [2/3]

bool ON_Viewport::GetCameraExtents ( int  ,
int  ,
const double *  ,
ON_BoundingBox cambbox,
int  bGrowBox = false 
) const
Parameters
cambboxbounding box in camera coordinates
bGrowBoxset to true if you want to enlarge an existing camera coordinate box

◆ GetCameraExtents() [3/3]

bool ON_Viewport::GetCameraExtents ( ON_3dPoint ,
double  ,
ON_BoundingBox cambox,
int  bGrowBox = false 
) const
Parameters
camboxbounding box in camera coordinates
bGrowBoxset to true if you want to enlarge an existing camera coordinate box

◆ GetCameraFrame() [1/2]

bool ON_Viewport::GetCameraFrame ( class ON_Plane camera_frame) const

◆ GetCameraFrame() [2/2]

bool ON_Viewport::GetCameraFrame ( double *  ,
double *  ,
double *  ,
double *   
) const

returns true if current camera orientation is valid

◆ GetClipCoordDepthBiasXform()

bool ON_Viewport::GetClipCoordDepthBiasXform ( double  relative_depth_bias,
ON_Xform clip_bias 
) const

Description: Calculate a transformation to apply to clipping coordinates to bias their depth.

Parameters: relative_depth_bias - [in] signed relative bias. = 0: no bias, > 0: bias towards frustum's near clipping plane < 0: bias towards frustum's far clipping plane When you have curves and points that are "on" shaded objects, values around 1/512 work well to move the wire objects in front of or behind shaded objects.

clip_bias - [out] clip_bias = cam2clip * delta * clip2cam, where delta = 1 0 0 0 0 1 0 0 0 0 1 D 0 0 0 1 and D = relative_depth_bias*(far-near).

Returns: True if the function worked. False if the frustum settings are not valild, in which cate the identity matrix is returned.

Remarks: The inverse of the transformations returned by GetClipCoordDepthBiasXform(+r,...) is the transformation returned by GetClipCoordDepthBiasXform(-r,...).

◆ GetCoordinateSprite()

bool ON_Viewport::GetCoordinateSprite ( int  ,
int  ,
int  ,
int  [3],
double  [3][2] 
) const

◆ GetDollyCameraVector()

bool ON_Viewport::GetDollyCameraVector ( int  screen_x0,
int  screen_y0,
int  screen_x1,
int  screen_y1,
double  proj_plane_dist,
ON_3dVector dolly_vector 
) const

Gets a world coordinate dolly vector that can be passed to DollyCamera().

Parameters
screen_y0(x,y) screen coords of start point
screen_y1(x,y) screen coords of end point
proj_plane_distdistance of projection plane from camera.
dolly_vectorWhen in doubt, use 0.5*(frus_near+frus_far). world coordinate dolly vector returned here

◆ GetFarPlane()

bool ON_Viewport::GetFarPlane ( ON_Plane far_plane) const

Description: Get far clipping plane.

far_plane - [out] 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.

Returns: true if camera and frustum are valid.

◆ GetFarPlaneEquation()

bool ON_Viewport::GetFarPlaneEquation ( ON_PlaneEquation far_plane_equation) const

◆ GetFarRect()

bool ON_Viewport::GetFarRect ( ON_3dPoint left_bottom,
ON_3dPoint right_bottom,
ON_3dPoint left_top,
ON_3dPoint right_top 
) const

Description: Get corners of far clipping plane rectangle.

Parameters: left_bottom - [out] right_bottom - [out] left_top - [out] right_top - [out]

Returns: true if camera and frustum are valid.

◆ GetFrustum()

bool ON_Viewport::GetFrustum ( double *  left,
double *  right,
double *  bottom,
double *  top,
double *  near_dist = nullptr,
double *  far_dist = nullptr 
) const
Parameters
right(left < right)
top(bottom < top)
far_dist(0 < near_dist < far_dist)

◆ GetFrustumAspect()

bool ON_Viewport::GetFrustumAspect ( double &  ) const

Returns frustum's width/height.

◆ GetFrustumBottomPlane()

bool ON_Viewport::GetFrustumBottomPlane ( ON_Plane bottom_plane) const

Description: Get bottom world frustum clipping plane. Parameters: bottom_plane - [out] frustum bottom side clipping plane. The normal points into the visible region of the frustum. If the projection is perspective, the origin is at the camera location, otherwise the origin isthe point on the plane that is closest to the camera location. Returns: True if camera and frustum are valid and plane was set.

◆ GetFrustumBottomPlaneEquation()

bool ON_Viewport::GetFrustumBottomPlaneEquation ( ON_PlaneEquation bottom_plane_equation) const

◆ GetFrustumCenter()

bool ON_Viewport::GetFrustumCenter ( double *  ) const

Returns world coordinates of frustum's center.

◆ GetFrustumLeftPlane()

bool ON_Viewport::GetFrustumLeftPlane ( ON_Plane left_plane) const

Description: Get left world frustum clipping plane. Parameters: left_plane - [out] frustum left side clipping plane. The normal points into the visible region of the frustum. If the projection is perspective, the origin is at the camera location, otherwise the origin isthe point on the plane that is closest to the camera location. Returns: True if camera and frustum are valid and plane was set.

◆ GetFrustumLeftPlaneEquation()

bool ON_Viewport::GetFrustumLeftPlaneEquation ( ON_PlaneEquation left_plane_equation) const

◆ GetFrustumLine()

bool ON_Viewport::GetFrustumLine ( double  screenx,
double  screeny,
ON_Line world_line 
) const

Description: Get the world coordinate line in the view frustum that projects to a point on the screen. Parameters: screenx - [in] screeny - [in] (screenx,screeny) = screen location world_line - [out] 3d world coordinate line segment starting on the near clipping plane and ending on the far clipping plane. Returns: true if successful. false if view projection or frustum is invalid.

◆ GetFrustumRightPlane()

bool ON_Viewport::GetFrustumRightPlane ( ON_Plane right_plane) const

Description: Get right world frustum clipping plane. Parameters: right_plane - [out] frustum right side clipping plane. The normal points into the visible region of the frustum. If the projection is perspective, the origin is at the camera location, otherwise the origin isthe point on the plane that is closest to the camera location. Returns: True if camera and frustum are valid and plane was set.

◆ GetFrustumRightPlaneEquation()

bool ON_Viewport::GetFrustumRightPlaneEquation ( ON_PlaneEquation right_plane_equation) const

◆ GetFrustumTopPlane()

bool ON_Viewport::GetFrustumTopPlane ( ON_Plane top_plane) const

Description: Get top world frustum clipping plane. Parameters: top_plane - [out] frustum top side clipping plane. The normal points into the visible region of the frustum. If the projection is perspective, the origin is at the camera location, otherwise the origin isthe point on the plane that is closest to the camera location. Returns: True if camera and frustum are valid and plane was set.

◆ GetFrustumTopPlaneEquation()

bool ON_Viewport::GetFrustumTopPlaneEquation ( ON_PlaneEquation top_plane_equation) const

◆ GetNearPlane()

bool ON_Viewport::GetNearPlane ( ON_Plane near_plane) const

Description: Get near clipping plane.

near_plane - [out] 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.

Returns: true if camera and frustum are valid.

◆ GetNearPlaneEquation()

bool ON_Viewport::GetNearPlaneEquation ( ON_PlaneEquation near_plane_equation) const

◆ GetNearRect()

bool ON_Viewport::GetNearRect ( ON_3dPoint left_bottom,
ON_3dPoint right_bottom,
ON_3dPoint left_top,
ON_3dPoint right_top 
) const

Description: Get corners of near clipping plane rectangle.

Parameters: left_bottom - [out] right_bottom - [out] left_top - [out] right_top - [out]

Returns: true if camera and frustum are valid.

◆ GetPerspectiveClippingPlaneConstraints()

static void ON_Viewport::GetPerspectiveClippingPlaneConstraints ( ON_3dPoint  camera_location,
unsigned int  depth_buffer_bit_depth,
double *  min_near_dist,
double *  min_near_over_far 
)
static

Description:
Get suggested values for setting the perspective minimum near distance and minimum near/far ratio. Parameters:
camera_location - [in] depth_buffer_bit_depth - [in] typically 32, 24, 16 or 8, but any positive value can be passed in. min_near_dist - [out] Suggest value for passing to SetPerspectiveMinNearDist().
min_near_over_far - [out] Suggest value for passing to SetPerspectiveMinNearOverFar().

◆ GetPointDepth() [1/2]

bool ON_Viewport::GetPointDepth ( ON_3dPoint  point,
double *  near_dist,
double *  far_dist,
bool  bGrowNearFar = false 
) const

Description: Get near and far clipping distances of a point Parameters: point - [in] near_dist - [out] near distance of the point (can be < 0) far_dist - [out] far distance of the point (can be equal to near_dist) bGrowNearFar - [in] If true and input values of near_dist and far_dist are not ON_UNSET_VALUE, the near_dist and far_dist are enlarged to include bbox. Returns: True if the point is ing the view frustum and near_dist/far_dist were set. False if the bounding box does not intesect the view frustum.

◆ GetPointDepth() [2/2]

bool ON_Viewport::GetPointDepth ( ON_3dPoint  point,
double *  view_plane_depth 
) const

Description: Get the view plane depth of a point Parameters: point - [in] view_plane_depth - [out] positive values are in front of the camera and negative values are behind the camera. If 0 <= point_depth < FrustumNear(), the point's view plane is between the camera and the frustum's near plane. If point_depth > FrustumFar(), the point's view plane is farther from the camera and the frustum's far plane. Returns: True if the point is ing the view frustum and near_dist/far_dist were set. False if the bounding box does not intesect the view frustum.

◆ GetScreenPort()

bool ON_Viewport::GetScreenPort ( int *  left,
int *  right,
int *  port_bottom,
int *  port_top,
int *  port_near = nullptr,
int *  port_far = nullptr 
) const
Parameters
right( port_left != port_right )
port_top( port_bottom != port_top)

◆ GetScreenPortAspect()

bool ON_Viewport::GetScreenPortAspect ( double &  ) const

port's |width/height|

◆ GetSphereDepth()

bool ON_Viewport::GetSphereDepth ( ON_Sphere  sphere,
double *  near_dist,
double *  far_dist,
bool  bGrowNearFar = false 
) const

Description: Get near and far clipping distances of a bounding sphere. Parameters: sphere - [in] bounding sphere near_dist - [out] near distance of the sphere (can be < 0) far_dist - [out] far distance of the sphere (can be equal to near_dist) bGrowNearFar - [in] If true and input values of near_dist and far_dist are not ON_UNSET_VALUE, the near_dist and far_dist are enlarged to include bbox. Returns: True if the sphere intersects the view frustum and near_dist/far_dist were set. False if the sphere does not intesect the view frustum.

◆ GetViewPlane()

bool ON_Viewport::GetViewPlane ( double  view_plane_depth,
ON_Plane view_plane 
) const

Description: Get the plane that is a specified distance from the camera. This plane is parallel to the frustum's near and far planes. Parameters: view_plane_depth - [in] The distance from the camera location to the view plane. Positive distances are in front of the camera and negative distances are behind the camera. A value of FrustumNear() will return the frustum's near plane and a valud of FrustumFar() will return the frustum's far plane. view_plane - [out] View plane view_plane_equation - [out] Equation of the view plane. Returns: True if the camera and frustum are valid and view_plane was calculated. False otherwise.

◆ GetViewPlaneEquation()

bool ON_Viewport::GetViewPlaneEquation ( double  view_plane_depth,
ON_PlaneEquation view_plane_equation 
) const

◆ GetViewPlaneRect()

bool ON_Viewport::GetViewPlaneRect ( double  view_plane_depth,
ON_3dPoint left_bottom,
ON_3dPoint right_bottom,
ON_3dPoint left_top,
ON_3dPoint right_top 
) const

Description: Get the world coordinate corners of the rectangle of a view plane that is a specified distance from the camera. This rectangle is parallel to the frustum's near and far planes. Parameters: view_plane_depth - [in] The distance from the camera location to the view plane. Positive distances are in front of the camera and negative distances are behind the camera. A value of FrustumNear() will return the frustum's near rectangle and a valud of FrustumFar() will return the frustum's far rectangle. left_bottom - [out] right_bottom - [out] left_top - [out] right_top - [out] Returns: True if the camera and frustum are valid and view_plane was calculated. False otherwise.

◆ GetViewScale() [1/2]

void ON_Viewport::GetViewScale ( double *  x,
double *  y 
) const

◆ GetViewScale() [2/2]

void ON_Viewport::GetViewScale ( double *  x,
double *  y,
double *  z 
) const

◆ GetWorldToScreenScale() [1/2]

bool ON_Viewport::GetWorldToScreenScale ( double  frustum_depth,
double *  pixels_per_unit 
) const

Description: Get the number of horizontal pixels per world unit at the location in screen space where world_point would be rendered. Parameters: frustum_depth - [in] (ignored for parallel projection viewports) If the viewport has a perspective projection, then this parameter specifies the depth in the view frustum where the scale is calculated. If frustum_depth is not > 0.0, then FrustumNear() is used. pixels_per_unit - [out] number of horizontal screen pixels per world unit at the location in screen space where frustum_depth would be rendered. If the viewport is not valid, then 0.0 is returned. Returns: true: success. false: The view projection or frustum is invalid.

◆ GetWorldToScreenScale() [2/2]

bool ON_Viewport::GetWorldToScreenScale ( ON_3dPoint  world_point,
double *  pixels_per_unit 
) const

display tools

Description: Get the number of horizontal pixels per world unit at the location in screen space where world_point would be rendered. Parameters: world_point - [in] (ignored for parallel projection viewports) world location frustum_depth - [in] (ignored for parallel projection viewports) If the viewport has a perspective projection, then this parameter specifies the depth in the view frustum where the scale is calculated. If frustum_depth is not > 0.0, then FrustumNear() is used. pixels_per_unit - [out] number of horizontal screen pixels per world unit at the location in screen space where world_point would be rendered. If the viewport is not valid, then 0.0 is returned. Returns: true: success. false: The view projection or frustum is invalid.

◆ GetXform()

bool ON_Viewport::GetXform ( ON::coordinate_system  srcCS,
ON::coordinate_system  destCS,
ON_Xform matrix 
) const
Parameters
matrix4x4 transformation matrix (acts on the left)

◆ Initialize()

void ON_Viewport::Initialize ( )

Interface /////////////////////////////////////////////////////////////////

Deprecated:
Use = ON_Viewport::DefaultTopViewYUp

◆ InViewFrustum() [1/6]

int ON_Viewport::InViewFrustum ( bool  bInfiniteFrustum,
const ON_BoundingBox bbox,
const ON_Xform bbox_xform 
) const

Description: Determine if some portion of the transformed bounding box is inside the view frustum. Parameters: bInfiniteFrustum - [in] ignore the near and far clipping planes of the viewport. bbox - [in] bounding box bbox_xform - [in] If not nullptr, this transformation is applied to the bounding box. Typically bbox_xform is used to pass an instance reference transformation. Returns: 0 = No part of the of the transformed bounding box is in the view frustum or the view camera and frustum have not been set. 1 = A portion of of the transformed bounding box is in the view frustum 2 = The entire transformed bounding box is in the view frustum.

◆ InViewFrustum() [2/6]

int ON_Viewport::InViewFrustum ( const ON_BoundingBox bbox) const

◆ InViewFrustum() [3/6]

int ON_Viewport::InViewFrustum ( int  count,
const ON_3dPoint p 
) const

◆ InViewFrustum() [4/6]

int ON_Viewport::InViewFrustum ( int  count,
const ON_3fPoint p 
) const

◆ InViewFrustum() [5/6]

int ON_Viewport::InViewFrustum ( int  count,
const ON_4dPoint p 
) const

◆ InViewFrustum() [6/6]

int ON_Viewport::InViewFrustum ( ON_3dPoint  P) const

Description: The "view frustum" is the frustum the m_xform transformation maps to clipping coordinate box (-1,+1)^3. These functions determine if some portion of the convex hull of the test points is inside the view frustum. Parameters: P - [in] point box - [in] bounding box count - [in] number of points p - [in] array of points bEnableClippingPlanes - [in] If true, then the additional clipping planes are tested. If false, then the additional clipping planes are ignored. Returns: 0 = No part of the of the convex hull of the tested points is in the view frustum or the view camera and frustum have not been set. 1 = A portion of the convex hull of the otested points may be in the view frustum. 2 = The entire convex hull of the tested points is in the view frustum.

Remarks: Each call to ON_Viewport::InViewFrustum() requires the calculation of the world-to-clipping coordinates transformation. If multiple queries are required, fewer computation resources will be used if you set ON_ClippingRegion.m_xform to the viewport's world-to- clipping coordinate transformation and then call the ON_ClippingRegion::InViewFrustum() functions.

◆ IsCameraFrameWorldPlan()

bool ON_Viewport::IsCameraFrameWorldPlan ( int *  ,
int *  ,
int *   
)

◆ IsParallelProjection()

bool ON_Viewport::IsParallelProjection ( ) const

Returns: True if the projection is ON::parallel_view.

◆ IsPerspectiveProjection()

bool ON_Viewport::IsPerspectiveProjection ( ) const

Returns: True if the projection is ON::perspective_view.

◆ IsTwoPointPerspectiveProjection()

bool ON_Viewport::IsTwoPointPerspectiveProjection ( ) const

Returns IsPerspectiveProjection() && CameraUpIsLocked() && FrustumIsLeftRightSymmetric && !FrustumIsTopBottomSymmetric

◆ IsValid()

bool ON_Viewport::IsValid ( class ON_TextLog text_log = nullptr) const
overridevirtual

ON_Object overrides //////////////////////////////////////////////////////

Reimplemented from ON_Geometry.

◆ IsValidCamera()

bool ON_Viewport::IsValidCamera ( ) const

Returns: True if camera location is valid and camera up, direction, X, Y, and Z are valid.

◆ IsValidCameraFrame()

bool ON_Viewport::IsValidCameraFrame ( ) const

Returns: True if camera up, direction, X, Y, and Z are valid.

◆ IsValidCameraLocation()

static bool ON_Viewport::IsValidCameraLocation ( ON_3dPoint  candidate_point)
static

Returns: candidate_point.IsValid() && candidate_point.MaximumCoordinate() < ON_NONSENSE_WORLD_COORDINATE_VALUE;

◆ IsValidCameraUpOrDirection()

static bool ON_Viewport::IsValidCameraUpOrDirection ( ON_3dVector  candidate_vector)
static

Returns: candidate_vector.IsValid() && candidate_vector.MaximumCoordinate() < ON_NONSENSE_WORLD_COORDINATE_VALUE && candidate_vector.MaximumCoordinate() > ON_ZERO_TOLERANCE ;

◆ IsValidFrustum()

bool ON_Viewport::IsValidFrustum ( ) const

Returns: True if camera frustum is valid.

◆ operator=()

ON_Viewport& ON_Viewport::operator= ( const ON_Viewport )
default

◆ PerspectiveMinNearDist()

double ON_Viewport::PerspectiveMinNearDist ( ) const

Description: Expert user function to get the minimum value of near when perspective projections are begin used. Returns: The minimum permitted value of near when perspective projections are begin used. Remarks: This is a runtime setting and is not saved in 3dm files.

◆ PerspectiveMinNearOverFar()

double ON_Viewport::PerspectiveMinNearOverFar ( ) const

Description: Expert user function to get the minimum runtime value of near/far when perspective projections are begin used. Returns: The minimum permitted value of near/far when perspective projections are begin used. Remarks: This is a runtime setting and is not saved in 3dm files.

◆ Projection()

ON::view_projection ON_Viewport::Projection ( ) const

◆ Read()

bool ON_Viewport::Read ( ON_BinaryArchive )
overridevirtual

Description: Reads ON_Viewport definition from a binary archive.

Parameters: binary_archive - [in] open binary archive

Returns: true if successful.

Remarks: This overrides the virtual ON_Object::Read() function.

Reimplemented from ON_Object.

◆ ScreenPortHeight()

int ON_Viewport::ScreenPortHeight ( ) const

Returns: std::abs(port_bottom - port_top)

◆ ScreenPortSize()

ON_2iSize ON_Viewport::ScreenPortSize ( ) const

◆ ScreenPortWidth()

int ON_Viewport::ScreenPortWidth ( ) const

Returns: std::abs(port_right - port_left)

◆ SetCamera()

bool ON_Viewport::SetCamera ( const ON_Viewport source_viewport,
bool  bBreakLocks 
)

Description: Copy camera location, up, direction and frame from source_viewport. Parameters: source_viewport - [in] camera location to copy bBreakLocks - [in] If true, any locked frustum settings will be unlocked.

◆ SetCamera35mmLenseLength()

bool ON_Viewport::SetCamera35mmLenseLength ( double  lens_length)

Same as SetCamera35mmLensLength() with "lens" misspelled.

◆ SetCamera35mmLensLength()

bool ON_Viewport::SetCamera35mmLensLength ( double  lens_length)

◆ SetCameraAngle()

bool ON_Viewport::SetCameraAngle ( double  half_smallest_angle)
Parameters
half_smallest_angle1/2 of smallest subtended view angle 0 < angle < pi/2

◆ SetCameraDirection()

bool ON_Viewport::SetCameraDirection ( const ON_3dVector )

◆ SetCameraDirectionLock()

void ON_Viewport::SetCameraDirectionLock ( bool  bLockCameraDirection)

◆ SetCameraLocation()

bool ON_Viewport::SetCameraLocation ( const ON_3dPoint )

These return true if the current direction and up are not zero and not parallel so the camera position is well defined.

◆ SetCameraLocationLock()

void ON_Viewport::SetCameraLocationLock ( bool  bLockCameraLocation)

◆ SetCameraUp()

bool ON_Viewport::SetCameraUp ( const ON_3dVector )

◆ SetCameraUpLock()

void ON_Viewport::SetCameraUpLock ( bool  bLockCameraUp)

◆ SetFrustum() [1/2]

bool ON_Viewport::SetFrustum ( const ON_Viewport source_viewport,
bool  bBreakLocks 
)

Description: Copy frustum information from source_viewport. Parameters: source_viewport - [in] bBreakLocks - [in] If true, any locked frustum settings will be unlocked.

◆ SetFrustum() [2/2]

bool ON_Viewport::SetFrustum ( double  left,
double  right,
double  bottom,
double  top,
double  near_dist,
double  far_dist 
)

Description: Set 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
right( left < right )
top( bottom < top )
far_dist( 0 < near_dist < far_dist ) ///< ignored by Rhino version 1.0

◆ SetFrustumAspect()

bool ON_Viewport::SetFrustumAspect ( double  )

SetFrustumAspect() 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().

◆ SetFrustumLeftRightSymmetry()

void ON_Viewport::SetFrustumLeftRightSymmetry ( bool  bForceLeftRightSymmetry)

◆ SetFrustumNearFar() [1/5]

bool ON_Viewport::SetFrustumNearFar ( const double *  bboxmin,
const double *  bboxmax 
)
Parameters
bboxmin3d bounding box min
bboxmax3d bounding box max

◆ SetFrustumNearFar() [2/5]

bool ON_Viewport::SetFrustumNearFar ( const double *  center,
double  radius 
)
Parameters
center3d bounding sphere center
radius3d bounding sphere radius

◆ SetFrustumNearFar() [3/5]

bool ON_Viewport::SetFrustumNearFar ( double  near_dist,
double  far_dist 
)
Parameters
near_dist( > 0 )

◆ SetFrustumNearFar() [4/5]

bool ON_Viewport::SetFrustumNearFar ( double  near_dist,
double  far_dist,
double  min_near_dist,
double  min_near_over_far,
double  target_dist 
)

Description: Set near and far clipping distance subject to constraints. Parameters: near_dist - [in] (>0) desired near clipping distance far_dist - [in] (>near_dist) desired near clipping distance min_near_dist - [in] 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. min_near_over_far - [in] 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. target_dist - [in]
If target_dist <= 0.0, it is ignored. If target_dist > 0, it is used as described in the description of the min_near_over_far parameter. relative_depth_bias - [in] If relative_depth_bias <= 0.0, it is ignored. If relative_depth_bias > 0, it is assumed that the requested near_dist and far_dist were calculated assuming no depth bias and the values will be appropriately adjusted to ensure the frustum's near and far clipping planes will not clip biased objects.

◆ SetFrustumNearFar() [5/5]

bool ON_Viewport::SetFrustumNearFar ( double  near_dist,
double  far_dist,
double  min_near_dist,
double  min_near_over_far,
double  target_dist,
double  relative_depth_bias 
)

◆ SetFrustumTopBottomSymmetry()

void ON_Viewport::SetFrustumTopBottomSymmetry ( bool  bForceTopBottomSymmetry)

◆ SetPerspectiveClippingPlaneConstraints()

void ON_Viewport::SetPerspectiveClippingPlaneConstraints ( unsigned int  depth_buffer_bit_depth)

Description: Set suggested the perspective minimum near distance and minimum near/far ratio to the suggested values returned by GetPerspectiveClippingPlaneConstraints(). Parameters: depth_buffer_bit_depth - [in] typically 32, 24, 16 or 8, but any positive value can be passed in.

◆ SetPerspectiveMinNearDist()

void ON_Viewport::SetPerspectiveMinNearDist ( double  min_near_dist)

Description: Expert user function to control the minimum value of near when perspective projections are begin used. Parameters: min_near_dist - [in] Remarks: This is a runtime setting and is not saved in 3dm files.

◆ SetPerspectiveMinNearOverFar()

void ON_Viewport::SetPerspectiveMinNearOverFar ( double  min_near_over_far)

Description: Expert user function to control the minimum ratio of near/far when perspective projections are begin used. Parameters: min_near_over_far - [in] Remarks: This is a runtime setting and is not saved in 3dm files.

◆ SetProjection()

bool ON_Viewport::SetProjection ( ON::view_projection  projection)

Description: Unconditionally set the projection. Parameters: projection - [in] See Also: ON_Viewport::SetParallelProjection ON_Viewport::SetPerpectiveProjection ON_Viewport::SetTwoPointPerspectiveProjection

◆ SetScreenPort()

bool ON_Viewport::SetScreenPort ( int  port_left,
int  port_right,
int  port_bottom,
int  port_top,
int  port_near = 0,
int  port_far = 0 
)

Description: 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. Parameters: port_left - [in] port_right - [in] (port_left != port_right) port_bottom - [in] port_top - [in] (port_top != port_bottom) port_near - [in] port_far - [in] Example:

/ 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 );

Returns: true if input is valid. See Also: ON_Viewport::GetScreenPort

◆ SetTargetPoint()

bool ON_Viewport::SetTargetPoint ( ON_3dPoint  target_point)

Description: Set the target point. Parameters: target_point - [in] When in doubt, the point returned by FrustumCenterPoint(ON_UNSET_VALUE) is a good choice. Remarks: The default constructor sets this point on ON_3dPoint::UnsetPoint. You must explicitly call one SetTargetPoint() functions to set the target point.

◆ SetViewportId()

bool ON_Viewport::SetViewportId ( const ON_UUID viewport_id)

Description: Sets the viewport's id to the value used to uniquely identify this viewport. Parameters: viewport_id - [in]
Returns: True if the viewport's id was successfully set and false otherwise (ie. the viewport uuid has already been set). Remarks: 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.

◆ SetViewScale() [1/2]

bool ON_Viewport::SetViewScale ( double  x,
double  y 
)

Description: Apply scaling factors to parallel projection clipping coordinates by setting the m_clip_mod transformation.
Parameters: x - [in] x > 0 y - [in] y > 0 Example: If you want to compress the view projection across the viewing plane, then set x = 0.5, y = 1.0, and z = 1.0. Returns: True if successful. False if input is invalid or the view is a perspective view.

◆ SetViewScale() [2/2]

bool ON_Viewport::SetViewScale ( double  x,
double  y,
double  z 
)

◆ ShallowCopy()

ON_Viewport* ON_Viewport::ShallowCopy ( ON_Viewport destination) const

Description: Creates a shallow copy of this (no base class member including user data are copied). Parameters: destination - [in] If destination is not nullptr, then the copy is put in this class. Otherwise, the copy is put into a viewport created by calling new ON_Viewport().

◆ TargetDistance()

double ON_Viewport::TargetDistance ( bool  bUseFrustumCenterFallback) const

Description: Get 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: bUseFrustumCenterFallback - [in] 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.

◆ TargetPoint()

ON_3dPoint ON_Viewport::TargetPoint ( ) const

Returns: 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. Remarks: The default constructor sets this point on ON_3dPoint::UnsetPoint. You must explicitly call one SetTargetPoint() functions to set the target point.

◆ Transform()

bool ON_Viewport::Transform ( const ON_Xform )
overridevirtual

Description: Transforms the view camera location, direction, and up.

Parameters: xform - [in] transformation to apply to camera.

Returns: @untitled table true Valid camera was transformed. false Invalid camera, frustum, or transformation.

Remarks: This overrides the virtual ON_Geometry::Transform() function.

Reimplemented from ON_Geometry.

◆ UnlockCamera()

void ON_Viewport::UnlockCamera ( )

sets all camera locks to false

◆ UnlockFrustumSymmetry()

void ON_Viewport::UnlockFrustumSymmetry ( )

sets all frustum symmetry locks to false

◆ ViewportId()

ON_UUID ON_Viewport::ViewportId ( void  ) const

◆ ViewProjectionContentHash()

ON_SHA1_Hash ON_Viewport::ViewProjectionContentHash ( ) const

Returns: A sha1 hash of all the settings that effect view projection matrices. view projection, camera location, camera X,Y,Z frame, frustum, port.
If two ON_Viewport classes have identical values ViewProjectionContentHash(), then they will have identical view projection matrices and generate identical images from the same model content.

◆ Write()

bool ON_Viewport::Write ( ON_BinaryArchive ) const
overridevirtual

Description: Writes ON_Viewport definition from a binary archive.

Parameters: binary_archive - [in] open binary archive

Returns: true if successful.

Remarks: This overrides the virtual ON_Object::Write() function.

Reimplemented from ON_Object.

◆ ZoomToScreenRect()

bool ON_Viewport::ZoomToScreenRect ( int  screen_x0,
int  screen_y0,
int  screen_x1,
int  screen_y1 
)

ZoomToScreenRect() may change camera and frustum settings.

View changing from screen input points. Handy for using a mouse to manipulate a view.

Parameters
screen_y0(x,y) screen coords of a rectangle corner
screen_y1(x,y) screen coords of opposite rectangle corner

Member Data Documentation

◆ Default3dCameraDirection

const ON_3dVector ON_Viewport::Default3dCameraDirection
static

(-0.43301270189221932338186158537647,0.75,-0.5)

◆ DefaultCameraLocation

const ON_3dPoint ON_Viewport::DefaultCameraLocation
static

(0.0,0.0,100.0)

◆ DefaultFarDist

const double ON_Viewport::DefaultFarDist
static

1000.0

◆ DefaultMinNearDist

const double ON_Viewport::DefaultMinNearDist
static

0.0001

◆ DefaultMinNearOverFar

const double ON_Viewport::DefaultMinNearOverFar
static

0.0001

◆ DefaultNearDist

const double ON_Viewport::DefaultNearDist
static

0.005

◆ DefaultPerspectiveViewZUp

const ON_Viewport ON_Viewport::DefaultPerspectiveViewZUp
static

Description: A Z-up perspective projection looking down on the origin of the XY plane. up = ON_3dVector::Zaxis, dir = ON_3dVector:Default3dCameraDirection

◆ DefaultTopViewYUp

const ON_Viewport ON_Viewport::DefaultTopViewYUp
static

Description: A Y-up parallel projection looking at the origin of the XYplane. up = ON_3dVector::Yaxis, dir = -ON_3dVector::Zaxis

◆ m_bLockCamDir

bool ON_Viewport::m_bLockCamDir = false
protected

◆ m_bLockCamLoc

bool ON_Viewport::m_bLockCamLoc = false
protected

◆ m_bLockCamUp

bool ON_Viewport::m_bLockCamUp = false
protected

Camera location, direction and orientation (in world coordinates). These values are used to set the camera frame vectors CamX, CamY, CamZ. If bValidCamera is true, then the CamX, CamY and CamZ vectors are properly initialized and should be used instead of CamDir[] and CamUp[]. The frame vectors CamX, CamY, CamZ are always a right handed orthonormal frame. The CamDir and CamUp vectors contain the values passed to SetViewCamera(). If true and the camera is valid, then the corresponding camera parameter will not be changed by view editing functions. This permits user interface to easily preserve important camera features without having to perform excessive calculations.

◆ m_bValidCamera

bool ON_Viewport::m_bValidCamera = true
protected

These boolean status flags are set to true when the associated fields contain valid values.

◆ m_bValidCameraFrame

bool ON_Viewport::m_bValidCameraFrame = true
protected

◆ m_bValidFrustum

bool ON_Viewport::m_bValidFrustum = true
protected

◆ m_bValidPort

bool ON_Viewport::m_bValidPort = false
protected

◆ m_CamDir

ON_3dVector ON_Viewport::m_CamDir = -ON_3dVector::ZAxis
protected

from camera towards view (nonzero and not parallel to m_CamUp)

◆ m_CamLoc

ON_3dPoint ON_Viewport::m_CamLoc = ON_Viewport::DefaultCameraLocation
protected

camera location

◆ m_CamUp

ON_3dVector ON_Viewport::m_CamUp = ON_3dVector::YAxis
protected

(nonzero and not parallel to m_CamDir)

◆ m_CamX

ON_3dVector ON_Viewport::m_CamX = ON_3dVector::XAxis
protected

The camera frame vectors are properly initialized by SetCamera()

◆ m_CamY

ON_3dVector ON_Viewport::m_CamY = ON_3dVector::YAxis
protected

◆ m_CamZ

ON_3dVector ON_Viewport::m_CamZ = ON_3dVector::ZAxis
protected

◆ m_frus_bottom

double ON_Viewport::m_frus_bottom = -20.0
protected

frus_bottom < frus_top

◆ m_frus_far

double ON_Viewport::m_frus_far = ON_Viewport::DefaultFarDist
protected

◆ m_frus_left

double ON_Viewport::m_frus_left = -20.0
protected

frus_left < frus_right

View Frustum Settings: /////////////////////////////////////// left, right are camera X coords on near clipping plane bottom, top are camera Y coords on near clipping plane near = distance from camera to near clipping plane far = distance from camera to far clipping plane

◆ m_frus_near

double ON_Viewport::m_frus_near = ON_Viewport::DefaultMinNearDist
protected

0 < frus_near < frus_far

◆ m_frus_right

double ON_Viewport::m_frus_right = 20.0
protected

◆ m_frus_top

double ON_Viewport::m_frus_top = 20.0
protected

◆ m_frustum_symmetry_flags

unsigned char ON_Viewport::m_frustum_symmetry_flags = 0
protected

0 != (flags & 1) top/bottom symmetry enforced 0 != (flags & 2) left/right symmetry enforced.

◆ m_port_bottom

int ON_Viewport::m_port_bottom = 0
protected

port_bottom != port_top

◆ m_port_far

int ON_Viewport::m_port_far = 1
protected

◆ m_port_left

int ON_Viewport::m_port_left = 0
protected

port_left != port_right

Device View Port Box Settings: ( in display device coordinates ) //// The point (left,bottom,-near), in camera coordinates, of the view frustum is mapped to pixel coordinate (port_left,port_bottom,port_near). The point (right,top,-far), in camera coordinates, of the view frustum is mapped to pixel coordinate (port_right,port_top,port_far). In many situations including Microsoft Windows coordinates, port_left = 0, port_right = viewport width-1, port_top = 0, port_bottom = viewport height-1.

◆ m_port_near

int ON_Viewport::m_port_near = 0
protected

(If you want an 8 bit z-buffer with z=255 being "in front of" z=0, then set port_near = 255 and port_far = 0.)

◆ m_port_right

int ON_Viewport::m_port_right = 1000
protected

◆ m_port_top

int ON_Viewport::m_port_top = 1000
protected

◆ m_projection

ON::view_projection ON_Viewport::m_projection = ON::parallel_view
protected

Camera Settings: ///////////////////////////////////////////////.

perspective or parallel projection

◆ m_target_point

ON_3dPoint ON_Viewport::m_target_point = ON_3dPoint::UnsetPoint
protected

The location of this point has no impact on the view projection. It is simply a suggestion for a fixed point when views are rotated or the isometric depth when perpsective views are dollied. The default is ON_3dPoint::UnsetPoint.