public BVHAABB3Object(Vector3 min, Vector3 max) : base(GeoShape.GeoAABB3) { mAABB3 = new GeoAABB3(min, max); mCenter = (min + max) * 0.5f; mExtent = max - min; }
public BVHTriangle3Object(Vector3 p1, Vector3 p2, Vector3 p3, int meshIndex = 0, int faceIndex = 0) : base(GeoShape.GeoTriangle3) { mP1 = p1; mP2 = p2; mP3 = p3; mCenter = (mP1 + mP2 + mP3) * 0.333333f; mAABB = new GeoAABB3(Vector3.Min(Vector3.Min(mP1, mP2), mP3), Vector3.Max(Vector3.Max(mP1, mP2), mP3)); mMeshIndex = meshIndex; mFaceIndex = faceIndex; }
public static GeoAABB3 GetAABB(List <Vector3> points) { GeoAABB3 aabb = new GeoAABB3(); if (points.Count > 0) { aabb.mMin = points[0]; aabb.mMax = points[0]; for (int i = 1; i < points.Count; ++i) { aabb.mMax = Vector3.Max(aabb.mMax, points[i]); aabb.mMin = Vector3.Min(aabb.mMin, points[i]); } } return(aabb); }
public void ExpandToInclude(GeoAABB3 b) { mMin = Vector3.Min(mMin, b.mMin); mMax = Vector3.Max(mMax, b.mMax); mExtent = mMax - mMin; }