void GameBase::UpdateBoundingBox()
{
	int nVal = (int)g_ShowDimsTrack.GetFloat();

	if (nVal < 4)
	{
		switch (GetType())
		{
			case OT_WORLDMODEL :
			{
				if (nVal != 1)
				{
					RemoveBoundingBox();
					return;
				}
			}
			break;

			case OT_MODEL :
			{
				if (nVal != 2)
				{
					RemoveBoundingBox();
					return;
				}
			}
			break;

			case OT_NORMAL :
			{
				if (nVal != 3)
				{
					RemoveBoundingBox();
					return;
				}
			}
			break;

			default :
			break;
		}
	}

	CreateBoundingBox();

	if (m_hDimsBox)
	{
        LTVector vDims, vScale;
        g_pLTServer->GetObjectDims(m_hObject, &vDims);
		vScale = (vDims * 2.0);
        g_pLTServer->ScaleObject(m_hDimsBox, &vScale);
	}
}
GameBase::~GameBase()
{
	RemoveBoundingBox();

	if (m_pMarkList)
	{
        g_pLTServer->RelinquishList(m_pMarkList);
	}

	FREE_HSTRING(m_hstrSave);
}
// Algorithm IncrementalDelaunay(V)
// Input: 由n个点组成的二维点集V
// Output: Delaunay三角剖分DT
//	1.add a appropriate triangle boudingbox to contain V ( such as: we can use triangle abc, a=(0, 3M), b=(-3M,-3M), c=(3M, 0), M=Max({|x1|,|x2|,|x3|,...} U {|y1|,|y2|,|y3|,...}))
//	2.initialize DT(a,b,c) as triangle abc
//	3.for i <- 1 to n 
//		do (Insert(DT(a,b,c,v1,v2,...,vi-1), vi))   
//	4.remove the boundingbox and relative triangle which cotains any vertex of triangle abc from DT(a,b,c,v1,v2,...,vn) and return DT(v1,v2,...,vn).
void IncrementalDelaunay(MESH * pMesh)
{
	// Add a appropriate triangle boudingbox to contain V
	AddBoundingBox(pMesh);

	// Get a vertex/point vi from V and Insert(vi)
	for (int i=3; i<pMesh->vertex_num+3; i++)
	{
		Insert(pMesh, i);
	}

	// Remove the bounding box
	RemoveBoundingBox(pMesh);
}
 void PhysicsBoundingBoxCollection::RemovePhysicsBoundingBox (
   BoundingBox* boundingBox)
 {
   RemoveBoundingBox (boundingBox);
 }