23 #if !defined(OPENNURBS_VIEWPORT_INC_) 24 #define OPENNURBS_VIEWPORT_INC_ 82 static bool IsValidCameraLocation(
93 static bool IsValidCameraUpOrDirection(
101 bool IsValidCameraFrame()
const;
107 bool IsValidCamera()
const;
113 bool IsValidFrustum()
const;
177 bool GetBBox(
double* boxmin,
double* boxmax,
bool bGrowBox =
false )
const override;
201 ON_DEPRECATED_MSG(
"Use = ON_Viewport::DefaultTopViewYUp")
204 ON::view_projection Projection() const;
216 bool SetProjection( ON::view_projection projection );
232 bool ChangeToParallelProjection(
bool bSymmetricFrustum );
258 bool ChangeToPerspectiveProjection(
259 double target_distance,
260 bool bSymmetricFrustum,
291 bool ChangeToTwoPointPerspectiveProjection(
292 double target_distance,
301 bool IsPerspectiveProjection() const;
310 bool IsTwoPointPerspectiveProjection() const;
316 bool IsParallelProjection() const;
322 bool SetCameraUp( const ON_3dVector& );
324 ON_3dPoint CameraLocation() const;
325 ON_3dVector CameraDirection() const;
326 ON_3dVector CameraUp() const;
342 bool CameraLocationIsLocked() const;
343 bool CameraDirectionIsLocked() const;
344 bool CameraUpIsLocked() const;
345 bool FrustumIsLeftRightSymmetric() const;
346 bool FrustumIsTopBottomSymmetric() const;
348 void SetCameraLocationLock(
bool bLockCameraLocation );
349 void SetCameraDirectionLock(
bool bLockCameraDirection ) ;
350 void SetCameraUpLock(
bool bLockCameraUp );
351 void SetFrustumLeftRightSymmetry(
bool bForceLeftRightSymmetry );
352 void SetFrustumTopBottomSymmetry(
bool bForceTopBottomSymmetry );
354 void UnlockFrustumSymmetry();
365 ON_3dVector CameraX() const;
366 ON_3dVector CameraY() const;
367 ON_3dVector CameraZ() const;
370 bool IsCameraFrameWorldPlan(
383 bool GetCameraExtents(
393 bool GetCameraExtents(
397 ON_BoundingBox& cambbox,
401 bool GetCameraExtents(
406 ON_BoundingBox& cambox,
429 double* near_dist =
nullptr,
430 double* far_dist =
nullptr 454 bool SetFrustumAspect(
double );
457 bool GetFrustumAspect(
double& ) const;
460 bool GetFrustumCenter(
double* ) const;
466 double FrustumLeft() const;
467 double FrustumRight() const;
468 double FrustumBottom() const;
469 double FrustumTop() const;
470 double FrustumNear() const;
471 double FrustumFar() const;
477 double FrustumWidth() const;
483 double FrustumHeight() const;
489 double FrustumMinimumDiameter() const;
495 double FrustumMaximumDiameter() const;
498 bool SetFrustumNearFar(
499 const
double* bboxmin,
500 const
double* bboxmax
502 bool SetFrustumNearFar(
503 const
double* center,
506 bool SetFrustumNearFar(
532 bool ChangeToSymmetricFrustum(
533 bool bLeftRightSymmetric,
534 bool bTopBottomSymmetric,
535 double target_distance
561 bool bGrowNearFar=false
584 double* view_plane_depth
619 bool GetBoundingBoxDepth(
623 bool bGrowNearFar=false
664 int GetBoundingBoxDepth(
702 bool GetBoundingBoxProjectionExtents(
731 bool bGrowNearFar=false
768 bool SetFrustumNearFar(
771 double min_near_dist,
772 double min_near_over_far,
776 bool SetFrustumNearFar(
779 double min_near_dist,
780 double min_near_over_far,
782 double relative_depth_bias
801 bool GetNearPlaneEquation(
820 bool GetFarPlaneEquation(
845 double view_plane_depth,
849 bool GetViewPlaneEquation(
850 double view_plane_depth,
867 bool GetFrustumLeftPlane(
871 bool GetFrustumLeftPlaneEquation(
888 bool GetFrustumRightPlane(
892 bool GetFrustumRightPlaneEquation(
909 bool GetFrustumBottomPlane(
913 bool GetFrustumBottomPlaneEquation(
929 bool GetFrustumTopPlane(
933 bool GetFrustumTopPlaneEquation(
949 ON_3dPoint& left_bottom,
950 ON_3dPoint& right_bottom,
951 ON_3dPoint& left_top,
952 ON_3dPoint& right_top
967 ON_3dPoint& left_bottom,
968 ON_3dPoint& right_bottom,
969 ON_3dPoint& left_top,
970 ON_3dPoint& right_top
994 bool GetViewPlaneRect(
995 double view_plane_depth,
996 ON_3dPoint& left_bottom,
997 ON_3dPoint& right_bottom,
998 ON_3dPoint& left_top,
999 ON_3dPoint& right_top
1050 int* port_near=
nullptr,
1051 int* port_far=
nullptr 1058 int ScreenPortWidth() const;
1064 int ScreenPortHeight() const;
1068 bool GetScreenPortAspect(
double& ) const;
1070 bool GetCameraAngle(
1071 double* half_diagonal_angle,
1072 double* half_vertical_angle,
1073 double* half_horizontal_angle
1075 bool GetCameraAngle(
1076 double* half_smallest_angle
1078 bool SetCameraAngle(
1079 double half_smallest_angle
1089 bool GetCamera35mmLensLength(
1092 bool SetCamera35mmLensLength(
1097 bool GetCamera35mmLenseLength(
1102 bool SetCamera35mmLenseLength(
1107 ON::coordinate_system srcCS,
1108 ON::coordinate_system destCS,
1126 bool GetFrustumLine(
1153 bool GetWorldToScreenScale(
1154 ON_3dPoint world_point,
1155 double* pixels_per_unit
1175 bool GetWorldToScreenScale(
1176 double frustum_depth,
1177 double* pixels_per_unit
1180 bool GetCoordinateSprite(
1191 double half_view_angle,
1193 const ON_BoundingBox& world_bbox
1196 double half_view_angle,
1198 const ON_3dPoint& center,
1209 bool ZoomToScreenRect(
1223 const ON_3dVector& dolly_vector
1229 bool GetDollyCameraVector(
1234 double proj_plane_dist,
1236 ON_3dVector& dolly_vector
1242 double dolly_distance
1259 bool SetViewScale(
double x,
double y );
1260 void GetViewScale(
double* x,
double* y ) const;
1276 ON_Xform ClipModInverseXform() const;
1282 bool ClipModXformIsIdentity() const;
1302 ON_3dPoint FrustumCenterPoint(
double target_distance ) const;
1315 ON_3dPoint TargetPoint() const;
1329 bool SetTargetPoint( ON_3dPoint target_point );
1349 double TargetDistance(
bool bUseFrustumCenterFallback ) const;
1365 static
void GetPerspectiveClippingPlaneConstraints(
1366 ON_3dPoint camera_location,
1367 unsigned int depth_buffer_bit_depth,
1368 double* min_near_dist,
1369 double* min_near_over_far
1400 double ClipCoordDepthBias(
1401 double relative_depth_bias,
1438 bool GetClipCoordDepthBiasXform(
1439 double relative_depth_bias,
1453 void SetPerspectiveClippingPlaneConstraints(
1454 unsigned int depth_buffer_bit_depth
1467 void SetPerspectiveMinNearOverFar(
double min_near_over_far);
1480 double PerspectiveMinNearOverFar() const;
1492 void SetPerspectiveMinNearDist(
double min_near_dist);
1505 double PerspectiveMinNearDist() const;
1523 bool SetViewportId(const
ON_UUID& viewport_id );
1525 ON_UUID ViewportId(
void) const;
1535 void ChangeViewportId(const
ON_UUID& viewport_id);
1573 const ON_BoundingBox& bbox
1610 bool bInfiniteFrustum,
1611 const ON_BoundingBox& bbox,
1619 bool m_bValidCamera = true;
1620 bool m_bValidFrustum = true;
1621 bool m_bValidPort = false;
1622 bool m_bValidCameraFrame = true;
1627 ON::view_projection m_projection = ON::parallel_view;
1641 bool m_bLockCamUp = false;
1642 bool m_bLockCamDir = false;
1643 bool m_bLockCamLoc = false;
1644 unsigned char m_frustum_symmetry_flags = 0;
1646 ON_3dPoint m_CamLoc =
ON_Viewport::DefaultCameraLocation;
1647 ON_3dVector m_CamDir = -ON_3dVector::ZAxis;
1648 ON_3dVector m_CamUp = ON_3dVector::YAxis;
1651 ON_3dVector m_CamX = ON_3dVector::XAxis;
1652 ON_3dVector m_CamY = ON_3dVector::YAxis;
1653 ON_3dVector m_CamZ = ON_3dVector::ZAxis;
1660 double m_frus_left = -20.0;
1661 double m_frus_right = 20.0;
1662 double m_frus_bottom = -20.0;
1663 double m_frus_top = 20.0;
1664 double m_frus_near =
ON_Viewport::DefaultMinNearDist;
1677 int m_port_left = 0;
1678 int m_port_right = 1000;
1679 int m_port_bottom = 0;
1680 int m_port_top = 1000;
1684 int m_port_near = 0;
1693 ON_3dPoint m_target_point = ON_3dPoint::UnsetPoint;
1699 ON_UUID m_viewport_id = ON_nil_uuid;
1701 bool SetCameraFrame();
1715 bool SetClipModXform(
ON_Xform clip_mod_xform );
1721 double m__MIN_NEAR_DIST =
ON_Viewport::DefaultMinNearDist;
1722 double m__MIN_NEAR_OVER_FAR =
ON_Viewport::DefaultMinNearOverFar;
1730 ON_GetViewportRotationAngles(
1741 ON_ViewportFromRhinoView(
1742 ON::view_projection,
1772 ON_IntersectViewFrustumPlane(
1773 const ON_Viewport& vp,
virtual bool Transform(const ON_Xform &xform)
Transforms the object.
ON_UUID is a 16 byte universally unique identifier.
Definition: opennurbs_uuid.h:32
virtual int Dimension() const
Dimension of the object.
Definition: opennurbs_ipoint.h:236
virtual bool GetBBox(double *boxmin, double *boxmax, bool bGrowBox=false) const
This is the virtual function that actually calculates axis aligned bounding boxes.
Definition: opennurbs_array.h:36
Definition: opennurbs_sha1.h:19
Definition: opennurbs_fpoint.h:211
Base class for all geometry classes that must provide runtime class id. Provides interface for common...
Definition: opennurbs_geometry.h:37
static const double DefaultMinNearDist
Definition: opennurbs_viewport.h:38
Definition: opennurbs_point.h:648
Definition: opennurbs_bounding_box.h:25
virtual void Dump(ON_TextLog &) const
Creates a text dump of the object.
Definition: opennurbs_line.h:20
ON_Geometry & operator=(const ON_Geometry &)=default
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
static const double DefaultMinNearOverFar
Definition: opennurbs_viewport.h:39
Definition: opennurbs_viewport.h:31
virtual bool Read(ON_BinaryArchive &binary_archive)
Low level archive writing tool used by ON_BinaryArchive::ReadObject().
Definition: opennurbs_point.h:460
bool IsValid(class ON_TextLog *text_log=nullptr) const override
Tests an object to see if its data members are correctly initialized.
virtual bool Write(ON_BinaryArchive &binary_archive) const
Low level archive writing tool used by ON_BinaryArchive::WriteObject().
static const double DefaultFarDist
Definition: opennurbs_viewport.h:37
static const ON_3dVector Default3dCameraDirection
Definition: opennurbs_viewport.h:42
Definition: opennurbs_plane.h:20
static const double DefaultNearDist
Definition: opennurbs_viewport.h:36
Typically the vector portion is a unit vector and m_d = -(x*P.x + y*P.y + z*P.z) for a point P on the...
Definition: opennurbs_point.h:1433
Definition: opennurbs_point.h:1152
Definition: opennurbs_point.h:46
Definition: opennurbs_sphere.h:22
static const ON_3dPoint DefaultCameraLocation
Definition: opennurbs_viewport.h:41