public List <Segment> GetSplitSegmentForVertecies(List <Point3> perimeter, long maxDistance)
        {
            IntPoint start2D = new IntPoint(Start.x, Start.y);
            IntPoint end2D   = new IntPoint(End.x, End.y);

            SortedList <long, IntPoint> requiredSplits2D = new SortedList <long, IntPoint>();

            // get some data we will need for the operations
            IntPoint direction             = (end2D - start2D);
            long     length                = direction.Length();
            long     lengthSquared         = length * length;
            IntPoint rightDirection        = direction.GetPerpendicularRight();
            long     maxDistanceNormalized = maxDistance * length;

            // for every vertex
            for (int vertexIndex = 0; vertexIndex < perimeter.Count; vertexIndex++)
            {
                IntPoint vertex = new IntPoint(perimeter[vertexIndex].x, perimeter[vertexIndex].y) - start2D;
                // if the vertex is close enough to the segment
                long dotProduct = rightDirection.Dot(vertex);
                if (Math.Abs(dotProduct) < maxDistanceNormalized)
                {
                    long dotProduct2 = direction.Dot(vertex);
                    if (dotProduct2 > 0 && dotProduct2 < lengthSquared)
                    {
                        long distance = dotProduct2 / length;
                        // don't add if there is already a point at this position
                        if (!requiredSplits2D.ContainsKey(distance))
                        {
                            // we are close enough to the line split it
                            requiredSplits2D.Add(distance, start2D + direction.Normal(distance));
                        }
                    }
                }
            }

            if (requiredSplits2D.Count > 0)
            {
                // add in the start and end
                if (!requiredSplits2D.ContainsKey(0))
                {
                    requiredSplits2D.Add(0, start2D);
                }
                if (!requiredSplits2D.ContainsKey(length))
                {
                    requiredSplits2D.Add(length, end2D);
                }
                // convert to a segment list
                List <Segment> newSegments = Segment.ConvertPathToSegments(requiredSplits2D.Values, Start.z, false);
                // return them;
                return(newSegments);
            }

            return(null);
        }