POV-Ray : Newsgroups : povray.general : Number range : Re: Number range Server Time
7 Aug 2024 15:16:57 EDT (-0400)
  Re: Number range  
From: Warp
Date: 21 Aug 2001 04:29:29
Message: <3b821be8@news.povray.org>
The easiest "trick" to scale numbers in this way is to first scale them to
the range 0-1 and then scale them to the desired range.

  So if you have numbers between 0.1 and 1, you first scale them to be
between 0 and 1: normalized=(number-0.1)/(1-0.1)

  Now you scale this to the range 0.6-1: normalized*(1-0.6)+0.6

  If we write that into one line, it would be:

  (number-0.1)*(1-0.6)/(1-0.1) + 0.6

and simplifying a bit:

  (number-0.1)*0.4/0.9 + 0.6

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

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