示例#1
0
        static public Plane2 CreatePointsAndInsidePoint(Vector2 v0, Vector2 v1, Vector2 inside)
        {
            Plane2 plane = CreatePoints(v0, v1);

            if (plane.IsInside(inside))
            {
                return(plane);
            }

            return(plane.GetFlipped());
        }
示例#2
0
        static public ConvexPolygon GetIntersection(this ConvexPolygon item, Plane2 plane)
        {
            ConvexPolygon intersection = new ConvexPolygon();

            intersection.AddVertexs(item.GetVertexs().Narrow(v => plane.IsInside(v)));

            Vector2 point;

            foreach (Face face in item.GetFaces())
            {
                if (face.IsIntersecting(plane, out point))
                {
                    intersection.AddVertex(point);
                }
            }

            return(intersection);
        }