|
|
I've just started experimenting with the Trace() function, and I need to
know if it is possible to use the normal returned to rotate an object that
was already declared. I tried to do this:
// Trace object Spike onto object Ball's surface.
#declare Norm = <0, 0, 0>;
#declare Start = <-8, 20, 0>;
#declare Inter = trace (Ball, Start, -y, Norm);
#if (vlength (Norm))
object { Spike rotate Norm translate Inter }
#end
The spike is translated to the correct position, but it is not rotated; it
still points straight up. So how would I use the returned normal to rotate
the spike so it points the same direction as the surface normal at Inter?
Here's the entire scene file:
// Test scene file.
#include "shapes.inc"
#include "colors.inc"
// Objects
--------------------------------------------------------------------
#declare Ball =
object {
sphere { 0, 10 }
texture {
pigment { color Blue }
finish { ambient 0.5 phong 1 }
}
}
#declare Spike =
object {
cone { <0, 0, 0>,0.5, <0, 1, 0>, 0 }
texture {
pigment { color Red }
finish { ambient 0.5 phong 1 }
}
}
// Scene
----------------------------------------------------------------------
camera {
location <0, 20, -20>
look_at <0, 0, 0>
}
light_source { <3000, 10000, 5000> color White }
object { Ball }
// Trace object Spike onto object Ball's surface.
#declare Norm = <0, 0, 0>;
#declare Start = <-8, 20, 0>;
#declare Inter = trace (Ball, Start, -y, Norm);
#if (vlength (Norm))
object { Spike rotate Norm translate Inter }
#end
Post a reply to this message
|
|
|
|
"Slime" <fak### [at] emailaddress> wrote:
> > I've just started experimenting with the Trace() function, and I need to
> > know if it is possible to use the normal returned to rotate an object that
> > was already declared.
>
> Use the Reorient_Trans macro in transforms.inc.
>
> - Slime
> [ http://www.slimeland.com/ ]
Thanks for the quick response, Slime! Using Reorient_Trans(y, Norm) gave
the result I was looking for!
Tranceaholic
Post a reply to this message
|
|