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
Yes folks. I'm still struggling with this.
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.
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 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?!:
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement