|
|
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
|
|