public ConvexPoly2(Vector2[] points) { Vector2 vector = Math._00; this.Planes = new Plane2[points.Length]; int num = points.Length; int num2 = num - 1; int i = 0; while (i < num) { Vector2 vector2 = points[num2]; Vector2 vector3 = points[i]; this.Planes[num2] = new Plane2(vector2, -Math.Perp(vector3 - vector2).Normalize()); vector += vector2; num2 = i++; } vector /= (float)points.Length; float num3 = 0f; for (num2 = 0; num2 != points.Length; num2++) { num3 = FMath.Max(num3, (points[num2] - vector).Length()); } this.m_sphere = new Sphere2(vector, num3); }
public void MakeBox(Bounds2 bounds) { this.Planes = new Plane2[4]; this.Planes[0] = new Plane2(bounds.Point00, -Math._10); this.Planes[1] = new Plane2(bounds.Point10, -Math._01); this.Planes[2] = new Plane2(bounds.Point11, Math._10); this.Planes[3] = new Plane2(bounds.Point01, Math._01); this.m_sphere = new Sphere2(bounds.Center, bounds.Size.Length() * 0.5f); }
public void Translate(Vector2 dx, ConvexPoly2 poly) { this.Planes = new Plane2[poly.Planes.Length]; for (int num = 0; num != poly.Planes.Length; num++) { this.Planes[num] = poly.Planes[num]; Plane2[] expr_49_cp_0 = this.Planes; int expr_49_cp_1 = num; expr_49_cp_0[expr_49_cp_1].Base = expr_49_cp_0[expr_49_cp_1].Base + dx; } this.m_sphere = poly.m_sphere; this.m_sphere.Center = this.m_sphere.Center + dx; }
public void MakeRegular(uint num, float r) { this.Planes = new Plane2[num]; float num2 = Math.TwicePi * 0.5f / num; for (uint num3 = 0u; num3 != num; num3 += 1u) { float num4 = Math.TwicePi * num3 / num; Vector2 vector = Vector2.Rotation(num4 + num2); Vector2 a_unit_normal = Vector2.Rotation(num4); this.Planes[(int)((UIntPtr)num3)] = new Plane2(vector * r, a_unit_normal); } this.m_sphere = new Sphere2(Math._00, r); }