29#ifndef GEOMETRY_INCLUDED
30#define GEOMETRY_INCLUDED
39 static const double Pi = 3.1415926535897932384;
41 static const double Infinity = std::numeric_limits< double >::infinity();
50 template<
unsigned int Dim >
57 void _init(
const double *values ,
unsigned int sz );
66 template<
typename ... Doubles >
67 Point( Doubles ... values );
88 template<
typename ... Points >
115 template<
unsigned int Dim >
119 template<
unsigned int Dim >
124 template<
unsigned int Rows ,
unsigned int Cols ,
typename MatrixType ,
typename MatrixTransposeType >
128 double _m[Rows][Cols];
137 const double &
operator() (
int r ,
int c )
const;
140 MatrixTransposeType
transpose(
void )
const;
152 MatrixType
operator + (
const MatrixType &m )
const;
162 template<
unsigned int Rows ,
unsigned int Cols >
class Matrix;
166 template<
unsigned int Rows ,
unsigned int Cols >
180 template<
unsigned int _Cols >
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 > >
205 double subDeterminant(
int r ,
int c )
const;
208 double determinant(
void )
const;
211 double trace(
void )
const;
215 Matrix inverse(
void )
const;
219 bool setInverse(
Matrix &m )
const;
238 Matrix symmetrize(
void )
const;
241 Matrix skewSymmetrize(
void )
const;
247 Matrix closestRotation(
void )
const;
253 template<
unsigned int Cols >
258 template<
unsigned int Rows ,
unsigned int Cols ,
typename MatrixType ,
typename MatrixTransposeType >
262 template<
unsigned int Rows ,
unsigned int Cols ,
typename MatrixType ,
typename MatrixTransposeType >
267 template<
unsigned int Dim >
283 template<
typename ... Points >
284 Plane( Points ... points );
297 template<
unsigned int Dim >
330 template<
unsigned int Dim >
334 template<
unsigned int Dim >
343 template<
unsigned int Dim >
346 template<
unsigned int _Dim >
397 template<
unsigned int Dim >
404 template<
unsigned int _Dim >
454 template<
unsigned int _Dim >
468 template<
unsigned int Dim >
485 void _set( const Quadric< Dim > &Q );
486 bool _intersect( const Quadric< Dim > &Q , const BoundingBox< Dim > &bBox ) const;
511 template<
unsigned int Dim >
515 template<
unsigned int Dim >
609 Quaternion multiplicativeInverse(
void )
const;
623 namespace RotationParameters
637 const std::string
Names[] = {
"trivial" ,
"closest rotation" ,
"euler" ,
"skew symmetric" ,
"quaternion" };
641 template<
typename RotationParameterType ,
typename ParameterType >
655 RotationParameterType
operator * (
double scale )
const;
658 RotationParameterType
operator + (
const RotationParameterType &p )
const;
716 void _fromMatrix(
const Matrix3D &skew );
749 template<
typename RotationParameterType >
const GXMatrixMNTC< Coord > Identity(unsigned int cOrder)
Definition: geometry.h:126
Point< Rows > operator*(const Point< Cols > &p) const
Definition: geometry.inl:169
double & operator()(int r, int c)
Definition: geometry.inl:155
double _m[Rows][Cols]
Definition: geometry.h:128
_BaseMatrix(void)
Definition: geometry.inl:152
MatrixType operator+(const MatrixType &m) const
Definition: geometry.inl:180
double dot(const _BaseMatrix &p) const
Definition: geometry.inl:144
MatrixTransposeType transpose(void) const
Definition: geometry.inl:161
Definition: algebra.h:143
Definition: geometry.h:345
BoundingBox(void)
Definition: geometry.inl:503
friend BoundingBox< _Dim > operator*(const Matrix< _Dim+1, _Dim+1 > &, const BoundingBox< _Dim > &)
bool isEmpty(void) const
Definition: geometry.inl:580
BoundingBox & operator^=(const BoundingBox &b)
Definition: geometry.inl:557
BoundingBox & operator+=(const BoundingBox &b)
Definition: geometry.inl:543
bool isInside(const Point< Dim > &p) const
Definition: geometry.inl:573
BoundingBox operator+(const BoundingBox &b) const
Definition: geometry.inl:528
Point< Dim > & operator[](int index)
Definition: geometry.inl:522
BoundingBox operator^(const BoundingBox &b) const
Definition: geometry.inl:546
Point< Dim > _p[2]
Definition: geometry.h:350
BoundingBox< 1 > intersect(const Ray< Dim > &ray) const
Definition: geometry.todo.inl:58
Definition: geometry.h:680
Definition: algebra.h:133
Definition: geometry.h:187
Matrix(const Matrix< Dim-1, Dim-1 > &m, Point< Dim-1 > p=Point< Dim-1 >())
Matrix(const Matrix< Dim+1, Dim+1 > &m)
Definition: geometry.h:168
Matrix(void)
Definition: geometry.inl:185
Matrix< Rows, _Cols > operator*(const Matrix< Cols, _Cols > &m) const
Definition: geometry.inl:189
Definition: geometry.h:697
Definition: geometry.h:269
double distance
Definition: geometry.h:274
Point< Dim > normal
Definition: geometry.h:272
Plane(void)
Definition: geometry.inl:432
double operator()(const Point< Dim > &p) const
Definition: geometry.inl:463
Definition: geometry.h:52
static Point CrossProduct(Points ... points)
Point operator*(const Point &p) const
Definition: geometry.inl:83
double & operator[](int index)
Definition: geometry.inl:77
Point & operator/=(const Point &p)
Definition: geometry.inl:102
Point(void)
Definition: geometry.inl:48
Point operator/(const Point &p) const
Definition: geometry.inl:91
void _init(const double *values, unsigned int sz)
Definition: geometry.inl:40
double _p[Dim]
Definition: geometry.h:54
Point operator+(const Point &p) const
Definition: geometry.inl:66
Point & operator*=(const Point &p)
Definition: geometry.inl:99
double dot(const Point &p) const
Definition: geometry.inl:69
Definition: geometry.h:399
Quadric< 1 > intersect(const Ray< Dim > &ray) const
Definition: geometry.todo.inl:71
double getConstant(void) const
Definition: geometry.inl:633
Quadric< _Dim > operator*(const Matrix< Dim, _Dim > &T) const
Definition: geometry.inl:649
friend class Quadric
Definition: geometry.h:405
Point< Dim > getLinear(void) const
Definition: geometry.inl:630
Matrix< Dim+1, Dim+1 > operator()(void) const
Definition: geometry.inl:614
void setQuadratic(Matrix< Dim, Dim > Q)
Definition: geometry.inl:636
bool setExtremum(Point< Dim > &extremum) const
Definition: geometry.inl:675
void setLinear(Point< Dim > L)
Definition: geometry.inl:639
Matrix< Dim, Dim > _Q
Definition: geometry.h:400
Matrix< Dim, Dim > getQuadratic(void) const
Definition: geometry.inl:627
void setConstant(double C)
Definition: geometry.inl:642
friend struct BoundingBoxOverlap
Definition: geometry.h:463
Point< Dim > _L
Definition: geometry.h:401
Quadric< Dim > operator+(const Point< Dim > &t) const
Definition: geometry.inl:662
double _C
Definition: geometry.h:402
Definition: geometry.h:584
double real
Definition: geometry.h:587
Point3D imag
Definition: geometry.h:590
Definition: geometry.h:733
Definition: geometry.h:299
Ray operator+(const Point< Dim > &p) const
Definition: geometry.inl:481
Point< Dim > direction
Definition: geometry.h:305
Ray(void)
Definition: geometry.inl:472
Point< Dim > position
Definition: geometry.h:302
Point< Dim > operator()(double t) const
Definition: geometry.inl:478
Ray operator-(const Point< Dim > &p) const
Definition: geometry.inl:487
Ray & operator+=(const Point< Dim > &p)
Definition: geometry.inl:484
Ray & operator-=(const Point< Dim > &p)
Definition: geometry.inl:490
Definition: geometry.h:643
ParameterType parameter
Definition: geometry.h:645
virtual Matrix3D operator()(void) const =0
Definition: geometry.h:714
Definition: geometry.h:663
CmdLineParameter< int > ParameterType("parameter", RotationParameters::TRIVIAL+1)
const std::string Names[]
Definition: geometry.h:637
@ ROTATION
Definition: geometry.h:629
@ QUATERNION
Definition: geometry.h:632
@ TRIVIAL
Definition: geometry.h:628
@ EULER
Definition: geometry.h:630
@ SKEW_SYMMETRIC
Definition: geometry.h:631
@ COUNT
Definition: geometry.h:633
Matrix< 3, 3 > Matrix3D
Definition: geometry.h:544
Point< 1 > Point1D
Definition: geometry.h:523
BoundingBox< 3 > BoundingBox3D
Definition: geometry.h:577
Matrix< 4, 4 > Matrix4D
Definition: geometry.h:547
Matrix< 2, 2 > Matrix2D
Definition: geometry.h:541
BoundingBox< 2 > BoundingBox2D
Definition: geometry.h:574
Matrix< 1, 1 > Matrix1D
Definition: geometry.h:538
Ray< 1 > Ray1D
Definition: geometry.h:559
Point< 3 > Point3D
Definition: geometry.h:529
static const double Infinity
Definition: geometry.h:41
std::ostream & operator<<(std::ostream &stream, const Point< Dim > &p)
Definition: geometry.inl:127
BoundingBox< 1 > BoundingBox1D
Definition: geometry.h:571
Ray< 3 > Ray3D
Definition: geometry.h:565
Plane< 4 > Plane4D
Definition: geometry.h:556
Plane< 3 > Plane3D
Definition: geometry.h:553
Ray< 2 > Ray2D
Definition: geometry.h:562
std::istream & operator>>(std::istream &stream, Point< Dim > &p)
Definition: geometry.inl:134
Ray< 4 > Ray4D
Definition: geometry.h:568
Ray< Dim > operator*(const Matrix< Dim+1, Dim+1 > &m, const Ray< Dim > &ray)
Definition: geometry.inl:493
BoundingBox< 4 > BoundingBox4D
Definition: geometry.h:580
Point< 4 > Point4D
Definition: geometry.h:532
static const double Pi
Definition: geometry.h:39
Plane< 2 > Plane2D
Definition: geometry.h:550
static const double Epsilon
Definition: geometry.h:40
Point< 2 > Point2D
Definition: geometry.h:526
const double eps
Definition: poly34.cpp:13
Definition: geometry.h:45
static bool DebugFlag
Definition: geometry.h:46
Definition: geometry.h:470
bool operator()(const BoundingBox< 1 > &bBox) const
BoundingBoxOverlap(const Quadric< 1 > &Q)
Definition: geometry.h:493
Definition: geometry.h:394