1

I have a cartesian point that I am being given (blue line), and I need to convert it to a point relative to a rotated plane (green box). The plane is rotated at 28.227º as shown below.

Sadly, my lack of math education has me completely baffled as to how to solve this. I need to be able to take any x,y point and convert it for the rotated plane.

Any help at all on this would be greatly appreciated as I am at a total loss.

Best I can figure out, I will need several different calculations depending on where the input point is.


(source: adam-meyer.com)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Adam Meyer
  • 1,505
  • 1
  • 19
  • 28
  • at first I wanted to write it down for you, but its best for you to figure it out yourself: have a look here: http://mathworld.wolfram.com/RotationMatrix.html , you know x0 and y0 and even the euler angle... so its "easy" to get x' and y' – Najzero Apr 05 '13 at 11:46
  • @Najzero - Hahahaha... I think you severely over estimate the math they teach in design school. Thanks for the link! Ill see if I can try and make some sense of it, looking pretty dim sadly. – Adam Meyer Apr 05 '13 at 11:58
  • A tip: the angles between your red and blue lines are equal to your 28.227 –  Apr 09 '13 at 15:43

1 Answers1

1

I love friends who know math. Thanks KJ! Here is the answer.

function convertPoint(x,y){

    var degree = -28.227;
    var offset = 0; //change if your corner is 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);
}
Adam Meyer
  • 1,505
  • 1
  • 19
  • 28
  • you help a lot, I'm stuck 30 minutes in this problem, but not for this solution, I just forgot to convert to radians.... – Guilherme Dec 12 '14 at 22:04