Example #1
0
        public bool AppendVertex(StraightPathVertex vert)
        {
            bool equalToLast = false;

            if (Count > 0)
            {
                //can only be done if at least one vertex in path
                Vector3 lastStraightPath = verts[Count - 1].Point.Position;
                Vector3 pos = vert.Point.Position;
                equalToLast = Vector3Extensions.AlmostEqual(ref lastStraightPath, ref pos);
            }

            if (equalToLast)
            {
                //the vertices are equal, update flags and polys
                verts[Count - 1] = vert;
            }
            else
            {
                //append new vertex
                verts.Add(vert);

                if (vert.Flags == StraightPathFlags.End)
                {
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        public bool AppendVertex(StraightPathVertex vert)
        {
            bool equalToLast = false;
            if (Count > 0)
            {
                //can only be done if at least one vertex in path
                Vector3 lastStraightPath = verts[Count - 1].Point.Position;
                Vector3 pos = vert.Point.Position;
                equalToLast = Vector3Extensions.AlmostEqual(ref lastStraightPath, ref pos);
            }

            if (equalToLast)
            {
                //the vertices are equal, update flags and polys
                verts[Count - 1] = vert;
            }
            else
            {
                //append new vertex
                verts.Add(vert);

                if (vert.Flags == StraightPathFlags.End)
                {
                    return false;
                }
            }

            return true;
        }