POV-Ray : Newsgroups : povray.general : transforms.inc issue with Spline_Trans Server Time
26 Apr 2025 11:53:36 EDT (-0400)
  transforms.inc issue with Spline_Trans (Message 1 to 2 of 2)  
From: Chris R
Subject: transforms.inc issue with Spline_Trans
Date: 14 Mar 2025 12:10:00
Message: <web.67d4541fce33082853fb81ab5cc1b6e@news.povray.org>
While playing with the Spline_Trans macro from transforms.inc in my text layout
tests I ran into an issue when the spline I was using hand segments that aligned
with the Sky axis.

The problem is that Spline_Trans computes Forward and then determines the
"right" vector using VPerp_To_Plane(Sky,Forward).  VPerp_To_Plane calls
vnormalize(vcross(V1,V2)), and vnormalize barfs on a zero-length vector, which
is what happens if V1 and V2 are co-linear.

I have created a new version that I am now using that checks for this
possibility when computing the Right axis.  If the Forward is co-linear with
Sky, then the right vector can be any arbitrary vector that is perpendicular to
the Sky vector, so I compute the transformation from the "y" vector <0,1,0>, to
the given Sky vector, and apply the same transformation to the "x" vector
<1,0,0> and use that as Right.  Otherwise, I just use VPerp_To_Plane as before.

The choice of x is arbitrary, but the easiest to implement since Spline_Trans
has an assumption that the forward direction of the object being transformed is
on the z axis.

-- Chris R.


Post a reply to this message

From: Bald Eagle
Subject: Re: transforms.inc issue with Spline_Trans
Date: 14 Mar 2025 12:25:00
Message: <web.67d457f0d10acfc2b00a87a025979125@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:

> I have created a new version that I am now using that checks for this
> possibility when computing the Right axis.  If the Forward is co-linear with
> Sky, then the right vector can be any arbitrary vector that is perpendicular to
> the Sky vector, so I compute the transformation from the "y" vector <0,1,0>, to
> the given Sky vector, and apply the same transformation to the "x" vector
> <1,0,0> and use that as Right.  Otherwise, I just use VPerp_To_Plane as before.


Very nice development work.

It's almost always fruitful to go digging around in these macros to understand
the basic principles, since it reveals what's going on in some of the more
"black box" macros of the include files, and highlights some of the assumptions
that are being made.

Thread
https://news.povray.org/povray.binaries.images/thread/%3Cweb.602dddf4e63e50ad87570eab0%40news.povray.org%3E/?mtop=43394
&moff=30

Post in thread
https://news.povray.org/povray.binaries.images/message/%3Cweb.65c027a941c066f01f9dae3025979125%40news.povray.org%3E/#%3
Cweb.65c027a941c066f01f9dae3025979125%40news.povray.org%3E

We could probably use a lot more digging and redesigning of macros to update our
collection - and possibly spot some holes where we need to write new ones.

Good work,
and keep doing what you're doing.  :)

- BW


Post a reply to this message

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