QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_evaluate_nurbs.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(ON_EVALUATE_NURBS_INC_)
17#define ON_EVALUATE_NURBS_INC_
18
21 int, // dimension
22 ON_BOOL32, // true if Bezier is rational
23 int, // order (>=2)
24 int, // cv_stride (>=dim+1)
25 double* // cv[(order+1)*cv_stride] array
26 );
27
29bool ON_RemoveBezierSingAt0( // input bezier is rational with 0/0 at start
30 int, // dimension
31 int, // order (>=2)
32 int, // cv_stride (>=dim+1)
33 double* // cv[order*cv_stride] array
34 );
35
37bool ON_RemoveBezierSingAt1( // input bezier is rational with 0/0 at end
38 int, // dimension
39 int, // order (>=2)
40 int, // cv_stride (>=dim+1)
41 double* // cv[order*cv_stride] array
42 );
43
45double ON_EvaluateBernsteinBasis( // returns (i choose d)*(1-t)^(d-i)*t^i
46 int, // degree,
47 int, // 0 <= i <= degree
48 double // t
49 );
50
53 int, // dim
54 int, // order
55 int, // side <= 0 return left side of bezier in cv array
56 // > 0 return right side of bezier in cv array
57 int, // cv_stride
58 double*, // cv
59 double // t 0 <= t <= 1
60 );
61
64 int, // dimension
65 ON_BOOL32, // true if Bezier is rational
66 int, // order (>=2)
67 int, // cv_stride >= (is_rat)?dim+1:dim
68 const double*, // cv[order*cv_stride] array
69 double, double, // t0,t1 = domain of bezier
70 int, // number of derivatives to compute (>=0)
71 double, // evaluation parameter
72 int, // v_stride (>=dimension)
73 double* // v[(der_count+1)*v_stride] array
74 );
75
78 int, // order (>=1)
79 const double*, // knot[] array of 2*(order-1) knots
80 double, // evaluation parameter
81 double* // basis_values[] array of length order*order
82 );
83
86 int, // order (>=1)
87 const double*, // knot[] array of 2*(order-1) knots
88 int, // number of derivatives
89 double* // basis_values[] array of length order*order
90 );
91
92
93
94
95/*
96int dim, // dimension
97 ON_BOOL32 is_rat, // true if NURBS is rational
98 int order, // order
99 const double* knot, // knot[] array of (2*order-2) doubles
100 int cv_stride, // cv_stride >= (is_rat)?dim+1:dim
101 const double* cv, // cv[order*cv_stride] array
102 int der_count, // number of derivatives to compute
103 double t, // evaluation parameter
104 int v_stride, // v_stride (>=dimension)
105 double* v // v[(der_count+1)*v_stride] array
106 )
107 int, // dimension
108 ON_BOOL32, // true if NURBS is rational
109 int, // order
110 const double*, // knot[] array of (2*order-2) doubles
111 int, // cv_stride
112 const double*, // cv[] array of order*cv_stride doubles
113 int, // number of derivatives to compute (>=0)
114 double, // evaluation parameter
115 int, // answer_stride (>=dimension)
116 double* // answer[] array of length (ndir+1)*answer_stride
117*/
118
119
121
122/*
123Description:
124 Evaluate a NURBS curve span.
125Parameters:
126 dim - [in]
127 dimension (> 0).
128 is_rat - [in]
129 true or false.
130 order - [in]
131 order=degree+1 (order>=2)
132 knot - [in] NURBS knot vector.
133 NURBS knot vector with 2*(order-1) knots, knot[order-2] != knot[order-1]
134 cv_stride - [in]
135 cv - [in]
136 For 0 <= i < order the i-th control vertex is
137
138 cv[n],...,cv[n+(is_rat?dim:dim+1)],
139
140 where n = i*cv_stride. If is_rat is true the cv is
141 in homogeneous form.
142 der_count - [in]
143 number of derivatives to evaluate (>=0)
144 t - [in]
145 evaluation parameter
146 v_stride - [in]
147 v - [out]
148 An array of length v_stride*(der_count+1). The evaluation
149 results are returned in this array.
150
151 P = v[0],...,v[m_dim-1]
152 Dt = v[v_stride],...
153 Dtt = v[2*v_stride],...
154 ...
155
156 In general, Dt^i returned in v[n],...,v[n+m_dim-1], where
157
158 n = v_stride*i.
159
160Returns:
161 True if successful.
162See Also:
163 ON_NurbsCurve::Evaluate
164 ON_EvaluateNurbsSurfaceSpan
165 ON_EvaluateNurbsCageSpan
166*/
168 int dim,
169 int is_rat,
170 int order,
171 const double* knot,
172 int cv_stride,
173 const double* cv,
174 int der_count,
175 double t,
176 int v_stride,
177 double* v
178 );
179
180/*
181Description:
182 Evaluate a NURBS surface bispan.
183Parameters:
184 dim - [in] >0
185 is_rat - [in] true of false
186 order0 - [in] >= 2
187 order1 - [in] >= 2
188 knot0 - [in]
189 NURBS knot vector with 2*(order0-1) knots, knot0[order0-2] != knot0[order0-1]
190 knot1 - [in]
191 NURBS knot vector with 2*(order1-1) knots, knot1[order1-2] != knot1[order1-1]
192 cv_stride0 - [in]
193 cv_stride1 - [in]
194 cv - [in]
195 For 0 <= i < order0 and 0 <= j < order1, the (i,j) control vertex is
196
197 cv[n],...,cv[n+(is_rat?dim:dim+1)],
198
199 where n = i*cv_stride0 + j*cv_stride1. If is_rat is true the cv is
200 in homogeneous form.
201
202 der_count - [in] (>=0)
203 s - [in]
204 t - [in] (s,t) is the evaluation parameter
205 v_stride - [in] (>=dim)
206 v - [out] An array of length v_stride*(der_count+1)*(der_count+2)/2.
207 The evaluation results are stored in this array.
208
209 P = v[0],...,v[m_dim-1]
210 Ds = v[v_stride],...
211 Dt = v[2*v_stride],...
212 Dss = v[3*v_stride],...
213 Dst = v[4*v_stride],...
214 Dtt = v[5*v_stride],...
215
216 In general, Ds^i Dt^j is returned in v[n],...,v[n+m_dim-1], where
217
218 n = v_stride*( (i+j)*(i+j+1)/2 + j).
219
220Returns:
221 True if succcessful.
222See Also:
223 ON_NurbsSurface::Evaluate
224 ON_EvaluateNurbsSpan
225 ON_EvaluateNurbsCageSpan
226*/
229 int dim,
230 int is_rat,
231 int order0,
232 int order1,
233 const double* knot0,
234 const double* knot1,
235 int cv_stride0,
236 int cv_stride1,
237 const double* cv,
238 int der_count,
239 double s,
240 double t,
241 int v_stride,
242 double* v
243 );
244
245
246
247/*
248Description:
249 Evaluate a NURBS cage trispan.
250Parameters:
251 dim - [in] >0
252 is_rat - [in] true of false
253 order0 - [in] >= 2
254 order1 - [in] >= 2
255 order2 - [in] >= 2
256 knot0 - [in]
257 NURBS knot vector with 2*(order0-1) knots, knot0[order0-2] != knot0[order0-1]
258 knot1 - [in]
259 NURBS knot vector with 2*(order1-1) knots, knot1[order1-2] != knot1[order1-1]
260 knot2 - [in]
261 NURBS knot vector with 2*(order1-1) knots, knot2[order2-2] != knot2[order2-1]
262 cv_stride0 - [in]
263 cv_stride1 - [in]
264 cv_stride2 - [in]
265 cv - [in]
266 For 0 <= i < order0, 0 <= j < order1, and 0 <= k < order2,
267 the (i,j,k)-th control vertex is
268
269 cv[n],...,cv[n+(is_rat?dim:dim+1)],
270
271 where n = i*cv_stride0 + j*cv_stride1 *k*cv_stride2.
272 If is_rat is true the cv is in homogeneous form.
273
274 der_count - [in] (>=0)
275 r - [in]
276 s - [in]
277 t - [in] (r,s,t) is the evaluation parameter
278 v_stride - [in] (>=dim)
279 v - [out] An array of length v_stride*(der_count+1)*(der_count+2)*(der_count+3)/6.
280 The evaluation results are stored in this array.
281
282 P = v[0],...,v[m_dim-1]
283 Dr = v[v_stride],...
284 Ds = v[2*v_stride],...
285 Dt = v[3*v_stride],...
286 Drr = v[4*v_stride],...
287 Drs = v[5*v_stride],...
288 Drt = v[6*v_stride],...
289 Dss = v[7*v_stride],...
290 Dst = v[8*v_stride],...
291 Dtt = v[9*v_stride],...
292
293 In general, Dr^i Ds^j Dt^k is returned in v[n],...,v[n+dim-1], where
294
295 d = (i+j+k)
296 n = v_stride*( d*(d+1)*(d+2)/6 + (j+k)*(j+k+1)/2 + k)
297
298Returns:
299 True if succcessful.
300See Also:
301 ON_NurbsCage::Evaluate
302 ON_EvaluateNurbsSpan
303 ON_EvaluateNurbsSurfaceSpan
304*/
307 int dim,
308 int is_rat,
309 int order0, int order1, int order2,
310 const double* knot0,
311 const double* knot1,
312 const double* knot2,
313 int cv_stride0, int cv_stride1, int cv_stride2,
314 const double* cv,
315 int der_count,
316 double t0, double t1, double t2,
317 int v_stride,
318 double* v
319 );
320
321
323bool ON_EvaluateNurbsDeBoor( // for expert users only - no support available
324 int, // cv_dim ( dim+1 for rational cvs )
325 int, // order (>=2)
326 int, // cv_stride (>=cv_dim)
327 double*, // cv array - values changed to result of applying De Boor's algorithm
328 const double*, // knot array
329 int, // side,
330 // -1 return left side of B-spline span in cv array
331 // +1 return right side of B-spline span in cv array
332 // -2 return left side of B-spline span in cv array
333 // Ignore values of knots[0,...,order-3] and assume
334 // left end of span has a fully multiple knot with
335 // value "mult_k".
336 // +2 return right side of B-spline span in cv array
337 // Ignore values of knots[order,...,2*order-2] and
338 // assume right end of span has a fully multiple
339 // knot with value "mult_k".
340 double, // mult_k - used when side is +2 or -2. See above for usage.
341 double // t
342 // If side < 0, then the cv's for the portion of the NURB span to
343 // the LEFT of t are computed. If side > 0, then the cv's for the
344 // portion the span to the RIGHT of t are computed. The following
345 // table summarizes the restrictions on t:
346 //
347 // value of side condition t must satisfy
348 // -2 mult_k < t and mult_k < knots[order-1]
349 // -1 knots[order-2] < t
350 // +1 t < knots[order-1]
351 // +2 t < mult_k and knots[order-2] < mult_k
352 );
353
354
356bool ON_EvaluateNurbsBlossom(int, // cvdim,
357 int, // order,
358 int, // cv_stride,
359 const double*, //CV, size cv_stride*order
360 const double*, //knot, nondecreasing, size 2*(order-1)
361 // knot[order-2] != knot[order-1]
362 const double*, //t, input parameters size order-1
363 double* // P
364
365 // DeBoor algorithm with different input at each step.
366 // returns false for bad input.
367 );
368
369
372 int, // cvdim (dim+1 for rational curves)
373 int, // order,
374 int, // cvstride (>=cvdim)
375 double*, // cv array - input has NURBS cvs, output has Bezier cvs
376 const double*, // (2*order-2) knots for the NURBS span
377 double, // t0, NURBS span parameter of start point
378 double // t1, NURBS span parameter of end point
379 );
380#endif
#define ON_DECL
Definition opennurbs_defines.h:92
ON_DECL void ON_ConvertNurbSpanToBezier(int, int, int, double *, const double *, double, double)
Definition opennurbs_evaluate_nurbs.cpp:1595
ON_DECL double ON_EvaluateBernsteinBasis(int, int, double)
Definition opennurbs_evaluate_nurbs.cpp:18
ON_DECL bool ON_EvaluateNurbsDeBoor(int, int, int, double *, const double *, int, double, double)
Definition opennurbs_evaluate_nurbs.cpp:1269
ON_DECL bool ON_IncreaseBezierDegree(int, ON_BOOL32, int, int, double *)
Definition opennurbs_evaluate_nurbs.cpp:303
ON_DECL bool ON_RemoveBezierSingAt0(int, int, int, double *)
Definition opennurbs_evaluate_nurbs.cpp:382
ON_DECL bool ON_EvaluateNurbsSurfaceSpan(int dim, int is_rat, int order0, int order1, const double *knot0, const double *knot1, int cv_stride0, int cv_stride1, const double *cv, int der_count, double s, double t, int v_stride, double *v)
Definition opennurbs_evaluate_nurbs.cpp:1085
ON_DECL bool ON_RemoveBezierSingAt1(int, int, int, double *)
Definition opennurbs_evaluate_nurbs.cpp:412
ON_DECL bool ON_EvaluateNurbsBasisDerivatives(int, const double *, int, double *)
Definition opennurbs_evaluate_nurbs.cpp:813
ON_DECL bool ON_EvaluateNurbsBlossom(int, int, int, const double *, const double *, const double *, double *)
Definition opennurbs_evaluate_nurbs.cpp:1538
ON_DECL bool ON_EvaluateNurbsSpan(int dim, int is_rat, int order, const double *knot, int cv_stride, const double *cv, int der_count, double t, int v_stride, double *v)
Definition opennurbs_evaluate_nurbs.cpp:1051
ON_DECL bool ON_EvaluateNurbsCageSpan(int dim, int is_rat, int order0, int order1, int order2, const double *knot0, const double *knot1, const double *knot2, int cv_stride0, int cv_stride1, int cv_stride2, const double *cv, int der_count, double t0, double t1, double t2, int v_stride, double *v)
Definition opennurbs_nurbsvolume.cpp:1075
ON_DECL bool ON_EvaluateNurbsBasis(int, const double *, double, double *)
Definition opennurbs_evaluate_nurbs.cpp:660
ON_DECL bool ON_EvaluateBezier(int, ON_BOOL32, int, int, const double *, double, double, int, double, int, double *)
Definition opennurbs_evaluate_nurbs.cpp:444
ON_DECL void ON_EvaluatedeCasteljau(int, int, int, int, double *, double)
Definition opennurbs_evaluate_nurbs.cpp:151
char s
Definition opennurbs_string.cpp:32
int ON_BOOL32
Definition opennurbs_system.h:362