public bool NegativeClipSegment(ref Vector2 A, ref Vector2 B) { bool flag = true; flag &= new Plane2(this.Min, -Math._10).NegativeClipSegment(ref A, ref B); flag &= new Plane2(this.Min, -Math._01).NegativeClipSegment(ref A, ref B); flag &= new Plane2(this.Max, Math._10).NegativeClipSegment(ref A, ref B); return(flag & new Plane2(this.Max, Math._01).NegativeClipSegment(ref A, ref B)); }
public void DrawConvexPoly2(ConvexPoly2 convex_poly) { if (convex_poly.Planes.Length != 0) { this.ShaderPush(); this.ImmBegin((DrawMode)2, (uint)(convex_poly.Planes.Length + 1)); Plane2[] planes = convex_poly.Planes; for (int i = 0; i < planes.Length; i++) { Plane2 plane = planes[i]; this.ImmVertex(new DrawHelpers.Vertex(plane.Base, this.m_current_color)); } this.ImmVertex(new DrawHelpers.Vertex(convex_poly.Planes[0].Base, this.m_current_color)); this.ImmEnd(); this.ShaderPop(); } }
public bool IsInside(Vector2 point) { Plane2[] planes = this.Planes; bool result; for (int i = 0; i < planes.Length; i++) { Plane2 plane = planes[i]; if (plane.SignedDistance(point) > 0f) { result = false; return(result); } } result = true; return(result); }