Results 1 to 3 of 3

Thread: 3d projection

  1. #1
    Member Contributor
    Join Date
    Feb 2001
    Posts
    50

    3d projection

    how can I project a 3dpoint correctly when its z is negative?
    I would want to visualize correctly
    a polygon also when is behind the observer

    es:this this example produces an incorrect result.

    Distance=2.56f // Distance of the observer

    x=-0.5f // 3d x
    y=-0.5f // 3d y
    z=-2.50f // 3d z
    Inverse=1.0f/(z+Distance); // reciprocal
    Xp=(x*Distance)*Inverse; //x projected
    YP=(y*Distance)*Inverse; //y projected

    thanks in advance

    [This message has been edited by jeppa (edited 10-04-2001).]

  2. #2
    Member Newbie
    Join Date
    Aug 2001
    Location
    Switzerland
    Posts
    47

    Re: 3d projection

    As I understood you do the projection yourself already in eyespace. So any point with negativ z-value is behind the viewer. Your problem seems to be the "Inverse = 1.0f/(z+Distance);". Try to do a "z = (float)fabs(z);"(or something like that) before you calculate the "Inverse".

    qwert

  3. #3
    Member Contributor
    Join Date
    Feb 2001
    Posts
    50

    Re: 3d projection

    yes it know.when z is(-2.57f)the point 3d changes direction!!!And the polygon returns in the scene!

    thanks in advace

Similar Threads

  1. Replies: 1
    Last Post: 05-17-2018, 03:58 AM
  2. Using modelview/projection matrix to do a projection myself
    By AllForum in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-30-2012, 07:42 AM
  3. Projection matrix, arbitrary projection plane
    By omdown in forum OpenGL: General
    Replies: 0
    Last Post: 04-01-2010, 07:26 AM
  4. projection
    By powerpad in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-29-2005, 07:44 AM
  5. Different projection?!?
    By Peter in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-22-2000, 09:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean