|
![](/i/fill.gif) |
"clipka" <nomail@nomail> wrote in message
news:web.49afac96ed80e874f567c3de0@news.povray.org...
> Um... unfortunately, rotation stuff is quite complex, and I know neither
> whether
> you got the docs right
No, no...you are correct, I actually *do* have no idea what I'm talking
about. :-p
I tend to learn best by undertaking difficult tasks with basically no idea
what I am doing.
I know, I'm weird.. :-D
>nor whether I get you right :}
This is likely, as I am worse than horrible at explaining things that I
happen to be attempting, as I am sure you have realized by now. :-)
>
> First off, vrotate(A,B) does the same thing to vector A that an "object
> { O
> rotate B }" does to the whole object O; i.e., B does not specify the axis
> to
> rotate about, but rather a set of three consecutive rotations about the X,
> Y
> and Z axes respectively.
I found this out by dicking around these last few hours.
> For that reason, computing the dot product of A and B makes absolutely no
> sense.
>
> Speaking of the VRotation macro and the perpendicular axis, the thing you
> should
> input to - say - VRotation(A,B,C) - as C is c*VCross(A,B), where c is an
> arbitrary float constant, of which only the size matters.
Ok, so I wasn't too awfully far from target there at least.
> Actually, to my knowledge the only added value of VRotation over VAngle is
> that
> while VAngle just gives you the angle between two vectors, VRotation will
> add
> some direction information to this angle.
This is potentially useful.
> Maybe the best thing is you tell us what you actually want to do; vector
> stuff
> involving rotations is quite a complex topic (as you can probably see from
> the
> number of macros related to it).
Ok.
I'm using the following macro (ye olde snowmacro core) to output relevant
vectors along with the surface normal:
#macro
GDSX_VectTestN(Array,normArray,ctr,vectorArray,testVector,testObject,Normal)
#local vectorA = min_extent(testObject);
#local vectorB = max_extent(testObject);
#local i=0;
#while (i<ctr)
#if (((vectorArray[i].x <= vectorB.x) & (vectorArray[i].x >= vectorA.x)) &
((vectorArray[i].y <= vectorB.y) & (vectorArray[i].y >= vectorA.y)) &
((vectorArray[i].z <= vectorB.z) & (vectorArray[i].z >= vectorA.z)))
#if (inside(testObject,vectorArray[i]))
#declare Array[i] = trace(testObject,vectorArray[i],testVector,Normal);
#declare normArray[i] = Normal;
#end
#end
#set i=i+1;
#end
#end
This works well, and I've tested the output with cyls, which give the effect
that I want, with the obvious exception that cyls make *terrible* moss.
Since I'm dealing with a moss object generated from a macro that
approximates Campylopus sp., which is obviously more complicated than a cyl,
I need to find a meaningful way to rotate the individual models according to
the surface normal to acheive any kind of meaningful effect.
Right now I am stuck with the attached image, and I know you guys are just
about sick of that damned torus, but it renders fast and has a hole, so is
useful for testing trace based effects.
I also would like to use some kind of rotation within the actual moss object
macro every so often, as real moss isn't y+ straight (but the base of one
object must remain stationary while the top moves, I think NewTop =
vrotate(CylTop-CylBot,<30,0,0>)+CylBot; as proposed by Chris B might get
that at least in part, but requires the solution to the other problem to
use).
Thanks!
ian
Post a reply to this message
Attachments:
Download 'Moss.jpg' (46 KB)
Preview of image 'Moss.jpg'
![Moss.jpg](/povray.general/attachment/%3C49afc9c4%40news.povray.org%3E/Moss.jpg?preview=1)
|
![](/i/fill.gif) |