Beispiel #1
0
/// Do ??? with dag, and points a,b,c
/// What use does pIdx1 serve? Freshly inserted point?
/// => make sure edge bc is Locally Delaunay,
///    ??? and that the flips we make keep things Locally Delaunay
void DirectedGraph::legalizeEdge(int pIdx1, int pIdx2, int pIdx3) {
// TODO: legalizeEdge could be even quicker if we know adj. tri already
#ifdef DELAUNAY_CHECK
	cout << "DTri::legalizeEdge, " << pIdx1 << ", " << pIdx2 << "," << pIdx3 << endl;

	assert(isTriangleCCW(pointSet_, TriRecord(pIdx1, pIdx2, pIdx3)));
#endif

	int p4 = findAdjacentTriangle(pIdx1, pIdx2, pIdx3);

	if (p4 > 0) {
		// Presumably delaunayPointSet === dag.getPointSet()
		// so this is legit

		/// if this point is in the circumcircle of abc triangle..
		if (pointSet_.inCircle(pIdx1, pIdx2, pIdx3, p4) > 0) {
			///> want to replace ij w/ kr
			// abd, dbc must be triangles.
			// TRI = pidx1,2,3;
			// TRI = pidx2,3,4
			// dag.flipTriangles(pIdx1, pIdx2, pIdx3, p4);
			flipTriangles(pIdx1, pIdx2, p4, pIdx3);
		}
	}
}
Beispiel #2
0
my::ConicMesh::ConicMesh(const float & height, const float & aperture, const int & nbSlices, const int & nbStacks)
    :ParametricMesh("ConicMesh", nbStacks+2, 2*nbSlices),
      _height(height),
      _aperture(aperture),
      _nbSlices(nbSlices),
      _nbStacks(nbStacks)
{
    _preConicMesh(_height, _aperture, _nbSlices, _nbStacks);

    my::Conic coord(Point(0,-1,0), _aperture);

    parametricVertexInsertion(imax()-1, jmax(), coord);
    this->addVertex(0,-1,0);

    parametricTriangleInsertion(imax()-1, jmax());

    flipTriangles();

    computeNormalsT();
    computeNormalsV();
}