Re: [osg-users] PagedLOD and IntersectionVisitor

2013-11-29 Thread Olivier Tournaire
Robert,

Thank you for your idea. Something that I forgive to mention in my posts is
that the data I use to build the polytopes are in a geographic reference
system, and my models are in local coordinates. I thus used to add a
MatrixTransform to my input model (and to several nodes I had to create for
my particular purpose). It seems that removing all this MatrixTransforms
(translations) and simply translating GIS data did the trick.

So, problem solved!

Thanks again for your help.

Regards,

Olivier


2013/11/22 Robert Osfield robert.osfi...@gmail.com

 Hi Olivier,

 It sounds like the next thing to investigate would be the size of the
 bounding sphere that it's testing against, perhaps there is an error in the
 bounding sphere settings that is resulting in the traversal being culled
 prematurely.

 Robert.


 On 22 November 2013 14:03, Olivier Tournaire olit...@gmail.com wrote:

 Hi Robert,

 Thank you for your answer. Unfortunately, I cannot share the model ...
 However, I can share the code.

 Here it is:

 // Building a osgUtil::PolytopeIntersector from a CONCAVE planar polygon

 /* 1) split the concave polygon in its convex rings */
 /* 2) iterate over each convex ring to build a convex
 osg::Polyope */

 // Begin loop over convex rings
 osg::Polytope currentBuildingPolytope;
 for(int j=0;jring.getNumPoints()-1;++j)
 {
 osg::Vec3d A( ring.getX(j),   ring.getY(j),   ring.getZ(j)   );
 osg::Vec3d B( ring.getX(j+1), ring.getY(j+1), ring.getZ(j+1) );
 osg::Vec3d C( ring.getX(j+1), ring.getY(j+1),
 ring.getZ(j+1)+delta ); // delta  0.

 osg::Vec3d AB = B-A; AB.normalize();
 osg::Vec3d BC = C-B; BC.normalize();
 osg::Vec3d n = BC^AB; n.normalize();

 osg::Plane p(n,A);
 currentBuildingPolytope.add(p);
 }
 osg::ref_ptrosgUtil::PolytopeIntersector
 currentPolytopeIntersector = new
 osgUtil::PolytopeIntersector(currentBuildingPolytope);

 currentPolytopeIntersector-setDimensionMask(osgUtil::PolytopeIntersector::DimTwo);
 // End loop over convex rings

 /* 3) add the convex osg::Polytope to a vector
 ref_ptrosgUtil::PolytopeIntersector  */
 _polytopeIntersectors.push_back(currentPolytopeIntersector);

 /* 4) Find intersections of the model with the previously build
 osgUtil::PolytopeIntersectors */
 bool hasIntersections = false;
 for(unsigned int i=0;i_polytopeIntersectors.size();++i)
 {
 osgUtil::IntersectionVisitor
 visitor(_polytopeIntersectors[i].get());
 osg::ref_ptrosgSim::DatabaseCacheReadCallback _readCallback
 = new osgSim::DatabaseCacheReadCallback;
 visitor.setReadCallback(_readCallback);
 model-accept(visitor); // model contains one triangle per
 Drawable

 if(_polytopeIntersectors[i]-containsIntersections())
 {
 hasIntersections = true;
 _numIntersections +=
 _polytopeIntersectors[i]-getIntersections().size();
 // ...
 }
 // ...
 }

 If you see anything wrong, please let me know.

 As I tols in my first post, the reader callback works quite well (my DB
 model contains around 150 files). Debugging my application, the method
 IntersectionVisitor::apply(osg::PagedLOD plod) exits on the first line
 only if _intersectorStack.back()-enter(node); returns false. This happen
 in LineSegmentIntersector::intersects(const osg::BoundingSphere bs),
 because of this line:
  if (d0.0) return false;
 which seems to mean that the bounding sphere of the current PagedLOD is
 not intersected by the line.

 Hope this give you more :)

 Regards,

 Olivier


 2013/11/21 Robert Osfield robert.osfi...@gmail.com

 Hi Oliver,

 I have looked at the OSG code and can't see a specific cause, but then I
 don't have your code or models so it's all just guessing.

 Does LineOfSight work fine for you?  If so I'd recommend stepping
 through to see what happening and then compare it with your own usage.

 Robert.


 On 19 November 2013 19:58, Olivier Tournaire olit...@gmail.com wrote:

 Hi all,

 Sorry for the noise, but, as I did not receive any answer, I am
 interested if someone has an idea on the topic.

 Regards,

 Olivier


 2013/11/15 Olivier Tournaire olit...@gmail.com

 Hi,

 I am currently trying to retrieve some specific triangles in a
 PagedLOD model. To do so, I use a PolytopeIntersector with an
 IntersectionVisitor. As my model is a PagedLOD, I have set up a reader
 callback, directly taken from osgSim::LineOfSight.

 The intersector works, but not as expected: it gives me the triangles
 at the lowest resolution, whereas I would expect to have them at the 
 finest
 LOD. Debugging my program showed me that the void
 IntersectionVisitor::apply(osg::PagedLOD plod) method goes where it has 
 to
 (i.e., it traverses correctly all childs until the best resolution).

 As the 

Re: [osg-users] PagedLOD and IntersectionVisitor

2013-11-22 Thread Olivier Tournaire
Hi Robert,

Thank you for your answer. Unfortunately, I cannot share the model ...
However, I can share the code.

Here it is:

// Building a osgUtil::PolytopeIntersector from a CONCAVE planar polygon

/* 1) split the concave polygon in its convex rings */
/* 2) iterate over each convex ring to build a convex osg::Polyope
*/

// Begin loop over convex rings
osg::Polytope currentBuildingPolytope;
for(int j=0;jring.getNumPoints()-1;++j)
{
osg::Vec3d A( ring.getX(j),   ring.getY(j),   ring.getZ(j)   );
osg::Vec3d B( ring.getX(j+1), ring.getY(j+1), ring.getZ(j+1) );
osg::Vec3d C( ring.getX(j+1), ring.getY(j+1), ring.getZ(j+1)+delta
); // delta  0.

osg::Vec3d AB = B-A; AB.normalize();
osg::Vec3d BC = C-B; BC.normalize();
osg::Vec3d n = BC^AB; n.normalize();

osg::Plane p(n,A);
currentBuildingPolytope.add(p);
}
osg::ref_ptrosgUtil::PolytopeIntersector
currentPolytopeIntersector = new
osgUtil::PolytopeIntersector(currentBuildingPolytope);

currentPolytopeIntersector-setDimensionMask(osgUtil::PolytopeIntersector::DimTwo);
// End loop over convex rings

/* 3) add the convex osg::Polytope to a vector
ref_ptrosgUtil::PolytopeIntersector  */
_polytopeIntersectors.push_back(currentPolytopeIntersector);

/* 4) Find intersections of the model with the previously build
osgUtil::PolytopeIntersectors */
bool hasIntersections = false;
for(unsigned int i=0;i_polytopeIntersectors.size();++i)
{
osgUtil::IntersectionVisitor
visitor(_polytopeIntersectors[i].get());
osg::ref_ptrosgSim::DatabaseCacheReadCallback _readCallback =
new osgSim::DatabaseCacheReadCallback;
visitor.setReadCallback(_readCallback);
model-accept(visitor); // model contains one triangle per
Drawable

if(_polytopeIntersectors[i]-containsIntersections())
{
hasIntersections = true;
_numIntersections +=
_polytopeIntersectors[i]-getIntersections().size();
// ...
}
// ...
}

If you see anything wrong, please let me know.

As I tols in my first post, the reader callback works quite well (my DB
model contains around 150 files). Debugging my application, the method
IntersectionVisitor::apply(osg::PagedLOD plod) exits on the first line
only if _intersectorStack.back()-enter(node); returns false. This happen
in LineSegmentIntersector::intersects(const osg::BoundingSphere bs),
because of this line:
 if (d0.0) return false;
which seems to mean that the bounding sphere of the current PagedLOD is not
intersected by the line.

Hope this give you more :)

Regards,

Olivier


2013/11/21 Robert Osfield robert.osfi...@gmail.com

 Hi Oliver,

 I have looked at the OSG code and can't see a specific cause, but then I
 don't have your code or models so it's all just guessing.

 Does LineOfSight work fine for you?  If so I'd recommend stepping through
 to see what happening and then compare it with your own usage.

 Robert.


 On 19 November 2013 19:58, Olivier Tournaire olit...@gmail.com wrote:

 Hi all,

 Sorry for the noise, but, as I did not receive any answer, I am
 interested if someone has an idea on the topic.

 Regards,

 Olivier


 2013/11/15 Olivier Tournaire olit...@gmail.com

 Hi,

 I am currently trying to retrieve some specific triangles in a PagedLOD
 model. To do so, I use a PolytopeIntersector with an IntersectionVisitor.
 As my model is a PagedLOD, I have set up a reader callback, directly taken
 from osgSim::LineOfSight.

 The intersector works, but not as expected: it gives me the triangles at
 the lowest resolution, whereas I would expect to have them at the finest
 LOD. Debugging my program showed me that the void
 IntersectionVisitor::apply(osg::PagedLOD plod) method goes where it has to
 (i.e., it traverses correctly all childs until the best resolution).

 As the IntersectionVisitor sets up by default to use
 the USE_HIGHEST_LEVEL_OF_DETAIL flag, I am wondering if I am missing
 something and if you could give some pointers on how to achieve triangles
 extraction at the finest LOD.

 The header root file is:

 osg::PagedLOD {
   UniqueID 1
   Name Tile_+001_+006.osgb
   CenterMode USER_DEFINED_CENTER
   UserCenter -741.555 904.039 94.1168 213.403
   RangeMode PIXEL_SIZE_ON_SCREEN
   RangeList 2 {
 0 106.702
 106.702 1e+030
   }
   DatabasePath FALSE
   RangeDataList 2 {
 
 Tile_+001_+006_L15_0.osgb
   }
   PriorityList 2 {
 0 1
 0 1
   }

 The header of the child file (Tile_+001_+006_L15_0.osgb) is:

 osg::PagedLOD {
   UniqueID 1
   Name Tile_+001_+006_L15_0.osgb
   CenterMode USER_DEFINED_CENTER
   UserCenter -741.869 906.466 94.7166 206.312
   RangeMode PIXEL_SIZE_ON_SCREEN
   RangeList 2 {
 0 206.312
 206.312 1e+030
   }
   DatabasePath FALSE
   RangeDataList 2 {
 
 

Re: [osg-users] PagedLOD and IntersectionVisitor

2013-11-22 Thread Robert Osfield
Hi Olivier,

It sounds like the next thing to investigate would be the size of the
bounding sphere that it's testing against, perhaps there is an error in the
bounding sphere settings that is resulting in the traversal being culled
prematurely.

Robert.


On 22 November 2013 14:03, Olivier Tournaire olit...@gmail.com wrote:

 Hi Robert,

 Thank you for your answer. Unfortunately, I cannot share the model ...
 However, I can share the code.

 Here it is:

 // Building a osgUtil::PolytopeIntersector from a CONCAVE planar polygon

 /* 1) split the concave polygon in its convex rings */
 /* 2) iterate over each convex ring to build a convex osg::Polyope
 */

 // Begin loop over convex rings
 osg::Polytope currentBuildingPolytope;
 for(int j=0;jring.getNumPoints()-1;++j)
 {
 osg::Vec3d A( ring.getX(j),   ring.getY(j),   ring.getZ(j)   );
 osg::Vec3d B( ring.getX(j+1), ring.getY(j+1), ring.getZ(j+1) );
 osg::Vec3d C( ring.getX(j+1), ring.getY(j+1), ring.getZ(j+1)+delta
 ); // delta  0.

 osg::Vec3d AB = B-A; AB.normalize();
 osg::Vec3d BC = C-B; BC.normalize();
 osg::Vec3d n = BC^AB; n.normalize();

 osg::Plane p(n,A);
 currentBuildingPolytope.add(p);
 }
 osg::ref_ptrosgUtil::PolytopeIntersector
 currentPolytopeIntersector = new
 osgUtil::PolytopeIntersector(currentBuildingPolytope);

 currentPolytopeIntersector-setDimensionMask(osgUtil::PolytopeIntersector::DimTwo);
 // End loop over convex rings

 /* 3) add the convex osg::Polytope to a vector
 ref_ptrosgUtil::PolytopeIntersector  */
 _polytopeIntersectors.push_back(currentPolytopeIntersector);

 /* 4) Find intersections of the model with the previously build
 osgUtil::PolytopeIntersectors */
 bool hasIntersections = false;
 for(unsigned int i=0;i_polytopeIntersectors.size();++i)
 {
 osgUtil::IntersectionVisitor
 visitor(_polytopeIntersectors[i].get());
 osg::ref_ptrosgSim::DatabaseCacheReadCallback _readCallback
 = new osgSim::DatabaseCacheReadCallback;
 visitor.setReadCallback(_readCallback);
 model-accept(visitor); // model contains one triangle per
 Drawable

 if(_polytopeIntersectors[i]-containsIntersections())
 {
 hasIntersections = true;
 _numIntersections +=
 _polytopeIntersectors[i]-getIntersections().size();
 // ...
 }
 // ...
 }

 If you see anything wrong, please let me know.

 As I tols in my first post, the reader callback works quite well (my DB
 model contains around 150 files). Debugging my application, the method
 IntersectionVisitor::apply(osg::PagedLOD plod) exits on the first line
 only if _intersectorStack.back()-enter(node); returns false. This happen
 in LineSegmentIntersector::intersects(const osg::BoundingSphere bs),
 because of this line:
  if (d0.0) return false;
 which seems to mean that the bounding sphere of the current PagedLOD is
 not intersected by the line.

 Hope this give you more :)

 Regards,

 Olivier


 2013/11/21 Robert Osfield robert.osfi...@gmail.com

 Hi Oliver,

 I have looked at the OSG code and can't see a specific cause, but then I
 don't have your code or models so it's all just guessing.

 Does LineOfSight work fine for you?  If so I'd recommend stepping through
 to see what happening and then compare it with your own usage.

 Robert.


 On 19 November 2013 19:58, Olivier Tournaire olit...@gmail.com wrote:

 Hi all,

 Sorry for the noise, but, as I did not receive any answer, I am
 interested if someone has an idea on the topic.

 Regards,

 Olivier


 2013/11/15 Olivier Tournaire olit...@gmail.com

 Hi,

 I am currently trying to retrieve some specific triangles in a PagedLOD
 model. To do so, I use a PolytopeIntersector with an IntersectionVisitor.
 As my model is a PagedLOD, I have set up a reader callback, directly taken
 from osgSim::LineOfSight.

 The intersector works, but not as expected: it gives me the triangles
 at the lowest resolution, whereas I would expect to have them at the finest
 LOD. Debugging my program showed me that the void
 IntersectionVisitor::apply(osg::PagedLOD plod) method goes where it has to
 (i.e., it traverses correctly all childs until the best resolution).

 As the IntersectionVisitor sets up by default to use
 the USE_HIGHEST_LEVEL_OF_DETAIL flag, I am wondering if I am missing
 something and if you could give some pointers on how to achieve triangles
 extraction at the finest LOD.

 The header root file is:

 osg::PagedLOD {
   UniqueID 1
   Name Tile_+001_+006.osgb
   CenterMode USER_DEFINED_CENTER
   UserCenter -741.555 904.039 94.1168 213.403
   RangeMode PIXEL_SIZE_ON_SCREEN
   RangeList 2 {
 0 106.702
 106.702 1e+030
   }
   DatabasePath FALSE
   RangeDataList 2 {
 
 Tile_+001_+006_L15_0.osgb
   }
   PriorityList 2 {
  

Re: [osg-users] PagedLOD and IntersectionVisitor

2013-11-21 Thread Robert Osfield
Hi Oliver,

I have looked at the OSG code and can't see a specific cause, but then I
don't have your code or models so it's all just guessing.

Does LineOfSight work fine for you?  If so I'd recommend stepping through
to see what happening and then compare it with your own usage.

Robert.


On 19 November 2013 19:58, Olivier Tournaire olit...@gmail.com wrote:

 Hi all,

 Sorry for the noise, but, as I did not receive any answer, I am interested
 if someone has an idea on the topic.

 Regards,

 Olivier


 2013/11/15 Olivier Tournaire olit...@gmail.com

 Hi,

 I am currently trying to retrieve some specific triangles in a PagedLOD
 model. To do so, I use a PolytopeIntersector with an IntersectionVisitor.
 As my model is a PagedLOD, I have set up a reader callback, directly taken
 from osgSim::LineOfSight.

 The intersector works, but not as expected: it gives me the triangles at
 the lowest resolution, whereas I would expect to have them at the finest
 LOD. Debugging my program showed me that the void
 IntersectionVisitor::apply(osg::PagedLOD plod) method goes where it has to
 (i.e., it traverses correctly all childs until the best resolution).

 As the IntersectionVisitor sets up by default to use
 the USE_HIGHEST_LEVEL_OF_DETAIL flag, I am wondering if I am missing
 something and if you could give some pointers on how to achieve triangles
 extraction at the finest LOD.

 The header root file is:

 osg::PagedLOD {
   UniqueID 1
   Name Tile_+001_+006.osgb
   CenterMode USER_DEFINED_CENTER
   UserCenter -741.555 904.039 94.1168 213.403
   RangeMode PIXEL_SIZE_ON_SCREEN
   RangeList 2 {
 0 106.702
 106.702 1e+030
   }
   DatabasePath FALSE
   RangeDataList 2 {
 
 Tile_+001_+006_L15_0.osgb
   }
   PriorityList 2 {
 0 1
 0 1
   }

 The header of the child file (Tile_+001_+006_L15_0.osgb) is:

 osg::PagedLOD {
   UniqueID 1
   Name Tile_+001_+006_L15_0.osgb
   CenterMode USER_DEFINED_CENTER
   UserCenter -741.869 906.466 94.7166 206.312
   RangeMode PIXEL_SIZE_ON_SCREEN
   RangeList 2 {
 0 206.312
 206.312 1e+030
   }
   DatabasePath FALSE
   RangeDataList 2 {
 
 Tile_+001_+006_L16_00.osgb
   }
   PriorityList 2 {
 0 1
 0 1
   }


 Hope you could help

 Regards,

 Olivier



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and IntersectionVisitor

2013-11-19 Thread Olivier Tournaire
Hi all,

Sorry for the noise, but, as I did not receive any answer, I am interested
if someone has an idea on the topic.

Regards,

Olivier


2013/11/15 Olivier Tournaire olit...@gmail.com

 Hi,

 I am currently trying to retrieve some specific triangles in a PagedLOD
 model. To do so, I use a PolytopeIntersector with an IntersectionVisitor.
 As my model is a PagedLOD, I have set up a reader callback, directly taken
 from osgSim::LineOfSight.

 The intersector works, but not as expected: it gives me the triangles at
 the lowest resolution, whereas I would expect to have them at the finest
 LOD. Debugging my program showed me that the void
 IntersectionVisitor::apply(osg::PagedLOD plod) method goes where it has to
 (i.e., it traverses correctly all childs until the best resolution).

 As the IntersectionVisitor sets up by default to use
 the USE_HIGHEST_LEVEL_OF_DETAIL flag, I am wondering if I am missing
 something and if you could give some pointers on how to achieve triangles
 extraction at the finest LOD.

 The header root file is:

 osg::PagedLOD {
   UniqueID 1
   Name Tile_+001_+006.osgb
   CenterMode USER_DEFINED_CENTER
   UserCenter -741.555 904.039 94.1168 213.403
   RangeMode PIXEL_SIZE_ON_SCREEN
   RangeList 2 {
 0 106.702
 106.702 1e+030
   }
   DatabasePath FALSE
   RangeDataList 2 {
 
 Tile_+001_+006_L15_0.osgb
   }
   PriorityList 2 {
 0 1
 0 1
   }

 The header of the child file (Tile_+001_+006_L15_0.osgb) is:

 osg::PagedLOD {
   UniqueID 1
   Name Tile_+001_+006_L15_0.osgb
   CenterMode USER_DEFINED_CENTER
   UserCenter -741.869 906.466 94.7166 206.312
   RangeMode PIXEL_SIZE_ON_SCREEN
   RangeList 2 {
 0 206.312
 206.312 1e+030
   }
   DatabasePath FALSE
   RangeDataList 2 {
 
 Tile_+001_+006_L16_00.osgb
   }
   PriorityList 2 {
 0 1
 0 1
   }


 Hope you could help

 Regards,

 Olivier

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] PagedLOD and IntersectionVisitor

2013-11-15 Thread Olivier Tournaire
Hi,

I am currently trying to retrieve some specific triangles in a PagedLOD
model. To do so, I use a PolytopeIntersector with an IntersectionVisitor.
As my model is a PagedLOD, I have set up a reader callback, directly taken
from osgSim::LineOfSight.

The intersector works, but not as expected: it gives me the triangles at
the lowest resolution, whereas I would expect to have them at the finest
LOD. Debugging my program showed me that the void
IntersectionVisitor::apply(osg::PagedLOD plod) method goes where it has to
(i.e., it traverses correctly all childs until the best resolution).

As the IntersectionVisitor sets up by default to use
the USE_HIGHEST_LEVEL_OF_DETAIL flag, I am wondering if I am missing
something and if you could give some pointers on how to achieve triangles
extraction at the finest LOD.

The header root file is:

osg::PagedLOD {
  UniqueID 1
  Name Tile_+001_+006.osgb
  CenterMode USER_DEFINED_CENTER
  UserCenter -741.555 904.039 94.1168 213.403
  RangeMode PIXEL_SIZE_ON_SCREEN
  RangeList 2 {
0 106.702
106.702 1e+030
  }
  DatabasePath FALSE
  RangeDataList 2 {

Tile_+001_+006_L15_0.osgb
  }
  PriorityList 2 {
0 1
0 1
  }

The header of the child file (Tile_+001_+006_L15_0.osgb) is:

osg::PagedLOD {
  UniqueID 1
  Name Tile_+001_+006_L15_0.osgb
  CenterMode USER_DEFINED_CENTER
  UserCenter -741.869 906.466 94.7166 206.312
  RangeMode PIXEL_SIZE_ON_SCREEN
  RangeList 2 {
0 206.312
206.312 1e+030
  }
  DatabasePath FALSE
  RangeDataList 2 {

Tile_+001_+006_L16_00.osgb
  }
  PriorityList 2 {
0 1
0 1
  }


Hope you could help

Regards,

Olivier
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and IntersectionVisitor

2008-06-27 Thread Robert Osfield
Hi Paul,

On Thu, Jun 26, 2008 at 8:25 PM, Paul Martz [EMAIL PROTECTED] wrote:
 Switch derives from Group, and if I create a Switch and set all its children
 on, I think we can all agree that it should act just like Group.

 In the same way, since PagedLOD derives from LOD, once all its children are
 loaded, I'd expect it to work just like LOD. But this isn't what I see.

Sorry but you can't make a PagedLOD work just like a LOD.  Yes it's
related but not identical as it has to have extra constraints to
enable the ability to have fallback mechanism that is essential to
PagedLOD.

If you want LOD that has children that are paged in a uniform way than
using LOD with ProxyNode as children is what you should do.

 Attached are two files, identical except that one uses an LOD and the other
 uses a PagedLOD. Run osgpick on both, and you'll see that it works fine for
 the PagedLOD case, but fails to pick anything for the LOD case.

 I suspect the problem is in how IntersectionVisitor has completely different
 logic for both LOD and PagedLOD, but without understanding the difference,
 I'm not inclined to tinker with the code.

 What do you make of it? Is the LOD test case just a badly-formed LOD because
 the max range doesn't go to zero distance? If so, again, this is a
 restriction of LOD usage that I'm not aware of, nor do I understand why it
 isn't also a restriction on PagedLOD usage...

What I make of it is you a flogging the PagedLOD because it can handle
misuse of it.  Fix the database.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and IntersectionVisitor

2008-06-27 Thread Paul Martz
 What I make of it is you a flogging the PagedLOD because it 
 can handle misuse of it.  Fix the database.

I encourage you to reread my previous post, as the test data I posted
clearly concerns questionable LOD behavior; the PagedLOD case works fine...
   -Paul

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and IntersectionVisitor

2008-06-27 Thread Robert Osfield
On Fri, Jun 27, 2008 at 2:14 PM, Paul Martz [EMAIL PROTECTED] wrote:
 What I make of it is you a flogging the PagedLOD because it
 can handle misuse of it.  Fix the database.

 I encourage you to reread my previous post, as the test data I posted
 clearly concerns questionable LOD behavior; the PagedLOD case works fine...

Just re-read, and tested the paged.osg and lod.osg files, and confirm
at my end that the picking ist working for paged.osg but not lod.osg.

The IntersectionVistor code should be using the LOD::traverse()
method, and the TRAVERSE_ACTIVE_CHILDREN method in particular.  This
code itself has been pretty reliable for a number of years, so I'd
guess it's correct.  Perhaps its the getDistanceToViewPoint code is
not producing appropriate values.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] PagedLOD and IntersectionVisitor

2008-06-26 Thread Paul Martz
Hi Robert -- I'm redirecting this from osg-submissions to osg-users, as it
is now more of a general discussion than a submission.

 PagedLOD's that don't have children ordered from lowest to 
 height res are invalid,

Okay. I didn't know that, and it's surprising, as I'm under the impression
that the base class LOD doesn't have this restriction.

 Having multiple children at the 
 same range will also break this mechanism.

To be clear, you are saying that multiple children at the same range breaks
the IntersectionVisitor, but is still valid usage, right? I understand it
breaks the code in question, thus my submission. Would you like me to
resubmit the fix, addressing only the multiple-children shortcoming, and
maintaining the range-ordering assumption?

 There isn't any 
 code to catch erroneous PagedLODs, it's currently assumed 
 that the user will set things up appropriately.

I understand it might be useful to assert ordered children, not sure where
this would go.

 How were the files generated?

I have a client with the multiple-children issue. He has multiple children
at the max res range but is only able to pick one using the
IntersectionVisitor (as the case2.osg file demonstrates). With the fix I
submitted, all children at the max res range are pickable.

The out-of-order test case was hand-generated. This is not an issue for my
client, but would be an issue for anyone using PagedLOD as a normal LOD.

BTW I note a significant difference between the handling of LOD and PagedLOD
by the IntersectionVisitor, is this intentional?
   -Paul

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and IntersectionVisitor

2008-06-26 Thread Robert Osfield
Hi Paul,

On Thu, Jun 26, 2008 at 7:01 PM, Paul Martz [EMAIL PROTECTED] wrote:
 Hi Robert -- I'm redirecting this from osg-submissions to osg-users, as it
 is now more of a general discussion than a submission.

 PagedLOD's that don't have children ordered from lowest to
 height res are invalid,

 Okay. I didn't know that, and it's surprising, as I'm under the impression
 that the base class LOD doesn't have this restriction.

LOD don't have this restriction, but they aren't being populated on
the fly, and they don't have an extra fallback mechanism that PagedLOD
adds into the mix to handle cases where the required level of detail
is not available yet.

PagedLOD's have to be ordered in from low res to high res, and without
duplicates for the whole paged request and fallback mechanism to
function.  This constraint on PagedLOD is something that was discussed
heavily during its development, but I guess that's a few years back
now so easily forgoton/missed.  Just checking the doxygen docs I can
see that there is no note of this constraint so we really need to fill
in these blanks.

 Having multiple children at the
 same range will also break this mechanism.

 To be clear, you are saying that multiple children at the same range breaks
 the IntersectionVisitor, but is still valid usage, right?

It's not just the orignal IntersectionVisitor::accept(PagedLOD) that
won't behave correctly for PagedLOD's that aren't set up correctly,
the CullVisitor and any other visitors that make that assumptions
about the structure of a PageLOD will also be broken.

  I understand it
 breaks the code in question, thus my submission. Would you like me to
 resubmit the fix, addressing only the multiple-children shortcoming, and
 maintaining the range-ordering assumption?

I've merged your changes, as they look safe for correct PagedLOD as
well as your rather freeform versions.


 There isn't any
 code to catch erroneous PagedLODs, it's currently assumed
 that the user will set things up appropriately.

 I understand it might be useful to assert ordered children, not sure where
 this would go.

Yes, a check would be easy to write, but it's not something you'd want
to call every traversal, and its not something you can call on each
update of the range data as it's not till you have all the data
applied can you set that its valid or not.  Perhaps if you constrained
the ways you could set the ranges, or have a dirty mechanism w.r.t the
check then perhaps could do the checks safely.

 How were the files generated?

 I have a client with the multiple-children issue. He has multiple children
 at the max res range but is only able to pick one using the
 IntersectionVisitor (as the case2.osg file demonstrates). With the fix I
 submitted, all children at the max res range are pickable.

For PagedLOD multiple children really should be tackled by placing
both children into a single group and then having this group at this
range.

 The out-of-order test case was hand-generated. This is not an issue for my
 client, but would be an issue for anyone using PagedLOD as a normal LOD.

 BTW I note a significant difference between the handling of LOD and PagedLOD
 by the IntersectionVisitor, is this intentional?

Well PagedLOD has the fallback mechanism, and has strict ordering
constraint that's what makes it different.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and IntersectionVisitor

2008-06-26 Thread Paul Martz
  BTW I note a significant difference between the handling of LOD and 
  PagedLOD by the IntersectionVisitor, is this intentional?
 
 Well PagedLOD has the fallback mechanism, and has strict 
 ordering constraint that's what makes it different.

Switch derives from Group, and if I create a Switch and set all its children
on, I think we can all agree that it should act just like Group.

In the same way, since PagedLOD derives from LOD, once all its children are
loaded, I'd expect it to work just like LOD. But this isn't what I see.

Attached are two files, identical except that one uses an LOD and the other
uses a PagedLOD. Run osgpick on both, and you'll see that it works fine for
the PagedLOD case, but fails to pick anything for the LOD case.

I suspect the problem is in how IntersectionVisitor has completely different
logic for both LOD and PagedLOD, but without understanding the difference,
I'm not inclined to tinker with the code.

What do you make of it? Is the LOD test case just a badly-formed LOD because
the max range doesn't go to zero distance? If so, again, this is a
restriction of LOD usage that I'm not aware of, nor do I understand why it
isn't also a restriction on PagedLOD usage...
   -Paul


paged.osg
Description: Binary data


lod.osg
Description: Binary data
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and IntersectionVisitor

2008-06-26 Thread Paul Martz
 For PagedLOD multiple children really should be tackled by 
 placing both children into a single group and then having 
 this group at this range.

If each child is currently in a separate file, then this restriction
requires reformatting the database so that all those children are in a
single file under a Group node. Correct?
   -Paul

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and IntersectionVisitor

2008-06-26 Thread Thrall, Bryan
Paul Martz wrote on Thursday, June 26, 2008 2:37 PM:

 For PagedLOD multiple children really should be tackled by
 placing both children into a single group and then having
 this group at this range.
 
 If each child is currently in a separate file, then this restriction
 requires reformatting the database so that all those children are in a
 single file under a Group node. Correct?
-Paul

Or using ProxyNodes for them under the Group node.

-- 
Bryan Thrall
FlightSafety International
[EMAIL PROTECTED]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org