Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
SymMatrix.h
1// SYMMATRIX.h: interface for the CSymMatrix class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#if !defined(AFX_SYMMATRIX_H__BB3D80EA_003C_11D2_A0E3_000000000000__INCLUDED_)
6#define AFX_SYMMATRIX_H__BB3D80EA_003C_11D2_A0E3_000000000000__INCLUDED_
7
8#ifdef _MSC_VER
9#pragma once
10#endif // _MSC_VER
11
12BEGIN_MOOTOOLS_NAMESPACE
13
14#ifdef PLY_SMALL_FACES
15#define SYMMATRIX_INCLUDE_AREA
16#ifndef _DEBUG
17#pragma message("************************************************")
18#pragma message("SymMatrix : SYMMATRIX_INCLUDE_AREA is defined\n")
19#pragma message("************************************************")
20#endif
21#endif
22
23// double is used because it gives a very very better optimization...
24// It is also faster (15/04/2008)
25class DLLFUNCTION CSymMatrix
26{
27public:
28 double matrix[10];
29
30public:
31 void Init();
32 CSymMatrix();
33
34 void ComputeErrorQuadric(const C4DVectorD& plane);
35 void operator *=(double);
36 void OldMult(C3DVector& resvect, const C3DVector& vector) const;
37 void Mult(C3DVectorD& resvect, const C3DVectorD& vector) const;
38 bool operator==(const CSymMatrix&);
39
40 inline CSymMatrix& operator=(const CSymMatrix& refmatrix)
41 {
42 memcpy(matrix, refmatrix.matrix, sizeof(double[10]));
43#ifdef SYMMATRIX_INCLUDE_AREA
44 area = refmatrix.area;
45#endif
46 return *this;
47 }
48
49 inline double operator()(int i, int j) const
50 {
51 switch (i)
52 {
53 case 0:
54 switch (j)
55 {
56 case 0:
57 return matrix[0];
58 case 1:
59 return matrix[1];
60 case 2:
61 return matrix[2];
62 case 3:
63 return matrix[3];
64 }
65 break;
66
67 case 1:
68 switch (j)
69 {
70 case 0:
71 return matrix[1];
72 case 1:
73 return matrix[4];
74 case 2:
75 return matrix[5];
76 case 3:
77 return matrix[6];
78 }
79 break;
80
81 case 2:
82 switch (j)
83 {
84 case 0:
85 return matrix[2];
86 case 1:
87 return matrix[5];
88 case 2:
89 return matrix[7];
90 case 3:
91 return matrix[8];
92 }
93 break;
94
95 case 3:
96 switch (j)
97 {
98 case 0:
99 return matrix[3];
100 case 1:
101 return matrix[6];
102 case 2:
103 return matrix[8];
104 case 3:
105 return matrix[9];
106 }
107 break;
108
109 default:
110 XASSERT(0);
111 }
112
113 return 0.0;
114 }
115
116 void operator-= (const CSymMatrix& submatrix);
117 void operator+= (const CSymMatrix& matrix);
118 CSymMatrix(bool);
119 ~CSymMatrix(); // Avoid virtual. It adds one point on the C3DExtPointSize
120
121#ifdef _DEBUG
122 void Dump();
123#endif
124
125#ifdef SYMMATRIX_INCLUDE_AREA
126 double area;
127
128 inline void SetArea(double area)
129 {
130 this->area = area;
131 }
132
133 inline double GetArea() const
134 {
135 return area;
136 }
137#endif
138};
139
140END_MOOTOOLS_NAMESPACE
141
142#endif // !defined(AFX_SYMMATRIX_H__BB3D80EA_003C_11D2_A0E3_000000000000__INCLUDED_)
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27