opennurbs_pointgeometry.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(OPENNURBS_POINT_GEOMETRY_INC_)
18 #define OPENNURBS_POINT_GEOMETRY_INC_
19 
20 // NOTE: ON_3dPoint is much more efficient than ON_Point.
21 // Use ON_Point when you need a polymorphic 3d point
22 // that is derived from ON_Geometry or ON_Object.
23 
24 class ON_CLASS ON_Point : public ON_Geometry
25 {
26 public:
28 
29  ON_Point();
30  ON_Point(const ON_Point&);
31  ON_Point(const ON_3dPoint&);
32  ON_Point(double,double,double);
33  ~ON_Point();
34  ON_Point& operator=(const ON_Point&);
35  ON_Point& operator=(const ON_3dPoint&);
36 
37  operator double*();
38  operator const double*() const;
39  operator ON_3dPoint*();
40  operator const ON_3dPoint*() const;
41  operator ON_3dPoint&();
42  operator const ON_3dPoint&() const;
43 
44  /////////////////////////////////////////////////////////////////
45  //
46  // ON_Object overrides
47  //
48 
49  bool IsValid( class ON_TextLog* text_log = nullptr ) const override;
50 
51  void Dump( ON_TextLog& ) const override; // for debugging
52 
53  bool Write(
54  ON_BinaryArchive& // serialize definition to binary archive
55  ) const override;
56 
57  bool Read(
58  ON_BinaryArchive& // restore definition from binary archive
59  ) override;
60 
61  ON::object_type ObjectType() const override;
62 
63  /////////////////////////////////////////////////////////////////
64  //
65  // ON_Geometry overrides
66  //
67 
68  int Dimension() const override;
69 
70  // virtual ON_Geometry GetBBox override
71  bool GetBBox( double* boxmin, double* boxmax, bool bGrowBox = false ) const override;
72 
73  bool Transform(
74  const ON_Xform&
75  ) override;
76 
77  // virtual ON_Geometry::IsDeformable() override
78  bool IsDeformable() const override;
79 
80  // virtual ON_Geometry::MakeDeformable() override
81  bool MakeDeformable() override;
82 
83  bool SwapCoordinates(
84  int, int // indices of coords to swap
85  ) override;
86 
87 
88 private:
89  ON_OBJECT_DECLARE(ON_Point);
90 };
91 
92 #endif
virtual bool Transform(const ON_Xform &xform)
Transforms the object.
ON_3dPoint point
Definition: opennurbs_pointgeometry.h:27
virtual int Dimension() const
Dimension of the object.
virtual bool GetBBox(double *boxmin, double *boxmax, bool bGrowBox=false) const
This is the virtual function that actually calculates axis aligned bounding boxes.
virtual bool MakeDeformable()
If possible, converts the object into a form that can be accuratly modified with "squishy" transforma...
virtual bool SwapCoordinates(int i, int j)
Swaps object coordinate values with indices i and j.
virtual ON::object_type ObjectType() const
Useful for switch statements that need to differentiate between basic object types like points...
Base class for all geometry classes that must provide runtime class id. Provides interface for common...
Definition: opennurbs_geometry.h:37
Definition: opennurbs_xform.h:28
virtual void Dump(ON_TextLog &) const
Creates a text dump of the object.
virtual bool IsDeformable() const
ON_Geometry & operator=(const ON_Geometry &)=default
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
virtual bool Read(ON_BinaryArchive &binary_archive)
Low level archive writing tool used by ON_BinaryArchive::ReadObject().
Definition: opennurbs_point.h:460
Definition: opennurbs_pointgeometry.h:24
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().