Assignments Assignments

geometry.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2019, Michael Kazhdan
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7
8 Redistributions of source code must retain the above copyright notice, this list of
9 conditions and the following disclaimer. Redistributions in binary form must reproduce
10 the above copyright notice, this list of conditions and the following disclaimer
11 in the documentation and/or other materials provided with the distribution.
12
13 Neither the name of the Johns Hopkins University nor the names of its contributors
14 may be used to endorse or promote products derived from this software without specific
15 prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES
19 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
20 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26 DAMAGE.
27*/
28
29#ifndef GEOMETRY_INCLUDED
30#define GEOMETRY_INCLUDED
31
32#include <iostream>
33#include <string>
34#include <limits>
35#include <Util/algebra.h>
36
37 namespace Util
38{
39 static const double Pi = 3.1415926535897932384;
40 static const double Epsilon = 1e-10;
41 static const double Infinity = std::numeric_limits< double >::infinity();
42
43 /*** This is a simple class defining globally accessible variables. */
44 struct GlobalProperties
45 {
46 static bool DebugFlag;
47 };
48
50 template< unsigned int Dim >
51 class Point : public InnerProductSpace< Point< Dim > >
52 {
54 double _p[Dim];
55
57 void _init( const double *values , unsigned int sz );
58 public:
60 Point( void );
61
63 Point( const Point &p );
64
66 template< typename ... Doubles >
67 Point( Doubles ... values );
68
70 double &operator[] ( int index );
71
73 const double &operator[] ( int index ) const;
74
76 Point operator * ( const Point &p ) const;
77
79 Point &operator *= ( const Point &p );
80
82 Point operator / ( const Point &p ) const;
83
85 Point& operator /= ( const Point &p );
86
88 template< typename ... Points >
89 static Point CrossProduct( Points ... points );
90
92 static Point CrossProduct( Point *points );
93
95 static Point CrossProduct( const Point *points );
96
98 // InnerProductSpace methods //
100
102 Point operator * ( double s ) const;
103
105 Point operator + ( const Point &p ) const;
106
108 double dot( const Point &p ) const;
109 };
110
112 template<> class Point< 0 >{};
113
115 template< unsigned int Dim >
116 std::ostream &operator << ( std::ostream &stream , const Point< Dim > &p );
117
119 template< unsigned int Dim >
120 std::istream &operator >> ( std::istream &stream , Point< Dim > &p );
121
124 template< unsigned int Rows , unsigned int Cols , typename MatrixType , typename MatrixTransposeType >
125 class _BaseMatrix
126 {
128 double _m[Rows][Cols];
129 public:
131 _BaseMatrix( void );
132
134 double &operator() ( int r , int c );
135
137 const double &operator() ( int r , int c ) const;
138
140 MatrixTransposeType transpose( void ) const;
141
143 Point< Rows > operator * ( const Point< Cols > &p ) const;
144
146 // Algebra methods //
148
149 MatrixType operator * ( double s ) const;
150
152 MatrixType operator + ( const MatrixType &m ) const;
153
155 // InnerProductSpace methods //
157
158 double dot( const _BaseMatrix &p ) const;
159 };
160
161
162 template< unsigned int Rows , unsigned int Cols > class Matrix;
163
166 template< unsigned int Rows , unsigned int Cols >
167 class Matrix : public _BaseMatrix< Rows , Cols , Matrix< Rows , Cols > , Matrix< Cols , Rows > > , InnerProductSpace< Matrix< Rows , Cols > >
168 {
169 public:
171 using _BaseMatrix< Rows , Cols , Matrix< Rows , Cols > , Matrix< Cols , Rows > >::_BaseMatrix;
172 using _BaseMatrix< Rows , Cols , Matrix< Rows , Cols > , Matrix< Cols , Rows > >::operator *;
173 using _BaseMatrix< Rows , Cols , Matrix< Rows , Cols > , Matrix< Cols , Rows > >::operator ();
174 using _BaseMatrix< Rows , Cols , Matrix< Rows , Cols > , Matrix< Cols , Rows > >::transpose;
175
177 Matrix( void );
178
180 template< unsigned int _Cols >
181 Matrix< Rows , _Cols > operator * ( const Matrix< Cols , _Cols > &m ) const;
182 };
183
185 template< unsigned int Dim >
186 class Matrix< Dim , Dim > : public _BaseMatrix< Dim , Dim , Matrix< Dim , Dim > , Matrix< Dim , Dim > > , public InnerProductSpace< Matrix< Dim , Dim > > , Algebra< Matrix< Dim , Dim > >
187 {
188 public:
190 using _BaseMatrix< Dim , Dim , Matrix< Dim , Dim > , Matrix< Dim , Dim > >::_BaseMatrix;
191 using _BaseMatrix< Dim , Dim , Matrix< Dim , Dim > , Matrix< Dim , Dim > >::operator *;
192 using _BaseMatrix< Dim , Dim , Matrix< Dim , Dim > , Matrix< Dim , Dim > >::operator ();
193 using _BaseMatrix< Dim , Dim , Matrix< Dim , Dim > , Matrix< Dim , Dim > >::transpose;
194
196 Matrix( void );
197
199 Matrix( const Matrix< Dim+1 , Dim+1 > &m );
200
202 Matrix( const Matrix< Dim-1 , Dim-1 > &m , Point< Dim-1 > p = Point< Dim-1 >() );
203
205 double subDeterminant( int r , int c ) const;
206
208 double determinant( void ) const;
209
211 double trace( void ) const;
212
215 Matrix inverse( void ) const;
216
219 bool setInverse( Matrix &m ) const;
220
222 Point< Dim-1 > operator * ( const Point< Dim-1 > &p ) const;
223
225 static Matrix Identity( void );
226
228 static Matrix Log( const Matrix &m , double eps=0.0001 );
229
231 static Matrix SquareRoot( const Matrix &m , double eps=0.000001 );
232
235 void SVD( Matrix &r1 , Matrix &diagonal , Matrix &r2 ) const;
236
238 Matrix symmetrize( void ) const;
239
241 Matrix skewSymmetrize( void ) const;
242
244 static Matrix Exp( const Matrix &m , int terms=100 );
245
247 Matrix closestRotation( void ) const;
248
250 // Algebra methods //
252
253 template< unsigned int Cols >
254 Matrix< Dim , Cols > operator * ( const Matrix< Dim , Cols > &m ) const;
255 };
256
258 template< unsigned int Rows , unsigned int Cols , typename MatrixType , typename MatrixTransposeType >
259 std::ostream &operator << ( std::ostream &stream , const _BaseMatrix< Rows , Cols , MatrixType , MatrixTransposeType > &m );
260
262 template< unsigned int Rows , unsigned int Cols , typename MatrixType , typename MatrixTransposeType >
263 std::istream &operator >> ( std::istream &stream , _BaseMatrix< Rows , Cols , MatrixType , MatrixTransposeType > &m );
264
265
267 template< unsigned int Dim >
268 class Plane
269 {
270 public:
272 Point< Dim > normal;
274 double distance;
275
277 Plane( void );
278
280 Plane( const Point< Dim > &n , const Point< Dim > &p );
281
283 template< typename ... Points >
284 Plane( Points ... points );
285
287 Plane( Point< Dim > *points );
288
290 Plane( const Point< Dim > *points );
291
293 double operator()( const Point< Dim > &p ) const;
294 };
295
297 template< unsigned int Dim >
298 class Ray
299 {
300 public:
302 Point< Dim > position;
303
305 Point< Dim > direction;
306
308 Ray( void );
309
311 Ray( const Point< Dim > &position , const Point< Dim > &direction );
312
314 Ray operator + ( const Point< Dim > &p ) const;
315
317 Ray &operator += ( const Point< Dim > &p );
318
320 Ray operator - ( const Point< Dim > &p ) const;
321
323 Ray &operator -= ( const Point< Dim > &p );
324
326 Point< Dim > operator() ( double t ) const;
327 };
328
330 template< unsigned int Dim >
331 Ray< Dim > operator * ( const Matrix< Dim+1 , Dim+1 > &m , const Ray< Dim > &ray );
332
334 template< unsigned int Dim >
335 std::ostream &operator << ( std::ostream &stream , const Ray< Dim > &ray )
336 {
337 stream << "[ " << ray.position << " ] [ " << ray.direction << " ]";
338 return stream;
339 }
340
343 template< unsigned int Dim >
344 class BoundingBox
345 {
346 template< unsigned int _Dim >
347 friend BoundingBox< _Dim > operator * ( const Matrix< _Dim+1 , _Dim+1 > & , const BoundingBox< _Dim > & );
348
350 Point< Dim > _p[2];
351 public:
353 BoundingBox( void );
354
356 BoundingBox( const Point< Dim > &p1 , const Point< Dim > &p2 );
357
359 BoundingBox( const Point< Dim > *pList , int pSize );
360
363 Point< Dim > &operator[] ( int index );
364
367 const Point< Dim > &operator[] ( int index ) const;
368
371 BoundingBox operator + ( const BoundingBox &b ) const;
372
375 BoundingBox& operator += ( const BoundingBox &b );
376
378 BoundingBox operator ^ ( const BoundingBox &b ) const;
379
381 BoundingBox& operator ^= ( const BoundingBox &b );
382
384 bool isInside( const Point< Dim > &p ) const;
385
387 bool isEmpty( void ) const;
388
391 BoundingBox< 1 > intersect( const Ray< Dim > &ray ) const;
392 };
393
394 template< unsigned int Dim > struct QuadricBoundingBoxIntersectionInfo;
395
397 template< unsigned int Dim >
398 class Quadric
399 {
400 Matrix< Dim , Dim > _Q;
401 Point< Dim > _L;
402 double _C;
403
404 template< unsigned int _Dim >
405 friend class Quadric;
406
407 public:
409 Quadric( void );
410
413 Quadric( const Matrix< Dim , Dim > &Q , const Point< Dim > &L , const double &C );
414
416 Quadric( const Matrix< Dim+1 , Dim+1 > &Q );
417
419 Matrix< Dim+1 , Dim+1 > operator()( void ) const;
420
422 Matrix< Dim , Dim > getQuadratic( void ) const;
423
425 Point< Dim > getLinear( void ) const;
426
428 double getConstant( void ) const;
429
431 void setQuadratic( Matrix< Dim , Dim > Q );
432
434 void setLinear( Point< Dim > L );
435
437 void setConstant( double C );
438
440 double operator()( const Point< Dim > &p ) const;
441
443 Quadric< 1 > intersect( const Ray< Dim > &ray ) const;
444
449 bool setExtremum( Point< Dim > &extremum ) const;
450
454 template< unsigned int _Dim >
455 Quadric< _Dim > operator * ( const Matrix< Dim , _Dim > &T ) const;
456
460 Quadric< Dim > operator + ( const Point< Dim > &t ) const;
461
462 template< unsigned int _Dim > friend struct QuadricBoundingBoxOverlap;
463 };
464
465 template< unsigned int Dim >
466 struct QuadricBoundingBoxOverlap
467 {
469 QuadricBoundingBoxOverlap( const Quadric< Dim > &Q );
470
472 bool operator()( const BoundingBox< Dim > & bBox ) const;
473 protected:
474 template< unsigned int _Dim > friend struct QuadricBoundingBoxOverlap;
475 Quadric< Dim > _quadric;
476 Matrix< Dim , Dim > _Q , _Qinv;
477 Matrix< Dim+1 , Dim > _T;
478 Matrix< Dim , Dim+1 > _Tt , _Tt_Q;
479 struct QuadricBoundingBoxOverlap< Dim-1 > _boundaryInfo[Dim];
480
481 QuadricBoundingBoxOverlap( void );
482 void _set( const Quadric< Dim > &Q );
483 bool _intersect( const Quadric< Dim > &Q , const BoundingBox< Dim > &bBox ) const;
484 };
485
486 template<>
487 struct QuadricBoundingBoxOverlap<1>
488 {
490 QuadricBoundingBoxOverlap( const Quadric< 1 > &Q ){ _set(Q); }
491
493 bool operator()( const BoundingBox< 1 > & bBox ) const;
494 protected:
495 template< unsigned int _Dim > friend struct QuadricBoundingBoxOverlap;
496 Quadric< 1 > _quadric;
497 Matrix< 1 , 1 > _Q , _Qinv;
498 Matrix< 2 , 1 > _T;
499 Matrix< 1 , 2 > _Tt , _Tt_Q;
500
501 QuadricBoundingBoxOverlap( void ){}
502 void _set( const Quadric< 1 > &Q );
503 bool _intersect( const Quadric< 1 > &Q , const BoundingBox< 1 > &bBox ) const;
504 };
505
508 template< unsigned int Dim >
509 BoundingBox< Dim > operator * ( const Matrix< Dim+1 , Dim+1 > &m , const BoundingBox< Dim > &b );
510
512 template< unsigned int Dim >
513 std::ostream &operator << ( std::ostream &stream , const Point< Dim > &p );
514
516 // Classes specialized for 2D, 3D, and 4D //
518
520 typedef Point< 1 > Point1D;
521
523 typedef Point< 2 > Point2D;
524
526 typedef Point< 3 > Point3D;
527
529 typedef Point< 4 > Point4D;
530
532 template< unsigned int Dim > using SquareMatrix = Matrix< Dim , Dim >;
533
535 typedef Matrix< 1 , 1 > Matrix1D;
536
538 typedef Matrix< 2 , 2 > Matrix2D;
539
541 typedef Matrix< 3 , 3 > Matrix3D;
542
544 typedef Matrix< 4 , 4 > Matrix4D;
545
547 typedef Plane< 2 > Plane2D;
548
550 typedef Plane< 3 > Plane3D;
551
553 typedef Plane< 4 > Plane4D;
554
556 typedef Ray< 1 > Ray1D;
557
559 typedef Ray< 2 > Ray2D;
560
562 typedef Ray< 3 > Ray3D;
563
565 typedef Ray< 4 > Ray4D;
566
568 typedef BoundingBox< 1 > BoundingBox1D;
569
571 typedef BoundingBox< 2 > BoundingBox2D;
572
574 typedef BoundingBox< 3 > BoundingBox3D;
575
577 typedef BoundingBox< 4 > BoundingBox4D;
578
580 class Quaternion : public Field< Quaternion > , public _InnerProductSpace< Quaternion >
581 {
582 public:
584 double real;
585
587 Point3D imag;
588
590 Quaternion( double r=0 , Point3D i = Point3D() );
591
593 double dot( const Quaternion& q ) const;
594
596 Quaternion conjugate( void ) const;
597
599 // Field methods //
601
603 Quaternion additiveInverse( void ) const;
604
606 Quaternion multiplicativeInverse( void ) const;
607
609 Quaternion operator * ( double scale ) const;
610
612 Quaternion operator + ( const Quaternion& q ) const;
613
615 Quaternion operator * ( const Quaternion& q ) const;
616
617 };
618
620 namespace RotationParameters
621 {
623 enum
624 {
625 TRIVIAL ,
626 ROTATION ,
627 EULER ,
628 SKEW_SYMMETRIC ,
629 QUATERNION ,
630 COUNT
631 };
632
634 const std::string Names[] = { "trivial" , "closest rotation" , "euler" , "skew symmetric" , "quaternion" };
635 }
636
638 template< typename RotationParameterType , typename ParameterType >
639 class RotationParameter
640 {
641 public:
642 ParameterType parameter;
643
645 virtual Matrix3D operator()( void ) const = 0;
646
648 // VectorSpace methods //
650
652 RotationParameterType operator * ( double scale ) const;
653
655 RotationParameterType operator + ( const RotationParameterType &p ) const;
656 };
657
659 class TrivialRotationParameter : public RotationParameter< TrivialRotationParameter , Matrix3D > , public VectorSpace< TrivialRotationParameter >
660 {
661 public:
663 TrivialRotationParameter( void );
664
666 TrivialRotationParameter( const Matrix3D &r );
667
669 TrivialRotationParameter( const Matrix3D &r , const TrivialRotationParameter &previous );
670
672 Matrix3D operator()( void ) const;
673 };
674
676 class EulerRotationParameter : public RotationParameter< EulerRotationParameter , Point3D > , public VectorSpace< EulerRotationParameter >
677 {
678 public:
680 EulerRotationParameter( void );
681
683 EulerRotationParameter( const Matrix3D &r );
684
686 EulerRotationParameter( const Matrix3D &r , const EulerRotationParameter &previous );
687
689 Matrix3D operator()( void ) const;
690 };
691
693 class MatrixRotationParameter : public RotationParameter< MatrixRotationParameter , Matrix3D > , public VectorSpace< MatrixRotationParameter >
694 {
695 public:
697 MatrixRotationParameter( void );
698
700 MatrixRotationParameter( const Matrix3D &r );
701
703 MatrixRotationParameter( const Matrix3D &r , const MatrixRotationParameter &previous );
704
706 Matrix3D operator()( void ) const;
707 };
708
710 class SkewSymmetricRotationParameter : public RotationParameter< SkewSymmetricRotationParameter , Point3D > , public VectorSpace< SkewSymmetricRotationParameter >
711 {
712 Matrix3D _toMatrix( void ) const;
713 void _fromMatrix( const Matrix3D &skew );
714 public:
716 SkewSymmetricRotationParameter( void );
717
719 SkewSymmetricRotationParameter( const Matrix3D &r );
720
722 SkewSymmetricRotationParameter( const Matrix3D &r , const SkewSymmetricRotationParameter &previous );
723
725 Matrix3D operator()( void ) const;
726 };
727
729 class QuaternionRotationParameter : public RotationParameter< QuaternionRotationParameter , Quaternion > , public VectorSpace< QuaternionRotationParameter >
730 {
731 public:
733 QuaternionRotationParameter( void );
734
736 QuaternionRotationParameter( const Matrix3D &r );
737
739 QuaternionRotationParameter( const Matrix3D &r , const QuaternionRotationParameter &previous );
740
742 Matrix3D operator()( void ) const;
743 };
744
746 template< typename RotationParameterType >
747 class TransformationParameter : public VectorSpace< TransformationParameter< RotationParameterType > >
748 {
749 public:
751 RotationParameterType rotationParameter;
752
754 Point3D translation;
755
757 TransformationParameter( void );
758
760 TransformationParameter( const Matrix4D &m );
761
763 TransformationParameter( const Matrix4D &m , const TransformationParameter &p );
764
766 TransformationParameter operator * ( double scale ) const;
767
769 TransformationParameter operator + ( const TransformationParameter &tp ) const;
770
772 Matrix4D operator()( void ) const;
773 };
774}
775#include "geometry.inl"
776#include "geometry.todo.inl"
777#endif // GEOMETRY_INCLUDED
Identity
const GXMatrixMNTC< Coord > Identity(unsigned int cOrder)
algebra.h
Util::_BaseMatrix
Definition geometry.h:126
Util::_BaseMatrix::operator*
Point< Rows > operator*(const Point< Cols > &p) const
Definition geometry.inl:169
Util::_BaseMatrix::operator()
double & operator()(int r, int c)
Definition geometry.inl:155
Util::_BaseMatrix::_m
double _m[Rows][Cols]
Definition geometry.h:128
Util::_BaseMatrix::_BaseMatrix
_BaseMatrix(void)
Definition geometry.inl:152
Util::_BaseMatrix::operator+
MatrixType operator+(const MatrixType &m) const
Definition geometry.inl:180
Util::_BaseMatrix::dot
double dot(const _BaseMatrix &p) const
Definition geometry.inl:144
Util::_BaseMatrix::transpose
MatrixTransposeType transpose(void) const
Definition geometry.inl:161
Util::_InnerProductSpace
Definition algebra.h:99
Util::Algebra
Definition algebra.h:143
Util::BoundingBox< 1 >
Util::BoundingBox::BoundingBox
BoundingBox(void)
Definition geometry.inl:503
Util::BoundingBox::operator*
friend BoundingBox< _Dim > operator*(const Matrix< _Dim+1, _Dim+1 > &, const BoundingBox< _Dim > &)
Util::BoundingBox::isEmpty
bool isEmpty(void) const
Definition geometry.inl:580
Util::BoundingBox::operator^=
BoundingBox & operator^=(const BoundingBox &b)
Definition geometry.inl:557
Util::BoundingBox::operator+=
BoundingBox & operator+=(const BoundingBox &b)
Definition geometry.inl:543
Util::BoundingBox::isInside
bool isInside(const Point< Dim > &p) const
Definition geometry.inl:573
Util::BoundingBox::operator+
BoundingBox operator+(const BoundingBox &b) const
Definition geometry.inl:528
Util::BoundingBox::operator[]
Point< Dim > & operator[](int index)
Definition geometry.inl:522
Util::BoundingBox::operator^
BoundingBox operator^(const BoundingBox &b) const
Definition geometry.inl:546
Util::BoundingBox::BoundingBox
BoundingBox(const Point< Dim > *pList, int pSize)
Definition geometry.inl:512
Util::BoundingBox< 1 >::_p
Point< Dim > _p[2]
Definition geometry.h:350
Util::BoundingBox::BoundingBox
BoundingBox(const Point< Dim > &p1, const Point< Dim > &p2)
Definition geometry.inl:506
Util::BoundingBox::intersect
BoundingBox< 1 > intersect(const Ray< Dim > &ray) const
Definition geometry.todo.inl:58
Util::EulerRotationParameter::operator()
Matrix3D operator()(void) const
Definition geometry.todo.cpp:39
Util::EulerRotationParameter::EulerRotationParameter
EulerRotationParameter(void)
Definition geometry.cpp:76
Util::Field
Definition algebra.h:57
Util::InnerProductSpace
Definition algebra.h:133
Util::Matrix
Definition geometry.h:168
Util::Matrix::Matrix
Matrix(void)
Definition geometry.inl:185
Util::Matrix::operator*
Matrix< Rows, _Cols > operator*(const Matrix< Cols, _Cols > &m) const
Definition geometry.inl:189
Util::MatrixRotationParameter::operator()
Matrix3D operator()(void) const
Definition geometry.cpp:136
Util::MatrixRotationParameter::MatrixRotationParameter
MatrixRotationParameter(void)
Definition geometry.cpp:130
Util::Plane< 2 >
Util::Plane< 2 >::distance
double distance
Definition geometry.h:274
Util::Plane::Plane
Plane(Points ... points)
Definition geometry.inl:443
Util::Plane< 2 >::normal
Point< Dim > normal
Definition geometry.h:272
Util::Plane::Plane
Plane(void)
Definition geometry.inl:432
Util::Plane::operator()
double operator()(const Point< Dim > &p) const
Definition geometry.inl:463
Util::Plane::Plane
Plane(Point< Dim > *points)
Definition geometry.inl:451
Util::Plane::Plane
Plane(const Point< Dim > &n, const Point< Dim > &p)
Definition geometry.inl:435
Util::Plane::Plane
Plane(const Point< Dim > *points)
Definition geometry.inl:454
Util::Point
Definition geometry.h:52
Util::Point::CrossProduct
static Point CrossProduct(Points ... points)
Util::Point::Point
Point(const Point &p)
Definition geometry.inl:51
Util::Point::operator*
Point operator*(const Point &p) const
Definition geometry.inl:83
Util::Point::operator[]
double & operator[](int index)
Definition geometry.inl:77
Util::Point::operator/=
Point & operator/=(const Point &p)
Definition geometry.inl:102
Util::Point::Point
Point(void)
Definition geometry.inl:48
Util::Point::operator/
Point operator/(const Point &p) const
Definition geometry.inl:91
Util::Point::_init
void _init(const double *values, unsigned int sz)
Definition geometry.inl:40
Util::Point< 1 >::_p
double _p[Dim]
Definition geometry.h:54
Util::Point::CrossProduct
static Point CrossProduct(const Point *points)
Definition geometry.inl:117
Util::Point::CrossProduct
static Point CrossProduct(Point *points)
Definition geometry.inl:114
Util::Point::operator+
Point operator+(const Point &p) const
Definition geometry.inl:66
Util::Point::operator*=
Point & operator*=(const Point &p)
Definition geometry.inl:99
Util::Point::dot
double dot(const Point &p) const
Definition geometry.inl:69
Util::Point::Point
Point(Doubles ... values)
Definition geometry.inl:55
Util::Quadric< 1 >
Util::Quadric::intersect
Quadric< 1 > intersect(const Ray< Dim > &ray) const
Definition geometry.todo.inl:71
Util::Quadric::getConstant
double getConstant(void) const
Definition geometry.inl:633
Util::Quadric::operator*
Quadric< _Dim > operator*(const Matrix< Dim, _Dim > &T) const
Definition geometry.inl:649
Util::Quadric::Quadric
friend class Quadric
Definition geometry.h:405
Util::Quadric::getLinear
Point< Dim > getLinear(void) const
Definition geometry.inl:630
Util::Quadric::operator()
Matrix< Dim+1, Dim+1 > operator()(void) const
Definition geometry.inl:614
Util::Quadric::setQuadratic
void setQuadratic(Matrix< Dim, Dim > Q)
Definition geometry.inl:636
Util::Quadric::setExtremum
bool setExtremum(Point< Dim > &extremum) const
Definition geometry.inl:675
Util::Quadric::setLinear
void setLinear(Point< Dim > L)
Definition geometry.inl:639
Util::Quadric::_Q
Matrix< Dim, Dim > _Q
Definition geometry.h:400
Util::Quadric::QuadricBoundingBoxOverlap
friend struct QuadricBoundingBoxOverlap
Definition geometry.h:462
Util::Quadric::getQuadratic
Matrix< Dim, Dim > getQuadratic(void) const
Definition geometry.inl:627
Util::Quadric::setConstant
void setConstant(double C)
Definition geometry.inl:642
Util::Quadric::_L
Point< Dim > _L
Definition geometry.h:401
Util::Quadric::operator+
Quadric< Dim > operator+(const Point< Dim > &t) const
Definition geometry.inl:662
Util::Quadric::_C
double _C
Definition geometry.h:402
Util::Quaternion::multiplicativeInverse
Quaternion multiplicativeInverse(void) const
Definition geometry.cpp:50
Util::Quaternion::real
double real
Definition geometry.h:584
Util::Quaternion::Quaternion
Quaternion(double r=0, Point3D i=Point3D())
Definition geometry.cpp:46
Util::Quaternion::operator+
Quaternion operator+(const Quaternion &q) const
Definition geometry.cpp:56
Util::Quaternion::additiveInverse
Quaternion additiveInverse(void) const
Definition geometry.cpp:48
Util::Quaternion::operator*
Quaternion operator*(double scale) const
Definition geometry.cpp:54
Util::Quaternion::imag
Point3D imag
Definition geometry.h:587
Util::Quaternion::conjugate
Quaternion conjugate(void) const
Definition geometry.cpp:60
Util::Quaternion::dot
double dot(const Quaternion &q) const
Definition geometry.cpp:52
Util::QuaternionRotationParameter::operator()
Matrix3D operator()(void) const
Definition geometry.todo.cpp:51
Util::QuaternionRotationParameter::QuaternionRotationParameter
QuaternionRotationParameter(void)
Definition geometry.cpp:209
Util::Ray
Definition geometry.h:299
Util::Ray::operator+
Ray operator+(const Point< Dim > &p) const
Definition geometry.inl:481
Util::Ray< 1 >::direction
Point< Dim > direction
Definition geometry.h:305
Util::Ray::Ray
Ray(void)
Definition geometry.inl:472
Util::Ray< 1 >::position
Point< Dim > position
Definition geometry.h:302
Util::Ray::operator()
Point< Dim > operator()(double t) const
Definition geometry.inl:478
Util::Ray::operator-
Ray operator-(const Point< Dim > &p) const
Definition geometry.inl:487
Util::Ray::operator+=
Ray & operator+=(const Point< Dim > &p)
Definition geometry.inl:484
Util::Ray::Ray
Ray(const Point< Dim > &position, const Point< Dim > &direction)
Definition geometry.inl:475
Util::Ray::operator-=
Ray & operator-=(const Point< Dim > &p)
Definition geometry.inl:490
Util::RotationParameter
Definition geometry.h:640
Util::RotationParameter::operator+
RotationParameterType operator+(const RotationParameterType &p) const
Definition geometry.inl:807
Util::RotationParameter::parameter
ParameterType parameter
Definition geometry.h:642
Util::RotationParameter::operator*
RotationParameterType operator*(double scale) const
Definition geometry.inl:799
Util::RotationParameter::operator()
virtual Matrix3D operator()(void) const =0
Util::SkewSymmetricRotationParameter::_toMatrix
Matrix3D _toMatrix(void) const
Definition geometry.cpp:141
Util::SkewSymmetricRotationParameter::_fromMatrix
void _fromMatrix(const Matrix3D &skew)
Definition geometry.cpp:150
Util::SkewSymmetricRotationParameter::SkewSymmetricRotationParameter
SkewSymmetricRotationParameter(void)
Definition geometry.cpp:157
Util::SkewSymmetricRotationParameter::operator()
Matrix3D operator()(void) const
Definition geometry.cpp:204
Util::TransformationParameter::operator+
TransformationParameter operator+(const TransformationParameter &tp) const
Definition geometry.inl:827
Util::TransformationParameter::rotationParameter
RotationParameterType rotationParameter
Definition geometry.h:751
Util::TransformationParameter::TransformationParameter
TransformationParameter(void)
Definition geometry.inl:836
Util::TransformationParameter::translation
Point3D translation
Definition geometry.h:754
Util::TransformationParameter::operator*
TransformationParameter operator*(double scale) const
Definition geometry.inl:818
Util::TransformationParameter::operator()
Matrix4D operator()(void) const
Definition geometry.inl:851
Util::TrivialRotationParameter::operator()
Matrix3D operator()(void) const
Definition geometry.cpp:71
Util::TrivialRotationParameter::TrivialRotationParameter
TrivialRotationParameter(void)
Definition geometry.cpp:65
Util::VectorSpace
Definition algebra.h:66
geometry.inl
geometry.todo.inl
b
long b
Definition jpegint.h:371
ParameterType
CmdLineParameter< int > ParameterType("parameter", RotationParameters::TRIVIAL+1)
Ray
Definition box.h:7
Util::RotationParameters
Definition geometry.h:621
Util::RotationParameters::ROTATION
@ ROTATION
Definition geometry.h:626
Util::RotationParameters::QUATERNION
@ QUATERNION
Definition geometry.h:629
Util::RotationParameters::TRIVIAL
@ TRIVIAL
Definition geometry.h:625
Util::RotationParameters::EULER
@ EULER
Definition geometry.h:627
Util::RotationParameters::SKEW_SYMMETRIC
@ SKEW_SYMMETRIC
Definition geometry.h:628
Util::RotationParameters::COUNT
@ COUNT
Definition geometry.h:630
Util::RotationParameters::Names
const std::string Names[]
Definition geometry.h:634
Util
Definition algebra.h:7
Util::Matrix3D
Matrix< 3, 3 > Matrix3D
Definition geometry.h:541
Util::Point1D
Point< 1 > Point1D
Definition geometry.h:520
Util::BoundingBox3D
BoundingBox< 3 > BoundingBox3D
Definition geometry.h:574
Util::Matrix4D
Matrix< 4, 4 > Matrix4D
Definition geometry.h:544
Util::Matrix2D
Matrix< 2, 2 > Matrix2D
Definition geometry.h:538
Util::BoundingBox2D
BoundingBox< 2 > BoundingBox2D
Definition geometry.h:571
Util::Matrix1D
Matrix< 1, 1 > Matrix1D
Definition geometry.h:535
Util::Ray1D
Ray< 1 > Ray1D
Definition geometry.h:556
Util::Point3D
Point< 3 > Point3D
Definition geometry.h:526
Util::Infinity
static const double Infinity
Definition geometry.h:41
Util::operator<<
std::ostream & operator<<(std::ostream &stream, const Point< Dim > &p)
Definition geometry.inl:127
Util::BoundingBox1D
BoundingBox< 1 > BoundingBox1D
Definition geometry.h:568
Util::Ray3D
Ray< 3 > Ray3D
Definition geometry.h:562
Util::Plane4D
Plane< 4 > Plane4D
Definition geometry.h:553
Util::Plane3D
Plane< 3 > Plane3D
Definition geometry.h:550
Util::Ray2D
Ray< 2 > Ray2D
Definition geometry.h:559
Util::operator>>
std::istream & operator>>(std::istream &stream, Point< Dim > &p)
Definition geometry.inl:134
Util::Ray4D
Ray< 4 > Ray4D
Definition geometry.h:565
Util::operator*
Ray< Dim > operator*(const Matrix< Dim+1, Dim+1 > &m, const Ray< Dim > &ray)
Definition geometry.inl:493
Util::BoundingBox4D
BoundingBox< 4 > BoundingBox4D
Definition geometry.h:577
Util::SquareMatrix
Matrix< Dim, Dim > SquareMatrix
Definition geometry.h:532
Util::Point4D
Point< 4 > Point4D
Definition geometry.h:529
Util::Pi
static const double Pi
Definition geometry.h:39
Util::Plane2D
Plane< 2 > Plane2D
Definition geometry.h:547
Util::Epsilon
static const double Epsilon
Definition geometry.h:40
Util::Point2D
Point< 2 > Point2D
Definition geometry.h:523
Util::GlobalProperties
Definition geometry.h:45
Util::GlobalProperties::DebugFlag
static bool DebugFlag
Definition geometry.h:46
Util::QuadricBoundingBoxIntersectionInfo
Definition geometry.h:394
Util::QuadricBoundingBoxOverlap< 1 >::_T
Matrix< 2, 1 > _T
Definition geometry.h:498
Util::QuadricBoundingBoxOverlap< 1 >::_quadric
Quadric< 1 > _quadric
Definition geometry.h:496
Util::QuadricBoundingBoxOverlap< 1 >::_Q
Matrix< 1, 1 > _Q
Definition geometry.h:497
Util::QuadricBoundingBoxOverlap< 1 >::QuadricBoundingBoxOverlap
QuadricBoundingBoxOverlap(const Quadric< 1 > &Q)
Definition geometry.h:490
Util::QuadricBoundingBoxOverlap< 1 >::QuadricBoundingBoxOverlap
QuadricBoundingBoxOverlap(void)
Definition geometry.h:501
Util::QuadricBoundingBoxOverlap< 1 >::operator()
bool operator()(const BoundingBox< 1 > &bBox) const
Util::QuadricBoundingBoxOverlap< 1 >::QuadricBoundingBoxOverlap
friend struct QuadricBoundingBoxOverlap
Definition geometry.h:495
Util::QuadricBoundingBoxOverlap< 1 >::_Tt_Q
Matrix< 1, 2 > _Tt_Q
Definition geometry.h:499
Util::QuadricBoundingBoxOverlap< 1 >::_Qinv
Matrix< 1, 1 > _Qinv
Definition geometry.h:497
Util::QuadricBoundingBoxOverlap< 1 >::_Tt
Matrix< 1, 2 > _Tt
Definition geometry.h:499
Util::QuadricBoundingBoxOverlap::_Qinv
Matrix< Dim, Dim > _Qinv
Definition geometry.h:476
Util::QuadricBoundingBoxOverlap::_Tt
Matrix< Dim, Dim+1 > _Tt
Definition geometry.h:478
Util::QuadricBoundingBoxOverlap::_T
Matrix< Dim+1, Dim > _T
Definition geometry.h:477
Util::QuadricBoundingBoxOverlap::_Tt_Q
Matrix< Dim, Dim+1 > _Tt_Q
Definition geometry.h:478
Util::QuadricBoundingBoxOverlap::_Q
Matrix< Dim, Dim > _Q
Definition geometry.h:476
Util::QuadricBoundingBoxOverlap::_intersect
bool _intersect(const Quadric< Dim > &Q, const BoundingBox< Dim > &bBox) const
Definition geometry.inl:718
Util::QuadricBoundingBoxOverlap::QuadricBoundingBoxOverlap
friend struct QuadricBoundingBoxOverlap
Definition geometry.h:474
Util::QuadricBoundingBoxOverlap::_boundaryInfo
struct QuadricBoundingBoxOverlap< Dim-1 > _boundaryInfo[Dim]
Definition geometry.h:479
Util::QuadricBoundingBoxOverlap::_quadric
Quadric< Dim > _quadric
Definition geometry.h:475
Util::QuadricBoundingBoxOverlap::operator()
bool operator()(const BoundingBox< Dim > &bBox) const
Definition geometry.inl:698
Util::QuadricBoundingBoxOverlap::_set
void _set(const Quadric< Dim > &Q)
Definition geometry.inl:701