Hi Tianyun,

The sequence that the points are joined up in will depend upon the
algorithm which stitches all the triangle intersection segments together,
it's objective is to stick things together not sort things into an order
governed by the user - it's a complicated enough task that adding extra
constraints wouldn't be helpful.  If one did want to impose an order onto
the file polylines generated then you are best doing this as post process.
 The alternatively is to simply write code that isn't sensitive to the
ordering of the polylines.

Robert.


On 21 October 2013 08:45, Tianyun Su <[email protected]> wrote:

> Hi,
> I am trying to get the intersection points between an intersection plane and 
> a terrain using osgUtil::PlaneIntersector。
> The code is listed as following:
>
> osg::Plane planeLeft( osg::Vec3(1,0,0), osg::Vec3(0+1,0,0) );//define an 
> intersetion plane
> osg::Polytope polytopeLeft;//define the range of planeLeft
> polytopeLeft.add( osg::Plane(osg::Vec3(0,1,0), osg::Vec3(0,0,0)) );
> polytopeLeft.add( osg::Plane(osg::Vec3(0,-1,0), 
> osg::Vec3(0,GlobalVariable::g_maxDepth,0)) );
> osg::ref_ptr<osgUtil::PlaneIntersector> insectorLeft = new 
> osgUtil::PlaneIntersector(planeLeft, polytopeLeft);
> osgUtil::IntersectionVisitor ivleft(insectorLeft);
> geodeTerrain->accept(ivleft);
> if (insectorLeft->containsIntersections() )
> {
> //output the intersection points
> fstream file;
> file.open("Terrain.txt",ios::out);
>
> osgUtil::PlaneIntersector::Intersections& intersections = 
> insectorLeft->getIntersections();
> osgUtil::PlaneIntersector::Intersections::iterator itr = 
> intersections.begin();
> for ( unsigned int i=0; i<(*itr).polyline.size(); ++i )
> {
> file<<(*itr).polyline[i].x()<<","<<(*itr).polyline[i].y()<<","<<(*itr).polyline[i].z()<<std::endl;
> }
> file.close();
> }
> I can get the intersection points successfully. But, when I change the 
> terrain value just multiplying it with 3 and intersect with the same plane 
> again, the sequence of output intersection points is reversed. So I wonder 
> how can I control the sequence of the intersection points.
>
> Thank you!
>
> Cheers,
> Tianyun
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to