#include <opennurbs_viewport.h>
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 |
ON_3dVector | CameraZ () const |
bool | ChangeToParallelProjection (bool bSymmetricFrustum) |
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. More... | |
bool | ChangeToPerspectiveProjection (double target_distance, bool bSymmetricFrustum, double lens_length) |
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. More... | |
bool | ChangeToSymmetricFrustum (bool bLeftRightSymmetric, bool bTopBottomSymmetric, double target_distance) |
If needed, adjust the current frustum so it has the specified symmetries and adjust the camera location so the target plane remains visible. More... | |
bool | ChangeToTwoPointPerspectiveProjection (double target_distance, ON_3dVector up, double lens_length) |
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. More... | |
void | ChangeViewportId (const ON_UUID &viewport_id) |
EXPERT USER function to change the viewport's id. If you change the id, you risk damaging display and visibility relationships in the model. More... | |
double | ClipCoordDepthBias (double relative_depth_bias, double clip_z, double clip_w) const |
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). More... | |
ON_Xform | ClipModInverseXform () const |
Gets the m_clip_mod_inverse transformation; More... | |
ON_Xform | ClipModXform () const |
Gets the m_clip_mod transformation; More... | |
bool | ClipModXformIsIdentity () const |
int | Dimension () const override |
The dimension of a camera view frustum is 3. More... | |
bool | DollyCamera (const ON_3dVector &dolly_vector) |
bool | DollyFrustum (double dolly_distance) |
Moves frustum's clipping planes. More... | |
void | Dump (ON_TextLog &) const override |
Dumps debugging text description to a text log. More... | |
bool | Extents (double half_view_angle, const ON_BoundingBox &world_bbox) |
bool | Extents (double half_view_angle, const ON_3dPoint ¢er, double radius) |
double | FrustumBottom () const |
ON_3dPoint | FrustumCenterPoint (double target_distance) const |
Return a point on the central axis of the view frustum. This point is a good choice for a general purpose target point. More... | |
double | FrustumFar () const |
double | FrustumHeight () const |
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 |
bool | GetBBox (double *boxmin, double *boxmax, bool bGrowBox=false) const override |
virtual ON_Geometry GetBBox override More... | |
bool | GetBoundingBoxDepth (ON_BoundingBox bbox, double *near_dist, double *far_dist, bool bGrowNearFar=false) const |
Get near and far clipping distances of a bounding box. More... | |
int | GetBoundingBoxDepth (ON_BoundingBox bbox, const ON_Xform *bbox_xform, double *near_dist, double *far_dist, bool bGrowNearFar) const |
Get near and far clipping distances of a bounding box. More... | |
bool | GetBoundingBoxProjectionExtents (ON_BoundingBox bbox, ON_Interval &x_extents, ON_Interval &y_extents) const |
Get the normalized extents of the smallest rectangle that contains the intersection of bbox and the view's frustum. More... | |
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 (int, int, const double *, ON_BoundingBox &cambbox, int bGrowBox=false) const |
bool | GetCameraExtents (const ON_BoundingBox &, ON_BoundingBox &cambbox, int bGrowBox=false) const |
bool | GetCameraExtents (ON_3dPoint &, double, ON_BoundingBox &cambox, int bGrowBox=false) 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 |
Calculate a transformation to apply to clipping coordinates to bias their depth. More... | |
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 |
Get far clipping plane. More... | |
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 |
Get corners of far clipping plane rectangle. More... | |
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 |
Get bottom world frustum clipping plane. More... | |
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 |
Get left world frustum clipping plane. More... | |
bool | GetFrustumLeftPlaneEquation (ON_PlaneEquation &left_plane_equation) const |
bool | GetFrustumLine (double screenx, double screeny, ON_Line &world_line) const |
Get the world coordinate line in the view frustum that projects to a point on the screen. More... | |
bool | GetFrustumRightPlane (ON_Plane &right_plane) const |
Get right world frustum clipping plane. More... | |
bool | GetFrustumRightPlaneEquation (ON_PlaneEquation &right_plane_equation) const |
bool | GetFrustumTopPlane (ON_Plane &top_plane) const |
Get top world frustum clipping plane. More... | |
bool | GetFrustumTopPlaneEquation (ON_PlaneEquation &top_plane_equation) const |
bool | GetNearPlane (ON_Plane &near_plane) const |
Get near clipping plane. More... | |
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 |
Get corners of near clipping plane rectangle. More... | |
bool | GetPointDepth (ON_3dPoint point, double *near_dist, double *far_dist, bool bGrowNearFar=false) const |
Get near and far clipping distances of a point More... | |
bool | GetPointDepth (ON_3dPoint point, double *view_plane_depth) const |
Get the view plane depth of a point More... | |
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 |
bool | GetSphereDepth (ON_Sphere sphere, double *near_dist, double *far_dist, bool bGrowNearFar=false) const |
Get near and far clipping distances of a bounding sphere. More... | |
bool | GetViewPlane (double view_plane_depth, ON_Plane &view_plane) const |
Get the plane that is a specified distance from the camera. This plane is parallel to the frustum's near and far planes. More... | |
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 |
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. More... | |
void | GetViewScale (double *x, double *y) const |
bool | GetWorldToScreenScale (ON_3dPoint world_point, double *pixels_per_unit) const |
display tools More... | |
bool | GetWorldToScreenScale (double frustum_depth, double *pixels_per_unit) const |
Get the number of horizontal pixels per world unit at the location in screen space where world_point would be rendered. More... | |
bool | GetXform (ON::coordinate_system srcCS, ON::coordinate_system destCS, ON_Xform &matrix) const |
void | Initialize () |
int | InViewFrustum (ON_3dPoint P) const |
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. More... | |
int | InViewFrustum (const ON_BoundingBox &bbox) const |
int | InViewFrustum (int count, const ON_3fPoint *p) const |
int | InViewFrustum (int count, const ON_3dPoint *p) const |
int | InViewFrustum (int count, const ON_4dPoint *p) const |
int | InViewFrustum (bool bInfiniteFrustum, const ON_BoundingBox &bbox, const ON_Xform *bbox_xform) const |
Determine if some portion of the transformed bounding box is inside the view frustum. More... | |
bool | IsCameraFrameWorldPlan (int *, int *, int *) |
bool | IsParallelProjection () const |
bool | IsPerspectiveProjection () const |
bool | IsTwoPointPerspectiveProjection () const |
bool | IsValid (class ON_TextLog *text_log=nullptr) const override |
Tests an object to see if its data members are correctly initialized. More... | |
bool | IsValidCamera () const |
bool | IsValidCameraFrame () const |
bool | IsValidFrustum () const |
ON_Viewport & | operator= (const ON_Viewport &)=default |
double | PerspectiveMinNearDist () const |
Expert user function to get the minimum value of near when perspective projections are begin used. More... | |
double | PerspectiveMinNearOverFar () const |
Expert user function to get the minimum runtime value of near/far when perspective projections are begin used. More... | |
ON::view_projection | Projection () const |
bool | Read (ON_BinaryArchive &) override |
Reads ON_Viewport defintion from a binary archive. More... | |
int | ScreenPortHeight () const |
ON_2iSize | ScreenPortSize () const |
int | ScreenPortWidth () const |
bool | SetCamera (const ON_Viewport &source_viewport, bool bBreakLocks) |
Copy camera location, up, direction and frame from source_viewport. More... | |
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 (double left, double right, double bottom, double top, double near_dist, double far_dist) |
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. More... | |
bool | SetFrustum (const ON_Viewport &source_viewport, bool bBreakLocks) |
Copy frustum information from source_viewport. More... | |
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) |
Set near and far clipping distance subject to constraints. More... | |
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) |
Set suggested the perspective minimum near distance and minimum near/far ratio to the suggested values returned by GetPerspectiveClippingPlaneConstraints(). More... | |
void | SetPerspectiveMinNearDist (double min_near_dist) |
Expert user function to control the minimum value of near when perspective projections are begin used. More... | |
void | SetPerspectiveMinNearOverFar (double min_near_over_far) |
Expert user function to control the minimum ratio of near/far when perspective projections are begin used. More... | |
bool | SetProjection (ON::view_projection projection) |
Unconditionally set the projection. More... | |
bool | SetScreenPort (int port_left, int port_right, int port_bottom, int port_top, int port_near=0, int port_far=0) |
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. More... | |
bool | SetTargetPoint (ON_3dPoint target_point) |
Set the target point. More... | |
bool | SetViewportId (const ON_UUID &viewport_id) |
Sets the viewport's id to the value used to uniquely identify this viewport. More... | |
bool | SetViewScale (double x, double y) |
Apply scaling factors to parallel projection clipping coordinates by setting the m_clip_mod transformation. More... | |
double | TargetDistance (bool bUseFrustumCenterFallback) const |
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. More... | |
ON_3dPoint | TargetPoint () const |
bool | Transform (const ON_Xform &) override |
Transforms the view camera location, direction, and up. More... | |
void | UnlockCamera () |
void | UnlockFrustumSymmetry () |
ON_UUID | ViewportId (void) const |
ON_SHA1_Hash | ViewProjectionContentHash () const |
bool | Write (ON_BinaryArchive &) const override |
Writes ON_Viewport defintion from a binary archive. More... | |
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 |
Get object's 3d axis aligned bounding box. More... | |
virtual class ON_Brep * | BrepForm (class ON_Brep *brep=nullptr) const |
If possible, BrepForm() creates a brep form of the ON_Geometry. More... | |
virtual void | ClearBoundingBox () |
Some objects cache bounding box information. If you modify an object, then call ClearBoundingBox() to inform the object that any cached bounding boxes are invalid. More... | |
virtual ON_COMPONENT_INDEX | ComponentIndex () const |
If this piece of geometry is a component in something larger, like an ON_BrepEdge in an ON_Brep, then this function returns the component index. More... | |
virtual bool | EvaluatePoint (const class ON_ObjRef &objref, ON_3dPoint &P) const |
Evaluate the location of a point from the object reference. More... | |
bool | GetBoundingBox (ON_BoundingBox &bbox, bool bGrowBox=false) const |
Get object's 3d axis aligned bounding box or the union of the input box with the object's bounding box. More... | |
bool | GetBoundingBox (ON_3dPoint &bbox_min, ON_3dPoint &bbox_max, bool bGrowBox=false) const |
Get corners of object's 3d axis aligned bounding box or the union of the input box with the object's bounding box. More... | |
virtual bool | GetTightBoundingBox (class ON_BoundingBox &tight_bbox, bool bGrowBox=false, const class ON_Xform *xform=nullptr) const |
Get tight bounding box. More... | |
virtual bool | HasBrepForm () const |
Query an object to see if it has an ON_Brep form. Result: Returns true if the virtual ON_Geometry::BrepForm can compute an ON_Brep representation of this object. More... | |
virtual bool | IsDeformable () const |
virtual bool | MakeDeformable () |
If possible, converts the object into a form that can be accuratly modified with "squishy" transformations like projections, shears, an non-uniform scaling. More... | |
ON_Geometry & | operator= (const ON_Geometry &)=default |
bool | Rotate (double sin_angle, double cos_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center) |
Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule). More... | |
bool | Rotate (double rotation_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center) |
Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule). More... | |
bool | Scale (double scale_factor) |
Scales the object by the specified facotor. The scale is centered at the origin. More... | |
virtual bool | SwapCoordinates (int i, int j) |
Swaps object coordinate values with indices i and j. More... | |
bool | Translate (const ON_3dVector &translation_vector) |
Translates the object along the specified vector. More... | |
Public Member Functions inherited from ON_Object | |
ON_Object () ON_NOEXCEPT | |
ON_Object (const ON_Object &) | |
virtual | ~ON_Object () |
virtual ON_AggregateComponentStatus | AggregateComponentStatus () const |
Call whenever a component status setting is modifed by directly changing it on a component in a way that will result in any saved information about the parent object's aggretate component status becoming invalid. More... | |
bool | AttachUserData (class ON_UserData *pUserData) |
Attach user data to an object. More... | |
unsigned int | ClearAllComponentStates () const |
Set all active level component states to ON_ComponentStatus::NoneSet. More... | |
virtual unsigned int | ClearComponentStates (ON_ComponentStatus states_to_clear) const |
Clear the specified states on every component. More... | |
virtual unsigned int | ClearComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_clear) const |
Clear states on an individual component. More... | |
unsigned int | CopyUserData (const ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution) |
Expert user tool that copies user data items with positive values of ON_UserData.m_userdata_copycount from source_object to "this. More... | |
void | CopyUserData (const ON_Object &source_object) |
Calls CopyUserData(source_object,ON_Object::UserDataConflictResolution::source_object). More... | |
virtual ON__UINT32 | DataCRC (ON__UINT32 current_remainder) const |
Returns a CRC calculated from the information that defines the object. This CRC can be used as a quick way to see if two objects are not identical. More... | |
virtual bool | DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count) |
Delete the portions of the object identified in ci_list[]. More... | |
virtual void | DestroyRuntimeCache (bool bDelete=true) |
Expert user function. If you are using openNURBS in its default configuration to read and write 3dm archives, you never need to call this function. Many objects employ lazy creation of (runtime) caches that save information to help speed geometric calculations. This function will destroy all runtime information. More... | |
bool | DetachUserData (class ON_UserData *pUserData) |
Remove user data from an object. More... | |
void | EmergencyDestroy () |
Sets m_user_data_list = 0. More... | |
class ON_UserData * | FirstUserData () const |
User data is stored as a linked list of ON_UserData classes. FirstUserData gets the first item in the linked list. This is the most recent item attached using AttachUserData(). Remark: To iterate through all the user data on an object, call FirstUserData() and then use ON_UserData::Next() to traverse the list. More... | |
virtual unsigned int | GetComponentsWithSetStates (ON_ComponentStatus states_filter, bool bAllEqualStates, ON_SimpleArray< ON_COMPONENT_INDEX > &components) const |
class ON_UserData * | GetUserData (const ON_UUID &userdata_uuid) const |
Get a pointer to user data. More... | |
bool | GetUserString (const wchar_t *key, ON_wString &string_value) const |
Get user string from the object. More... | |
int | GetUserStringKeys (ON_ClassArray< ON_wString > &user_string_keys) const |
Get a list of all user string keys on the object. More... | |
int | GetUserStrings (ON_ClassArray< ON_UserString > &user_strings) const |
Get a list of all user strings on the object. More... | |
bool | IsKindOf (const ON_ClassId *pClassId) const |
Low level tool to test if an object is derived from a specified class. More... | |
virtual void | MarkAggregateComponentStatusAsNotCurrent () const |
Call whenever a component status setting is modifed by directly changing it on a component in a way that will result in any saved information about the parent object's aggretate component status becoming invalid. More... | |
virtual void | MemoryRelocate () |
The MemoryRelocate() function is called when an object's location in memory is changed. For example, if an object resides in a chunk of memory that is grown by calling a realloc that has to allocate a new chunk and copy the contents of the old chunk to the new chunk, then the location of the object's memory changes. In practice this happens when classes derived from ON_Object are stored in dynamic arrays, like the default implementation of ON_ObjectArray<>'s that use realloc to grow the dynamic array. More... | |
virtual ON_UUID | ModelObjectId () const |
All objects in an opennurbs model have an id ( ON_Layer.m_layer_id, ON_Font.m_font_id, ON_Material.m_material_id, ON_3dmObjectAttributes.m_uuid ). More... | |
unsigned int | MoveUserData (ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution, bool bDeleteAllSourceItems) |
Expert user tool that moves user data items from source_object to "this. More... | |
void | MoveUserData (ON_Object &source_object) |
Calls MoveUserData(source_object,ON_Object::UserDataConflictResolution::source_object,true). More... | |
virtual ON::object_type | ObjectType () const |
Useful for switch statements that need to differentiate between basic object types like points, curves, surfaces, and so on. More... | |
ON_Object & | operator= (const ON_Object &) |
void | PurgeUserData () |
PurgeUserData() removes all user data from object. More... | |
virtual unsigned int | SetComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_set) const |
Set states on an individual component. More... | |
virtual unsigned int | SetComponentStatus (ON_COMPONENT_INDEX component_index, ON_ComponentStatus status_to_copy) const |
Copy status settings to an individual component. More... | |
bool | SetUserString (const wchar_t *key, const wchar_t *string_value) |
Attach a user string to the object. This information will perisist through copy construction, operator=, and file IO. More... | |
int | SetUserStrings (int count, const ON_UserString *user_strings, bool bReplace) |
Append entries to the user string list More... | |
virtual unsigned int | SizeOf () const |
void | TransformUserData (const class ON_Xform &xform) |
Objects derived from ON_Geometry must call TransformUserData() in their Transform() member function. More... | |
virtual bool | UpdateReferencedComponents (const class ON_ComponentManifest &source_manifest, const class ON_ComponentManifest &destination_manifest, const class ON_ManifestMap &manifest_map) |
Uses the destination_manifest to update references to other components. This is typically done when a component's references came from a "source" context and are being updated to the "destination" context. For example, inserting one model into another when index, id, and name conflicts need to be resolved at the time of insertion. More... | |
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) |
Get suggested values for setting the perspective minimum near distance and minimum near/far ratio. More... | |
static bool | IsValidCameraLocation (ON_3dPoint candidate_point) |
static bool | IsValidCameraUpOrDirection (ON_3dVector candidate_vector) |
Static Public Attributes | |
static const ON_3dVector | Default3dCameraDirection |
static const ON_3dPoint | DefaultCameraLocation |
static const double | DefaultFarDist |
static const double | DefaultMinNearDist |
static const double | DefaultMinNearOverFar |
static const double | DefaultNearDist |
static const ON_Viewport | DefaultPerspectiveViewZUp |
A Z-up perspective projection looking down on the origin of the XY plane. up = ON_3dVector::Zaxis, dir = ON_3dVector:Default3dCameraDirection More... | |
static const ON_Viewport | DefaultTopViewYUp |
A Y-up parallel projection looking at the origin of the XYplane. up = ON_3dVector::Yaxis, dir = -ON_3dVector::Zaxis More... | |
Static Public Attributes inherited from ON_Geometry | |
static const ON_Geometry | Unset |
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 } |
When a userdata item is copied or moved from a source object to a destination object, the ON_Object::UserDataConflictResolution enum values specify how conficts are resolved. Remark: A userdata item "conflict" occurs when both the destination and source object have a user data item with the same value of ON_UserData::m_userdata_uuid. More... | |
|
default |
|
default |
|
default |
ON_3dVector ON_Viewport::CameraDirection | ( | ) | const |
bool ON_Viewport::CameraDirectionIsLocked | ( | ) | const |
ON_3dPoint ON_Viewport::CameraLocation | ( | ) | const |
bool ON_Viewport::CameraLocationIsLocked | ( | ) | const |
ON_3dVector ON_Viewport::CameraUp | ( | ) | const |
bool ON_Viewport::CameraUpIsLocked | ( | ) | const |
ON_3dVector ON_Viewport::CameraX | ( | ) | const |
these do not check for a valid camera orientation
ON_3dVector ON_Viewport::CameraY | ( | ) | const |
ON_3dVector ON_Viewport::CameraZ | ( | ) | const |
bool ON_Viewport::ChangeToParallelProjection | ( | bool | bSymmetricFrustum | ) |
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.
bSymmetricFrustum | [in] True if you want the resulting frustum to be symmetric. |
If the current projection is parallel and bSymmetricFrustum, FrustumIsLeftRightSymmetric() and FrustumIsTopBottomSymmetric() are all equal, then no changes are made and true is returned.
bool ON_Viewport::ChangeToPerspectiveProjection | ( | double | target_distance, |
bool | bSymmetricFrustum, | ||
double | lens_length | ||
) |
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.
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 perserved. |
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. |
If the current projection is perspective and bSymmetricFrustum, FrustumIsLeftRightSymmetric() and FrustumIsTopBottomSymmetric() are all equal, then no changes are made and true is returned.
bool ON_Viewport::ChangeToSymmetricFrustum | ( | bool | bLeftRightSymmetric, |
bool | bTopBottomSymmetric, | ||
double | target_distance | ||
) |
If needed, adjust the current frustum so it has the specified symmetries and adjust the camera location so the target plane remains visible.
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. |
bool ON_Viewport::ChangeToTwoPointPerspectiveProjection | ( | double | target_distance, |
ON_3dVector | up, | ||
double | lens_length | ||
) |
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.
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 perserved. |
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. |
If the current projection is perspective and FrustumIsLeftRightSymmetric() is true and FrustumIsTopBottomSymmetric() is false, then no changes are made and true is returned.
void ON_Viewport::ChangeViewportId | ( | const ON_UUID & | viewport_id | ) |
EXPERT USER function to change the viewport's id. If you change the id, you risk damaging display and visibility relationships in the model.
viewport_id | [in] |
double ON_Viewport::ClipCoordDepthBias | ( | double | relative_depth_bias, |
double | clip_z, | ||
double | clip_w | ||
) | const |
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).
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. |
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.
ON_Xform ON_Viewport::ClipModInverseXform | ( | ) | const |
Gets the m_clip_mod_inverse transformation;
ON_Xform ON_Viewport::ClipModXform | ( | ) | const |
Gets the m_clip_mod transformation;
bool ON_Viewport::ClipModXformIsIdentity | ( | ) | const |
|
overridevirtual |
The dimension of a camera view frustum is 3.
3
This is virtual ON_Geometry function.
Reimplemented from ON_Geometry.
bool ON_Viewport::DollyCamera | ( | const ON_3dVector & | dolly_vector | ) |
bool ON_Viewport::DollyFrustum | ( | double | dolly_distance | ) |
Moves frustum's clipping planes.
|
overridevirtual |
Dumps debugging text description to a text log.
dump_target | [in] text log |
This overrides the virtual ON_Object::Dump() function.
Reimplemented from ON_Object.
bool ON_Viewport::Extents | ( | double | half_view_angle, |
const ON_BoundingBox & | world_bbox | ||
) |
bool ON_Viewport::Extents | ( | double | half_view_angle, |
const ON_3dPoint & | center, | ||
double | radius | ||
) |
double ON_Viewport::FrustumBottom | ( | ) | const |
ON_3dPoint ON_Viewport::FrustumCenterPoint | ( | double | target_distance | ) | const |
Return a point on the central axis of the view frustum. This point is a good choice for a general purpose target point.
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. |
double ON_Viewport::FrustumFar | ( | ) | const |
double ON_Viewport::FrustumHeight | ( | ) | const |
bool ON_Viewport::FrustumIsLeftRightSymmetric | ( | ) | const |
bool ON_Viewport::FrustumIsTopBottomSymmetric | ( | ) | const |
double ON_Viewport::FrustumLeft | ( | ) | const |
double ON_Viewport::FrustumMaximumDiameter | ( | ) | const |
double ON_Viewport::FrustumMinimumDiameter | ( | ) | const |
double ON_Viewport::FrustumNear | ( | ) | const |
double ON_Viewport::FrustumRight | ( | ) | const |
double ON_Viewport::FrustumTop | ( | ) | const |
double ON_Viewport::FrustumWidth | ( | ) | const |
|
overridevirtual |
virtual ON_Geometry GetBBox override
Reimplemented from ON_Geometry.
bool ON_Viewport::GetBoundingBoxDepth | ( | ON_BoundingBox | bbox, |
double * | near_dist, | ||
double * | far_dist, | ||
bool | bGrowNearFar = false |
||
) | const |
Get near and far clipping distances of a bounding box.
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. |
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 infinte view region with the bounding box and returns the near and far distances of the projection.
int ON_Viewport::GetBoundingBoxDepth | ( | ON_BoundingBox | bbox, |
const ON_Xform * | bbox_xform, | ||
double * | near_dist, | ||
double * | far_dist, | ||
bool | bGrowNearFar | ||
) | const |
Get near and far clipping distances of a bounding box.
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. |
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 infinte view region with the bounding box and returns the near and far distances of the projection.
bool ON_Viewport::GetBoundingBoxProjectionExtents | ( | ON_BoundingBox | bbox, |
ON_Interval & | x_extents, | ||
ON_Interval & | y_extents | ||
) | const |
Get the normalized extents of the smallest rectangle that contains the intersection of bbox and the view's frustum.
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. |
This function takes the viewport's near and far settings into account. Set them to something appropriate before calling this function.
bool ON_Viewport::GetCamera35mmLenseLength | ( | double * | lens_length | ) | const |
Same as GetCamera35mmLensLength() with "lens" misspelled.
bool ON_Viewport::GetCamera35mmLensLength | ( | double * | lens_length | ) | const |
bool ON_Viewport::GetCameraAngle | ( | double * | half_diagonal_angle, |
double * | half_vertical_angle, | ||
double * | half_horizontal_angle | ||
) | const |
bool ON_Viewport::GetCameraAngle | ( | double * | half_smallest_angle | ) | const |
bool ON_Viewport::GetCameraExtents | ( | int | , |
int | , | ||
const double * | , | ||
ON_BoundingBox & | cambbox, | ||
int | bGrowBox = false |
||
) | const |
bool ON_Viewport::GetCameraExtents | ( | const ON_BoundingBox & | , |
ON_BoundingBox & | cambbox, | ||
int | bGrowBox = false |
||
) | const |
bool ON_Viewport::GetCameraExtents | ( | ON_3dPoint & | , |
double | , | ||
ON_BoundingBox & | cambox, | ||
int | bGrowBox = false |
||
) | const |
bool ON_Viewport::GetCameraFrame | ( | double * | , |
double * | , | ||
double * | , | ||
double * | |||
) | const |
returns true if current camera orientation is valid
bool ON_Viewport::GetClipCoordDepthBiasXform | ( | double | relative_depth_bias, |
ON_Xform & | clip_bias | ||
) | const |
Calculate a transformation to apply to clipping coordinates to bias their depth.
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). |
True if the function worked. False if the frustum settings are not valild, in which cate the identity matrix is returned.
The inverse of the transformations returned by GetClipCoordDepthBiasXform(+r,...) is the transformation returned by GetClipCoordDepthBiasXform(-r,...).
bool ON_Viewport::GetCoordinateSprite | ( | int | , |
int | , | ||
int | , | ||
int | [3], | ||
double | [3][2] | ||
) | const |
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 |
bool ON_Viewport::GetFarPlane | ( | ON_Plane & | far_plane | ) | const |
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.
bool ON_Viewport::GetFarPlaneEquation | ( | ON_PlaneEquation & | far_plane_equation | ) | const |
bool ON_Viewport::GetFarRect | ( | ON_3dPoint & | left_bottom, |
ON_3dPoint & | right_bottom, | ||
ON_3dPoint & | left_top, | ||
ON_3dPoint & | right_top | ||
) | const |
Get corners of far clipping plane rectangle.
left_bottom | [out] |
right_bottom | [out] |
left_top | [out] |
right_top | [out] |
bool ON_Viewport::GetFrustum | ( | double * | left, |
double * | right, | ||
double * | bottom, | ||
double * | top, | ||
double * | near_dist = nullptr , |
||
double * | far_dist = nullptr |
||
) | const |
bool ON_Viewport::GetFrustumAspect | ( | double & | ) | const |
Returns frustum's width/height.
bool ON_Viewport::GetFrustumBottomPlane | ( | ON_Plane & | bottom_plane | ) | const |
Get bottom world frustum clipping plane.
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. |
bool ON_Viewport::GetFrustumBottomPlaneEquation | ( | ON_PlaneEquation & | bottom_plane_equation | ) | const |
bool ON_Viewport::GetFrustumCenter | ( | double * | ) | const |
Returns world coordinates of frustum's center.
bool ON_Viewport::GetFrustumLeftPlane | ( | ON_Plane & | left_plane | ) | const |
Get left world frustum clipping plane.
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. |
bool ON_Viewport::GetFrustumLeftPlaneEquation | ( | ON_PlaneEquation & | left_plane_equation | ) | const |
bool ON_Viewport::GetFrustumLine | ( | double | screenx, |
double | screeny, | ||
ON_Line & | world_line | ||
) | const |
Get the world coordinate line in the view frustum that projects to a point on the screen.
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. |
bool ON_Viewport::GetFrustumRightPlane | ( | ON_Plane & | right_plane | ) | const |
Get right world frustum clipping plane.
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. |
bool ON_Viewport::GetFrustumRightPlaneEquation | ( | ON_PlaneEquation & | right_plane_equation | ) | const |
bool ON_Viewport::GetFrustumTopPlane | ( | ON_Plane & | top_plane | ) | const |
Get top world frustum clipping plane.
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. |
bool ON_Viewport::GetFrustumTopPlaneEquation | ( | ON_PlaneEquation & | top_plane_equation | ) | const |
bool ON_Viewport::GetNearPlane | ( | ON_Plane & | near_plane | ) | const |
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.
bool ON_Viewport::GetNearPlaneEquation | ( | ON_PlaneEquation & | near_plane_equation | ) | const |
bool ON_Viewport::GetNearRect | ( | ON_3dPoint & | left_bottom, |
ON_3dPoint & | right_bottom, | ||
ON_3dPoint & | left_top, | ||
ON_3dPoint & | right_top | ||
) | const |
Get corners of near clipping plane rectangle.
left_bottom | [out] |
right_bottom | [out] |
left_top | [out] |
right_top | [out] |
|
static |
Get suggested values for setting the perspective minimum near distance and minimum near/far ratio.
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(). |
bool ON_Viewport::GetPointDepth | ( | ON_3dPoint | point, |
double * | near_dist, | ||
double * | far_dist, | ||
bool | bGrowNearFar = false |
||
) | const |
Get near and far clipping distances of a point
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. |
bool ON_Viewport::GetPointDepth | ( | ON_3dPoint | point, |
double * | view_plane_depth | ||
) | const |
Get the view plane depth of a point
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. |
bool ON_Viewport::GetScreenPort | ( | int * | left, |
int * | right, | ||
int * | port_bottom, | ||
int * | port_top, | ||
int * | port_near = nullptr , |
||
int * | port_far = nullptr |
||
) | const |
bool ON_Viewport::GetScreenPortAspect | ( | double & | ) | const |
bool ON_Viewport::GetSphereDepth | ( | ON_Sphere | sphere, |
double * | near_dist, | ||
double * | far_dist, | ||
bool | bGrowNearFar = false |
||
) | const |
Get near and far clipping distances of a bounding sphere.
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. |
bool ON_Viewport::GetViewPlane | ( | double | view_plane_depth, |
ON_Plane & | view_plane | ||
) | const |
Get the plane that is a specified distance from the camera. This plane is parallel to the frustum's near and far planes.
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. |
bool ON_Viewport::GetViewPlaneEquation | ( | double | view_plane_depth, |
ON_PlaneEquation & | view_plane_equation | ||
) | const |
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 |
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.
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] |
void ON_Viewport::GetViewScale | ( | double * | x, |
double * | y | ||
) | const |
bool ON_Viewport::GetWorldToScreenScale | ( | ON_3dPoint | world_point, |
double * | pixels_per_unit | ||
) | const |
display tools
Get the number of horizontal pixels per world unit at the location in screen space where world_point would be rendered.
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. |
bool ON_Viewport::GetWorldToScreenScale | ( | double | frustum_depth, |
double * | pixels_per_unit | ||
) | const |
Get the number of horizontal pixels per world unit at the location in screen space where world_point would be rendered.
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. |
bool ON_Viewport::GetXform | ( | ON::coordinate_system | srcCS, |
ON::coordinate_system | destCS, | ||
ON_Xform & | matrix | ||
) | const |
void ON_Viewport::Initialize | ( | ) |
int ON_Viewport::InViewFrustum | ( | ON_3dPoint | P | ) | const |
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.
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. |
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.
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.
int ON_Viewport::InViewFrustum | ( | const ON_BoundingBox & | bbox | ) | const |
int ON_Viewport::InViewFrustum | ( | int | count, |
const ON_3fPoint * | p | ||
) | const |
int ON_Viewport::InViewFrustum | ( | int | count, |
const ON_3dPoint * | p | ||
) | const |
int ON_Viewport::InViewFrustum | ( | int | count, |
const ON_4dPoint * | p | ||
) | const |
int ON_Viewport::InViewFrustum | ( | bool | bInfiniteFrustum, |
const ON_BoundingBox & | bbox, | ||
const ON_Xform * | bbox_xform | ||
) | const |
Determine if some portion of the transformed bounding box is inside the view frustum.
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. |
bool ON_Viewport::IsCameraFrameWorldPlan | ( | int * | , |
int * | , | ||
int * | |||
) |
bool ON_Viewport::IsParallelProjection | ( | ) | const |
bool ON_Viewport::IsPerspectiveProjection | ( | ) | const |
bool ON_Viewport::IsTwoPointPerspectiveProjection | ( | ) | const |
|
overridevirtual |
Tests an object to see if its data members are correctly initialized.
text_log | [in] if the object is not valid and text_log is not nullptr, then a brief englis description of the reason the object is not valid is appened to the log. The information appended to text_log is suitable for |
low | level debugging purposes by programmers and is not intended to be useful as a high level user interface tool. |
Reimplemented from ON_Geometry.
bool ON_Viewport::IsValidCamera | ( | ) | const |
bool ON_Viewport::IsValidCameraFrame | ( | ) | const |
|
static |
|
static |
bool ON_Viewport::IsValidFrustum | ( | ) | const |
|
default |
double ON_Viewport::PerspectiveMinNearDist | ( | ) | const |
Expert user function to get the minimum value of near when perspective projections are begin used.
This is a runtime setting and is not saved in 3dm files.
double ON_Viewport::PerspectiveMinNearOverFar | ( | ) | const |
Expert user function to get the minimum runtime value of near/far when perspective projections are begin used.
This is a runtime setting and is not saved in 3dm files.
ON::view_projection ON_Viewport::Projection | ( | ) | const |
|
overridevirtual |
Reads ON_Viewport defintion from a binary archive.
binary_archive | [in] open binary archive |
true if successful.
This overrides the virtual ON_Object::Read() function.
Reimplemented from ON_Object.
int ON_Viewport::ScreenPortHeight | ( | ) | const |
ON_2iSize ON_Viewport::ScreenPortSize | ( | ) | const |
int ON_Viewport::ScreenPortWidth | ( | ) | const |
bool ON_Viewport::SetCamera | ( | const ON_Viewport & | source_viewport, |
bool | bBreakLocks | ||
) |
Copy camera location, up, direction and frame from source_viewport.
source_viewport | [in] camera location to copy |
bBreakLocks | [in] If true, any locked frustum settings will be unlocked. |
bool ON_Viewport::SetCamera35mmLenseLength | ( | double | lens_length | ) |
Same as SetCamera35mmLensLength() with "lens" misspelled.
bool ON_Viewport::SetCamera35mmLensLength | ( | double | lens_length | ) |
bool ON_Viewport::SetCameraAngle | ( | double | half_smallest_angle | ) |
bool ON_Viewport::SetCameraDirection | ( | const ON_3dVector & | ) |
void ON_Viewport::SetCameraDirectionLock | ( | bool | bLockCameraDirection | ) |
bool ON_Viewport::SetCameraLocation | ( | const ON_3dPoint & | ) |
void ON_Viewport::SetCameraLocationLock | ( | bool | bLockCameraLocation | ) |
bool ON_Viewport::SetCameraUp | ( | const ON_3dVector & | ) |
void ON_Viewport::SetCameraUpLock | ( | bool | bLockCameraUp | ) |
bool ON_Viewport::SetFrustum | ( | double | left, |
double | right, | ||
double | bottom, | ||
double | top, | ||
double | near_dist, | ||
double | far_dist | ||
) |
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.
bool ON_Viewport::SetFrustum | ( | const ON_Viewport & | source_viewport, |
bool | bBreakLocks | ||
) |
Copy frustum information from source_viewport.
source_viewport | [in] |
bBreakLocks | [in] If true, any locked frustum settings will be unlocked. |
bool ON_Viewport::SetFrustumAspect | ( | double | ) |
void ON_Viewport::SetFrustumLeftRightSymmetry | ( | bool | bForceLeftRightSymmetry | ) |
bool ON_Viewport::SetFrustumNearFar | ( | const double * | bboxmin, |
const double * | bboxmax | ||
) |
bool ON_Viewport::SetFrustumNearFar | ( | const double * | center, |
double | radius | ||
) |
bool ON_Viewport::SetFrustumNearFar | ( | double | near_dist, |
double | far_dist | ||
) |
bool ON_Viewport::SetFrustumNearFar | ( | double | near_dist, |
double | far_dist, | ||
double | min_near_dist, | ||
double | min_near_over_far, | ||
double | target_dist | ||
) |
Set near and far clipping distance subject to constraints.
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. |
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 | ||
) |
void ON_Viewport::SetFrustumTopBottomSymmetry | ( | bool | bForceTopBottomSymmetry | ) |
void ON_Viewport::SetPerspectiveClippingPlaneConstraints | ( | unsigned int | depth_buffer_bit_depth | ) |
Set suggested the perspective minimum near distance and minimum near/far ratio to the suggested values returned by GetPerspectiveClippingPlaneConstraints().
depth_buffer_bit_depth | [in] typically 32, 24, 16 or 8, but any positive value can be passed in. |
void ON_Viewport::SetPerspectiveMinNearDist | ( | double | min_near_dist | ) |
Expert user function to control the minimum value of near when perspective projections are begin used.
min_near_dist | [in] |
This is a runtime setting and is not saved in 3dm files.
void ON_Viewport::SetPerspectiveMinNearOverFar | ( | double | min_near_over_far | ) |
Expert user function to control the minimum ratio of near/far when perspective projections are begin used.
min_near_over_far | [in] |
This is a runtime setting and is not saved in 3dm files.
bool ON_Viewport::SetProjection | ( | ON::view_projection | projection | ) |
Unconditionally set the projection.
projection | [in] |
bool ON_Viewport::SetScreenPort | ( | int | port_left, |
int | port_right, | ||
int | port_bottom, | ||
int | port_top, | ||
int | port_near = 0 , |
||
int | port_far = 0 |
||
) |
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.
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] |
bool ON_Viewport::SetTargetPoint | ( | ON_3dPoint | target_point | ) |
Set the target point.
target_point | [in] When in doubt, the point returned by FrustumCenterPoint(ON_UNSET_VALUE) is a good choice. |
The default constructor sets this point on ON_3dPoint::UnsetPoint. You must explicitly call one SetTargetPoint() functions to set the target point.
bool ON_Viewport::SetViewportId | ( | const ON_UUID & | viewport_id | ) |
Sets the viewport's id to the value used to uniquely identify this viewport.
viewport_id | [in] |
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.
bool ON_Viewport::SetViewScale | ( | double | x, |
double | y | ||
) |
Apply scaling factors to parallel projection clipping coordinates by setting the m_clip_mod transformation.
x | [in] x > 0 |
y | [in] y > 0 |
double ON_Viewport::TargetDistance | ( | bool | bUseFrustumCenterFallback | ) | const |
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.
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. |
ON_3dPoint ON_Viewport::TargetPoint | ( | ) | const |
The default constructor sets this point on ON_3dPoint::UnsetPoint. You must explicitly call one SetTargetPoint() functions to set the target point.
|
overridevirtual |
Transforms the view camera location, direction, and up.
xform | [in] transformation to apply to camera. |
table true Valid camera was transformed. false Invalid camera, frustum, or transformation.
This overrides the virtual ON_Geometry::Transform() function.
Reimplemented from ON_Geometry.
void ON_Viewport::UnlockCamera | ( | ) |
void ON_Viewport::UnlockFrustumSymmetry | ( | ) |
ON_UUID ON_Viewport::ViewportId | ( | void | ) | const |
ON_SHA1_Hash ON_Viewport::ViewProjectionContentHash | ( | ) | const |
|
overridevirtual |
Writes ON_Viewport defintion from a binary archive.
binary_archive | [in] open binary archive |
true if successful.
This overrides the virtual ON_Object::Write() function.
Reimplemented from ON_Object.
bool ON_Viewport::ZoomToScreenRect | ( | int | screen_x0, |
int | screen_y0, | ||
int | screen_x1, | ||
int | screen_y1 | ||
) |
ZoomToScreenRect() may change camera and frustum settings.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
A Z-up perspective projection looking down on the origin of the XY plane. up = ON_3dVector::Zaxis, dir = ON_3dVector:Default3dCameraDirection
|
static |
A Y-up parallel projection looking at the origin of the XYplane. up = ON_3dVector::Yaxis, dir = -ON_3dVector::Zaxis
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
The camera frame vectors are properly initialized by SetCamera()
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Camera Settings: ///////////////////////////////////////////////.
perspective or parallel projection
|
protected |