Yes folks. I'm still struggling with this.

Started by
2 comments, last by Jumpster 23 years, 6 months ago
Here is the source I am using. Viewplane is a class that contains the Location, Direction, Up and Right vectors of the display area. I am trying to determine if a given point is seen on the display area. The assumption is that Direction points to the middle of the display area. Right is the right side and Up is the top. I know that the FOV stuff should probably be doubled (*2) to account for the lower and left sides of the screen area. Would someone please tell me what I am doing wrong here? I have been struggling with this problem since Mid-April and would like to just give up on it, only, I can't. It is needed for certain aspects of what I am doing.
        
bool WF_VIEWPLANE::IsPointSeen( WF_VECTOR& vector )
{
  WF_VECTOR v( vector - Direction );
  WF_VECTOR vu( ((Up * v) * Up) + Direction );
  WF_VECTOR vr( ((Right * v) * Right) + Direction );

  //*********************************************************************

  // Previously defined elsewhere: HFOV = Direction.Angle(Up);
  if (Direction.Angle(vu) < HFOV)
  {
    //*********************************************************************

    // Previously defined elsewhere: HFOV = Direction.Angle(Right);
    if (Direction.Angle(vr) < VFOV) return true;
  }
  return false;
}

        
Thanks for your help. Regards, Jumpster Semper Fi Edited by - Jumpster on 10/20/00 1:16:02 PM
Regards,JumpsterSemper Fi
Advertisement
I was going to ask the same question! Could somebody help us out on this?

I feel like i should have a great idea right now but i dont!
I feel like i should have a great idea right now but i dont!
I''m not sure I understand your class 100% but I''ll give it a try.

I see you''re checking for angles. If you''re using a piramid for your view, using angles would be like checking for a cone. Is this really what you want?

Maybe another approach would be best?!:
  • First define a matrix for your camera. This way you can transform your coords to camera space first. If you don''t need this, and are always in camera space you don''t need this.
  • Just project your coord from 3D space to 2D screen. Why not use:
    Xscr = Xworld/Zworld * i
    Yscr = Yworld/Zworld * j
    where i&j are aspect & frustrum settings.
    (Notice optimization 1/ZWorld)

    After projection to 2D screen you can test like if you''re clipping.


  • I know that: 1) location refers to where I am (camera). 2) Direction is where I am looking at. 3. The up vector is the top of my screen(center). The right vector is the right center of my screen.

    How do I determine if point A is visible with the parameters given?



    Regards,
    Jumpster


    Semper Fi
    Regards,JumpsterSemper Fi

    This topic is closed to new replies.

    Advertisement