Added 'containsPoint' functions which take separate components instead of vectors.

This commit is contained in:
David Williams
2012-11-30 23:47:03 +01:00
parent 9c71c3fa30
commit ba827d446b
3 changed files with 55 additions and 24 deletions

View File

@ -546,8 +546,7 @@ namespace PolyVox
int32_t zPos = this->mZPosInVolume;
//FIXME - Can we speed this up?
//FIXME - replace with versions which don't build Vector3DInt32.
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos, yPos, zPos), 1))
if(this->mVolume->getEnclosingRegion().containsPoint(xPos, yPos, zPos, 1))
{
//We're well inside the region so all flags can be set.
m_uValidFlags = Current | PositiveX | NegativeX | PositiveY | NegativeY | PositiveZ | NegativeZ;
@ -556,13 +555,13 @@ namespace PolyVox
{
m_uValidFlags = 0;
//FIXME - replace with versions which don't build Vector3DInt32.
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos, yPos, zPos), 0)) m_uValidFlags |= Current;
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos+1, yPos, zPos), 0)) m_uValidFlags |= PositiveX;
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos-1, yPos, zPos), 0)) m_uValidFlags |= NegativeX;
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos, yPos+1, zPos), 0)) m_uValidFlags |= PositiveY;
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos, yPos-1, zPos), 0)) m_uValidFlags |= NegativeY;
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos, yPos, zPos+1), 0)) m_uValidFlags |= PositiveZ;
if(this->mVolume->getEnclosingRegion().containsPoint(Vector3DInt32(xPos, yPos, zPos-1), 0)) m_uValidFlags |= NegativeZ;
if(this->mVolume->getEnclosingRegion().containsPoint(xPos, yPos, zPos, 0)) m_uValidFlags |= Current;
if(this->mVolume->getEnclosingRegion().containsPoint(xPos+1, yPos, zPos, 0)) m_uValidFlags |= PositiveX;
if(this->mVolume->getEnclosingRegion().containsPoint(xPos-1, yPos, zPos, 0)) m_uValidFlags |= NegativeX;
if(this->mVolume->getEnclosingRegion().containsPoint(xPos, yPos+1, zPos, 0)) m_uValidFlags |= PositiveY;
if(this->mVolume->getEnclosingRegion().containsPoint(xPos, yPos-1, zPos, 0)) m_uValidFlags |= NegativeY;
if(this->mVolume->getEnclosingRegion().containsPoint(xPos, yPos, zPos+1, 0)) m_uValidFlags |= PositiveZ;
if(this->mVolume->getEnclosingRegion().containsPoint(xPos, yPos, zPos-1, 0)) m_uValidFlags |= NegativeZ;
}
}
}

View File

@ -128,9 +128,13 @@ namespace PolyVox
/// Sets the position of the upper corner.
void setUpperCorner(const Vector3DInt32& v3dUpperCorner);
/// Tests whether the given point is contained in this Region.
bool containsPoint(float fX, float fY, float fZ, float boundary = 0.0f) const;
/// Tests whether the given point is contained in this Region.
bool containsPoint(const Vector3DFloat& pos, float boundary = 0.0f) const;
/// Tests whether the given point is contained in this Region.
bool containsPoint(int32_t iX, int32_t iY, int32_t iZ, uint8_t boundary = 0) const;
/// Tests whether the given point is contained in this Region.
bool containsPoint(const Vector3DInt32& pos, uint8_t boundary = 0) const;
/// Tests whether the given position is contained in the 'x' range of this Region.
bool containsPointInX(float pos, float boundary = 0.0f) const;