On Jun 13, 2012, at 9:33 AM, plussai wrote:

> Hi!
>      I'v upload the patch to implement the adaptive bezier subdivision and 
> triangle mesh display,next I'll build a kt or qt tree to represent the 
> division in parameter region which seems like the 
> SurfaceTree::subdivideSurface(...) in opennurbs_ext.cpp,but the recursive 
> termination condition is different.
>    So,Where to implement the  kt/qt tree, in brep.cpp or  opennurbs_ext.cpp?

Whatever you do, please don't implement a kdtree from scratch!

There's the ad hoc subdivision currently in opennurbs, there's a kdtree in 
src/librt/primitives/bot/tie_kdtree.c that could be repurposed into a general 
library, and there are these two public projects that would be trivial to 
integrate:

For C/C++:
http://code.google.com/p/kdtree/

For C++:
http://code.google.com/p/nanoflann/

It'd be awesome to see a timed comparison of either of those to our redblack 
tree in libbu for insert and lookup operations of 3d point data...

Either way, the point is to focus on reuse as much as you can.  Even if it'd be 
faster for you to just do your own thing, we're starting to accumulate too many 
custom methods that it's time to introduce a general interface.

>      Another question about Nurbs! In opennurbs, the operator for ON_4dPoint 
> has something special.
>      below is the operator +=
>       const double sw1 = (w>0.0) ? sqrt(w) : -sqrt(-w);
>       const double sw2 = (p.w>0.0) ? sqrt(p.w) : -sqrt(-p.w);
>       const double s1 = sw2/sw1;
>       const double s2 = sw1/sw2;
>       x = x*s1 + p.x*s2;
>       y = y*s1 + p.y*s2;
>       z = z*s1 + p.z*s2;
>       w = sw1*sw2;
>       So,why to implement the operator in this way?

Not sure I understand the question.  Adding two homogeneous points is a 
weighted average, so it calculates a factor and then performs the weighted 
addition.  
http://en.wikipedia.org/wiki/Homogeneous_coordinates#Use_in_computer_graphics

Cheers!
Sean


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to