comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Is there somebody familiar with nurbs or b-Spline?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Is there somebody familiar with nurbs or b-Spline? [message #55537] Mon, 27 August 2007 08:46 Go to previous message
airy.jiang is currently offline  airy.jiang
Messages: 37
Registered: May 2007
Member
On 8 27 , 11 05 , hradilv <hrad...@yahoo.com> wrote:
> On Aug 27, 4:19 am, airy.ji...@gmail.com wrote:
>
>> In fact,I'm still trying to read the DXF file into IDL.The Spline in
>> the DXF is construct with nurbs line.The IDL have a
>> method :Spline_P,but it can't reconstruct completely the same
>> shape.Who can tell me how to use the nurbs create the Spline.I know
>> it's complex and hard to describe,so ,if there are some source code
>> can be showed it would be perfect.
>> Thanks!
>
> This function worked for me:
>
> First I get all the controlpts for the spline. Then, in my function
> ncp=# of control points, the controlpts are (in my case) 2 X ncp.
> nsegs is the number of line segments per controlpt that I want to make
> my spline into (4L is usually enough for me). The returned value is
> the 2 X (nsegs*ncp) line segments needed to dray a polyline.
>
> Hope this helps.
>
> function eval_spline, ncp, controlpts, nsegs
>
> tarray = findgen(nsegs)/(nsegs)
> np = (ncp-1)/3
>
> sval = fltarr(2,nsegs*np+1)
> for i=0l, np-1 do begin
> p0 = controlpts[*,3*i]
> p1 = controlpts[*,3*i+1]
> p2 = controlpts[*,3*i+2]
> p3 = controlpts[*,3*i+3]
>
> sval[*,nsegs*i] = p0
> for j=1l, nsegs-1 do begin
> t = tarray[j]
> vert = p0*(1-t)*(1-t)*(1-t) + p1*3.0*t*(1-t)*(1-t) +
> p2*3.0*t*t*(1-t) + p3*t*t*t
> sval[*,nsegs*i+j] = vert
> endfor
> endfor
> sval[*,nsegs*np] = controlpts[*,ncp-1]
>
> return, sval
> end

Hi,hradilv!I knew you'll comein.^_^In fact I'm waiting for you!
Somedays befor,I've used your code "plot_dxf" made some test.But I'm
sorry about that the result of the spline is looked not very good.I'll
made a screenshot of the result next day(it's very late at here and
the I'm not at the office but my home).Hope I can made more discussion
with you.
Thank you!And hope more people who is familiar with these things can
join here.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Weighted histogram
Next Topic: Is there somebody familiar with nurbs or b-Spline?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:33:27 PDT 2025

Total time taken to generate the page: 0.00437 seconds