|
![](/i/fill.gif) |
Rune wrote:
> Tim Nikias v2.0 wrote:
>> With the technique you mentioned, and have to do
>> some inbetween calculations to get the desired
>> angles, like projecting the forward vector onto
>> a plane with the sky-vector, thus getting vectors
>> with which I can calculate the "internal" spin to
>> get the up-vectors lined up...
>
> I'm not sure I understand. Why do you need any sky-vector in the first
> place? Why do you need to know anything about the spin of the tunnel?
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.
#include "transforms.inc"
#include "math.inc"
camera {location <-2,1,-3> look_at 0}
light_source {<-1,2,-3>*1000, color 1}
background {rgb 1}
#declare Spline = spline {
cubic_spline
-2, -x,
-1, -x,
0, -y,
1, -z,
2, y,
3, z,
4, x,
5, x+y,
6, y+z,
7, y+z
}
#declare C = 0;
#declare Samples = 50;
#declare Range = 5;
#declare LastY = y;
#while (C<=Samples)
#declare Val = C/Samples*Range;
#declare P = Spline(Val);
#declare Z = vnormalize(Spline(Val+0.001)-Spline(Val-0.001));
#declare Y = VPerp_Adjust(LastY,Z);
#declare X = vcross(Y,Z);
#declare T = Matrix_Trans(X,Y,Z,P)
#declare LastY = Y;
superellipsoid {<0.2,0.2> scale 0.1 transform {T} pigment {rgb 1}}
#declare C = C+1;
#end
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
|
![](/i/fill.gif) |