POV-Ray : Newsgroups : povray.binaries.animations : Creating tunnels... (MPGs, 2x126 kb) : Re: Creating tunnels... (MPGs, 2x126 kb) Server Time
19 Jul 2024 06:20:46 EDT (-0400)
  Re: Creating tunnels... (MPGs, 2x126 kb)  
From: Rune
Date: 11 Feb 2004 17:52:00
Message: <402ab210$1@news.povray.org>
Tim Nikias v2.0 wrote:
>> Here's some crude and simple code to explain the basic idea. The
>> algorithm is simpler than I remembered. Just use the VPerp_Adjust()
>> macro to make the last up-vector perpendicular to the current
>> forward-vector and then use that as the current up-vector... The code
>> here just aligns boxes and does not create a tunnel out of a mesh,
>> but the basic idea is the same.
>
> Hm. I can see that it works, but I don't understand why and how. I
> can't visualize what that VPerp_Adjust actually does

From the doc:
VPerp_Adjust(V1, Axis). Find a vector perpendicular to Axis and in the
plane of V1 and Axis. In other words, the new vector is a version of V1
adjusted to be perpendicular to Axis.

So the new Y vector is the same as the previous Y vector, except that it
is adjusted to be perpendicular with the new Z vector. Since the
previous and the new Y vectors are as close to each other as possible,
there is no twisting.

The Y and Z vectors are now perpendicular, and from those we can get the
X vector using the vcross-function. Now we have the local X, Y and Z
vector for the box as well as its origin P, and then we can create its
transformation matrix out of those four vectors.

That's all really.

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com **updated Jan 29**
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

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