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

#include <opennurbs_geometry.h>

Inheritance diagram for ON_Geometry:
ON_Object CRhinoGroupGeometry CRhinoWidgetGeometry ON_Annotation ON_Brep ON_BrepLoop ON_Curve ON_DetailView ON_Hatch ON_InstanceRef ON_Light ON_Mesh ON_MeshComponentRef ON_MorphControl ON_NurbsCage ON_Point ON_PointCloud ON_PointGrid ON_SubD ON_SubDComponentRef ON_Surface ON_TextContent ON_TextDot ON_Viewport

Public Member Functions

 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 int Dimension () const
 
virtual bool EvaluatePoint (const class ON_ObjRef &objref, ON_3dPoint &P) const
 
virtual bool GetBBox (double *boxmin, double *boxmax, bool bGrowBox=false) 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
 
bool IsValid (class ON_TextLog *text_log=nullptr) const override
 
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
 
virtual bool Transform (const ON_Xform &xform)
 
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)
 
virtual void Dump (ON_TextLog &) const
 
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 bool Read (ON_BinaryArchive &binary_archive)
 
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
 
virtual bool Write (ON_BinaryArchive &binary_archive) const
 

Static Public Attributes

const static 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
}
 

Detailed Description

Description: Base class for all geometry classes that must provide runtime class id. Provides interface for common geometric operations like finding bounding boxes and transforming.

Constructor & Destructor Documentation

◆ ON_Geometry() [1/2]

ON_Geometry::ON_Geometry ( )
default

◆ ~ON_Geometry()

ON_Geometry::~ON_Geometry ( )
default

◆ ON_Geometry() [2/2]

ON_Geometry::ON_Geometry ( const ON_Geometry )
default

Member Function Documentation

◆ BoundingBox()

ON_BoundingBox ON_Geometry::BoundingBox ( ) const

Description: Get object's 3d axis aligned bounding box. Returns: 3d bounding box. Remarks: Uses virtual GetBBox() function to calculate the result.

◆ BrepForm()

virtual class ON_Brep* ON_Geometry::BrepForm ( class ON_Brep brep = nullptr) const
virtual

Description: If possible, BrepForm() creates a brep form of the ON_Geometry. Parameters: brep - [in] if not nullptr, brep is used to store the brep form of the geometry. Result: Returns a pointer to on ON_Brep or nullptr. If the brep parameter is not nullptr, then brep is returned if the geometry has a brep form and nullptr is returned if the geometry does not have a brep form. Remarks: The caller is responsible for managing the brep memory. See Also ON_Geometry::HasBrepForm

Reimplemented in ON_SubD, ON_Brep, ON_MorphControl, ON_Surface, ON_Extrusion, and ON_Hatch.

◆ ClearBoundingBox()

virtual void ON_Geometry::ClearBoundingBox ( )
virtual

Description: 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.

Remarks: Generally, ClearBoundingBox() overrides simply invalidate a cached bounding box and then wait for a call to GetBBox() before recomputing the bounding box.

The default implementation does nothing.

Reimplemented in ON_SubDEdgeChainCurve, ON_SubD, ON_Brep, ON_MorphControl, ON_BrepFace, ON_TextContent, ON_SumSurface, and ON_RevSurface.

◆ ComponentIndex()

virtual ON_COMPONENT_INDEX ON_Geometry::ComponentIndex ( ) const
virtual

Description: 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. Returns: This object's component index. If this object is not a sub-piece of a larger geometric entity, then the returned index has m_type = ON_COMPONENT_INDEX::invalid_type and m_index = -1.

Reimplemented in ON_SubDComponentRef, ON_MeshComponentRef, ON_SubD, ON_BrepFace, ON_BrepLoop, ON_BrepTrim, CRhinoPolyEdgeSegment, ON_BrepEdge, and ON_BrepVertex.

◆ Dimension()

virtual int ON_Geometry::Dimension ( ) const
virtual

Description: Dimension of the object. Returns: Dimension of the object. Remarks: The dimension is typically three. For parameter space trimming curves the dimension is two. In rare cases the dimension can be one or greater than three.

Reimplemented in CRhinoWidgetGeometry, ON_SubDEdgeChainCurve, ON_SubDComponentRef, ON_MeshComponentRef, ON_SubD, ON_Mesh, ON_Brep, ON_MorphControl, ON_NurbsCage, ON_TextDot, ON_BrepLoop, ON_InstanceRef, ON_Hatch, ON_TextContent, ON_NurbsSurface, ON_CurveProxy, ON_NurbsCurve, ON_Viewport, ON_SumSurface, ON_ArcCurve, ON_RevSurface, ON_PolyCurve, ON_CurveOnSurface, ON_PolylineCurve, ON_SurfaceProxy, ON_Leader, ON_PointCloud, ON_Extrusion, ON_LineCurve, ON_PlaneSurface, ON_Point, ON_PointGrid, ON_Text, ON_Light, ON_DetailView, and CRhinoGroupGeometry.

◆ EvaluatePoint()

virtual bool ON_Geometry::EvaluatePoint ( const class ON_ObjRef objref,
ON_3dPoint P 
) const
virtual

Description: Evaluate the location of a point from the object reference. Parameters: objref - [in] point - [out] If the evaluation cannot be performed, ON_3dPoint::UnsetPoint is returned. Returns: True if successful.

Reimplemented in ON_SubD, ON_Mesh, ON_Brep, ON_PolyCurve, ON_Curve, and ON_Surface.

◆ GetBBox()

virtual bool ON_Geometry::GetBBox ( double *  boxmin,
double *  boxmax,
bool  bGrowBox = false 
) const
virtual

Description: This is the virtual function that actually calculates axis aligned bounding boxes. Parameters: boxmin - [in/out] array of Dimension() doubles boxmax - [in/out] array of Dimension() doubles bGrowBox - [in] (default=false) If true, then the union of the input bbox and the object's bounding box is returned in bbox.
If false, the object's bounding box is returned in bbox. Returns: true if object has bounding box and calculation was successful

Reimplemented in ON_SubDEdgeChainCurve, ON_SubDComponentRef, ON_MeshComponentRef, ON_SubD, ON_Mesh, ON_Brep, ON_MorphControl, ON_NurbsCage, ON_BrepFace, ON_Centermark, ON_TextDot, ON_DimOrdinate, ON_BrepLoop, ON_DimRadial, ON_InstanceRef, ON_Hatch, ON_DimAngular, ON_DimLinear, ON_OffsetSurface, ON_TextContent, ON_NurbsSurface, ON_CurveProxy, ON_NurbsCurve, ON_Viewport, CRhinoWidgetGeometry, ON_SumSurface, ON_ArcCurve, ON_RevSurface, ON_PolyCurve, ON_Text, ON_CurveOnSurface, ON_PolylineCurve, ON_SurfaceProxy, ON_Leader, ON_PointCloud, ON_Extrusion, ON_LineCurve, ON_PlaneSurface, ON_Point, ON_PointGrid, ON_Light, ON_DetailView, and CRhinoGroupGeometry.

◆ GetBoundingBox() [1/2]

bool ON_Geometry::GetBoundingBox ( ON_3dPoint bbox_min,
ON_3dPoint bbox_max,
bool  bGrowBox = false 
) const

Description: Get corners of object's 3d axis aligned bounding box or the union of the input box with the object's bounding box. Parameters: bbox_min - [in/out] minimum corner of the 3d bounding box bbox_max - [in/out] maximum corner of the 3d bounding box bGrowBox - [in] (default=false) If true, then the union of the input bbox and the object's bounding box is returned. If false, the object's bounding box is returned. Returns: true if successful.

◆ GetBoundingBox() [2/2]

bool ON_Geometry::GetBoundingBox ( ON_BoundingBox bbox,
bool  bGrowBox = false 
) const

Description: Get object's 3d axis aligned bounding box or the union of the input box with the object's bounding box. Parameters: bbox - [in/out] 3d axis aligned bounding box bGrowBox - [in] (default=false) If true, then the union of the input bbox and the object's bounding box is returned in bbox.
If false, the object's bounding box is returned in bbox. Returns: true if object has bounding box and calculation was successful. Remarks: Uses virtual GetBBox() function to calculate the result.

◆ GetTightBoundingBox()

virtual bool ON_Geometry::GetTightBoundingBox ( class ON_BoundingBox tight_bbox,
bool  bGrowBox = false,
const class ON_Xform xform = nullptr 
) const
virtual

Description: Get tight bounding box. Parameters: tight_bbox - [in/out] tight bounding box bGrowBox -[in] (default=false)
If true and the input tight_bbox is valid, then returned tight_bbox is the union of the input tight_bbox and the curve's tight bounding box. xform -[in] (default=nullptr) If not nullptr, the tight bounding box of the transformed geometry is calculated. The geometry is not modified. Returns: True if a valid tight_bbox is returned. Remarks: In general, GetTightBoundingBox is slower that BoundingBox, especially when xform is not null.

Reimplemented in ON_SubDEdgeChainCurve, ON_SubD, ON_Mesh, ON_Brep, ON_MorphControl, ON_NurbsCage, ON_Hatch, ON_Curve, ON_ArcCurve, ON_PolyCurve, ON_PolylineCurve, ON_PointCloud, ON_Extrusion, ON_LineCurve, ON_PointGrid, and ON_DetailView.

◆ HasBrepForm()

virtual bool ON_Geometry::HasBrepForm ( ) const
virtual

Description: 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. Remarks: The default implementation of ON_Geometry::BrepForm returns false. See Also ON_Geometry::BrepForm

Reimplemented in ON_SubD, ON_Brep, ON_MorphControl, and ON_Surface.

◆ IsDeformable()

virtual bool ON_Geometry::IsDeformable ( ) const
virtual

Returns: True if object can be accurately modified with "squishy" transformations like projections, shears, an non-uniform scaling. See Also: ON_Geometry::MakeDeformable();

Reimplemented in ON_SubDEdgeChainCurve, ON_SubD, ON_Mesh, ON_Brep, ON_NurbsCage, ON_TextDot, ON_InstanceRef, ON_NurbsSurface, ON_NurbsCurve, ON_SumSurface, ON_PolyCurve, ON_PolylineCurve, ON_PointCloud, ON_LineCurve, ON_PointGrid, and ON_Point.

◆ IsMorphable()

virtual bool ON_Geometry::IsMorphable ( ) const
virtual

◆ IsValid()

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

Description: Tests an object to see if its data members are correctly initialized. Parameters: 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. Returns: @untitled table true object is valid false object is invalid, uninitialized, etc.

Reimplemented from ON_Object.

Reimplemented in CRhinoWidgetGeometry, CRhinoGroupGeometry, ON_SubDEdgeChainCurve, ON_SubDComponentRef, ON_MeshComponentRef, ON_SubD, ON_Mesh, ON_MorphControl, ON_NurbsCage, ON_InstanceRef, ON_Hatch, ON_NurbsSurface, ON_NurbsCurve, ON_SumSurface, ON_Viewport, ON_RevSurface, ON_PolyCurve, ON_TextContent, ON_SurfaceProxy, ON_PointCloud, ON_LineCurve, ON_Leader, ON_PolylineCurve, ON_PlaneSurface, ON_PointGrid, ON_Point, ON_Light, and ON_Text.

◆ MakeDeformable()

virtual bool ON_Geometry::MakeDeformable ( )
virtual

Description: If possible, converts the object into a form that can be accurately modified with "squishy" transformations like projections, shears, an non-uniform scaling. Returns: False if object cannot be converted to a deformable object. True if object was already deformable or was converted into a deformable object. See Also: ON_Geometry::IsDeformable();

Reimplemented in ON_SubD, ON_Mesh, ON_Brep, ON_NurbsCage, ON_TextDot, ON_InstanceRef, ON_NurbsSurface, ON_NurbsCurve, ON_SumSurface, ON_PolyCurve, ON_PolylineCurve, ON_PointCloud, ON_LineCurve, ON_PointGrid, and ON_Point.

◆ Morph()

virtual bool ON_Geometry::Morph ( const class ON_SpaceMorph morph)
virtual

Description: Apply the space morph to this geometry. Parameters: morph - [in] Returns: True is successful. If false is returned, the object may be damaged and should be discarded. See Also: ON_Geometry::IsMorphable

Reimplemented in ON_SubDEdgeChainCurve.

◆ operator=()

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

◆ Rotate() [1/2]

bool ON_Geometry::Rotate ( double  rotation_angle,
const ON_3dVector rotation_axis,
const ON_3dPoint rotation_center 
)

Description: Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule). Parameters: rotation_angle - [in] angle of rotation in radians rotation_axis - [in] direction of the axis of rotation rotation_center - [in] point on the axis of rotation Returns: true if object successfully rotated Remarks: Uses virtual Transform() function to calculate the result.

◆ Rotate() [2/2]

bool ON_Geometry::Rotate ( double  sin_angle,
double  cos_angle,
const ON_3dVector rotation_axis,
const ON_3dPoint rotation_center 
)

Description: Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule). Parameters: sin_angle - [in] sine of rotation angle cos_angle - [in] sine of rotation angle rotation_axis - [in] direction of the axis of rotation rotation_center - [in] point on the axis of rotation Returns: true if object successfully rotated Remarks: Uses virtual Transform() function to calculate the result.

◆ Scale()

bool ON_Geometry::Scale ( double  scale_factor)

Description: Scales the object by the specified facotor. The scale is centered at the origin. Parameters: scale_factor - [in] scale factor Returns: true if object successfully scaled Remarks: Uses virtual Transform() function to calculate the result.

◆ SwapCoordinates()

virtual bool ON_Geometry::SwapCoordinates ( int  i,
int  j 
)
virtual

Description: Swaps object coordinate values with indices i and j.

Parameters: i - [in] coordinate index j - [in] coordinate index

Remarks: The default implementation uses the virtual Transform() function to calculate the result. If you are creating an object where Transform() is slow, coordinate swapping will be frequently used, and coordinate swapping can be quickly accomplished, then override this function.

Example:

     ON_Point point(7,8,9);
     point.SwapCoordinates(0,2);
     ///< point = (9,8,7) 

Reimplemented in ON_Mesh, ON_Brep, ON_NurbsSurface, ON_PolyCurve, ON_PointCloud, ON_CurveOnSurface, ON_LineCurve, ON_PointGrid, ON_Point, ON_SubD, ON_NurbsCurve, and ON_PolylineCurve.

◆ TightBoundingBox()

const ON_BoundingBox ON_Geometry::TightBoundingBox ( ) const

◆ Transform()

virtual bool ON_Geometry::Transform ( const ON_Xform xform)
virtual

Description: Transforms the object.

Parameters: xform - [in] transformation to apply to object. If xform.IsSimilarity() is zero, then you may want to call MakeSquishy() before calling Transform.

Remarks: When overriding this function, be sure to include a call to ON_Object::TransformUserData() which takes care of transforming any ON_UserData that may be attached to the object.

See Also: ON_Geometry::IsDeformable();

Remarks: Classes derived from ON_Geometry should call ON_Geometry::Transform() to handle user data transformations and then transform their definition.

Reimplemented in ON_SubDEdgeChainCurve, ON_MeshComponentRef, ON_SubD, ON_MorphControl, ON_NurbsCage, ON_Centermark, ON_TextDot, ON_DimOrdinate, ON_BrepLoop, ON_DimRadial, ON_InstanceRef, ON_DimAngular, ON_DimLinear, ON_TextContent, ON_NurbsCurve, ON_Curve, ON_PolylineCurve, CRhinoWidgetGeometry, ON_Text, ON_Leader, ON_Extrusion, ON_DetailView, CRhinoGroupGeometry, ON_Mesh, ON_Brep, ON_Hatch, ON_NurbsSurface, ON_CurveProxy, ON_Viewport, ON_SumSurface, ON_ArcCurve, ON_RevSurface, ON_PolyCurve, ON_PointCloud, ON_CurveOnSurface, ON_SurfaceProxy, ON_LineCurve, ON_PlaneSurface, ON_PointGrid, ON_Light, and ON_Point.

◆ Translate()

bool ON_Geometry::Translate ( const ON_3dVector translation_vector)

Description: Translates the object along the specified vector. Parameters: translation_vector - [in] translation vector Returns: true if object successfully translated Remarks: Uses virtual Transform() function to calculate the result.

Member Data Documentation

◆ Unset

const static ON_Geometry ON_Geometry::Unset
static