|
![](/i/fill.gif) |
Le 15/02/2012 10:15, Thomas de Groot a écrit :
> On 15-2-2012 5:01, Tail Kinker wrote:
>> Being dissatisfied with Point_At_Trans and Reorient_Trans, for use in my
>> inverse kinesics skeleton, I decided to break out the math and try to
>> write a replacement. And I ended up with this macro:
>>
>> #macro Point_To(tvector)
>> #declare rho = sqrt (
>> abs (tvector.x * tvector.x) +
>> abs (tvector.y * tvector.y) +
>> abs (tvector.z * tvector.z)
>> );
>> #declare sigma = sqrt (
>> abs (tvector.x * tvector.x) +
>> abs (tvector.y * tvector.y)
>> );
>> #declare phi = degrees(acos (tvector.z / rho));
>> #if (tvector.x < 0)
>> #declare theta = 180 - degrees(asin (tvector.y / sigma));
>> #else
>> #declare theta = degrees(asin (tvector.y / sigma));
>> #end
>> #if
>> <90 - phi, 0, theta - 90>
>> #end
>>
>> No doubt someone could make use of this. :)
>
> That last #if is not correct. (...) and #end are missing...
While we are at it, #local would be safer than #declare.
Post a reply to this message
|
![](/i/fill.gif) |