|
![](/i/fill.gif) |
I'm trying to apply shapes to the surface of an object to make the object
look larger... Anyway, I'm using the trace function to find the
intersection and normal, but the normal is expressed in 0..1 format instead
of the 0-360 format needed for rotations. I've tried multiplying the
returned normal with 360, and I tried seperate rotates for each part of the
normal multiplied by 360, but the shape isn't rotated the way I'm expecting
it to. I am expecting the flattened boxes to lie flat against the sphere.
I need to be able to rotate the object, as I will eventually be using
fairly complex shapes in place of the box. Any help appreciated, sample
code is below.
Rich
-------------------------------------
#version unofficial MegaPov 0.7;
camera {
location <5.0, 5.0, -15.0>
direction 1.5*z
right 4/3*x
look_at <0.0, 0.0, 0.0>
}
light_source {<-300,100,-200> color rgb 2}
light_source {<300,100,200> color rgb <0,0,.8>}
#declare MySphere = sphere {<0, 0, 0>, 4}
#declare Norm = <0, 0, 0>;
#declare R1 = seed(0);
#declare lp = 0;
#while (lp < 500)
#declare Start = <(rand(R1) -.5)*10,
(rand(R1) -.5)*10,
(rand(R1) -.5)*10>;
#declare Inter=trace(MySphere, Start, <0, 0, 0>-Start, Norm);
box {
<-.2,0,-.2> <.2,.1,.2>
//rotate Norm*360
rotate Norm.x*360
rotate Norm.y*360
rotate Norm.z*360
translate Inter
texture {pigment {color red 1}}
}
#declare lp = lp + 1;
#end
object {
MySphere
texture {pigment {rgb 1}}
}
--
Rich Allen
(Remove SPAM from my address to reply by e-mail)
Post a reply to this message
|
![](/i/fill.gif) |