Point Cloud Library (PCL) 1.13.0
opennurbs_pointgrid.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_GRID_INC_)
18#define OPENNURBS_POINT_GRID_INC_
19
20class ON_CLASS ON_PointGrid : public ON_Geometry
21{
22public:
26 int, // point count0 (>=1)
27 int // point count1 (>=1)
28 );
29
30 void Initialize(void); // zeros all fields
31
32 ON_BOOL32 Create(
33 int, // point count0 (>=1)
34 int // point count1 (>=1)
35 );
36
37 void Destroy();
38
39 virtual ~ON_PointGrid();
40 void EmergencyDestroy(); // call if memory used by point grid becomes invalid
41
43
44 // point_grid[i][j] returns GetPoint(i,j)
45 ON_3dPoint* operator[](int); // 0 <= index < PointCount(0)
46 const ON_3dPoint* operator[](int) const; // 0 <= index < PointCount(0)
47
48 /////////////////////////////////////////////////////////////////
49 // ON_Object overrides
50
51 /*
52 Description:
53 Tests an object to see if its data members are correctly
54 initialized.
55 Parameters:
56 text_log - [in] if the object is not valid and text_log
57 is not NULL, then a brief englis description of the
58 reason the object is not valid is appened to the log.
59 The information appended to text_log is suitable for
60 low-level debugging purposes by programmers and is
61 not intended to be useful as a high level user
62 interface tool.
63 Returns:
64 @untitled table
65 true object is valid
66 false object is invalid, uninitialized, etc.
67 Remarks:
68 Overrides virtual ON_Object::IsValid
69 */
70 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
71
72 void Dump( ON_TextLog& ) const; // for debugging
73
74 ON_BOOL32 Write(
75 ON_BinaryArchive& // open binary file
76 ) const;
77
78 ON_BOOL32 Read(
79 ON_BinaryArchive& // open binary file
80 );
81
82 ON::object_type ObjectType() const;
83
84 /////////////////////////////////////////////////////////////////
85 // ON_Geometry overrides
86
87 int Dimension() const;
88
89 ON_BOOL32 GetBBox( // returns true if successful
90 double*, // minimum
91 double*, // maximum
92 ON_BOOL32 = false // true means grow box
93 ) const;
94
95 /*
96 Description:
97 Get tight bounding box of the point grid.
98 Parameters:
99 tight_bbox - [in/out] tight bounding box
100 bGrowBox -[in] (default=false)
101 If true and the input tight_bbox is valid, then returned
102 tight_bbox is the union of the input tight_bbox and the
103 tight bounding box of the point grid.
104 xform -[in] (default=NULL)
105 If not NULL, the tight bounding box of the transformed
106 point grid is calculated. The point grid is not modified.
107 Returns:
108 True if the returned tight_bbox is set to a valid
109 bounding box.
110 */
112 ON_BoundingBox& tight_bbox,
113 int bGrowBox = false,
114 const ON_Xform* xform = 0
115 ) const;
116
117 ON_BOOL32 Transform(
118 const ON_Xform&
119 );
120
121 // virtual ON_Geometry::IsDeformable() override
122 bool IsDeformable() const;
123
124 // virtual ON_Geometry::MakeDeformable() override
126
128 int, int // indices of coords to swap
129 );
130
131 /////////////////////////////////////////////////////////////////
132 // Interface
133
134 ON_BOOL32 IsClosed(
135 int // dir
136 ) const;
137
138 int PointCount( // number of points in grid direction
139 int // dir 0 = "s", 1 = "t"
140 ) const;
141
142 int PointCount( // total number of points in grid
143 void
144 ) const;
145
147 int, int // point index ( 0 <= i <= PointCount(0), 0 <= j <= PointCount(1)
148 );
149
151 int, int // point index ( 0 <= i <= PointCount(0), 0 <= j <= PointCount(1)
152 ) const;
153
154 double* PointArray();
155
156 const double* PointArray() const;
157
158 int PointArrayStride( // point stride in grid direction
159 int // dir 0 = "s", 1 = "t"
160 ) const;
161
162 ON_BOOL32 SetPoint( // set a single point
163 int, int, // point index ( 0 <= i <= PointCount(0), 0 <= j <= PointCount(1)
164 const ON_3dPoint& // value of point
165 );
166
167 ON_BOOL32 GetPoint( // get a single control vertex
168 int, int, // CV index ( 0 <= i <= CVCount(0), 0 <= j <= CVCount(1)
169 ON_3dPoint& // gets euclidean cv when NURBS is rational
170 ) const;
171
172 ON_BOOL32 Reverse( // reverse grid order
173 int // dir 0 = "s", 1 = "t"
174 );
175
176 ON_BOOL32 Transpose(); // transpose grid points
177
178 /////////////////////////////////////////////////////////////////
179 // Implementation
180protected:
181
182 int m_point_count[2]; // number of points (>=1)
183 int m_point_stride0; // >= m_point_count[1]
185 // point[i][j] = m_point[i*m_point_stride0+j]
186
187private:
188 static ON_3dPoint m_no_point; // prevent crashes when sizes are 0
189
190 ON_OBJECT_DECLARE(ON_PointGrid);
191};
192
193
194#endif
bool GetTightBoundingBox(ON_BoundingBox &tight_bbox, int bGrowBox=false, const ON_Xform *xform=0) const
ON::object_type ObjectType() const
ON_3dPointArray m_point
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
void EmergencyDestroy()
void Initialize(void)
ON_BOOL32 SwapCoordinates(int, int)
const double * PointArray() const
ON_BOOL32 SetPoint(int, int, const ON_3dPoint &)
ON_BOOL32 Read(ON_BinaryArchive &)
ON_BOOL32 GetBBox(double *, double *, ON_BOOL32=false) const
ON_3dPoint Point(int, int) const
ON_PointGrid(const ON_PointGrid &)
int PointArrayStride(int) const
void Destroy()
virtual ~ON_PointGrid()
ON_3dPoint * operator[](int)
bool IsDeformable() const
int PointCount(void) const
const ON_3dPoint * operator[](int) const
int PointCount(int) const
ON_3dPoint & Point(int, int)
bool MakeDeformable()
ON_BOOL32 Reverse(int)
ON_BOOL32 IsClosed(int) const
ON_BOOL32 Create(int, int)
int Dimension() const
ON_PointGrid & operator=(const ON_PointGrid &)
ON_BOOL32 Write(ON_BinaryArchive &) const
ON_BOOL32 Transpose()
double * PointArray()
ON_PointGrid(int, int)
void Dump(ON_TextLog &) const
ON_BOOL32 Transform(const ON_Xform &)
ON_BOOL32 GetPoint(int, int, ON_3dPoint &) const