Point Cloud Library (PCL)  1.9.1-dev
opennurbs_curveonsurface.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_CURVE_ON_SURFACE_INC_)
18 #define OPENNURBS_CURVE_ON_SURFACE_INC_
19 
20 class ON_CurveOnSurface;
21 class ON_CLASS ON_CurveOnSurface : public ON_Curve
22 {
23  ON_OBJECT_DECLARE(ON_CurveOnSurface);
24 
25 public:
27 
28  /*
29  Parameters:
30  p2dCurve - [in] ~ON_CurveOnSurface() will delete this curve.
31  Use an ON_CurveProxy if you don't want the original deleted.
32  p3dCurve - [in] ~ON_CurveOnSurface() will delete this curve.
33  Use an ON_CurveProxy if you don't want the original deleted.
34  pSurface - [in] ~ON_CurveOnSurface() will delete this surface.
35  Use an ON_SurfaceProxy if you don't want the original deleted.
36  */
37  ON_CurveOnSurface( ON_Curve* p2dCurve, // required 2d curve
38  ON_Curve* p3dCurve, // optional 3d curve
39  ON_Surface* pSurface // required surface
40  );
41  ON_CurveOnSurface(const ON_CurveOnSurface&); // no implementation
42  ON_CurveOnSurface& operator=(const ON_CurveOnSurface&); // no implementation
43 
44  /*
45  Remarks:
46  Deletes m_c2, m_c3, and m_s. Use ON_CurveProxy or ON_SurfaceProxy
47  if you need to use curves or a surface that you do not want deleted.
48  */
49  virtual ~ON_CurveOnSurface();
50 
51  // virtual ON_Object::SizeOf override
52  unsigned int SizeOf() const;
53 
54 
55  /////////////////////////////////////////////////////////////////
56  // ON_Object overrides
57 
58  /*
59  Description:
60  Tests an object to see if its data members are correctly
61  initialized.
62  Parameters:
63  text_log - [in] if the object is not valid and text_log
64  is not NULL, then a brief englis description of the
65  reason the object is not valid is appened to the log.
66  The information appended to text_log is suitable for
67  low-level debugging purposes by programmers and is
68  not intended to be useful as a high level user
69  interface tool.
70  Returns:
71  @untitled table
72  true object is valid
73  false object is invalid, uninitialized, etc.
74  Remarks:
75  Overrides virtual ON_Object::IsValid
76  */
77  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
78 
79  void Dump( ON_TextLog& ) const; // for debugging
80 
81  ON_BOOL32 Write(
82  ON_BinaryArchive& // open binary file
83  ) const;
84 
85  ON_BOOL32 Read(
86  ON_BinaryArchive& // open binary file
87  );
88 
89  /////////////////////////////////////////////////////////////////
90  // ON_Geometry overrides
91 
92  int Dimension() const;
93 
94  ON_BOOL32 GetBBox( // returns true if successful
95  double*, // minimum
96  double*, // maximum
97  ON_BOOL32 = false // true means grow box
98  ) const;
99 
100  ON_BOOL32 Transform(
101  const ON_Xform&
102  );
103 
104  // (optional - default uses Transform for 2d and 3d objects)
105  ON_BOOL32 SwapCoordinates(
106  int, int // indices of coords to swap
107  );
108 
109  /////////////////////////////////////////////////////////////////
110  // ON_Curve overrides
111 
112  ON_Interval Domain() const;
113 
114  int SpanCount() const; // number of smooth spans in curve
115 
116  ON_BOOL32 GetSpanVector( // span "knots"
117  double* // array of length SpanCount() + 1
118  ) const; //
119 
120  int Degree( // returns maximum algebraic degree of any span
121  // ( or a good estimate if curve spans are not algebraic )
122  ) const;
123 
124 
125  // (optional - override if curve is piecewise smooth)
126  ON_BOOL32 GetParameterTolerance( // returns tminus < tplus: parameters tminus <= s <= tplus
127  double, // t = parameter in domain
128  double*, // tminus
129  double* // tplus
130  ) const;
131 
132  ON_BOOL32 IsLinear( // true if curve locus is a line segment between
133  // between specified points
134  double = ON_ZERO_TOLERANCE // tolerance to use when checking linearity
135  ) const;
136 
137  ON_BOOL32 IsArc( // ON_Arc.m_angle > 0 if curve locus is an arc between
138  // specified points
139  const ON_Plane* = NULL, // if not NULL, test is performed in this plane
140  ON_Arc* = NULL, // if not NULL and true is returned, then arc parameters
141  // are filled in
142  double = ON_ZERO_TOLERANCE // tolerance to use when checking
143  ) const;
144 
145  ON_BOOL32 IsPlanar(
146  ON_Plane* = NULL, // if not NULL and true is returned, then plane parameters
147  // are filled in
148  double = ON_ZERO_TOLERANCE // tolerance to use when checking
149  ) const;
150 
151  ON_BOOL32 IsInPlane(
152  const ON_Plane&, // plane to test
153  double = ON_ZERO_TOLERANCE // tolerance to use when checking
154  ) const;
155 
156  ON_BOOL32 IsClosed( // true if curve is closed (either curve has
157  void // clamped end knots and euclidean location of start
158  ) const; // CV = euclidean location of end CV, or curve is
159  // periodic.)
160 
161  ON_BOOL32 IsPeriodic( // true if curve is a single periodic segment
162  void
163  ) const;
164 
165  ON_BOOL32 Reverse(); // reverse parameterizatrion
166  // Domain changes from [a,b] to [-b,-a]
167 
168  ON_BOOL32 Evaluate( // returns false if unable to evaluate
169  double, // evaluation parameter
170  int, // number of derivatives (>=0)
171  int, // array stride (>=Dimension())
172  double*, // array of length stride*(ndir+1)
173  int = 0, // optional - determines which side to evaluate from
174  // 0 = default
175  // < 0 to evaluate from below,
176  // > 0 to evaluate from above
177  int* = 0 // optional - evaluation hint (int) used to speed
178  // repeated evaluations
179  ) const;
180 
181  int GetNurbForm( // returns 0: unable to create NURBS representation
182  // with desired accuracy.
183  // 1: success - returned NURBS parameterization
184  // matches the curve's to wthe desired accuracy
185  // 2: success - returned NURBS point locus matches
186  // the curve's to the desired accuracy but, on
187  // the interior of the curve's domain, the
188  // curve's parameterization and the NURBS
189  // parameterization may not match to the
190  // desired accuracy.
191  ON_NurbsCurve&,
192  double = 0.0,
193  const ON_Interval* = NULL // OPTIONAL subdomain of 2d curve
194  ) const;
195 
196  /////////////////////////////////////////////////////////////////
197  // Interface
198 
199  // ~ON_CurveOnSurface() deletes these classes. Use a
200  // ON_CurveProxy and/or ON_SurfaceProxy wrapper if you don't want
201  // the destructor to destroy the curves
202  ON_Curve* m_c2; // REQUIRED parameter space (2d) curve
203  ON_Curve* m_c3; // OPTIONAL 3d curve (approximation) to srf(crv2(t))
205 };
206 
207 
208 #endif
virtual ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const =0
virtual ON_BOOL32 IsLinear(double tolerance=ON_ZERO_TOLERANCE) const
virtual ON_BOOL32 IsPlanar(ON_Plane *plane=NULL, double tolerance=ON_ZERO_TOLERANCE) const
virtual int SpanCount() const =0
unsigned int SizeOf() const
virtual ON_BOOL32 Transform(const ON_Xform &xform)
virtual ON_BOOL32 IsClosed() const
virtual int Degree() const =0
virtual ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
virtual ON_BOOL32 IsPeriodic() const
virtual ON_BOOL32 SwapCoordinates(int i, int j)
virtual int Dimension() const =0
virtual ON_BOOL32 IsArc(const ON_Plane *plane=NULL, ON_Arc *arc=NULL, double tolerance=ON_ZERO_TOLERANCE) const
virtual ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
virtual ON_BOOL32 GetParameterTolerance(double t, double *tminus, double *tplus) const
virtual void Dump(ON_TextLog &) const
ON_Curve & operator=(const ON_Curve &)
virtual ON_BOOL32 Reverse()=0
virtual ON_BOOL32 GetSpanVector(double *knots) const =0
virtual ON_BOOL32 IsInPlane(const ON_Plane &test_plane, double tolerance=ON_ZERO_TOLERANCE) const =0
virtual int GetNurbForm(ON_NurbsCurve &nurbs_curve, double tolerance=0.0, const ON_Interval *subdomain=NULL) const
virtual ON_BOOL32 GetBBox(double *boxmin, double *boxmax, int bGrowBox=false) const =0
virtual ON_BOOL32 Evaluate(double t, int der_count, int v_stride, double *v, int side=0, int *hint=0) const =0
virtual ON_Interval Domain() const =0