POV-Ray : Newsgroups : povray.advanced-users : bigPatch update : Re: bigPatch update Server Time
15 May 2024 02:03:46 EDT (-0400)
  Re: bigPatch update  
From: Tor Olav Kristensen
Date: 30 Mar 2003 17:14:42
Message: <Xns934F2B811ED4torolavkhotmailcom@204.213.191.226>
Tor Olav Kristensen <tor_olav_kCURLYAhotmail.com> wrote in 
news:Xns### [at] 204213191226:

...

> Have a look at the code below code. (It does the same
> as yours but calculates iX + dX*C and iZ + dZ*R only
> once in each loop instead of 16 times.)
> 
> 
> // This first line should be placed outside the loops
> #local vXYZ = <dX, dY, dZ>;
> .
> <snip>
> .
>   bicubic_patch {
>     type 1  flatness 0 u_steps 3 v_steps 3
> .
> <snip>
> .
>     <0.0, A[R  ][C  ][Y]                 , 0.0>*vXYZ
>     <0.5, A[R  ][C  ][Y] + A[R  ][C  ][X], 0.0>*vXYZ
> .
> <snip>
> .
>     <0.5, A[R+1][C+1][Y] - A[R+1][C+1][X], 1.0>*vXYZ
>     <1.0, A[R+1][C+1][Y]                 , 1.0>*vXYZ
>     translate <iX + dX*C, 0, iZ + dZ*R>
>   }


I forgot to mention that you can probably move the
vXYZ vector into a scale statement at the end to save
further calculations. Like this:


  bicubic_patch {
    type 1  flatness 0 u_steps 3 v_steps 3
.
<snip>
.
    <0.0, A[R  ][C  ][Y]                 , 0.0>
    <0.5, A[R  ][C  ][Y] + A[R  ][C  ][X], 0.0>
.
<snip>
.
    <0.5, A[R+1][C+1][Y] - A[R+1][C+1][X], 1.0>
    <1.0, A[R+1][C+1][Y]                 , 1.0>
    scale vXYZ
    translate <iX + dX*C, 0, iZ + dZ*R>
  }


Tor Olav


Post a reply to this message

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