105 double cx = NAN, cy = NAN;
109 double mx2 = 0.5 * (p2.
_x + p3.
_x);
110 double my2 = 0.5 * (p2.
_y + p3.
_y);
111 cx = 0.5 * (p2.
_x + p1.
_x);
112 cy = my2 - (p3.
_x - p2.
_x) * (cx - mx2) / (p3.
_y - p2.
_y);
116 double mx1 = 0.5 * (p1.
_x + p2.
_x);
117 double my1 = 0.5 * (p1.
_y + p2.
_y);
118 cx = 0.5 * (p3.
_x + p2.
_x);
119 cy = my1 - (p2.
_x - p1.
_x) * (cx - mx1) / (p2.
_y - p1.
_y);
123 double m1 = -(p2.
_x - p1.
_x) / (p2.
_y - p1.
_y);
124 double m2 = -(p3.
_x - p2.
_x) / (p3.
_y - p2.
_y);
125 double mx1 = 0.5 * (p1.
_x + p2.
_x);
126 double mx2 = 0.5 * (p2.
_x + p3.
_x);
127 double my1 = 0.5 * (p1.
_y + p2.
_y);
128 double my2 = 0.5 * (p2.
_y + p3.
_y);
129 cx = (m1 * mx1 - m2 * mx2 + my2 - my1) / (m1 - m2);
130 cy = m1 * (cx - mx1) + my1;
133 double dx = p2.
_x - cx;
134 double dy = p2.
_y - cy;
136 return (
OPoint3D(cx, cy, sqrt(dx * dx + dy * dy)));
146 unsigned int i = 0, j = 0;
157 double xmin = NAN, xmax = NAN, ymin = NAN, ymax = NAN, zmin = NAN, zmax = NAN;
163 for (i = 0; i < nb - 1; i++)
166 unsigned int nbSame = 0;
172 for (j = i + 1; j < nb; j++)
260 double dx = xmax - xmin;
261 double dy = ymax - ymin;
262 double dz = zmax - zmin;
278 double dx = NAN, dy = NAN, xmin = NAN, xmax = NAN, ymin = NAN, ymax = NAN;
280 int i = 0, j = 0, k = 0;
294 bool xMain = (dx >= dy);
295 double dmax = (xMain ? dx : dy);
300 double xmid = 0.5 * (xmax + xmin);
301 double ymid = 0.5 * (ymax + ymin);
304 for (i = 0; i < nb - 1; i++)
307 for (j = i + 1; j < nb; j++)
325 for (i = 0; i < nb - 1; i++)
328 for (j = i + 1; j < nb; j++)
348 QList<OPoint3D> circle;
349 QList<bool> complete;
350 QList<OTriangle> edge;
353 complete.push_back(
false);
355 for (i = 0; i < nb; i++)
378 if (dx * dx + dy * dy <= circle[j]._z * circle[j]._z)
386 complete[j] = complete.back();
388 circle[j] = circle.back();
394 for (j = 0; j < edge.size() - 1; j++)
396 for (k = j + 1; k < edge.size(); k++)
398 if ((edge[j]._p1 == edge[k]._p2) && (edge[j]._p2 == edge[k]._p1))
400 edge[j]._p3 = edge[k]._p3 = 0;
409 complete.push_back(
false);
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
bool compute(void)
Compute the triangulation.
QList< OTriangle > _triangleOut
Triangles list.
void getBoundaries(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
Define boundaries.
ODelaunayMaker(double triangulatePrecision)
Constructor.
QList< OTriangle > getFaces(void)
Return faces list.
void setDecimation(double xdecim, double ydecim, double zdecim)
Set decimation.
QList< OPoint3D > getVertex(void)
Return the vertexes list.
QList< OPoint3D > _vertexInOut
Vertexes list.
void reinitParameters(void)
Re-initialization all parameters to zero.
double _triangulatePrecision
virtual ~ODelaunayMaker()
Destructor.
OPoint3D computeCircle(const OPoint3D &p1, const OPoint3D &p2, const OPoint3D &p3)
void addVertex(OPoint3D vertex)
Add a vertex.