Re: [osg-users] intersection of lines: line widths?

2012-10-23 Thread Peter Hrenka
Hi Andy,

Am 22.10.2012 21:05, schrieb Andy Skinner:
 I know that intersections are about 3d world coordinates, and line widths are 
 about pixels.  But is there a way to use line widths in calculating 
 intersections with the polytope intersector?
 
There is currently no code in PolytopeIntersector which takes line widths (or 
point sizes) into account.
While it would be possible to implement it I doubt that it would be worth the 
effort.

 
 In other words, I want a wider line to be easier to pick.

I think this could be accomplished by a post-processing step
on the results: Normally you would use the nearest intersection
but in your case you could also check the line width and prefer
thicker lines over nearer lines.

 I could just expand the polytope a bit, except that the lines are just one 
 kind of thing in the scene, and they could have different line widths.

I think your expanded polytope-idea should also work.
You could use differently sized polytopes for different 
line widths.

As for your other kinds of thinks in the scene you should
be aware that the performance of PolytopeIntersector for
2d-geometries is rather bad. It is much faster to use
LineSegementIntersector for those and combine the results
afterwards.

 
 thanks,
 
 andy
 

Cheers,

Peter

  
 
 
 
 ___
 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] intersection of lines: line widths?

2012-10-23 Thread Andy Skinner
Thanks for comments, Peter.

By easier to pick, I didn't mean relative to other lines in the scene, but 
that I wouldn't have to be as close to the actual line geometry.  It is a 
question of whether the line will be in the list of intersections, rather than 
which intersection I choose.

I suspect the same thing about whether it is worth the effort.

 As for your other kinds of thinks in the scene you should be aware that the 
 performance of PolytopeIntersector for 2d-geometries is rather bad. It is 
 much faster to use LineSegementIntersector for those and combine the results 
 afterwards.

By 2d-geometries, do you mean triangles and quads (and not 2D scenes)?  And 
that it would be better to run the polytope intersector for points and lines, 
and a separate line intersector for triangles and quads, and combine 
intersections?  I know all of that is pretty much what you said, but I wanted 
to be sure.  That's using two intersection traversals.  Sounds interesting if 
it is really faster.

thanks,
andy

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


Re: [osg-users] intersection of lines: line widths?

2012-10-23 Thread Peter Hrenka
Hi Andy,

Am 23.10.2012 15:03, schrieb Andy Skinner:
 Thanks for comments, Peter.
 
 By easier to pick, I didn't mean relative to other lines in the scene, but 
 that I wouldn't have to be as close to the actual line geometry.  It is a 
 question of whether the line will be in the list of intersections, rather 
 than which intersection I choose.
 
 I suspect the same thing about whether it is worth the effort.
 
 As for your other kinds of thinks in the scene you should be aware that 
 the performance of PolytopeIntersector for 2d-geometries is rather bad. It 
 is much faster to use LineSegementIntersector for those and combine the 
 results afterwards.
 
 By 2d-geometries, do you mean triangles and quads (and not 2D scenes)?  And 
 that it would be better to run the polytope intersector for points and lines, 
 and a separate line intersector for triangles and quads, and combine 
 intersections?  I know all of that is pretty much what you said, but I wanted 
 to be sure.  That's using two intersection traversals.  Sounds interesting if 
 it is really faster.

Yes, I did mean triangles and quads.
I haven't done performance measurements but I did implement the 
PolytopeIntersector
for triangles and quads. There are quite a few cases to cover to get it correct.

The IntersectionVisitor has the additional advantage that it can use a kd-tree 
for speedup
(which unfortunately is totally geared towards triangles, and hence unsuitable 
for the PolytopeIntersector).

But, yes, I do mean performing two separate intersections, where you can turn 
off 
the PolytopeIntersector checks for 2d-elements by using 
setDimensionMask(DimZero|DimOne)
and merging those results with the results from a LineSegmentIntersector.

 thanks,
 andy

Cheers,

Peter


 ___
 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


[osg-users] intersection of lines: line widths?

2012-10-22 Thread Andy Skinner
I know that intersections are about 3d world coordinates, and line widths are 
about pixels.  But is there a way to use line widths in calculating 
intersections with the polytope intersector?

In other words, I want a wider line to be easier to pick.

I could just expand the polytope a bit, except that the lines are just one kind 
of thing in the scene, and they could have different line widths.

thanks,
andy

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