HamsterofDeath

02-06-2003, 11:31 AM

is the following code correct ?

i'm asking because it seems to return true everytime....

public boolean rectangleInFrustum( float x, float y, float z, float xSize,float ySize,float zSize )

{

lsu[0]=x-xSize;

lsu[1]=x+xSize;

lsu[2]=y-ySize;

lsu[3]=y+ySize;

lsu[4]=z-zSize;

lsu[5]=z+zSize;

for(int i = 0; i < 6; i++ )

{

if(m_Frustum[i][A] * (lsu[0]) + m_Frustum[i][B] * (lsu[2]) + m_Frustum[i][C] * (lsu[4]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[1]) + m_Frustum[i][B] * (lsu[2]) + m_Frustum[i][C] * (lsu[4]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[0]) + m_Frustum[i][B] * (lsu[3]) + m_Frustum[i][C] * (lsu[4]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[1]) + m_Frustum[i][B] * (lsu[3]) + m_Frustum[i][C] * (lsu[4]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[0]) + m_Frustum[i][B] * (lsu[2]) + m_Frustum[i][C] * (lsu[5]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[1]) + m_Frustum[i][B] * (lsu[2]) + m_Frustum[i][C] * (lsu[5]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[0]) + m_Frustum[i][B] * (lsu[3]) + m_Frustum[i][C] * (lsu[5]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[1]) + m_Frustum[i][B] * (lsu[3]) + m_Frustum[i][C] * (lsu[5]) + m_Frustum[i][D] > 0)

continue;

return false;

}

return true;

}

i'm asking because it seems to return true everytime....

public boolean rectangleInFrustum( float x, float y, float z, float xSize,float ySize,float zSize )

{

lsu[0]=x-xSize;

lsu[1]=x+xSize;

lsu[2]=y-ySize;

lsu[3]=y+ySize;

lsu[4]=z-zSize;

lsu[5]=z+zSize;

for(int i = 0; i < 6; i++ )

{

if(m_Frustum[i][A] * (lsu[0]) + m_Frustum[i][B] * (lsu[2]) + m_Frustum[i][C] * (lsu[4]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[1]) + m_Frustum[i][B] * (lsu[2]) + m_Frustum[i][C] * (lsu[4]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[0]) + m_Frustum[i][B] * (lsu[3]) + m_Frustum[i][C] * (lsu[4]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[1]) + m_Frustum[i][B] * (lsu[3]) + m_Frustum[i][C] * (lsu[4]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[0]) + m_Frustum[i][B] * (lsu[2]) + m_Frustum[i][C] * (lsu[5]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[1]) + m_Frustum[i][B] * (lsu[2]) + m_Frustum[i][C] * (lsu[5]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[0]) + m_Frustum[i][B] * (lsu[3]) + m_Frustum[i][C] * (lsu[5]) + m_Frustum[i][D] > 0)

continue;

if(m_Frustum[i][A] * (lsu[1]) + m_Frustum[i][B] * (lsu[3]) + m_Frustum[i][C] * (lsu[5]) + m_Frustum[i][D] > 0)

continue;

return false;

}

return true;

}