|
![](/i/fill.gif) |
"Chris B" <c_b### [at] btconnect com nospam> wrote in message
news:44e78c42@news.povray.org...
>
> "Tim McMurdo" <jod### [at] woh rr com> wrote in message
> news:web.44e77cee2c8bed1ce921dc270@news.povray.org...
>>I forgot the code...oops!
>>
>> #declare Target =
>> object {NiagaraHull_1C_
>> scale 330
>> rotate<0,-90,0>
>> translate<1000,-1000,00>
>>
>>
>> }
>> #declare Norm = <0, 0, 0>;
>> #declare Start = <-3496,5000,0>;
>> #declare Inter =trace ( Target, Start, <0, -1, 0>, Norm );
>>
>>
>>
>> object{MainFifeRail Reorient_Trans(<0,1,0>, Norm)
>> translate
>> Inter}
>>
>
> Hi Tim,
>
> I'd recommend doing it in two parts, so you get the rotation in x followed
> by the rotation in z.
>
> For the z rotation you need the angle between the x,y components of the
> Normal and the y axis:
> #local Z_Rotation = VAngleD(Norm*<1,1,0>,y);
>
> Now you can rotate the Normal back to the z-y plane then work out the x
> rotation:
> #local X_Rotation = VAngleD(vrotate(Norm, -Z_Rotation*z),y);
>
> I 've included a little test script that you may find handy below (VAngleD
> is in math.inc).
> The last two lines rotate a vector of the same length back into position
> and write the position into the message stream, so it should always be the
> same as the vector you start with.
>
> #include "Math.inc"
>
> //#local Norm = <1,2,3>;
> //#local Norm = <-1,2,-3>;
> #local Norm = <-8,2,4>;
>
>
> #local Z_Rotation = VAngleD(Norm*<1,1,0>,y);
> #local X_Rotation = VAngleD(vrotate(Norm, -Z_Rotation*z),y);
>
>
> #local Test = vrotate(y*vlength(Norm),<X_Rotation,0,Z_Rotation>);
> #debug concat(vstr(3,Norm,",",3,3),"\n")
>
> Regards,
> Chris B.
>
Aargh,
Please ignore the above, I realised that I'm testing Norm instead of Test,
so I'd fooled myself into believing I'd got it right.
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |