|
![](/i/fill.gif) |
"Martial" <mar### [at] cathemline org> wrote in message
news:3cfd1d4a$1@news.povray.org...
>
> Bug in Spline_Trans in transforms.inc ?
You might, or might not, have learned before that vnormalize(<0,0,0>) is
illegal now. I don't know if there will be changes to the transform.inc and
math.inc (and any others) to accomodate for that. There was discussion of
such things in the recent past among pre-beta people.
Hopefully I won't be stepping on any toes here by showing you what I did to
the Spline_Trans() as a workaround just now:
/* BEGIN */
// Author: Rune S. Johansen
// [temporarily added checking for <0,0,0>. bob h]
#macro Spline_Trans (Spline, Time, Sky, Foresight, Banking)
#local Location = <0,0,0>+Spline(Time);
#local LocationNext = <0,0,0>+Spline(Time+Foresight);
#local LocationPrev = <0,0,0>+Spline(Time-Foresight);
#if
((LocationNext.x*LocationNext.y*LocationNext.z)-(Location.x*Location.y*Locat
ion.z)=0)
#local Forward = <0,0,0>;
#else
#local Forward = vnormalize(LocationNext-Location);
#end
#if ((Forward.x*Forward.y*Forward.z)=0)
#local Right = <0,0,0>;
#else
#local Right = VPerp_To_Plane(Sky,Forward);
#end
#if ((Forward.x*Forward.y*Forward.z)|(Right.x*Right.y*Right.z)=0)
#local Up = <0,0,0>;
#else
#local Up = VPerp_To_Plane(Forward,Right);
#end
#local Matrix = Matrix_Trans(Right,Up,Forward,Location)
#local NextL=(LocationNext-Location);
#local LPrev=(Location-LocationPrev);
#if ((NextL.x*NextL.y*NextL.z)|(LPrev.x*LPrev.y*LPrev.z)=0)
#local BankingRotation = <0,0,0>;
#else
#local BankingRotation =
degrees(atan2(
VRotation(
VProject_Plane((LocationNext-Location),Sky),
VProject_Plane((Location-LocationPrev),Sky),
Up
)*Banking
,1
));
#end
transform {
rotate BankingRotation*z
transform Matrix
}
#end
/* END */
As you can see this isn't exactly elegant but all I knew to do. The math.inc
has vnormalize all over in it so you pretty much need to check for <0,0,0>
as soon as possible to prevent the error. I was looking for some way to go
about that from the scene file but I didn't have any revelations.
bob h
Post a reply to this message
|
![](/i/fill.gif) |