math - Convert Cartesian point to point on rotated plane (pic) -
i have cartesian point being given (blue line), , need convert point relative rotated plane (green box). plane rotated @ 28.227º shown below.
sadly, lack of math education has me baffled how solve this. need able take x,y point , convert rotated plane.
any @ on appreciated @ total loss.
best can figure out, need several different calculations depending on input point is.
i love friends know math. kj! here answer.
function convertpoint(x,y){ var degree = -28.227; var offset = 0; //change if corner not 0,0 x2 = x *math.cos(radians(degree)) + (y - offset) *math.sin(radians(degree)); y2 = x *math.sin(radians(degree)) - (y - offset) *math.cos(radians(degree)); return {x: x2, y: y2} } function radians(degrees){ return degrees * (math.pi / 180); }
Comments
Post a Comment