i've come up with an algorithm that i think will work a bit better for 
my purposes, which i'd like to get some feedback on. it would proceed 
like this:

1.) convert any bezier/NURBS segments to piecewise circular arcs using 
the approach found here: http://itc.ktu.lt/itc354/Riskus354.pdf
2.) create a polygon inside the sketch by connecting the new vertices 
created by the circular arc approximation of the bezier/NURBS segments 
and any endpoints from line segments or existing circular arc segments. 
The area of this interior polygon can be calculated exactly, and is very 
easy to tesselate with a delaunay triangulation for the rt_sketch_tess() 
function.
3.) calculate the area of each circular arc segment exactly and add to 
the area of the interior polygon to find the total area.

the interior polygon should be a close approximation to the original 
sketch since its vertices will be created by the bezier curve->circular 
arcs function which will divide the bezier segment into more circular 
arcs the greater the change in curvature.

On 07/10/2012 07:23 AM, Christopher Sean Morrison wrote:
> On Jul 10, 2012, at 2:12 AM, crdueck wrote:
>
>> finding the new inside corners is working now for sketches consisting of 
>> only line segments and circular arcs as the important points used to divide 
>> the sketch into rectangular sections are simply their end points. but for 
>> bezier/NURBS segments I'll need their critical points.
>>
>> plussai mentioned some useful looking functions for NURBS in 
>> src/librt/opennurbs_ext.cpp, which i'll take a look at, but i'd have to 
>> promote the nurb_seg into a full ON_Curve in order to use those. however, i 
>> think i'll need to use some of the NURBS API functions anyways in order to 
>> evaluate the bezier/NURBS segments so it makes sense to do that unless there 
>> is already some simpler way to analyze the curve segments.
> That seems like an acceptable form of reuse -- just take care to make sure 
> any openNURBS API you are intending to call actually has an implementation 
> defined (either in src/librt/opennurbs_ext.* or in src/other/openNURBS/*).  
> Many of their API functions do not have an implementation, which is why we 
> provide extensions in opennurbs_ext implementing some of the pieces they 
> removed.
>
>> also, i havent touched any of the C++ codebase yet, will there be any issues 
>> calling ON functions in librt/primitives/sketch.c? where should I look for 
>> examples of opennurbs API functions being used in librt?
> There's not any issues other than proper containment.  You cannot make any 
> changes that would expose a C++ type to LIBRT's API.  That is, you can't make 
> a new public function or change an existing one (any defined by RT_EXPORT) to 
> make it pass a C++ object.  You CAN, however, use C++ properly encapsulated.
>
> I'd suggest adding a new sketch_tess.cpp and including all of the C++ guts 
> related to tessellation in there.  Make sense?
>
> 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
> brlcad-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/brlcad-devel
>



------------------------------------------------------------------------------
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
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to