|
|
> So if anyone can tell me what I'm doing wrong below, I'll be grateful.
Two mistakes...
> #macro vec2rot(V, A)
> #local _X_ = -V.u*cos(A)*sin(A) - V.v*cos(A)*sin(A);
> #local _Y_ = V.u*sin(A)*cos(A) + V.v*sin(A)*cos(A);
> #local RESULT = <_X_,_Y_>;
> RESULT
> #end
This is wrong, should be:
#macro vec2rot(V, A)
#local _X_ = V.u*cos(A) - V.v*sin(A);
#local _Y_ = V.u*sin(A) + V.v*cos(A);
#local RESULT = <_X_,_Y_>;
RESULT
#end
You seem to have made it too complicated, it's just a 2D rotation:
https://en.wikipedia.org/wiki/Rotation_matrix#In_two_dimensions
> #local np1 = (len/sqrt(7))*vec2rot( vT,asin(sqrt(3)/(2*sqrt(7))));
> #local np2 = (len/sqrt(7))*vec2rot( vT,-asin(sqrt(3)/(2*sqrt(7))));
These are wrong, should be:
#local np1 = p0 + len/sqrt(7)*vec2rot( vT,asin(sqrt(3)/(2*sqrt(7))));
#local np2 = p1 - len/sqrt(7)*vec2rot( vT,asin(sqrt(3)/(2*sqrt(7))));
np1 is at p0 plus the distance len/sqrt(7) times your new direction.
np2 is at p1 *minus* the distance len/sqrt(7) times the new direction.
Post a reply to this message
|
|