QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_pointgrid.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(OPENNURBS_POINT_GRID_INC_)
17#define OPENNURBS_POINT_GRID_INC_
18
20{
21public:
25 int, // point count0 (>=1)
26 int // point count1 (>=1)
27 );
28
29 void Initialize(void); // zeros all fields
30
31 ON_BOOL32 Create(
32 int, // point count0 (>=1)
33 int // point count1 (>=1)
34 );
35
36 void Destroy();
37
38 virtual ~ON_PointGrid();
39 void EmergencyDestroy(); // call if memory used by point grid becomes invalid
40
42
43 // point_grid[i][j] returns GetPoint(i,j)
44 ON_3dPoint* operator[](int); // 0 <= index < PointCount(0)
45 const ON_3dPoint* operator[](int) const; // 0 <= index < PointCount(0)
46
48 // ON_Object overrides
49
50 /*
51 Description:
52 Tests an object to see if its data members are correctly
53 initialized.
54 Parameters:
55 text_log - [in] if the object is not valid and text_log
56 is not NULL, then a brief englis description of the
57 reason the object is not valid is appened to the log.
58 The information appended to text_log is suitable for
59 low-level debugging purposes by programmers and is
60 not intended to be useful as a high level user
61 interface tool.
62 Returns:
63 @untitled table
64 true object is valid
65 false object is invalid, uninitialized, etc.
66 Remarks:
67 Overrides virtual ON_Object::IsValid
68 */
69 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
70
71 void Dump( ON_TextLog& ) const; // for debugging
72
74 ON_BinaryArchive& // open binary file
75 ) const;
76
78 ON_BinaryArchive& // open binary file
79 );
80
81 ON::object_type ObjectType() const;
82
84 // ON_Geometry overrides
85
86 int Dimension() const;
87
88 ON_BOOL32 GetBBox( // returns true if successful
89 double*, // minimum
90 double*, // maximum
91 ON_BOOL32 = false // true means grow box
92 ) const;
93
94 /*
95 Description:
96 Get tight bounding box of the point grid.
97 Parameters:
98 tight_bbox - [in/out] tight bounding box
99 bGrowBox -[in] (default=false)
100 If true and the input tight_bbox is valid, then returned
101 tight_bbox is the union of the input tight_bbox and the
102 tight bounding box of the point grid.
103 xform -[in] (default=NULL)
104 If not NULL, the tight bounding box of the transformed
105 point grid is calculated. The point grid is not modified.
106 Returns:
107 True if the returned tight_bbox is set to a valid
108 bounding box.
109 */
111 ON_BoundingBox& tight_bbox,
112 int bGrowBox = false,
113 const ON_Xform* xform = 0
114 ) const;
115
117 const ON_Xform&
118 );
119
120 // virtual ON_Geometry::IsDeformable() override
121 bool IsDeformable() const;
122
123 // virtual ON_Geometry::MakeDeformable() override
124 bool MakeDeformable();
125
127 int, int // indices of coords to swap
128 );
129
131 // Interface
132
133 ON_BOOL32 IsClosed(
134 int // dir
135 ) const;
136
137 int PointCount( // number of points in grid direction
138 int // dir 0 = "s", 1 = "t"
139 ) const;
140
141 int PointCount( // total number of points in grid
142 void
143 ) const;
144
146 int, int // point index ( 0 <= i <= PointCount(0), 0 <= j <= PointCount(1)
147 );
148
150 int, int // point index ( 0 <= i <= PointCount(0), 0 <= j <= PointCount(1)
151 ) const;
152
153 double* PointArray();
154
155 const double* PointArray() const;
156
157 int PointArrayStride( // point stride in grid direction
158 int // dir 0 = "s", 1 = "t"
159 ) const;
160
161 ON_BOOL32 SetPoint( // set a single point
162 int, int, // point index ( 0 <= i <= PointCount(0), 0 <= j <= PointCount(1)
163 const ON_3dPoint& // value of point
164 );
165
166 ON_BOOL32 GetPoint( // get a single control vertex
167 int, int, // CV index ( 0 <= i <= CVCount(0), 0 <= j <= CVCount(1)
168 ON_3dPoint& // gets euclidean cv when NURBS is rational
169 ) const;
170
171 ON_BOOL32 Reverse( // reverse grid order
172 int // dir 0 = "s", 1 = "t"
173 );
174
175 ON_BOOL32 Transpose(); // transpose grid points
176
178 // Implementation
179protected:
180
181 int m_point_count[2]; // number of points (>=1)
182 int m_point_stride0; // >= m_point_count[1]
184 // point[i][j] = m_point[i*m_point_stride0+j]
185
186private:
187 static ON_3dPoint m_no_point; // prevent crashes when sizes are 0
188
190};
191
192
193#endif
@ Point
Definition RSMetaType.h:50
@ Transform
Definition RSMetaType.h:67
Definition opennurbs_array.h:398
Definition opennurbs_point.h:403
Definition opennurbs_archive.h:152
Definition opennurbs_bounding_box.h:25
Definition opennurbs_geometry.h:36
virtual bool IsDeformable() const
Definition opennurbs_geometry.cpp:205
virtual ON_BOOL32 GetBBox(double *boxmin, double *boxmax, int bGrowBox=false) const =0
virtual bool GetTightBoundingBox(ON_BoundingBox &tight_bbox, int bGrowBox=false, const ON_Xform *xform=0) const
Definition opennurbs_geometry.cpp:98
virtual ON_BOOL32 SwapCoordinates(int i, int j)
Definition opennurbs_geometry.cpp:135
virtual bool MakeDeformable()
Definition opennurbs_geometry.cpp:210
ON_Geometry & operator=(const ON_Geometry &)
Definition opennurbs_geometry.cpp:26
virtual int Dimension() const =0
virtual void Dump(ON_TextLog &) const
Definition opennurbs_object.cpp:1695
virtual ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const =0
virtual ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
Definition opennurbs_object.cpp:1734
virtual ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
Definition opennurbs_object.cpp:1714
virtual ON::object_type ObjectType() const
Definition opennurbs_object.cpp:1616
Definition opennurbs_pointgrid.h:20
ON_3dPointArray m_point
Definition opennurbs_pointgrid.h:183
int m_point_stride0
Definition opennurbs_pointgrid.h:182
ON_OBJECT_DECLARE(ON_PointGrid)
static ON_3dPoint m_no_point
Definition opennurbs_pointgrid.h:187
Definition opennurbs_textlog.h:20
Definition opennurbs_xform.h:28
Reverses all selected entities which support reversing (lines, arcs, splines).
Definition Reverse.js:11
#define ON_CLASS
Definition opennurbs_defines.h:91
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362