| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#ifndef VERTICESQUERYRATIONAL_H |
| 42 |
#define VERTICESQUERYRATIONAL_H |
| 43 |
|
| 44 |
#include "rational.h" |
| 45 |
#include "rVector.h" |
| 46 |
#include "verticesQuery.h" |
| 47 |
#include "tetKey.h" |
| 48 |
#include <map> |
| 49 |
|
| 50 |
class VerticesQueryRational : public VerticesQuery |
| 51 |
{ |
| 52 |
public: |
| 53 |
|
| 54 |
|
| 55 |
VerticesQueryRational (int numVertices, const Vec3d * vertices); |
| 56 |
virtual ~VerticesQueryRational (); |
| 57 |
|
| 58 |
|
| 59 |
virtual Type getType () const { return RATIONAL; } |
| 60 |
|
| 61 |
virtual void addVertex(const Vec3d & v); |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
virtual int toPlane (int i, int v0, int v1, int v2) const; |
| 66 |
virtual int toPlane (const Vec3d& test, int v0, int v1, int v2) const; |
| 67 |
|
| 68 |
virtual int toTetrahedron (int i, int v0, int v1, int v2, int v3) const; |
| 69 |
virtual int toTetrahedron (const Vec3d& test, int v0, int v1, |
| 70 |
int v2, int v3) const; |
| 71 |
|
| 72 |
virtual int toCircumsphere (int i, int v0, int v1, int v2, int v3) const; |
| 73 |
virtual int toCircumsphere (const Vec3d& test, int v0, int v1, int v2, int v3) const; |
| 74 |
|
| 75 |
virtual int toCircumsphere (int i, int v0, int v1, int v2) const; |
| 76 |
virtual int toCircumsphere (const Vec3d& test, int v0, int v1, int v2) const; |
| 77 |
|
| 78 |
|
| 79 |
typedef Rational<8*sizeof(double)> QRational; |
| 80 |
typedef RVector3<8*sizeof(double)> QRVector; |
| 81 |
|
| 82 |
static QRational dot (QRational& x0, QRational& y0, QRational& z0, |
| 83 |
QRational& x1, QRational& y1, QRational& z1); |
| 84 |
|
| 85 |
static QRational det3 (QRational& x0, QRational& y0, QRational& z0, |
| 86 |
QRational& x1, QRational& y1, QRational& z1, QRational& x2, |
| 87 |
QRational& y2, QRational& z2); |
| 88 |
|
| 89 |
static QRational det4 (QRational& x0, QRational& y0, QRational& z0, |
| 90 |
QRational& w0, QRational& x1, QRational& y1, QRational& z1, |
| 91 |
QRational& w1, QRational& x2, QRational& y2, QRational& z2, |
| 92 |
QRational& w2, QRational& x3, QRational& y3, QRational& z3, |
| 93 |
QRational& w3); |
| 94 |
|
| 95 |
protected: |
| 96 |
|
| 97 |
void convert (int numIndices, int* indices) const; |
| 98 |
int toPlane (const QRVector& ratTest, int v0, int v1, int v2) const; |
| 99 |
int toTetrahedron (const QRVector& ratTest, int v0, int v1, int v2, |
| 100 |
int v3) const; |
| 101 |
int toCircumsphere (const QRVector& ratTest, int v0, int v1, int v2, |
| 102 |
int v3) const; |
| 103 |
|
| 104 |
int toCircumsphere (const QRVector& test, int v0, int v1, int v2) const; |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
mutable std::vector<QRVector> rVertices; |
| 110 |
mutable std::vector<bool> evaluated; |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
struct PlaneData |
| 115 |
{ |
| 116 |
QRVector normal; |
| 117 |
QRational d; |
| 118 |
}; |
| 119 |
|
| 120 |
mutable std::map<OTriKey, PlaneData> planeDataMap; |
| 121 |
typedef std::map<OTriKey, PlaneData> PlaneDataMap; |
| 122 |
typedef std::map<OTriKey, PlaneData>::iterator PlaneDataMapIter; |
| 123 |
|
| 124 |
struct CircumsphereData |
| 125 |
{ |
| 126 |
QRVector center; |
| 127 |
QRational r2; |
| 128 |
}; |
| 129 |
mutable std::map<OTetKey, CircumsphereData> circumsphereDataMap; |
| 130 |
typedef std::map<OTetKey, CircumsphereData> CircumsphereDataMap; |
| 131 |
typedef std::map<OTetKey, CircumsphereData>::iterator CircumsphereDataMapIter; |
| 132 |
}; |
| 133 |
|
| 134 |
#endif |