mathgraphicsplanerotation

Drawing a plane


I want to draw a plane which is given by the equation: Ax+By+Cz+D=0. I first tried to draw him by setting x,y and then get z from the equation. this did not work fine because there are some planes like 0x+0y+z + 0 = 0 and etc...

my current solution is this: - draw the plane on ZY plane by giving 4 coordinates which goes to infinity. - find out to rotation that should be done in order to bring the normal of the given plane(a,b,c) to lay on z axis. - find the translation that should be done in order for that plane be on x axis. - make the exactly opposite transformation to those rotation and to this translation hence i will get the
plane in his place.

ok

this is a great thing but I can make the proper math calculations(tried a lot of times...) with the dot product and etc....

can someone help me in understanding the exact way it should be done OR give me some formula in which I will put ABCD and get the right transformation?


Solution

  • Is this what you're asking?

    Transforming a simple plane like the xy plane to your plane is fairly simple:

    your plane is Ax+By+Cz+D=0

    the xy plane is simply z=0. i.e. A=B=D=0, while C=whatever you want. We'll say 1 for simplicity's sake.

    When you have a plane in this form, the normal of the plane is defined by the vector (A,B,C)

    so you want a rotation that will take you from (0,0,1) to (A,B,C)*

    *Note that this will only work if {A,B,C} is unitary. so you may have to divide A B and C each by sqrt(A^2+B^2+C^2).

    rotating around just two of the axes can get your from any direction to any other direction, so we'll pick x and y;

    here are the rotation matrices for rotations by a about the x axis, and b about the y axis.

    Rx := {{1, 0, 0}, {0, Cos[a], Sin[a]}, {0, -Sin[a], Cos[a]}}

    Ry := {{Cos[b], 0, -Sin[b]}, {0, 1, 0}, {Sin[b], 0, Cos[b]}}

    if we do a rotation about x, followed by a rotation about y, of the vector normal to the xy plane, (0,0,1), we get:

    Ry.Rx.{0,0,1} = {-Cos[a] Sin[b], Sin[a], Cos[a] Cos[b]}

    which are your A B C values.

    i.e.

    A = -Cos[a]Sin[b]

    B = Sin[a]

    C = Cos[a]Cos[b]

    From here, it's simple.

    a = aSin[B]

    so now A = -Cos[aSin[B]]Sin[b]

    Cos[aSin[x]] = sqrt(1-x^2) so:

    A = -Sqrt[1-B^2] * Sin[b]

    b = aSin[-A/sqrt[1-B^2]]

    a = aSin[B] (rotation about x axis)

    b = aSin[-A/sqrt[1-B^2]] (rotation about y axis)

    So we now have the angles about the x and y axes we need to rotate by.

    After this, you just need to shift your plane up or down until it matches the one you already have.

    The plane you have at the moment, (after those two rotations) is going to be Ax+By+Cz=0.

    the plane you want is Ax+Bx+Cz+D=0. To find out d, we will see where the z axis crosses your plane.

    i.e. Cz+D=0 -> z = -D/C

    So we transform your z in Ax+By+Cz=0 by -D/C to give:

    Ax+By+C(z+D/C) = Ax+By+Cz+D=0. Oh would you look at that!

    It turns out you don't have to do any extra maths once you have the angles to rotate by!

    The two angles will give you A,B, and C. To get D you just copy it from what you had.

    Hope that's of some help, I'm not entirely sure how you plan on actually drawing the plane though...

    Edited to fix some horrible formatting. hopefully it's better now.