POV-Ray : Newsgroups : povray.general : I need math help : Re: I need math help, partial solution Server Time
6 Aug 2024 14:23:06 EDT (-0400)
  Re: I need math help, partial solution  
From: =Bob=
Date: 6 Mar 2002 13:05:58
Message: <3c865a86$1@news.povray.org>
Well, here's what works if one value is zero and the
other is a positive number:

#declare TotalLen = 62;
#declare StartVal = 1;
#declare EndVal = 0;
#declare nRange = EndVal - StartVal;

#if (nRange != 0)
    #declare nSteps = ((TotalLen / abs(nRange)) * 2) + 1;
    #declare ChgVal = nRange / nSteps;
#else
    #declare ChgVal = 0;
#end

Then subtract ChgVal from StartVal for every iteration. When
StartVal reaches EndVal, TotalLen is achieved.

The problem is, I want it to be able to work for an ending
or starting value that's not zero, like starting at 4 and stopping
at 2. Why does it only work for values that either start or end
at zero? It works if StartVal = 0 and EndVal = 10 and such.

Thanks for your help.
Have a great day!
=Bob=


Post a reply to this message

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