コード例 #1
0
	bool AABB::IsContainSphere(const Vector3F &pos,float radius) const
	{
		CA_ASSERT( min.IsValid(), "IsContainSphere() : min is not valid");
		CA_ASSERT( max.IsValid(), "IsContainSphere() : max is not valid");
		CA_ASSERT( pos.IsValid(), "IsContainSphere() : pos is not valid");

		if (pos.x-radius < min.x) return false;
		if (pos.y-radius < min.y) return false;
		if (pos.z-radius < min.z) return false;
		if (pos.x+radius > max.x) return false;
		if (pos.y+radius > max.y) return false;
		if (pos.z+radius > max.z) return false;
		return true;
	}
コード例 #2
0
	bool AABB::IsContainPoint(const Vector3F &pos) const
	{
		CA_ASSERT( min.IsValid(), "IsContainPoint() : min is not valid");
		CA_ASSERT( max.IsValid(), "IsContainPoint() : max is not valid");
		CA_ASSERT( pos.IsValid(), "IsContainPoint() : pos is not valid");

		if (pos.x < min.x) return false;
		if (pos.y < min.y) return false;
		if (pos.z < min.z) return false;
		if (pos.x > max.x) return false;
		if (pos.y > max.y) return false;
		if (pos.z > max.z) return false;
		return true;
	}
コード例 #3
0
	bool AABB::IsOverlapSphereBounds(const Vector3F &pos, float radius) const
	{
		CA_ASSERT( min.IsValid(), "IsOverlapSphereBounds() : min is not valid");
		CA_ASSERT( max.IsValid(), "IsOverlapSphereBounds() : max is not valid");
		CA_ASSERT( pos.IsValid(), "IsOverlapSphereBounds() : pos is not valid");

		if (pos.x > min.x && pos.x < max.x &&	pos.y > min.y && pos.y < max.y &&	pos.z > min.z && pos.z < max.z) 
			return true;

		if (pos.x+radius < min.x) return false;
		if (pos.y+radius < min.y) return false;
		if (pos.z+radius < min.z) return false;
		if (pos.x-radius > max.x) return false;
		if (pos.y-radius > max.y) return false;
		if (pos.z-radius > max.z) return false;
		return true;
	}