public void InitializeSegmentsBvh(List <Vector2> outer, List <Vector2> inner) { if (!mIsConvex) { List <BVHObject2> tempObjects = new List <BVHObject2>(); for (int i = 0; i < outer.Count; ++i) { int j = i + 1; if (j == outer.Count) { j = 0; } tempObjects.Add(new BVHSegment2Object(outer[i], outer[j])); } if (inner != null) { for (int i = 0; i < inner.Count; ++i) { int j = i + 1; if (j == inner.Count) { j = 0; } tempObjects.Add(new BVHSegment2Object(inner[i], inner[j])); } } mSegmentsBvh = new BVHTree2D(tempObjects, 1); } }
public void Reset() { mRectangleList.Clear(); mCenterList.Clear(); mOccupied = 0.0f; mMaxSize = mAABB.mMax - mAABB.mMin; Decompose(); mLeftRectangle = new List <GeoAABB2>(); mBvh = new BVHTree2D(); }
public void InitializeSegmentsBvh(List <Vector4> removeEdge) { if (!mIsConvex && mPolygonData.Count > 8) { List <BVHObject2> tempObjects = new List <BVHObject2>(); for (int i = 0; i < mPolygonData.Count; ++i) { int j = i + 1; if (j == mPolygonData.Count) { j = 0; } if (removeEdge != null) { Vector4 v1 = new Vector4(mPolygonData[i][0], mPolygonData[i][1], mPolygonData[j][0], mPolygonData[j][1]); int index = removeEdge.FindIndex((Vector4 v) => { return(v == v1); }); if (index != -1) { continue; } Vector4 v2 = new Vector4(mPolygonData[j][0], mPolygonData[j][1], mPolygonData[i][0], mPolygonData[i][1]); index = removeEdge.FindIndex((Vector4 v) => { return(v == v2); }); if (index != -1) { continue; } } tempObjects.Add(new BVHSegment2Object(mPolygonData[i], mPolygonData[j])); } mSegmentsBvh = new BVHTree2D(tempObjects, 1); } }