void DebugDrawer::drawTetrahedron(const Ogre::Vector3 ¢re, float scale, const Ogre::ColourValue& colour, bool isFilled) { buildTetrahedron(centre, scale, colour); if (isFilled) buildFilledTetrahedron(centre, scale, colour, fillAlpha); }
/** * Find four points p1, p2, p3, p4 in P that form a tetrahedron, and build a tetrahedron. */ void init (Arrangement &arr) { if (Orient3D(arr.vertices[0]->p, arr.vertices[1]->p, arr.vertices[2]->p, arr.vertices[3]->p) > 0) { buildTetrahedron (arr, arr.vertices[0], arr.vertices[1], arr.vertices[2], arr.vertices[3]); } else { buildTetrahedron (arr, arr.vertices[0], arr.vertices[2], arr.vertices[1], arr.vertices[3]); } // Initialize the conflict graph with all visible pairs(pt,f), where f is a facet of C and t > 4. for (int i = 4; i < arr.vertices.size(); ++i) { for (Faces::iterator f = arr.faces.begin(); f != arr.faces.end(); ++f) { // check if this face is visible from the vertex if ((*f)->visible(arr.vertices[i])) { arr.vertices[i]->visibleFaces.push_back(*f); (*f)->visibleVertices.push_back(arr.vertices[i]); } } } }
/** * @param points Points used to construct the convex hull. Points inside the convex hull are accepted but will unused. */ template<class T> ConvexHull3D<T>::ConvexHull3D(const std::vector<Point3<T>> &points) : nextPointIndex(0), nextTriangleIndex(0) { //build tetrahedron std::set<unsigned int> pointsToExclude = buildTetrahedron(points); //add each point to the tetrahedron for(unsigned int i=0;i<points.size();i++) { if(pointsToExclude.find(i)==pointsToExclude.end()) { addNewPoint(points[i]); } } }