Hi, i want to triangulate the following U character like shape. [Image: http://jotschi.de/download/osg/delaunay_3.png ]
The DelaunayTriangulator generates this triangulated mesh. But as you can see the space in the middle of the U is also triangulated which i do not want. [Image: http://jotschi.de/download/osg/delaunay_2.png ] So i tried the DelaunayConstraint to add a constraint for all edges. Obviously i have no clue how to do this but i attach the image anyway. This doesn't seem to work: [Image: http://jotschi.de/download/osg/delaunay_1.png ] I used the following code: Code: osg::Group* root = new osg::Group(); osg::Vec3Array* v = new osg::Vec3Array; v->resize(16); //U (*v)[0].set(500, 250, 0); (*v)[1].set(500, 1000, 0); (*v)[2].set(500, 1000, 0); (*v)[3].set(1300, 1000, 0); (*v)[4].set(1300, 1000, 0); (*v)[5].set(1300, 250, 0); (*v)[6].set(1300, 250, 0); (*v)[7].set(1200, 250, 0); (*v)[8].set(1200, 250, 0); (*v)[9].set(1200, 900, 0); (*v)[10].set(1200, 900, 0); (*v)[11].set(650, 900, 0); (*v)[12].set(650, 900, 0); (*v)[13].set(650, 200, 0); (*v)[14].set(650, 200, 0); (*v)[15].set(500, 250, 0); osg::ref_ptr<osgUtil::DelaunayTriangulator> trig = new osgUtil::DelaunayTriangulator(); trig->setInputPointArray(v); osg::ref_ptr<osgUtil::DelaunayConstraint> constraint = new osgUtil::DelaunayConstraint; constraint->setVertexArray(v); constraint->addPrimitiveSet(new osg::DrawArrays( osg::PrimitiveSet::LINE_LOOP, 0, 3)); trig->addInputConstraint(constraint.get()); trig->triangulate(); trig->removeInternalTriangles(constraint.get()); osg::Geometry* gm = new osg::Geometry; gm->setVertexArray(v); gm->addPrimitiveSet(trig->getTriangles()); osg::Vec4Array* colors = new osg::Vec4Array(1); colors->push_back(osg::Vec4(1, 0, 1, 1)); gm->setColorArray(colors); gm->setColorBinding(osg::Geometry::BIND_OVERALL); osg::Geode* geode = new osg::Geode(); geode->addDrawable(gm); // you do not need this function call to use this example //forcedWireFrameModeOn(root); root->addChild(geode); /* int nEdges = 16; int i = 0; while (i < nEdges) { osg::Vec4 c = osg::Vec4(1., 1., 1., 1.); root->addChild(drawEdge(c, (*v)[i], (*v)[i + 1])); i += 2; } */ Do you have any idea how to solve this problem? I just want to get a triangulated mesh from the imput of a shapes outline. (The input is not a point cloud) Thank you! Cheers, Johannes ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16927#16927 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

