Results 1 to 7 of 7

Thread: Transforming planes using matrices

  1. #1

    Transforming planes using matrices

    Hi

    I was trying to figure out how to transform a plane using a matrix.

    A plane is (of course ) defined as follows:

    nx,ny,nz,d

    The vector (nx,ny,nz) is the plane's normal vector and b is the Z coordinate at which the plane intersects the Z-axis.

    Now i like to know how to transform this data.
    I think it's obvious that the normal vector must be multiplied with the matrix.

    But what happens to the d scalar??

    Can someone tell me how to transform a plane using a matrix?? :?

    Thank you.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2

    Transforming planes using matrices

    Besides the normal vector plus y distance, a plane can also be defined using three points in the plane, not on a line. You can transform those three points with a matrix, and perhaps convert them back into a normal vector plus y distance again.

    Using mathematics, you might be able to simplify the calculation.

  3. #3

    Transforming planes using matrices

    Ahh :razz: I know a better definition for a plane:

    (x,y,z),(nx,ny,nz)

    It's a point in space + a plane normal.
    My first definition was not completely waterproof because it couldn't contain a plain which runs parallel to the Z-axis. My new definition can.
    It's also i bit more compact than yours.

    I think.. to transform a plane using this definition, you must multiply the matrix with the (x,y,z) vector and divide the normal vector with the matrix and normalize it afterwards.

    Is this a correct way?? can someone confirm this.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4

    Transforming planes using matrices

    Well, the problem with the direction vector is that you can't move the plane. Multiplying it with a matrix which moves a point will move the direction vector: the results will be interresting, but probably not what you want. I think rotating and scaling will work ok.

  5. #5

    Transforming planes using matrices

    owh.. damn i was wrong.the d variabele in my first definition is the distance between the plane and the origin, and not a z-coordinate.

    I've also found this

    But i dont understand how D3DXPlane is defined.
    Is it similar to the definition above or is it different??

    BTW: merry christmas everyone
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #6

    Transforming planes using matrices

    According to the documentation there, it is defined by the plane equation: ax + by + cz + dw = 0

    This is simlar to your definition. To get the exact way to it I think you will really have to do the math. Create three points, apply the transformation matrix them it and see what formula rolls out.

    P.s. http://www.geometrictools.com/Docume...mentation.html is a gold mine of information regarding these topics. Alas, they don't handle this one...

  7. #7

    Transforming planes using matrices

    The a, b and c coefficients of the D3DXPlane define the normal to the plane and d is a distance from the origin.

    I am too late, as usual.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •