Intersections with TerrainEngine graph

classic Classic list List threaded Threaded
5 messages Options
Tension Tension
Reply | Threaded
Open this post in threaded view
|

Intersections with TerrainEngine graph

This post was updated on .
Hi,

I have a task, where i need to find minimum and maximum height of selected region. To achieve this, i use PolytopeIntersector with constructed Polytope (similar to createPolytope from GeoExtent, but for n edges of polygon, instead of four of extent) and simple use something like this:

osg::ref_ptr<osgUtil::PolytopeIntersector> intersector = new osgUtil::PolytopeIntersector(polytope);
intersector->setPrimitiveMask(osgUtil::PolytopeIntersector::TRIANGLE_PRIMITIVES);
osgUtil::IntersectionVisitor visitor;
visitor.setIntersector(intersector);

 _mapNode->getTerrainEngine()->accept(visitor);

if (!intersector->containsIntersections()) {
    return;
}

osgUtil::PolytopeIntersector::Intersections& intersections = intersector->getIntersections();

It works fine in most cases, but sometimes height of some intersections was lower than i expected. And I discovered that this is due to the fact that where is some vertical-oriented rectangles between tiles (above real elevation data), and intersector hits them, because they are part of TerrainEngine.

Can i disable them, or atleast mask them for intersector somehow?

Thanks for any help!
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Intersections with TerrainEngine graph

What osgEarth version are you using?
Are you requesting a particular terrain engine or using the default?
Glenn Waldron / Pelican Mapping
Tension Tension
Reply | Threaded
Open this post in threaded view
|

Re: Intersections with TerrainEngine graph

Glenn,

I use osgEarth 2.10

I used MP engine. I just tried REX, this engine doesn't contain this meshes on tile borders, but my intersector can't find any intersections now.
Tension Tension
Reply | Threaded
Open this post in threaded view
|

Re: Intersections with TerrainEngine graph

Oh, sorry, it was fail from my side about no intersections with REX. It works fine now. Thanks for the hint about different engines.
So that means i can't use this method with MP engine, because of implementation (meshes around tile border, which we can't mask or disable)?
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Intersections with TerrainEngine graph

Correct - there is no way with the old MP engine to ignore the terrain skirts.

Glenn Waldron / Pelican Mapping