QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_math.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_MATH_INC_)
17#define ON_MATH_INC_
18
19class ON_3dVector;
20class ON_Interval;
21class ON_Line;
22class ON_Arc;
23class ON_Plane;
24
25// qcad: compile fix for gcc 4.7:
26class ON_Circle;
27class ON_Cylinder;
28class ON_Sphere;
29// qcad: end
30
31/*
32Description:
33 Class for carefully adding long list of numbers.
34*/
36{
37public:
38
39 /*
40 Description:
41 Calls ON_Sum::Begin(x)
42 */
43 void operator=(double x);
44
45 /*
46 Description:
47 Calls ON_Sum::Plus(x);
48 */
49 void operator+=(double x);
50
51 /*
52 Description:
53 Calls ON_Sum::Plus(-x);
54 */
55 void operator-=(double x);
56
57 /*
58 Description:
59 Creates a sum that is ready to be used.
60 */
61 ON_Sum();
62
63 /*
64 Description:
65 If a sum is being used more than once, call Begin()
66 before starting each sum.
67 Parameters:
68 starting_value - [in] Initial value of sum.
69 */
70 void Begin( double starting_value = 0.0 );
71
72 /*
73 Description:
74 Add x to the current sum.
75 Parameters:
76 x - [in] value to add to the current sum.
77 */
78 void Plus( double x );
79
80 /*
81 Description:
82 Calculates the total sum.
83 Parameters:
84 error_estimate - [out] if not NULL, the returned value of
85 *error_estimate is an estimate of the error in the sum.
86 Returns:
87 Total of the sum.
88 Remarks:
89 You can get subtotals by mixing calls to Plus() and Total().
90 In delicate sums, some precision may be lost in the final
91 total if you call Total() to calculate subtotals.
92 */
93 double Total( double* error_estimate = NULL );
94
95 /*
96 Returns:
97 Number of summands.
98 */
99 int SummandCount() const;
100
101private:
102 enum {
103 sum1_max_count=256,
104 sum2_max_count=512,
105 sum3_max_count=1024
106 };
107 double m_sum_err;
108 double m_pos_sum;
109 double m_neg_sum;
110
111 int m_zero_count; // number of zeros added
112 int m_pos_count; // number of positive numbers added
113 int m_neg_count; // number of negative numbers added
114
118 double m_pos_sum1[sum1_max_count];
119 double m_pos_sum2[sum2_max_count];
120 double m_pos_sum3[sum3_max_count];
121
125 double m_neg_sum1[sum1_max_count];
126 double m_neg_sum2[sum2_max_count];
127 double m_neg_sum3[sum3_max_count];
128
129 double SortAndSum( int, double* );
130};
131
132/*
133Description:
134 Abstract function with an arbitrary number of parameters
135 and values. ON_Evaluator is used to pass functions to
136 local solvers.
137*/
139{
140public:
141
142 /*
143 Description:
144 Construction of the class for a function that takes
145 parameter_count input functions and returns
146 value_count values. If the domain is infinite, pass
147 a NULL for the domain[] and periodic[] arrays. If
148 the domain is finite, pass a domain[] array with
149 parameter_count increasing intervals. If one or more of
150 the parameters is periodic, pass the fundamental domain
151 in the domain[] array and a true in the periodic[] array.
152 Parameters:
153 parameter_count - [in] >= 1. Number of input parameters
154 value_count - [in] >= 1. Number of output values.
155 domain - [in] If not NULL, then this is an array
156 of parameter_count increasing intervals
157 that defines the domain of the function.
158 periodic - [in] if not NULL, then this is an array of
159 parameter_count bools where b[i] is true if
160 the i-th parameter is periodic. Valid
161 increasing finite domains must be specificed
162 when this parameter is not NULL.
163 */
165 int parameter_count,
166 int value_count,
167 const ON_Interval* domain,
168 const bool* periodic
169 );
170
171 virtual ~ON_Evaluator();
172
173 /*
174 Description:
175 Evaluate the function that takes m_parameter_count parameters
176 and returns a m_value_count dimensional point.
177 Parameters:
178 parameters - [in] array of m_parameter_count evaluation parameters
179 values - [out] array of m_value_count function values
180 jacobian - [out] If NULL, simply evaluate the value of the function.
181 If not NULL, this is the jacobian of the function.
182 jacobian[i][j] = j-th partial of the i-th value
183 0 <= i < m_value_count,
184 0 <= j < m_parameter_count
185 If not NULL, then all the memory for the
186 jacobian is allocated, you just need to fill
187 in the answers.
188 Example:
189 If f(u,v) = square of the distance from a fixed point P to a
190 surface evaluated at (u,v), then
191
192 values[0] = (S-P)o(S-P)
193 jacobian[0] = ( 2*(Du o (S-P)), 2*(Dv o (S-P)) )
194
195 where S, Du, Dv = surface point and first partials evaluated
196 at u=parameters[0], v = parameters[1].
197
198 If the function takes 3 parameters, say (x,y,z), and returns
199 two values, say f(x,y,z) and g(z,y,z), then
200
201 values[0] = f(x,y,z)
202 values[1] = g(x,y,z)
203
204 jacobian[0] = (DfDx, DfDy, DfDz)
205 jacobian[1] = (DgDx, DgDy, DgDz)
206
207 where dfx denotes the first partial of f with respect to x.
208
209 Returns:
210 0 = unable to evaluate
211 1 = successful evaluation
212 2 = found answer, terminate search
213 */
214 virtual int Evaluate(
215 const double* parameters,
216 double* values,
217 double** jacobian
218 ) = 0;
219
220 /*
221 Description:
222 OPTIONAL ability to evaluate the hessian in the case when
223 m_value_count is one. If your function has more that
224 one value or it is not feasable to evaluate the hessian,
225 then do not override this function. The default implementation
226 returns -1.
227 Parameters:
228 parameters - [in] array of m_parameter_count evaluation parameters
229 value - [out] value of the function (one double)
230 gradient - [out] The gradient of the function. This is a vector
231 of length m_parameter_count; gradient[i] is
232 the first partial of the function with respect to
233 the i-th parameter.
234 hessian - [out] The hessian of the function. This is an
235 m_parameter_count x m_parameter_count
236 symmetric matrix: hessian[i][j] is the
237 second partial of the function with respect
238 to the i-th and j-th parameters. The evaluator
239 is responsible for filling in both the upper
240 and lower triangles. Since the matrix is
241 symmetrix, you should do something like evaluate
242 the upper triangle and copy the values to the
243 lower tiangle.
244 Returns:
245 -1 = Hessian evaluation not available.
246 0 = unable to evaluate
247 1 = successful evaluation
248 2 = found answer, terminate search
249 */
250 virtual int EvaluateHessian(
251 const double* parameters,
252 double* value,
253 double* gradient,
254 double** hessian
255 );
256
257 // Number of the function's input parameters. This number
258 // is >= 1 and is specified in the constructor.
260
261 // Number of the function's output values. This number
262 // is >= 1 and is specified in the constructor.
263 const int m_value_count;
264
265 /*
266 Description:
267 Functions can have finite or infinite domains. Finite domains
268 are specified by passing the domain[] array to the constructor
269 or filling in the m_domain[] member variable. If
270 m_domain.Count() == m_parameter_count > 0, then the function
271 has finite domains.
272 Returns:
273 True if the domain of the function is finite.
274 */
275 bool FiniteDomain() const;
276
277 /*
278 Description:
279 If a function has a periodic parameter, then the m_domain
280 interval for that parameter is the fundamental domain and
281 the m_bPeriodicParameter bool for that parameter is true.
282 A parameter is periodic if, and only if,
283 m_domain.Count() == m_parameter_count, and
284 m_bPeriodicParameter.Count() == m_parameter_count, and
285 m_bPeriodicParameter[parameter_index] is true.
286 Returns:
287 True if the function parameter is periodic.
288 */
289 bool Periodic(
290 int parameter_index
291 ) const;
292
293 /*
294 Description:
295 If a function has a periodic parameter, then the m_domain
296 interval for that parameter is the fundamental domain and
297 the m_bPeriodicParameter bool for that parameter is true.
298 A parameter is periodic if, and only if,
299 m_domain.Count() == m_parameter_count, and
300 m_bPeriodicParameter.Count() == m_parameter_count, and
301 m_bPeriodicParameter[parameter_index] is true.
302 Returns:
303 The domain of the parameter. If the domain is infinite,
304 the (-1.0e300, +1.0e300) is returned.
305 */
306 ON_Interval Domain(
307 int parameter_index
308 ) const;
309
310
311 // If the function has a finite domain or periodic
312 // parameters, then m_domain[] is an array of
313 // m_parameter_count finite increasing intervals.
315
316 // If the function has periodic parameters, then
317 // m_bPeriodicParameter[] is an array of m_parameter_count
318 // bools. If m_bPeriodicParameter[i] is true, then
319 // the i-th parameter is periodic and m_domain[i] is
320 // the fundamental domain for that parameter.
322
323private:
324 ON_Evaluator(); // prohibit default constructor
325 ON_Evaluator& operator=(const ON_Evaluator&); // prohibit operator= (can't copy const members)
326};
327
328/*
329Description:
330 Test a double to make sure it is a valid number.
331Returns:
332 True if x != ON_UNSET_VALUE and _finite(x) is true.
333*/
335bool ON_IsValid( double x );
336
338bool ON_IsValidFloat( float x );
339
340
341// The ON_IS_FINITE and ON_IS_VALID defines are much faster
342// than calling ON_IsValid(), but need to be used when
343// the macro expansion works.
344
345#if defined(ON_LITTLE_ENDIAN)
346
347// works on little endian CPUs with IEEE doubles
348#define ON_IS_FINITE(x) (0x7FF0 != (*((unsigned short*)(&x) + 3) & 0x7FF0))
349#define ON_IS_VALID(x) (x != ON_UNSET_VALUE && 0x7FF0 != (*((unsigned short*)(&x) + 3) & 0x7FF0))
350#define ON_IS_VALID_FLOAT(x) (x != ON_UNSET_FLOAT)
351//TODO - ADD FAST ugly bit check#define ON_IS_VALID_FLOAT(x) (x != ON_UNSET_FLOAT && 0x7FF0 != (*((unsigned short*)(&x) + 3) & 0x7FF0))
352
353#elif defined(ON_BIG_ENDIAN)
354
355// works on big endian CPUs with IEEE doubles
356#define ON_IS_FINITE(x) (0x7FF0 != (*((unsigned short*)(&x)) & 0x7FF0))
357#define ON_IS_VALID(x) (x != ON_UNSET_VALUE && 0x7FF0 != (*((unsigned short*)(&x)) & 0x7FF0))
358#define ON_IS_VALID_FLOAT(x) (x != ON_UNSET_FLOAT)
359//TODO - ADD FAST ugly bit check#define ON_IS_VALID_FLOAT(x) (x != ON_UNSET_FLOAT && 0x7FF0 != (*((unsigned short*)(&x) + 3) & 0x7FF0))
360
361#else
362
363// Returns true if x is a finite double. Specifically,
364// _finite returns a nonzero value (true) if its argument x
365// is not infinite, that is, if -INF < x < +INF.
366// It returns 0 (false) if the argument is infinite or a NaN.
367//
368// If you are trying to compile opennurbs on a platform
369// that does not support finite(), then see if you can
370// use _fpclass(), fpclass(), _isnan(), or isnan(). If
371// you can't find anything, then just set this
372// function to return true.
373
374#if defined(_GNU_SOURCE)
375#define ON_IS_FINITE(x) (isfinite(x)?true:false)
376// If your compiler does not have "isfinite()", try using "finite()".
377//#define ON_IS_FINITE(x) (finite(x)?true:false)
378#else
379#define ON_IS_FINITE(x) (_finite(x)?true:false)
380#endif
381
382#define ON_IS_VALID(x) (x != ON_UNSET_VALUE && ON_IS_FINITE(x))
383#define ON_IS_VALID_FLOAT(x) (x != ON_UNSET_FLOAT && ON_IS_FINITE(x))
384
385#endif
386
387
389float ON_ArrayDotProduct( // returns AoB
390 int, // size of arrays (can be zero)
391 const float*, // A[]
392 const float* // B[]
393 );
394
396void ON_ArrayScale(
397 int, // size of arrays (can be zero)
398 float, // a
399 const float*, // A[]
400 float* // returns a*A[]
401 );
402
405 int, // size of arrays (can be zero)
406 float, // a
407 const float*, // A[]
408 const float*, // B[]
409 float* // returns a*A[] + B[]
410 );
411
413double ON_ArrayDotProduct( // returns AoB
414 int, // size of arrays (can be zero)
415 const double*, // A[]
416 const double* // B[]
417 );
418
420double ON_ArrayDotDifference( // returns A o ( B - C )
421 int, // size of arrays (can be zero)
422 const double*, // A[]
423 const double*, // B[]
424 const double* // C[]
425 );
426
428double ON_ArrayMagnitude( // returns sqrt(AoA)
429 int, // size of arrays (can be zero)
430 const double* // A[]
431 );
432
434double ON_ArrayMagnitudeSquared( // returns AoA
435 int, // size of arrays (can be zero)
436 const double* // A[]
437 );
438
440double ON_ArrayDistance( // returns sqrt((A-B)o(A-B))
441 int, // size of arrays (can be zero)
442 const double*, // A[]
443 const double* // B[]
444 );
445
447double ON_ArrayDistanceSquared( // returns (A-B)o(A-B)
448 int, // size of arrays (can be zero)
449 const double*, // A[]
450 const double* // B[]
451 );
452
454void ON_ArrayScale(
455 int, // size of arrays (can be zero)
456 double, // a
457 const double*, // A[]
458 double* // returns a*A[]
459 );
460
463 int, // size of arrays (can be zero)
464 double, // a
465 const double*, // A[]
466 const double*, // B[]
467 double* // returns a*A[] + B[]
468 );
469
471int ON_SearchMonotoneArray( // find a value in an increasing array
472 // returns -1: t < array[0]
473 // i: array[i] <= t < array[i+1] ( 0 <= i < length-1 )
474 // length-1: t == array[length-1]
475 // length: t >= array[length-1]
476 const double*, // array[]
477 int, // length of array
478 double // t = value to search for
479 );
480
481
482/*
483Description:
484 Compute a binomial coefficient.
485Parameters:
486 i - [in]
487 j - [in]
488Returns:
489 (i+j)!/(i!j!), if 0 <= i and 0 <= j, and 0 otherwise.
490See Also:
491 ON_TrinomialCoefficient()
492Remarks:
493 If (i+j) <= 52, this function is fast and returns the exact
494 value of the binomial coefficient.
495
496 For (i+j) > 52, the coefficient is computed recursively using
497 the formula bc(i,j) = bc(i-1,j) + bc(i,j-1).
498 For (i+j) much larger than 60, this is inefficient.
499 If you need binomial coefficients for large i and j, then you
500 should probably be using something like Stirling's Formula.
501 (Look up "Stirling" or "Gamma function" in a calculus book.)
502*/
505 int i,
506 int j
507 );
508
509
510/*
511Description:
512 Compute a trinomial coefficient.
513Parameters:
514 i - [in]
515 j - [in]
516 k - [in]
517Returns:
518 (i+j+k)!/(i!j!k!), if 0 <= i, 0 <= j and 0<= k, and 0 otherwise.
519See Also:
520 ON_BinomialCoefficient()
521Remarks:
522 The trinomial coefficient is computed using the formula
523
524 (i+j+k)! (i+j+k)! (j+k)!
525 -------- = -------- * -------
526 i! j! k! i! (j+k)! j! k!
527
528 = ON_BinomialCoefficient(i,j+k)*ON_BinomialCoefficient(j,k)
529
530*/
533 int i,
534 int j,
535 int k
536 );
537
538
541 double, double, // domain
542 double, // parameter in domain
543 double*, double* // parameter tolerance (tminus, tplus) returned here
544 );
545
546
549 int, // dim
550 ON_BOOL32, // true for homogeneous rational points
551 int, // count
552 int, // stride
553 const float*
554 );
555
558 int, // dim
559 ON_BOOL32, // true for homogeneous rational points
560 int, // count
561 int, // stride
562 const double*
563 );
564
565/*
566Description:
567 Determine if a list of points is planar.
568Parameters:
569 bRational - [in]
570 false if the points are euclidean (x,y,z)
571 true if the points are homogeneous rational (x,y,z,w)
572 point_count - [in]
573 number of points
574 point_stride - [in]
575 number of doubles between point x coordinates
576 first point's x coordinate = points[0],
577 second point's x coordinate = points[point_stride],...
578 points - [in]
579 point coordinates (3d or 4d homogeneous rational)
580 boxMin - [in]
581 boxMax - [in]
582 optional 3d bounding box - pass nulls if not readily available
583 tolerance - [in] >= 0.0
584 plane_equation0 - [in]
585 If you want to test for planarity in a specific plane,
586 pass the plane equation in here. If you want to find
587 a plane containing the points, pass null here.
588 plane_equation - [out]
589 If this point is not null, then the equation of the plane
590 containing the points is retuened here.
591Returns:
592 0 - points are not coplanar to the specified tolerance
593 1 - points are coplanar to the specified tolerance
594 2 - points are colinear to the specified tolerance
595 (in this case, plane_equation is not a unique answer)
596 3 - points are coincident to the specified tolerance
597 (in this case, plane_equation is not a unique answer)
598*/
601 bool bRational,
602 int count,
603 int stride,
604 const double* points,
605 const double* boxMin,
606 const double* boxMax,
607 double tolerance,
608 ON_PlaneEquation* plane_equation
609 );
610
613 int, // dim
614 ON_BOOL32, // true for homogeneous rational points
615 int, int, // point_count0, point_count1,
616 int, int, // point_stride0, point_stride1,
617 const double*
618 );
619
622 int, // dim
623 ON_BOOL32, // true for homogeneous rational points
624 int, // count
625 int, // stride
626 double*
627 );
628
631 int, // dim
632 ON_BOOL32, // true for homogeneous rational points
633 int, int, // point_count0, point_count1,
634 int, int, // point_stride0, point_stride1,
635 double*,
636 int // dir = 0 or 1
637 );
638
641 int, // count
642 int, // stride
643 float*,
644 int, int // coordinates to swap
645 );
646
649 int, // count
650 int, // stride
651 double*,
652 int, int // coordinates to swap
653 );
654
657 int, int, // point_count0, point_count1,
658 int, int, // point_stride0, point_stride1,
659 double*,
660 int, int // coordinates to swap
661 );
662
665 int, // dim
666 ON_BOOL32, // true for homogeneous rational points
667 int, // count
668 int, // stride
669 float*,
670 const ON_Xform&
671 );
672
675 int, // dim
676 ON_BOOL32, // true for homogeneous rational points
677 int, // count
678 int, // stride
679 double*,
680 const ON_Xform&
681 );
682
685 int, // dim
686 ON_BOOL32, // true for homogeneous rational points
687 int, int, // point_count0, point_count1,
688 int, int, // point_stride0, point_stride1,
689 double*,
690 const ON_Xform&
691 );
692
695 int, // dim
696 int, // count
697 int, // stride
698 float*,
699 const ON_Xform&
700 );
701
704 int, // dim
705 int, // count
706 int, // stride
707 double*,
708 const ON_Xform&
709 );
710
712int ON_ComparePoint( // returns
713 // -1: first < second
714 // 0: first == second
715 // +1: first > second
716 int, // dim (>=0)
717 ON_BOOL32, // true for rational CVs
718 const double*, // first CV
719 const double* // secont CV
720 );
721
723int ON_ComparePointList( // returns
724 // -1: first < second
725 // 0: first == second
726 // +1: first > second
727 int, // dim (>=0)
728 ON_BOOL32, // true for rational CVs
729 int, // count
730 // first point list
731 int, // stride
732 const double*, // point
733 // second point list
734 int, // stride
735 const double* // point
736 );
737
740 int, // dim
741 int, // true for homogeneos rational points
742 int, // count
743 int, // stride
744 const double*
745 );
746
749 int, // dim
750 ON_BOOL32, // true for homogeneous rational points
751 int, int, // point_count0, point_count1,
752 int, int, // point_stride0, point_stride1,
753 const double*,
754 int // dir = 0 or 1
755 );
756
758int ON_SolveQuadraticEquation( // solve a*X^2 + b*X + c = 0
759 // returns 0: two distinct real roots (r0 < r1)
760 // 1: one real root (r0 = r1)
761 // 2: two complex conjugate roots (r0 +/- (r1)*sqrt(-1))
762 // -1: failure - a = 0, b != 0 (r0 = r1 = -c/b)
763 // -2: failure - a = 0, b = 0 c != 0 (r0 = r1 = 0.0)
764 // -3: failure - a = 0, b = 0 c = 0 (r0 = r1 = 0.0)
765 double, double, double, // a, b, c
766 double*, double* // roots r0 and r1 returned here
767 );
768
770ON_BOOL32 ON_SolveTriDiagonal( // solve TriDiagMatrix( a,b,c )*X = d
771 int, // dimension of d and X (>=1)
772 int, // number of equations (>=2)
773 double*, // a[n-1] = sub-diagonal (a is modified)
774 const double*, // b[n] = diagonal
775 double*, // c[n-1] = supra-diagonal
776 const double*, // d[n*dim]
777 double* // X[n*dim] = unknowns
778 );
779
780// returns rank - if rank != 2, system is under determined
781// If rank = 2, then solution to
782//
783// a00*x0 + a01*x1 = b0,
784// a10*x0 + a11*x1 = b1
785//
786// is returned
788int ON_Solve2x2(
789 double, double, // a00 a01 = first row of 2x2 matrix
790 double, double, // a10 a11 = second row of 2x2 matrix
791 double, double, // b0 b1
792 double*, double*, // x0, x1 if not NULL, then solution is returned here
793 double* // if not NULL, then pivot_ratio returned here
794 );
795
796// Description:
797// Solves a system of 3 linear equations and 2 unknowns.
798//
799// x*col0[0] + y*col1[0] = d0
800// x*col0[1] + y*col1[1] = d0
801// x*col0[2] + y*col1[2] = d0
802//
803// Parameters:
804// col0 - [in] coefficents for "x" unknown
805// col1 - [in] coefficents for "y" unknown
806// d0 - [in] constants
807// d1 - [in]
808// d2 - [in]
809// x - [out]
810// y - [out]
811// error - [out]
812// pivot_ratio - [out]
813//
814// Returns:
815// rank of the system.
816// If rank != 2, system is under determined
817// If rank = 2, then the solution is
818//
819// (*x)*[col0] + (*y)*[col1]
820// + (*error)*((col0 X col1)/|col0 X col1|)
821// = (d0,d1,d2).
823int ON_Solve3x2(
824 const double[3], // col0
825 const double[3], // col1
826 double, // d0
827 double, // d1
828 double, // d2
829 double*, // x
830 double*, // y
831 double*, // error
832 double* // pivot_ratio
833 );
834
835/*
836Description:
837 Use Gauss-Jordan elimination with full pivoting to solve
838 a system of 3 linear equations and 3 unknowns(x,y,z)
839
840 x*row0[0] + y*row0[1] + z*row0[2] = d0
841 x*row1[0] + y*row1[1] + z*row1[2] = d1
842 x*row2[0] + y*row2[1] + z*row2[2] = d2
843
844Parameters:
845 row0 - [in] first row of 3x3 matrix
846 row1 - [in] second row of 3x3 matrix
847 row2 - [in] third row of 3x3 matrix
848 d0 - [in]
849 d1 - [in]
850 d2 - [in] (d0,d1,d2) right hand column of system
851 x_addr - [in] first unknown
852 y_addr - [in] second unknown
853 z_addr - [in] third unknown
854 pivot_ratio - [out] if not NULL, the pivot ration is
855 returned here. If the pivot ratio is "small",
856 then the matrix may be singular or ill
857 conditioned. You should test the results
858 before you use them. "Small" depends on the
859 precision of the input coefficients and the
860 use of the solution. If you can't figure out
861 what "small" means in your case, then you
862 must check the solution before you use it.
863
864Returns:
865 The rank of the 3x3 matrix (0,1,2, or 3)
866 If ON_Solve3x3() is successful (returns 3), then
867 the solution is returned in
868 (*x_addr, *y_addr, *z_addr)
869 and *pivot_ratio = min(|pivots|)/max(|pivots|).
870 If the return code is < 3, then (0,0,0) is returned
871 as the "solution".
872
873See Also:
874 ON_Solve2x2
875 ON_Solve3x2
876 ON_Solve4x4
877*/
879int ON_Solve3x3(
880 const double row0[3],
881 const double row1[3],
882 const double row2[3],
883 double d0,
884 double d1,
885 double d2,
886 double* x_addr,
887 double* y_addr,
888 double* z_addr,
889 double* pivot_ratio
890 );
891
892/*
893Description:
894 Use Gauss-Jordan elimination with full pivoting to solve
895 a system of 4 linear equations and 4 unknowns(x,y,z,w)
896
897 x*row0[0] + y*row0[1] + z*row0[2] + w*row0[3] = d0
898 x*row1[0] + y*row1[1] + z*row1[2] + w*row1[3] = d1
899 x*row2[0] + y*row2[1] + z*row2[2] + w*row2[3] = d2
900 x*row3[0] + y*row3[1] + z*row3[2] + w*row3[2] = d3
901
902Parameters:
903 row0 - [in] first row of 4x4 matrix
904 row1 - [in] second row of 4x4 matrix
905 row2 - [in] third row of 4x4 matrix
906 row3 - [in] forth row of 4x4 matrix
907 d0 - [in]
908 d1 - [in]
909 d2 - [in]
910 d3 - [in] (d0,d1,d2,d3) right hand column of system
911 x_addr - [in] first unknown
912 y_addr - [in] second unknown
913 z_addr - [in] third unknown
914 w_addr - [in] forth unknown
915 pivot_ratio - [out] if not NULL, the pivot ration is
916 returned here. If the pivot ratio is "small",
917 then the matrix may be singular or ill
918 conditioned. You should test the results
919 before you use them. "Small" depends on the
920 precision of the input coefficients and the
921 use of the solution. If you can't figure out
922 what "small" means in your case, then you
923 must check the solution before you use it.
924
925Returns:
926 The rank of the 4x4 matrix (0,1,2,3, or 4)
927 If ON_Solve4x4() is successful (returns 4), then
928 the solution is returned in
929 (*x_addr, *y_addr, *z_addr, *w_addr)
930 and *pivot_ratio = min(|pivots|)/max(|pivots|).
931 If the return code is < 4, then, it a solution exists,
932 on is returned. However YOU MUST CHECK THE SOLUTION
933 IF THE RETURN CODE IS < 4.
934
935See Also:
936 ON_Solve2x2
937 ON_Solve3x2
938 ON_Solve3x3
939*/
941int
943 const double row0[4],
944 const double row1[4],
945 const double row2[4],
946 const double row3[4],
947 double d0,
948 double d1,
949 double d2,
950 double d3,
951 double* x_addr,
952 double* y_addr,
953 double* z_addr,
954 double* w_addr,
955 double* pivot_ratio
956 );
957
958/*
959Description:
960 Use Gauss-Jordan elimination to find a numerical
961 solution to M*X = B where M is a n x n matrix,
962 B is a known n-dimensional vector and X is
963 an unknown.
964Paramters:
965 bFullPivot - [in] if true, full pivoting is used,
966 otherwise partial pivoting is used. In rare
967 cases full pivoting can produce a more accurate
968 answer and never produces a less accurate answer.
969 However full pivoting is slower. If speed is an
970 issue, then experiement with bFullPivot=false
971 and see if it makes a difference. Otherwise,
972 set it to true.
973 bNormalize - [in]
974 If bNormalize is true, then the rows of the
975 matrix are scaled so the sum of their squares
976 is one. This doesn't make the solution more
977 accurate but in some cases it makes the pivot
978 ratio more meaningful. Set bNormalize to
979 false unless you have a reason for setting it
980 to true.
981 n - [in] size of the matrix and vectors.
982 M - [in] n x n matrix. The values in M are
983 changed as the solution is calculated.
984 If you need to preserve M for future use,
985 pass in a copy.
986 B - [in] n-dimensional vector. The values in
987 B are changed as the solution is calculated.
988 If you need to preserve B for future use,
989 pass in a copy.
990 X - [out] solution to M*X = B.
991Returns:
992 If the returned value is <= 0.0, the input matrix
993 has rank < n and no solution is returned in X.
994 If the returned value is > 0.0, then a solution is
995 returned in X and the returned value is the ratio
996 (minimum pivot)/(maximum pivot). This value is
997 called the pivot ratio and will be denoted "pr"
998 the discussion below. If pr <= 1e-15, then
999 M was nearly degenerate and the solution should be
1000 used with caution. If an accurate solution is
1001 critcial, then check the solution anytime pr <= 1e-10
1002 In general, the difference between M*X and B will be
1003 reasonably small. However, when the pr is small
1004 there tend to be vector E, substantually different
1005 from zero, such that M*(X+E) - B is also reasonably
1006 small.
1007See Also:
1008 ON_Solve2x2
1009 ON_Solve3x3
1010 ON_Solve4x4
1011 ON_Solve3x2
1012*/
1013ON_DECL
1014double ON_SolveNxN(bool bFullPivot, bool bNormalize, int n, double* M[], double B[], double X[]);
1015
1016
1017// return false if determinant is (nearly) singular
1018ON_DECL
1020 double, // ds o ds
1021 double, // ds o dt
1022 double, // dt o dt
1023 double* // jacobian = determinant ( ds_o_ds ds_o_dt / ds_o_dt dt_o_dt )
1024 );
1025
1026/*
1027Description:
1028 Finds scalars x and y so that the component of V in the plane
1029 of A and B is x*A + y*B.
1030Parameters:
1031 V - [in]
1032 A - [in] nonzero and not parallel to B
1033 B - [in] nonzero and not parallel to A
1034 x - [out]
1035 y - [out]
1036Returns:
1037 1 - The rank of the problem is 2. The decomposition is unique.
1038 0 - The rank less than 2. Either there is no solution or there
1039 are infinitely many solutions.
1040
1041See Also:
1042 ON_Solve2x2
1043*/
1044ON_DECL
1046 const ON_3dVector& V,
1047 const ON_3dVector& A,
1048 const ON_3dVector& B,
1049 double* x, double* y
1050 );
1051
1052
1053/*
1054Description:
1055 Evaluate partial derivatives of surface unit normal
1056Parameters:
1057 ds - [in]
1058 dt - [in] surface first partial derivatives
1059 dss - [in]
1060 dst - [in]
1061 dtt - [in] surface second partial derivatives
1062 ns - [out]
1063 nt - [out] First partial derivatives of surface unit normal
1064 (If the Jacobian is degenerate, ns and nt are set to zero.)
1065Returns:
1066 true if Jacobian is nondegenerate
1067 false if Jacobian is degenerate
1068*/
1069ON_DECL
1071 const ON_3dVector& ds,
1072 const ON_3dVector& dt,
1073 const ON_3dVector& dss,
1074 const ON_3dVector& dst,
1075 const ON_3dVector& dtt,
1076 ON_3dVector& ns,
1077 ON_3dVector& nt
1078 );
1079
1080ON_DECL
1081ON_BOOL32
1082ON_Pullback3dVector( // use to pull 3d vector back to surface parameter space
1083 const ON_3dVector&, // 3d vector
1084 double, // signed distance from vector location to closet point on surface
1085 // < 0 if point is below with respect to Du x Dv
1086 const ON_3dVector&, // ds surface first partials
1087 const ON_3dVector&, // dt
1088 const ON_3dVector&, // dss surface 2nd partials
1089 const ON_3dVector&, // dst (used only when dist != 0)
1090 const ON_3dVector&, // dtt
1091 ON_2dVector& // pullback
1092 );
1093
1094ON_DECL
1095ON_BOOL32
1097 double, // t0 domain
1098 double, // t1
1099 double, // t parameter in domain
1100 double*, // tminus parameter tolerance (tminus, tplus) returned here
1101 double* // tplus
1102 );
1103
1104
1105ON_DECL
1107 int, // limit_dir 0=default,1=from quadrant I, 2 = from quadrant II, ...
1108 const ON_3dVector&, const ON_3dVector&, // first partials (Du,Dv)
1109 const ON_3dVector&, const ON_3dVector&, const ON_3dVector&, // optional second partials (Duu, Duv, Dvv)
1110 ON_3dVector& // unit normal returned here
1111 );
1112
1113// returns false if first derivtive is zero
1114ON_DECL
1116 const ON_3dVector&, // first derivative
1117 const ON_3dVector&, // second derivative
1118 ON_3dVector&, // Unit tangent returned here
1119 ON_3dVector& // Curvature returned here
1120 );
1121
1122ON_DECL
1124 const ON_3dVector&, // Ds,
1125 const ON_3dVector&, // Dt,
1126 const ON_3dVector&, // Dss,
1127 const ON_3dVector&, // Dst,
1128 const ON_3dVector&, // Dtt,
1129 const ON_3dVector&, // N, // unit normal to surface (use ON_EvNormal())
1130 double*, // gauss, // = Gaussian curvature = kappa1*kappa2
1131 double*, // mean, // = mean curvature = (kappa1+kappa2)/2
1132 double*, // kappa1, // = largest principal curvature value (may be negative)
1133 double*, // kappa2, // = smallest principal curvature value (may be negative)
1134 ON_3dVector&, // K1, // kappa1 unit principal curvature direction
1135 ON_3dVector& // K2 // kappa2 unit principal curvature direction
1136 // output K1,K2,N is right handed frame
1137 );
1138
1139ON_DECL
1141 const ON_3dVector&, // Ds,
1142 const ON_3dVector&, // Dt,
1143 double l, // Dss*N Second fundamental form coefficients
1144 double m, // Dst*N,
1145 double n, // Dtt*N,
1146 const ON_3dVector&, // N, // unit normal to surface (use ON_EvNormal())
1147 double*, // gauss, // = Gaussian curvature = kappa1*kappa2
1148 double*, // mean, // = mean curvature = (kappa1+kappa2)/2
1149 double*, // kappa1, // = largest principal curvature value (may be negative)
1150 double*, // kappa2, // = smallest principal curvature value (may be negative)
1151 ON_3dVector&, // K1, // kappa1 unit principal curvature direction
1152 ON_3dVector& // K2 // kappa2 unit principal curvature direction
1153 // output K1,K2,N is right handed frame
1154 );
1155
1156/*
1157Description:
1158 Evaluate sectional curvature from surface derivatives and
1159 section plane normal.
1160Parameters:
1161 S10, S01 - [in]
1162 surface 1st partial derivatives
1163 S20, S11, S02 - [in]
1164 surface 2nd partial derivatives
1165 planeNormal - [in]
1166 unit normal to section plane
1167 K - [out] Sectional curvature
1168 Curvature of the intersection curve of the surface
1169 and plane through the surface point where the partial
1170 derivatives were evaluationed.
1171Returns:
1172 True if successful.
1173 False if first partials are not linearly independent, in
1174 which case the K is set to zero.
1175*/
1176ON_DECL
1178 const ON_3dVector& S10,
1179 const ON_3dVector& S01,
1180 const ON_3dVector& S20,
1181 const ON_3dVector& S11,
1182 const ON_3dVector& S02,
1183 const ON_3dVector& planeNormal,
1184 ON_3dVector& K
1185 );
1186
1187
1188ON_DECL
1190 const ON_3dVector&, // surface 1rst partial (Ds)
1191 const ON_3dVector&, // surface 1rst partial (Dt)
1192 const ON_3dVector&, // surface 1rst partial (Dss)
1193 const ON_3dVector&, // surface 1rst partial (Dst)
1194 const ON_3dVector&, // surface 1rst partial (Dtt)
1195 const ON_3dVector&, // surface unit normal
1196 const ON_3dVector& // unit tangent direction
1197 );
1198
1199/*
1200Description:
1201 Determing if two curvatrues are different enough
1202 to qualify as a curvature discontinuity.
1203Parameters:
1204 Km - [in]
1205 Kp - [in]
1206 Km and Kp should be curvatures evaluated at the same
1207 parameters using limits from below (minus) and above (plus).
1208 The assumption is that you have already compared the
1209 tangents and consider to curve to be G1 at the point
1210 in question.
1211 cos_angle_tolerance - [in]
1212 Used to decide if Km and Kp are parallel.
1213 If Km o Kp <= cos_angle_tolerance*|Km|*|Kp|,
1214 then true is returned because Km and Kp are considered
1215 not parallel. Use something like cos(angle tolerance)
1216 for this parameter.
1217 curvature_tolerance - [in] (ignored if < 0.0)
1218 If curvature_tolerance >= 0 and (Kp-Km).Length() <= curvature_tolerance,
1219 then false is returned.
1220 zero_curvature - [in] (ignored if < 2^-110 = 7.7037197787136e-34)
1221 If |K| <= zero_curvature, then K is treated as zero.
1222 radius_tolerance - [in] (ignored if < 0.0)
1223 If the unit directions of Km and Kp agree to 3 decimal places
1224 and the difference between the radii of curvature are
1225 <= radius_tolerance, then false is returned.
1226Returns:
1227 False if the curvatures should be considered G2.
1228 True if the curvatures are different enough that the curve should be
1229 considered not G2.
1230 In addition to the tests described under the curvature_tolerance and
1231 radius_tolerance checks, other hurestic tests are used.
1232*/
1233ON_DECL
1235 const ON_3dVector Km,
1236 const ON_3dVector Kp,
1237 double cos_angle_tolerance,
1238 double curvature_tolerance,
1239 double zero_curvature,
1240 double radius_tolerance
1241 );
1242
1243/*
1244Description:
1245 Test curve continuity from derivative values.
1246Parameters:
1247 c - [in] type of continuity to test for. Read ON::continuity
1248 comments for details.
1249 Pa - [in] point on curve A.
1250 D1a - [in] first derviative of curve A.
1251 D1a - [in] second derviative of curve A.
1252 Pb - [in] point on curve B.
1253 D1b - [in] first derviative of curve B.
1254 D1b - [in] second derviative of curve B.
1255 point_tolerance - [in] if the distance between two points is
1256 greater than point_tolerance, then the curve is not C0.
1257 d1_tolerance - [in] if the difference between two first derivatives is
1258 greater than d1_tolerance, then the curve is not C1.
1259 d2_tolerance - [in] if the difference between two second derivatives is
1260 greater than d2_tolerance, then the curve is not C2.
1261 cos_angle_tolerance - [in] default = cos(1 degree) Used only when
1262 c is ON::G1_continuous or ON::G2_continuous. If the cosine
1263 of the angle between two tangent vectors
1264 is <= cos_angle_tolerance, then a G1 discontinuity is reported.
1265 curvature_tolerance - [in] (default = ON_SQRT_EPSILON) Used only when
1266 c is ON::G2_continuous. If K0 and K1 are curvatures evaluated
1267 from above and below and |K0 - K1| > curvature_tolerance,
1268 then a curvature discontinuity is reported.
1269Returns:
1270 true if the curve has at least the c type continuity at
1271 the parameter t.
1272*/
1273ON_DECL
1275 ON::continuity c,
1276 ON_3dPoint Pa,
1277 ON_3dVector D1a,
1278 ON_3dVector D2a,
1279 ON_3dPoint Pb,
1280 ON_3dVector D1b,
1281 ON_3dVector D2b,
1282 double point_tolerance=ON_ZERO_TOLERANCE,
1283 double d1_tolerance=ON_ZERO_TOLERANCE,
1284 double d2_tolerance=ON_ZERO_TOLERANCE,
1285 double cos_angle_tolerance=0.99984769515639123915701155881391,
1286 double curvature_tolerance=ON_SQRT_EPSILON
1287 );
1288
1289
1290ON_DECL
1291int ON_Compare2dex( const ON_2dex* a, const ON_2dex* b);
1292
1293ON_DECL
1294int ON_Compare3dex( const ON_3dex* a, const ON_3dex* b);
1295
1296/*
1297Description:
1298 Sort an index array.
1299Parameters
1300 method - [in]
1301 ON::heap_sort or ON::quick_sort
1302 index - [out]
1303 Pass in an array of count integers. The returned
1304 index[] is a permutation of (0,1,..,count-1)
1305 such that compare(B[index[i]],B[index[i+1]) <= 0
1306 where B[i] = base + i*sizeof_element
1307 base - [in]
1308 array of count elements
1309 count - [in]
1310 number of elements in the index[] and base[] arrays
1311 sizeof_element - [in]
1312 number of bytes between consecutive elements in the
1313 base[] array.
1314 compare - [in]
1315 Comparison function a la qsort().
1316*/
1317ON_DECL
1318void ON_Sort(
1319 ON::sort_algorithm method, // ON::heap_sort or ON::quick_sort,
1320 int* index,
1321 const void* base,
1322 size_t count,
1323 size_t sizeof_element,
1324 int (*compare)(const void*,const void*) // int compar(const void*,const void*)
1325 );
1326
1327/*
1328Description:
1329 Sort an index array using a compare function
1330 that takes an additional pointer that can be used to
1331 pass extra informtation.
1332Parameters
1333 method - [in]
1334 ON::heap_sort or ON::quick_sort
1335 index - [out]
1336 Pass in an array of count integers. The returned
1337 index[] is a permutation of (0,1,..,count-1)
1338 such that compare(B[index[i]],B[index[i+1]) <= 0
1339 where B[i] = base + i*sizeof_element
1340 base - [in]
1341 array of count elements
1342 count - [in]
1343 number of elements in the index[] and base[] arrays
1344 sizeof_element - [in]
1345 number of bytes between consecutive elements in the
1346 base[] array.
1347 compare - [in]
1348 Comparison function a la qsort(). The context parameter
1349 is pass as the third argument.
1350 context - [in]
1351 pointer passed as the third argument to compare().
1352*/
1353ON_DECL
1354void ON_Sort(
1355 ON::sort_algorithm method, // ON::heap_sort or ON::quick_sort,
1356 int* index,
1357 const void* base,
1358 size_t count,
1359 size_t sizeof_element,
1360 int (*compare)(const void*,const void*,void*), // int compar(const void* a,const void* b, void* ptr)
1361 void* context
1362 );
1363
1364/*
1365Description:
1366 heap sort analogue of qsort()
1367Parameters
1368 base - [in]
1369 array of count elements
1370 count - [in]
1371 number of elements in the index[] and base[] arrays
1372 sizeof_element - [in]
1373 number of bytes between consecutive elements in the
1374 base[] array.
1375 compare - [in]
1376 Comparison function a la qsort(). The context parameter
1377 is pass as the third argument.
1378 context - [in]
1379 pointer passed as the third argument to compare().
1380*/
1381ON_DECL
1382void ON_hsort(
1383 void* base,
1384 size_t count,
1385 size_t sizeof_element,
1386 int (*compare)(const void*,const void*)
1387 );
1388
1389/*
1390Description:
1391 heap sort analogue of qsort() with a compare function
1392 that takes an additional pointer that can be used to
1393 pass extra informtation.
1394Parameters
1395 base - [in]
1396 array of count elements
1397 count - [in]
1398 number of elements in the index[] and base[] arrays
1399 sizeof_element - [in]
1400 number of bytes between consecutive elements in the
1401 base[] array.
1402 compare - [in]
1403 Comparison function a la qsort(). The context parameter
1404 is passed as the first argument.
1405 context - [in]
1406 pointer passed as the first argument to compare().
1407*/
1408ON_DECL
1409void ON_hsort(
1410 void* base,
1411 size_t count,
1412 size_t sizeof_element,
1413 int (*compare)(void*,const void*,const void*),
1414 void* context
1415 );
1416
1417/*
1418Description:
1419 Quick sort an array
1420Parameters
1421 base - [in]
1422 array of count elements
1423 count - [in]
1424 number of elements in the index[] and base[] arrays
1425 sizeof_element - [in]
1426 number of bytes between consecutive elements in the
1427 base[] array.
1428 compare - [in]
1429 Comparison function a la qsort(). The context parameter
1430 is pass as the third argument.
1431 context - [in]
1432 pointer passed as the third argument to compare().
1433*/
1434ON_DECL
1435void ON_qsort(
1436 void* base,
1437 size_t count,
1438 size_t sizeof_element,
1439 int (*compare)(const void*,const void*)
1440 );
1441
1442/*
1443Description:
1444 Quick sort an array with a compare function
1445 that takes an additional pointer that can be used to
1446 pass extra informtation.
1447Parameters
1448 base - [in]
1449 array of count elements
1450 count - [in]
1451 number of elements in the index[] and base[] arrays
1452 sizeof_element - [in]
1453 number of bytes between consecutive elements in the
1454 base[] array.
1455 compare - [in]
1456 Comparison function a la qsort(). The context parameter
1457 is passed as the first argument.
1458 context - [in]
1459 pointer passed as the first argument to compare().
1460*/
1461ON_DECL
1462void ON_qsort(
1463 void* base,
1464 size_t count,
1465 size_t sizeof_element,
1466 int (*compare)(void*,const void*,const void*),
1467 void* context
1468 );
1469
1470// heap sort array of doubles in place
1471ON_DECL
1472void ON_SortDoubleArray(
1473 ON::sort_algorithm, // ON::heap_sort or ON::quick_sort,
1474 double*, // array of doubles
1475 size_t // length of array
1476 );
1477
1478ON_DECL
1479void ON_SortIntArray(
1480 ON::sort_algorithm, // ON::heap_sort or ON::quick_sort,
1481 int*, // array of doubles
1482 size_t // length of array
1483 );
1484
1485ON_DECL
1487 ON::sort_algorithm, // ON::heap_sort or ON::quick_sort,
1488 unsigned int*, // array of doubles
1489 size_t // length of array
1490 );
1491
1492ON_DECL
1494 ON::sort_algorithm, // ON::heap_sort or ON::quick_sort,
1495 char**, // array of doubles
1496 size_t // length of array
1497 );
1498
1499ON_DECL
1500const int* ON_BinarySearchIntArray(
1501 int key,
1502 const int* base,
1503 size_t nel
1504 );
1505
1506ON_DECL
1507const unsigned int* ON_BinarySearchUnsignedIntArray(
1508 unsigned int key,
1509 const unsigned int* base,
1510 size_t nel
1511 );
1512
1513ON_DECL
1515 double key,
1516 const double* base,
1517 size_t nel
1518 );
1519
1520ON_DECL
1522 int key_i,
1523 const ON_2dex* base,
1524 size_t nel
1525 );
1526
1527// These simple intersectors are fast and detect transverse intersections.
1528// If the intersection is not a simple transverse case, then they
1529// return false and you will have to use one of the slower but fancier
1530// models.
1531
1532// returns closest points between the two infinite lines
1533ON_DECL
1534bool ON_Intersect(
1535 const ON_Line&,
1536 const ON_Line&,
1537 double*, // parameter on first line
1538 double* // parameter on second line
1539 );
1540
1541// Returns false unless intersection is a single point
1542// If returned parameter is < 0 or > 1, then the line
1543// segment between line.m_point[0] and line.m_point[1]
1544// does not intersect the plane
1545ON_DECL
1546bool ON_Intersect(
1547 const ON_Line&,
1548 const ON_Plane&,
1549 double* // parameter on line
1550 );
1551
1552ON_DECL
1553bool ON_Intersect(
1554 const ON_Plane&,
1555 const ON_Plane&,
1556 ON_Line& // intersection line is returned here
1557 );
1558
1559ON_DECL
1560bool ON_Intersect(
1561 const ON_Plane&,
1562 const ON_Plane&,
1563 const ON_Plane&,
1564 ON_3dPoint& // intersection point is returned here
1565 );
1566
1567// returns 0 = no intersections,
1568// 1 = intersection = single point,
1569// 2 = intersection = circle
1570// If 0 is returned, returned circle has radius=0
1571// and center = point on sphere closest to plane.
1572// If 1 is returned, intersection is a single
1573// point and returned circle has radius=0
1574// and center = intersection point on sphere.
1575ON_DECL
1576int ON_Intersect(
1577 const ON_Plane&, const ON_Sphere&, ON_Circle&
1578 );
1579
1580// Intersects an infinte line and sphere and returns
1581// 0 = no intersections,
1582// 1 = one intersection,
1583// 2 = 2 intersections
1584// If 0 is returned, first point is point
1585// on line closest to sphere and 2nd point is the point
1586// on the sphere closest to the line.
1587// If 1 is returned, first point is obtained by evaluating
1588// the line and the second point is obtained by evaluating
1589// the sphere.
1590ON_DECL
1591int ON_Intersect(
1592 const ON_Line&,
1593 const ON_Sphere&,
1594 ON_3dPoint&,
1595 ON_3dPoint& // intersection point(s) returned here
1596 );
1597
1598
1599// Intersects an infinte line and cylinder and returns
1600// 0 = no intersections,
1601// 1 = one intersection,
1602// 2 = 2 intersections
1603// 3 = line lies on cylinder
1604//
1605// If 0 is returned, first point is point
1606// on line closest to cylinder and 2nd point is the point
1607// on the cylinder closest to the line.
1608// If 1 is returned, first point is obtained by evaluating
1609// the line and the second point is obtained by evaluating
1610// the cylinder.
1611//
1612// The value of cylinder.IsFinite() determines if the
1613// intersection is performed on the finite or infinite cylinder.
1614ON_DECL
1615int ON_Intersect(
1616 const ON_Line&, // [in]
1617 const ON_Cylinder&, // [in]
1618 ON_3dPoint&, // [out] first intersection point
1619 ON_3dPoint& // [out] second intersection point
1620 );
1621
1622// Description:
1623// Intersect an infinte line and circle.
1624// Parameters:
1625// line - [in]
1626// circle - [in]
1627// line_t0 - [out] line parameter of first intersection point
1628// circle_point0 - [out] first intersection point on circle
1629// line_t1 - [out] line parameter of second intersection point
1630// circle_point1 - [out] second intersection point on circle
1631// Returns:
1632// 0 No intersection
1633// 1 One intersection at line.PointAt(*line_t0)
1634// 2 Two intersections at line.PointAt(*line_t0)
1635// and line.PointAt(*line_t1).
1636ON_DECL
1637int ON_Intersect(
1638 const ON_Line& line,
1639 const ON_Circle& circle,
1640 double* line_t0,
1641 ON_3dPoint& circle_point0,
1642 double* line_t1,
1643 ON_3dPoint& circle_point1
1644 );
1645
1646
1647
1648// Description:
1649// Intersect a infinte line and arc.
1650// Parameters:
1651// line - [in]
1652// arc - [in]
1653// line_t0 - [out] line parameter of first intersection point
1654// arc_point0 - [out] first intersection point on arc
1655// line_t1 - [out] line parameter of second intersection point
1656// arc_point1 - [out] second intersection point on arc
1657// Returns:
1658// 0 No intersection
1659// 1 One intersection at line.PointAt(*line_t0)
1660// 2 Two intersections at line.PointAt(*line_t0)
1661// and line.PointAt(*line_t1).
1662ON_DECL
1663int ON_Intersect(
1664 const ON_Line& line,
1665 const ON_Arc& arc,
1666 double* line_t0,
1667 ON_3dPoint& arc_point0,
1668 double* line_t1,
1669 ON_3dPoint& arc_point1
1670 );
1671
1672// Description:
1673// Intersect a plane and a circle.
1674// Parameters:
1675// plane - [in]
1676// circle - [in]
1677// point0 - [out] first intersection point
1678// point1 - [out] second intersection point
1679// Returns:
1680// 0 No intersection
1681// 1 One intersection at point0
1682// 2 Two intersections at point0
1683// and point1.
1684// 3 Circle lies on plane
1685ON_DECL
1686int ON_Intersect(
1687 const ON_Plane& plane,
1688 const ON_Circle& circle,
1689 ON_3dPoint& point0,
1690 ON_3dPoint& point1
1691 );
1692
1693// Description:
1694// Intersect a plane and an arc.
1695// Parameters:
1696// plane - [in]
1697// arc - [in]
1698// point0 - [out] first intersection point
1699// point1 - [out] second intersection point
1700// Returns:
1701// 0 No intersection
1702// 1 One intersection at point0
1703// 2 Two intersections at point0
1704// and point1.
1705// 3 Arc lies on plane
1706ON_DECL
1707int ON_Intersect(
1708 const ON_Plane& plane,
1709 const ON_Arc& arc,
1710 ON_3dPoint& point0,
1711 ON_3dPoint& point1
1712 );
1713
1714
1715// returns 0 = no, 1 = yes, 2 = points are coincident and on line
1716ON_DECL
1718 int, // dimension of points
1719 int, // is_rat = true if homogeneous rational
1720 int, // count = number of points
1721 int, // stride ( >= is_rat?(dim+1) :dim)
1722 const double*, // point array
1723 const ON_BoundingBox&, // if needed, use ON_GetBoundingBox(dim,is_rat,count,stride,point)
1724 const ON_Line&,
1725 double // tolerance (if 0.0, a tolerance based on bounding box size is used)
1726 );
1727
1728// returns 0 = no, 1 = yes, 2 = points are coincident and on line
1729ON_DECL
1731 int, // dimension of points
1732 int, // is_rat = true if homogeneous rational
1733 int, // count = number of points
1734 int, // stride ( >= is_rat?(dim+1) :dim)
1735 const double*, // point array
1736 const ON_BoundingBox&, // if needed, use ON_GetBoundingBox(dim,is_rat,count,stride,point)
1737 const ON_Plane&,
1738 double // tolerance (if 0.0, a tolerance based on bounding box size is used)
1739 );
1740
1741/*
1742Description:
1743 Use the quotient rule to compute derivatives of a one parameter
1744 rational function F(t) = X(t)/W(t), where W is a scalar
1745 and F and X are vectors of dimension dim.
1746Parameters:
1747 dim - [in]
1748 der_count - [in] number of derivative (>=0)
1749 v_stride - [in] (>= dim+1)
1750 v - [in/out]
1751 v[] is an array of length (der_count+1)*v_stride.
1752 The input v[] array contains derivatives of the numerator and
1753 denominator functions in the order (X, W), (Xt, Wt), (Xtt, Wtt), ...
1754 In general, the (dim+1) coordinates of the d-th derivative
1755 are in (v[n],...,v[n+dim]) where n = d*v_stride.
1756 In the output v[] array the derivatives of X are replaced with
1757 the derivatives of F and the derivatives of W are divided by
1758 w = v[dim].
1759Returns:
1760 True if input is valid; i.e., v[dim] != 0.
1761See Also:
1762 ON_EvaluateQuotientRule2
1763 ON_EvaluateQuotientRule3
1764*/
1765ON_DECL
1767 int dim,
1768 int der_count,
1769 int v_stride,
1770 double *v
1771 );
1772
1773/*
1774Description:
1775 Use the quotient rule to compute partial derivatives of a two parameter
1776 rational function F(s,t) = X(s,t)/W(s,t), where W is a scalar
1777 and F and X are vectors of dimension dim.
1778Parameters:
1779 dim - [in]
1780 der_count - [in] number of derivative (>=0)
1781 v_stride - [in] (>= dim+1)
1782 v - [in/out]
1783 v[] is an array of length (der_count+2)*(der_count+1)*v_stride.
1784 The input array contains derivatives of the numerator and denominator
1785 functions in the order X, W, Xs, Ws, Xt, Wt, Xss, Wss, Xst, Wst, Xtt, Wtt, ...
1786 In general, the (i,j)-th derivatives are in the (dim+1) entries of v[]
1787 v[k], ..., answer[k+dim], where k = ((i+j)*(i+j+1)/2 + j)*v_stride.
1788 In the output v[] array the derivatives of X are replaced with
1789 the derivatives of F and the derivatives of W are divided by
1790 w = v[dim].
1791Returns:
1792 True if input is valid; i.e., v[dim] != 0.
1793See Also:
1794 ON_EvaluateQuotientRule
1795 ON_EvaluateQuotientRule3
1796*/
1797ON_DECL
1799 int dim,
1800 int der_count,
1801 int v_stride,
1802 double *v
1803 );
1804
1805/*
1806Description:
1807 Use the quotient rule to compute partial derivatives of a 3 parameter
1808 rational function F(r,s,t) = X(r,s,t)/W(r,s,t), where W is a scalar
1809 and F and X are vectors of dimension dim.
1810Parameters:
1811 dim - [in]
1812 der_count - [in] number of derivative (>=0)
1813 v_stride - [in] (>= dim+1)
1814 v - [in/out]
1815 v[] is an array of length
1816 v_stride*(der_count+1)*(der_count+2)*(der_count+3)/6.
1817 The input v[] array contains derivatives of the numerator and
1818 denominator functions in the order (X, W), (Xr, Wr), (Xs, Ws),
1819 (Xt, Wt), (Xrr, Wrr), (Xrs, Wrs), (Xrt, Wrt), (Xss, Wss),
1820 (Xst, Wst), (Xtt, Wtt), ...
1821 In general, the (dim+1) coordinates of the derivative
1822 (Dr^i Ds^j Dt^k, i+j+k=d) are at v[n], ..., v[n+dim] where
1823 n = v_stride*( d*(d+1)*(d+2)/6 + (d-i)*(d-i+1)/2 + k ).
1824 In the output v[] array the derivatives of X are replaced with
1825 the derivatives of F and the derivatives of W are divided by
1826 w = v[dim].
1827Returns:
1828 True if input is valid; i.e., v[dim] != 0.
1829See Also:
1830 ON_EvaluateQuotientRule
1831 ON_EvaluateQuotientRule2
1832*/
1833ON_DECL
1835 int dim,
1836 int der_count,
1837 int v_stride,
1838 double *v
1839 );
1840
1841ON_DECL
1843 int, // dimension of points
1844 ON_BOOL32, // bIsRational true if points are homogeneous rational
1845 int, // number of points
1846 int, // stride between points
1847 const double*, // points
1848 double* // length returned here
1849 );
1850
1851
1852/*
1853Description:
1854 Find the index of the point in the point_list that is closest to P.
1855Parameters:
1856 point_count - [in]
1857 point_list - [in]
1858 P - [in]
1859 closest_point_index - [out]
1860Returns:
1861 True if successful and *closest_point_index is set.
1862 False if input is not valid, in which case *closest_point_index
1863 is undefined.
1864*/
1865ON_DECL
1867 int point_count,
1868 const ON_3dPoint* point_list,
1869 ON_3dPoint P,
1870 int* closest_point_index
1871 );
1872
1873/*
1874Description:
1875 Test math library functions.
1876Parameters:
1877 function_index - [in] Determines which math library function is called.
1878
1879 1: z = x+y
1880 2: z = x-y
1881 3: z = x*y
1882 4: z = x/y
1883 5: z = fabs(x)
1884 6: z = exp(x)
1885 7: z = log(x)
1886 8: z = logb(x)
1887 9: z = log10(x)
1888 10: z = pow(x,y)
1889 11: z = sqrt(x)
1890 12: z = sin(x)
1891 13: z = cos(x)
1892 14: z = tan(x)
1893 15: z = sinh(x)
1894 16: z = cosh(x)
1895 17: z = tanh(x)
1896 18: z = asin(x)
1897 19: z = acos(x)
1898 20: z = atan(x)
1899 21: z = atan2(y,x)
1900 22: z = fmod(x,y)
1901 23: z = modf(x,&y)
1902 24: z = frexp(x,&y)
1903
1904 double x - [in]
1905 double y - [in]
1906Returns:
1907 Returns the "z" value listed in the function_index parameter
1908 description.
1909Remarks:
1910 This function is used to test the results of class floating
1911 point functions. It is primarily used to see what happens
1912 when opennurbs is used as a DLL and illegal operations are
1913 performed.
1914*/
1915ON_DECL
1916double ON_TestMathFunction(
1917 int function_index,
1918 double x,
1919 double y
1920 );
1921
1922// If performance is important, then
1923// you are better off using ((b<a)?a:b)
1924ON_DECL double ON_Max(double a, double b);
1925
1926// If performance is important, then
1927// you are better off using ((b<a)?a:b)
1928ON_DECL float ON_Max(float a, float b);
1929
1930// If performance is important, then
1931// you are better off using ((b<a)?a:b)
1932ON_DECL int ON_Max(int a, int b);
1933
1934// If performance is important, then
1935// you are better off using ((a<b)?a:b)
1936ON_DECL double ON_Min(double a, double b);
1937
1938// If performance is important, then
1939// you are better off using ((a<b)?a:b)
1940ON_DECL float ON_Min(float a, float b);
1941
1942// If performance is important, then
1943// you are better off using ((a<b)?a:b)
1944ON_DECL int ON_Min(int a, int b);
1945
1946// Do not call ON_Round() in any opennurbs code, tl code
1947// or any other code that does critical calculations or
1948// when there is any possibility that x is invalid or
1949// fabs(x)>2147483647. Use floor(x+0.5) instead.
1950ON_DECL int ON_Round(double x);
1951
1952
1953/*
1954Description:
1955 Find the equation of the parabola, ellipse or hyperbola
1956 (non-degenerate conic) that passes through six distinct points.
1957Parameters:
1958 stride - [in] (>=2)
1959 points array stride
1960 points2d - [in] (>=2)
1961 i-th point is (points[i*stride],points[i*stride+1])
1962 conic - [out]
1963 Coefficients of the conic equation.
1964 The points on the conic satisfy the equation
1965 0 = conic[0]*x^2 + conic[1]*xy + conic[2]*y^2
1966 + conic[3]*x + conic[4]*y + conic[5]
1967 max_pivot - [out] (can be null)
1968 min_pivot - [out] (can be null)
1969 zero_pivot - [out] (can be null)
1970 If there are some near duplicates in the input point set,
1971 the calculation is not stable. If you want to get an
1972 estimate of the validity of the solution, then inspect
1973 the returned values. max_pivot should around 1,
1974 min_pivot should be > 1e-4 or so, and zero_pivot should
1975 be < 1e-10 or so. If the returned pivots don't satisify
1976 these condtions, then exercise caution when using the
1977 returned solution.
1978Returns:
1979 True if a there is an ellipse, parabola or hyperbola through the
1980 six points.
1981 False if the input is invalid or the conic degenerate (the
1982 points lie on one or two lines).
1983 If false is returned, then conic[0]=...=conic[5] = 0 and
1984 *min_pivot = *max_pivot = *zero_pivot = 0.
1985*/
1987 int stride,
1988 const double* points2d,
1989 double conic[6],
1990 double* max_pivot,
1991 double* min_pivot,
1992 double* zero_pivot
1993 );
1994
1995/*
1996Description:
1997 Test a conic equation to see if it defines and ellipse. If so,
1998 return the center and axes of the ellipse.
1999Parameters:
2000 conic - [in]
2001 Coefficients of the conic equation.
2002 The points on the conic satisfy the equation
2003 0 = conic[0]*x^2 + conic[1]*xy + conic[2]*y^2
2004 + conic[3]*x + conic[4]*y + conic[5]
2005 center - [out]
2006 major_axis - [out]
2007 minor_axis - [out]
2008 major_radius - [out]
2009 minor_radius - [out]
2010Returns:
2011 True if the conic is an ellipse and the center and axes were found.
2012 False if the conic is not an ellipse, in which case the input values
2013 of center, major_axis, minor_axis, major_radius, and minor_radius
2014 are not changed.
2015*/
2017 const double conic[6],
2018 ON_2dPoint& center,
2019 ON_2dVector& major_axis,
2020 ON_2dVector& minor_axis,
2021 double* major_radius,
2022 double* minor_radius
2023 );
2024
2025/*
2026Description:
2027 Get the conic equation of an ellipse.
2028Parameters:
2029 a - [in] (a>0)
2030 b - [in] (b>0)
2031 a and b are the lengths of the axes. Either one
2032 may be largest and they can be equal.
2033 x0 - [in]
2034 y0 - [in]
2035 (x0,y0) is the enter of the ellipse.
2036 alpha - [in] (angle in radians)
2037 When alpha is 0, a corresponds to the x-axis and
2038 b corresponds to the y axis. If alpha is non-zero
2039 it specifies the rotation of these axes.
2040 conic - [out]
2041 Coefficients of the conic equation.
2042 The points on the conic satisfy the equation
2043 0 = conic[0]*x^2 + conic[1]*xy + conic[2]*y^2
2044 + conic[3]*x + conic[4]*y + conic[5]
2045 center - [out]
2046 major_axis - [out]
2047 minor_axis - [out]
2048 major_radius - [out]
2049 minor_radius - [out]
2050Remarks:
2051 Here is the way to evaluate a point on the ellipse:
2052
2053
2054 double t = ellipse paramter in radians;
2055 double x = a*cos(t);
2056 double y = b*sin(t);
2057 ON_2dPoint ellipse_point;
2058 ellipse_point.x = x0 + x*cos(alpha) + y*sin(alpha);
2059 ellipse_point.y = y0 - x*sin(alpha) + y*cos(alpha);
2060
2061Returns:
2062 True if the input is valid and conic[] was filled in.
2063 Falis if the input is not valid. In this case the values in conic[]
2064 are not changed.
2065*/
2067 double a, double b,
2068 double x0, double y0,
2069 double alpha,
2070 double conic[6]
2071 );
2072
2073#endif
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition autostart.js:32
Definition opennurbs_point.h:253
Definition opennurbs_point.h:655
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_arc.h:34
Definition opennurbs_bounding_box.h:25
Definition opennurbs_circle.h:33
Definition opennurbs_cylinder.h:28
Definition opennurbs_math.h:139
ON_Evaluator & operator=(const ON_Evaluator &)
ON_SimpleArray< bool > m_bPeriodicParameter
Definition opennurbs_math.h:321
virtual int Evaluate(const double *parameters, double *values, double **jacobian)=0
const int m_value_count
Definition opennurbs_math.h:263
ON_SimpleArray< ON_Interval > m_domain
Definition opennurbs_math.h:314
const int m_parameter_count
Definition opennurbs_math.h:259
Definition opennurbs_point.h:46
Definition opennurbs_line.h:20
Definition opennurbs_point.h:1169
Definition opennurbs_plane.h:20
Definition opennurbs_array.h:46
Definition opennurbs_sphere.h:22
Definition opennurbs_math.h:36
int m_pos_sum2_count
Definition opennurbs_math.h:116
int m_pos_count
Definition opennurbs_math.h:112
double m_neg_sum
Definition opennurbs_math.h:109
double m_sum_err
Definition opennurbs_math.h:107
int m_pos_sum3_count
Definition opennurbs_math.h:117
int m_zero_count
Definition opennurbs_math.h:111
int m_pos_sum1_count
Definition opennurbs_math.h:115
int m_neg_sum3_count
Definition opennurbs_math.h:124
int m_neg_count
Definition opennurbs_math.h:113
int m_neg_sum2_count
Definition opennurbs_math.h:123
int m_neg_sum1_count
Definition opennurbs_math.h:122
double m_pos_sum
Definition opennurbs_math.h:108
Definition opennurbs_xform.h:28
#define ON_ZERO_TOLERANCE
Definition opennurbs_defines.h:238
#define ON_DECL
Definition opennurbs_defines.h:92
#define ON_CLASS
Definition opennurbs_defines.h:91
#define ON_SQRT_EPSILON
Definition opennurbs_defines.h:147
ON_DECL bool ON_IsCurvatureDiscontinuity(const ON_3dVector Km, const ON_3dVector Kp, double cos_angle_tolerance, double curvature_tolerance, double zero_curvature, double radius_tolerance)
Definition opennurbs_nurbscurve.cpp:1314
ON_DECL double ON_ArrayDistance(int, const double *, const double *)
Definition opennurbs_math.cpp:180
ON_DECL int ON_Compare3dex(const ON_3dex *a, const ON_3dex *b)
Definition opennurbs_math.cpp:3596
ON_DECL bool ON_TransformPointList(int, ON_BOOL32, int, int, float *, const ON_Xform &)
Definition opennurbs_math.cpp:1227
ON_DECL void ON_ArrayScale(int, float, const float *, float *)
Definition opennurbs_math.cpp:323
ON_DECL void ON_SortStringArray(ON::sort_algorithm, char **, size_t)
Definition opennurbs_math.cpp:3699
ON_DECL bool ON_EvSectionalCurvature(const ON_3dVector &S10, const ON_3dVector &S01, const ON_3dVector &S20, const ON_3dVector &S11, const ON_3dVector &S02, const ON_3dVector &planeNormal, ON_3dVector &K)
Definition opennurbs_math.cpp:685
ON_DECL ON_BOOL32 ON_TransformVectorList(int, int, int, float *, const ON_Xform &)
Definition opennurbs_math.cpp:1454
ON_DECL bool ON_GetClosestPointInPointList(int point_count, const ON_3dPoint *point_list, ON_3dPoint P, int *closest_point_index)
Definition opennurbs_pointcloud.cpp:311
ON_DECL double ON_TrinomialCoefficient(int i, int j, int k)
Definition opennurbs_math.cpp:1038
ON_DECL ON_BOOL32 ON_EvCurvature(const ON_3dVector &, const ON_3dVector &, ON_3dVector &, ON_3dVector &)
Definition opennurbs_math.cpp:642
ON_DECL bool ON_Intersect(const ON_Line &, const ON_Line &, double *, double *)
Definition opennurbs_intersect.cpp:202
ON_DECL double ON_ArrayDistanceSquared(int, const double *, const double *)
Definition opennurbs_math.cpp:223
ON_DECL ON_BOOL32 ON_IsPointListClosed(int, int, int, int, const double *)
Definition opennurbs_math.cpp:1636
ON_DECL float ON_ArrayDotProduct(int, const float *, const float *)
Definition opennurbs_math.cpp:311
ON_DECL ON_3dVector ON_NormalCurvature(const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &)
Definition opennurbs_math.cpp:4482
ON_DECL void ON_Sort(ON::sort_algorithm method, int *index, const void *base, size_t count, size_t sizeof_element, int(*compare)(const void *, const void *))
Definition opennurbs_math.cpp:2812
ON_DECL int ON_ArePointsOnLine(int, int, int, int, const double *, const ON_BoundingBox &, const ON_Line &, double)
Definition opennurbs_line.cpp:176
ON_DECL bool ON_EvaluateQuotientRule3(int dim, int der_count, int v_stride, double *v)
Definition opennurbs_math.cpp:3988
ON_DECL int ON_ComparePoint(int, ON_BOOL32, const double *, const double *)
Definition opennurbs_math.cpp:1552
ON_DECL ON_BOOL32 ON_Pullback3dVector(const ON_3dVector &, double, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, ON_2dVector &)
Definition opennurbs_math.cpp:477
ON_DECL const ON_2dex * ON_BinarySearch2dexArray(int key_i, const ON_2dex *base, size_t nel)
Definition opennurbs_array.cpp:1074
ON_DECL ON_BOOL32 ON_SwapPointGridCoordinates(int, int, int, int, double *, int, int)
Definition opennurbs_math.cpp:1201
ON_DECL ON_BOOL32 ON_SolveTriDiagonal(int, int, double *, const double *, double *, const double *, double *)
Definition opennurbs_math.cpp:1812
ON_DECL int ON_SearchMonotoneArray(const double *, int, double)
Definition opennurbs_math.cpp:859
ON_DECL void ON_SortDoubleArray(ON::sort_algorithm, double *, size_t)
Definition opennurbs_math.cpp:3609
ON_DECL void ON_SortUnsignedIntArray(ON::sort_algorithm, unsigned int *, size_t)
Definition opennurbs_math.cpp:3663
ON_DECL int ON_Solve3x3(const double row0[3], const double row1[3], const double row2[3], double d0, double d1, double d2, double *x_addr, double *y_addr, double *z_addr, double *pivot_ratio)
Definition opennurbs_math.cpp:2611
ON_DECL int ON_Compare2dex(const ON_2dex *a, const ON_2dex *b)
Definition opennurbs_math.cpp:3585
ON_DECL ON_BOOL32 ON_EvNormalPartials(const ON_3dVector &ds, const ON_3dVector &dt, const ON_3dVector &dss, const ON_3dVector &dst, const ON_3dVector &dtt, ON_3dVector &ns, ON_3dVector &nt)
Definition opennurbs_math.cpp:418
ON_DECL const int * ON_BinarySearchIntArray(int key, const int *base, size_t nel)
Definition opennurbs_math.cpp:3446
ON_DECL ON_BOOL32 ON_TransformPointGrid(int, ON_BOOL32, int, int, int, int, double *, const ON_Xform &)
Definition opennurbs_math.cpp:1429
ON_DECL bool ON_GetEllipseConicEquation(double a, double b, double x0, double y0, double alpha, double conic[6])
Definition opennurbs_point.cpp:7361
ON_DECL int ON_Solve3x2(const double[3], const double[3], double, double, double, double *, double *, double *, double *)
Definition opennurbs_math.cpp:2026
ON_DECL bool ON_IsValidFloat(float x)
Definition opennurbs_point.cpp:23
ON_DECL int ON_ComparePointList(int, ON_BOOL32, int, int, const double *, int, const double *)
Definition opennurbs_math.cpp:1586
ON_DECL ON_BOOL32 ON_EvJacobian(double, double, double, double *)
Definition opennurbs_math.cpp:363
ON_DECL const unsigned int * ON_BinarySearchUnsignedIntArray(unsigned int key, const unsigned int *base, size_t nel)
Definition opennurbs_math.cpp:3492
ON_DECL double ON_ArrayMagnitude(int, const double *)
Definition opennurbs_math.cpp:235
ON_DECL void ON_qsort(void *base, size_t count, size_t sizeof_element, int(*compare)(const void *, const void *))
Definition opennurbs_math.cpp:2785
ON_DECL double ON_BinomialCoefficient(int i, int j)
Definition opennurbs_math.cpp:937
ON_DECL int ON_Solve2x2(double, double, double, double, double, double, double *, double *, double *)
Definition opennurbs_math.cpp:1930
ON_DECL int ON_ArePointsOnPlane(int, int, int, int, const double *, const ON_BoundingBox &, const ON_Plane &, double)
Definition opennurbs_plane.cpp:577
ON_DECL ON_BOOL32 ON_EvNormal(int, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, ON_3dVector &)
Definition opennurbs_math.cpp:535
ON_DECL double ON_ArrayDotDifference(int, const double *, const double *, const double *)
Definition opennurbs_math.cpp:167
ON_DECL int ON_Solve4x4(const double row0[4], const double row1[4], const double row2[4], const double row3[4], double d0, double d1, double d2, double d3, double *x_addr, double *y_addr, double *z_addr, double *w_addr, double *pivot_ratio)
Definition opennurbs_math.cpp:2313
ON_DECL bool ON_IsConicEquationAnEllipse(const double conic[6], ON_2dPoint &center, ON_2dVector &major_axis, ON_2dVector &minor_axis, double *major_radius, double *minor_radius)
Definition opennurbs_point.cpp:7247
ON_DECL int ON_Round(double x)
Definition opennurbs_math.cpp:4755
ON_DECL bool ON_ReversePointList(int, ON_BOOL32, int, int, double *)
Definition opennurbs_math.cpp:1101
ON_DECL void ON_SortIntArray(ON::sort_algorithm, int *, size_t)
Definition opennurbs_math.cpp:3642
ON_DECL bool ON_EvaluateQuotientRule2(int dim, int der_count, int v_stride, double *v)
Definition opennurbs_math.cpp:3840
ON_DECL void ON_Array_aA_plus_B(int, float, const float *, const float *, float *)
Definition opennurbs_math.cpp:333
ON_DECL ON_BOOL32 ON_IsPointGridClosed(int, ON_BOOL32, int, int, int, int, const double *, int)
Definition opennurbs_math.cpp:1660
ON_DECL double ON_Max(double a, double b)
Definition opennurbs_math.cpp:4726
ON_DECL const double * ON_BinarySearchDoubleArray(double key, const double *base, size_t nel)
ON_DECL bool ON_SwapPointListCoordinates(int, int, float *, int, int)
Definition opennurbs_math.cpp:1159
ON_DECL bool ON_EvaluateQuotientRule(int dim, int der_count, int v_stride, double *v)
Definition opennurbs_math.cpp:3745
ON_DECL void ON_hsort(void *base, size_t count, size_t sizeof_element, int(*compare)(const void *, const void *))
Definition opennurbs_math.cpp:3043
ON_DECL int ON_DecomposeVector(const ON_3dVector &V, const ON_3dVector &A, const ON_3dVector &B, double *x, double *y)
Definition opennurbs_math.cpp:343
ON_DECL bool ON_GetPolylineLength(int, ON_BOOL32, int, int, const double *, double *)
Definition opennurbs_math.cpp:4533
ON_DECL double ON_ArrayMagnitudeSquared(int, const double *)
Definition opennurbs_math.cpp:278
ON_DECL ON_BOOL32 ON_IsValidPointList(int, ON_BOOL32, int, int, const float *)
Definition opennurbs_math.cpp:1049
ON_DECL double ON_TestMathFunction(int function_index, double x, double y)
Definition opennurbs_math.cpp:60
ON_DECL int ON_IsPointListPlanar(bool bRational, int count, int stride, const double *points, const double *boxMin, const double *boxMax, double tolerance, ON_PlaneEquation *plane_equation)
ON_DECL ON_BOOL32 ON_EvPrincipalCurvatures(const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, const ON_3dVector &, double *, double *, double *, double *, ON_3dVector &, ON_3dVector &)
Definition opennurbs_math.cpp:4120
ON_DECL ON_BOOL32 ON_IsValidPointGrid(int, ON_BOOL32, int, int, int, int, const double *)
Definition opennurbs_math.cpp:1075
ON_DECL ON_BOOL32 ON_GetParameterTolerance(double, double, double, double *, double *)
Definition opennurbs_math.cpp:507
ON_DECL ON_BOOL32 ON_ReversePointGrid(int, ON_BOOL32, int, int, int, int, double *, int)
Definition opennurbs_math.cpp:1129
ON_DECL bool ON_IsValid(double x)
Definition opennurbs_point.cpp:18
ON_DECL double ON_Min(double a, double b)
Definition opennurbs_math.cpp:4741
ON_DECL bool ON_GetConicEquationThrough6Points(int stride, const double *points2d, double conic[6], double *max_pivot, double *min_pivot, double *zero_pivot)
Definition opennurbs_point.cpp:6807
ON_DECL ON_BOOL32 ON_IsContinuous(ON::continuity c, ON_3dPoint Pa, ON_3dVector D1a, ON_3dVector D2a, ON_3dPoint Pb, ON_3dVector D1b, ON_3dVector D2b, double point_tolerance=ON_ZERO_TOLERANCE, double d1_tolerance=ON_ZERO_TOLERANCE, double d2_tolerance=ON_ZERO_TOLERANCE, double cos_angle_tolerance=0.99984769515639123915701155881391, double curvature_tolerance=ON_SQRT_EPSILON)
Definition opennurbs_math.cpp:794
ON_DECL double ON_SolveNxN(bool bFullPivot, bool bNormalize, int n, double *M[], double B[], double X[])
Definition opennurbs_math.cpp:2154
ON_DECL int ON_SolveQuadraticEquation(double, double, double, double *, double *)
Definition opennurbs_math.cpp:1695
#define M
Definition opennurbs_rand.cpp:71
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362
Definition opennurbs_defines.h:249
Definition opennurbs_defines.h:261