POV-Ray : Newsgroups : povray.advanced-users : Reorient_Trans macro details Server Time
23 Nov 2024 23:46:44 EST (-0500)
  Reorient_Trans macro details (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: Bald Eagle
Subject: Re: Reorient_Trans macro details
Date: 8 Feb 2024 16:25:00
Message: <web.65c545c17ecd0aa1f9dae3025979125@news.povray.org>
Thanks Tor!

You've got an endless library of really useful macros, as usual.

With regard to matrix methods, would you happen to have any words of wisdom
about how to go about the following with matrices as opposed to my vector math
way?

http://news.povray.org/povray.binaries.images/message/%3Cweb.65c027a941c066f01f9dae3025979125%40news.povray.org%3E/#%3C
web.65c027a941c066f01f9dae3025979125%40news.povray.org%3E


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Reorient_Trans macro details
Date: 8 Feb 2024 19:35:00
Message: <web.65c5727c7ecd0aae9c3f02789db30a9@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
>...
>   // This makes no sense to me, since Vec_1 and Vec_2 are both normalized
> vectors,
>   // so the length of one unit vector minus another unit vector will ALWAYS be
> zero
>   #if (vlength (Vec_1-Vec_2) = 0)
>    transform {}
>   #else
>    // Which means that this part NEVER gets executed
>    #local vZ = VPerp_To_Vector (Vec_2);
>    transform {Axis_Rotate_Trans (vZ, 180)}
>...

IIRC it was me that added those two if-then-else parts to John VanSickle's
reorient macro.

Note that we are subtracting the normalized vectors, not their lengths.
And then we check if the resulting vector has zero length.

So no, one unit vector minus another unit vector will NOT ALWAYS be zero, only
if they are pointing the same direction, in which case no transformation is
necessary.

After the last else statement we can be sure that the two vectors are pointing
in opposite directions. In this case the math for calculating the components of
the reorient matrix breaks down.

In this case we can not know what the user actually want to achieve. (And
perhaps she/he does not know this her/him-selves.)

We can (and perhaps we should) now give up and use the #error statement.

But in some cases we can choose one of infinitely many possible solutions and
the result will be the same (e.g. if the reoriented object is symmetric around a
line in the same direction as the the "reorient from" vector, like a cylinder.)

Now note that the reorient transform is very similar to the axis rotate
transform. If we take the cross product between the vector to reorient from and
the vector to reorient to, we get a rotation axis for the axis rotate transform.
And if we find the angle between those two vectors, (e.g. by acos of their dot
product, or arcsin of the length of their cross product, or both combined with
atan2, or a more numerical stable formula), we have the rotation angle for the
axis transform.

I choose one vector (from infinitely many vectors), that is perpendicular to
both the "rotate from" vector and the "rotate to" vector, to use for the axis in
the axis rotate transform. The rotation angle is 180 degrees.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Reorient_Trans macro details
Date: 8 Feb 2024 20:20:00
Message: <web.65c57da87ecd0aae9c3f02789db30a9@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Thanks Tor!
>
> You've got an endless library of really useful macros, as usual.

Yes, I've written a lot of macros, some more useful than others.
My problem is to remember that I wrote them and were I've put them.


> With regard to matrix methods, would you happen to have any words of wisdom
> about how to go about the following with matrices as opposed to my vector math
> way?
>
>
http://news.povray.org/povray.binaries.images/message/%3Cweb.65c027a941c066f01f9dae3025979125%40news.povray.org%3E/#%
3C
> web.65c027a941c066f01f9dae3025979125%40news.povray.org%3E

I just had a quick peek at your code.
It seems healthy, although it can probably be slimmed down a bit.

I'll see of can find some spare time for commenting it in the coming days.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

From: Thomas de Groot
Subject: Re: Reorient_Trans macro details
Date: 9 Feb 2024 02:20:34
Message: <65c5d242$1@news.povray.org>
Op 08/02/2024 om 18:54 schreef Bald Eagle:
> 
> So, since my whole Reorient_Triangle macro relies on the Reorient_Trans macro,
> which was a bit of a black box operation,  I decided to take a deeper look into
> what goes on there, and unravel it all until I understood how it works.
> 
Before I go further in reading: This is a very welcome exercise you have 
started here, Bill! I am a very regular user of the macro and I confess 
that I have had a lot of misunderstandings about its working in the past.

Keep on the good work!

-- 
Thomas


Post a reply to this message

From: kurtz le pirate
Subject: Re: Reorient_Trans macro details
Date: 12 Feb 2024 11:03:52
Message: <65ca4168$1@news.povray.org>
On 08/02/2024 21:43, Tor Olav Kristensen wrote:
> And for axis rotate, this is relevant:
> 
> https://github.com/t-o-k/Rodrigues-rotation-formula


Exactly, that's right and don't forget : vaxis_rotate() bult in ;)



-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: kurtz le pirate
Subject: Re: Reorient_Trans macro details
Date: 16 Feb 2024 11:54:47
Message: <65cf9357$1@news.povray.org>
On 09/02/2024 08:20, Thomas de Groot wrote:

> Before I go further in reading: This is a very welcome exercise you have 
> started here, Bill! I am a very regular user of the macro and I confess 
> that I have had a lot of misunderstandings about its working in the past.

bonjour,


Following your comment, I made this page about rotations in 3d space.
Could this kind of literature be useful for POV user or no one is
interested or even be annoying ?


<http://louisbel.free.fr/scenes/scene036.shtml>
It's on my website and in English ;)






-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: Bald Eagle
Subject: Re: Reorient_Trans macro details
Date: 16 Feb 2024 17:05:00
Message: <web.65cfdbd47ecd0aa1f9dae3025979125@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:

> Following your comment, I made this page about rotations in 3d space.

> <http://louisbel.free.fr/scenes/scene036.shtml>

The animations "played", but were just black - no images.

- BW


Post a reply to this message

From: Thomas de Groot
Subject: Re: Reorient_Trans macro details
Date: 17 Feb 2024 02:29:27
Message: <65d06057$1@news.povray.org>
Op 16/02/2024 om 17:54 schreef kurtz le pirate:
> On 09/02/2024 08:20, Thomas de Groot wrote:
> 
>> Before I go further in reading: This is a very welcome exercise you have
>> started here, Bill! I am a very regular user of the macro and I confess
>> that I have had a lot of misunderstandings about its working in the past.
> 
> bonjour,
> 
> 
> Following your comment, I made this page about rotations in 3d space.
> Could this kind of literature be useful for POV user or no one is
> interested or even be annoying ?
> 
> 
> <http://louisbel.free.fr/scenes/scene036.shtml>
> It's on my website and in English ;)
> 

Note: Contrary To Bald Eagle, the animations played correctly on my 
system (Win11) not black.

I think these kind of simple and clear visual explanations can be very 
useful, certainly for starting (POV-Ray) modellers, but also for old 
hands who have temporarily lost their way in confusion and need a little 
reminder. :-) I am certainly one of those from time to time.

I would suggest that you label the x-, y-, z-axis in the first 
animation, and/or add the usual red, green, and blue colours to them.

Well done and keep on!

-- 
Thomas


Post a reply to this message

From: kurtz le pirate
Subject: Re: Reorient_Trans macro details
Date: 17 Feb 2024 05:50:21
Message: <65d08f6d$1@news.povray.org>
On 16/02/2024 23:04, Bald Eagle wrote:
> The animations "played", but were just black - no images.

Sorry for the inconvenience. I've tested with Fitrefox, Chrome and
Safari on Mac and Edge on Windows and it works fine.

I changed the video format from .mov to .mp4
Can you tell me if it's better?



-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: Bald Eagle
Subject: Re: Reorient_Trans macro details
Date: 17 Feb 2024 09:10:00
Message: <web.65d0bd817ecd0aa1f9dae3025979125@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:

> I changed the video format from .mov to .mp4
> Can you tell me if it's better?


Very Nice.  Works perfectly and the colors and lighting are beautiful.

Well done.

- BW


Post a reply to this message

<<< Previous 6 Messages Goto Initial 10 Messages

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