示例#1
0
        static public IEnumerable <Triangle2> SplitAlongEdge12ByPercent(this Triangle2 item, float percent)
        {
            Vector2 vertex = item.GetEdge12().GetPointOnByPercent(percent);

            yield return(new Triangle2(item.v0, item.v1, vertex));

            yield return(new Triangle2(vertex, item.v2, item.v0));
        }
示例#2
0
        public PolygonTriangle(Triangle2 t)
        {
            triangle = t;

            f1 = triangle.GetEdge01().GetFace();
            f2 = triangle.GetEdge12().GetFace();
            f3 = triangle.GetEdge20().GetFace();
        }
示例#3
0
        static public Vector2 GetPointOnEdgeByPercent(this Triangle2 item, float percent)
        {
            percent = percent.GetLooped(3.0f);

            if (percent < 1.0f)
            {
                return(item.GetEdge01().GetPointOnByPercent(percent));
            }

            if (percent < 2.0f)
            {
                return(item.GetEdge12().GetPointOnByPercent(percent - 1.0f));
            }

            return(item.GetEdge20().GetPointOnByPercent(percent - 2.0f));
        }