Thread: Defining a plane using three points?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    Defining a plane using three points?

    This adds to another thread but is for a different reason thus another thread.

    Given this:
    http://www.peachpit.com/articles/art...02090&seqNum=3

    And this:
    http://mathworld.wolfram.com/Plane.html

    I'm afraid I do not understand this statement from the first link:

    Notice how we are defining the plane by three passing points. Thus, the plane is vertical, and its normal is pointing to the left side of the world, as seen from the local player position.
    Since the general equation of a plane is:

    ax+by+cz+d=0 or ax+by+cz=d (whichever you choose)

    And the constructor options for D3DXPLANE are:
    Code:
    D3DXPLANE() {}
    D3DXPLANE( CONST FLOAT* );
    D3DXPLANE( CONST D3DXFLOAT16* );
    D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d );
    How do I construct a plane with only 3 points? Where is d?


    EDIT:

    I found the answer. Sorry.
    Code:
    D3DXPLANE * D3DXPlaneFromPoints(
      D3DXPLANE * pOut,
      CONST D3DXVECTOR3 * pV1,
      CONST D3DXVECTOR3 * pV2,
      CONST D3DXVECTOR3 * pV3
    );
    I'm going to use this to allow the AI space ships to follow waypoints, targets, and the player during battles. The code finds out which quadrant the target object is in and adjusts pitch and yaw respectively. I was going to use vector LERP but I have not converted to quaternions and using Euler's is such a PITA.

    I'm using vector LERP for auto-pilot tracking and target tracking using:
    Code:
    void VectorLERP(D3DXVECTOR3 &result,D3DXVECTOR3 v1,D3DXVECTOR3 v2,float lerp)
    {
       result.x=v1.x+lerp*(v2.x-v1.x);
       result.y=v1.y+lerp*(v2.y-v1.y);
       result.z=v1.z+lerp*(v2.z-v1.z);
    }
    Last edited by VirtualAce; 07-16-2007 at 01:46 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Yahtzee C++ programme help
    By kenneth_888 in forum C++ Programming
    Replies: 13
    Last Post: 09-05-2007, 02:14 PM
  2. CProg Fantasy Football version pi
    By Govtcheez in forum A Brief History of Cprogramming.com
    Replies: 155
    Last Post: 12-26-2006, 04:30 PM
  3. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM