[osg-users] osgUtil::Delaunay* question (where is the triangulation of the constraints?)

Trajce Nikolov NICK trajce.nikolov.nick at gmail.com
Sat Nov 12 09:14:31 PST 2016


Thanks anyway Robert,

I was counting from someone else from the community too, someone that might
have experience with this piece of the code.

I went to reading the code indeed and I managed it.

Nick

p.s. osgUtil::Delaunay* are really cool written classes!

On Sat, Nov 12, 2016 at 10:38 AM, Robert Osfield <robert.osfield at gmail.com>
wrote:

> Hi Nick,
>
> The original author of DelaunayTriangulator hasn't been an active
> member of the OSG for decade so it's unfortunately a case of reading
> the code to work out what is happening.
>
> I'm afraid it doesn't make much sense for me to go read your code,
> read the DelaunayTriangulator code and work out what is going on, then
> try to communicate my findings to you, it's just way more efficient to
> dive into the code yourself.
>
> Robert.
>
> On 11 November 2016 at 18:18, Trajce Nikolov NICK
> <trajce.nikolov.nick at gmail.com> wrote:
> > Hi Community,
> >
> > I hope you will help this time too. Struggling again :-).
> >
> > I am trying to add cultural features to terrain models, nothing fancy
> (yet!
> > :-) ) it is simple. Code will describe it more how I am doing it but it
> is
> > the very basic, elevations array to be triangulated with some
> constraints.
> > And it works nicely. However when I want to cut the triangulated
> constraint
> > from the terrain, and add this cut triangles as separate primitive set,
> > constraint->getTriangles() is empty. Based on the doxygen in the header
> I am
> > expecting to have these triangles there:
> >
> > /** Get the filling primitive. One:
> >      * triangulate must have bneen called and
> >      * two:  triangle list is filled when
> >      * DelaunayTriangulator::removeInternalTriangles is called.
> >      * These return the triangles removed from the delaunay
> triangulation by
> >      * DelaunayTriangulator::removeInternalTriangles. */
> >     inline const osg::DrawElementsUInt *getTriangles() const { return
> > prim_tris_.get(); }
> >
> > No triangles when calling this and this is the snippet:
> >
> > osg::ref_ptr<osgUtil::DelaunayTriangulator> triangulator = new
> > osgUtil::DelaunayTriangulator;
> >
> > osg::ref_ptr<osg::Vec3Array> polyline = getPolylineVertices(line);
> > osg::ref_ptr<osg::Vec3Array> polylineEdges = getEdges(polyline);
> >
> > constraint->setVertexArray(polylineEdges);
> > constraint->addPrimitiveSet(new osg::DrawArrays(GL_LINE_LOOP, 0,
> > polylineEdges->size()));
> >
> > triangulator->addInputConstraint(constraint);
> > triangulator->setInputPointArray(_points);
> > triangulator->triangulate();
> > triangulator->removeInternalTriangles(constraint);
> >
> > osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
> > geometry->setVertexArray(_points);
> > geometry->addPrimitiveSet(triangulator->getTriangles()); // triangles
> with
> > constraint cut
> > geometry->addPrimitiveSet(constraint->getTriangles()); // no triangles
> >
> > Thanks a bunch as always!
> >
> > Nick
> >
> > --
> > trajce nikolov nick
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-
> openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161112/7fa56900/attachment-0002.htm>


More information about the osg-users mailing list