Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Point in poly test

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 Ake   Members   

122
Like
Likes
Like

Posted 05 November 1999 - 06:15 AM

Hi,

I'm trying to write a point in poly function for my lightmap creator.
Before I used a 2d point-in-poly test, but I want to use planes instead.
I tried this:

code:

int CPoly::GetPointInPoly(CVector p)
{
CVector v1, v2, cNormal, tmp;
CPlane plane;

cNormal = GetNormal( NULL );

for(int i = 0; i < m_iNumVertices; i++)
{
v1 = m_pPolyVert->m_pVertices[ m_iVertices[i] ].cCoord;
tmp = cNormal.Crossproduct( v1 );
tmp.Normalize();
plane.m_cNormal = tmp;
plane.m_fDistance = - ( tmp.Dotproduct( p ) );
if( plane.m_fDistance < 0 )
plane.m_cNormal.Invert();
if( plane.PlaneSide( p ) < 0)
return 0;
}
return 1;
}



But that doesn't work at all

Greets Tobias





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.