POV-Ray : Newsgroups : povray.advanced-users : Search for a value : Re: Search for a value Server Time
29 Jul 2024 16:32:46 EDT (-0400)
  Re: Search for a value  
From: Kari Kivisalo
Date: 24 Aug 2001 18:35:45
Message: <3B86D771.BB2582AC@engineer.com>
I used this in my lspline3 macro.

Find segment where the desired location (input parameter) is, then:

#local slen=; // segment length
#local l=; // from start of segment to location
#local e=0.01;
#local t1=l/slen; // relative location in segment
#local err=0.001*slen; //tolerance
#local dif=err+1;
#while (abs(dif)>err)
  lensp(t1,...,len) // returns length from start of segment to parameter
  #local dif=l-len;
  #local t2=t1+e;
  lensp(t2,...,len2)
  #local t1=e/(len2-len)*dif+t1;
#end

t1 is the parameter pointing to location.

_____________
Kari Kivisalo


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.