public SegmentedLine3D Clone()
        {
            var result = new SegmentedLine3D(new List <Line3D>(lines));

            result.color = color;
            return(result);
        }
        public bool TryMerge(SegmentedLine3D segment, float distanceThreshold, float angleThreshold)
        {
            if (Vector3.Distance(Start, segment.Start) < distanceThreshold && Vector3.Angle(StartVector, segment.StartVector) < angleThreshold)
            {
                segment.Invert();
                segment.lines.AddRange(lines);
                lines = segment.lines;
                return(true);
            }

            if (Vector3.Distance(End, segment.End) < distanceThreshold && Vector3.Angle(EndVector, segment.EndVector) < angleThreshold)
            {
                segment.Invert();
                lines.AddRange(segment.lines);
                return(true);
            }

            if (Vector3.Distance(End, segment.Start) < distanceThreshold && Vector3.Angle(EndVector, segment.StartVector) < angleThreshold)
            {
                lines.AddRange(segment.lines);
                return(true);
            }

            if (Vector3.Distance(Start, segment.End) < distanceThreshold && Vector3.Angle(Start, segment.End) < angleThreshold)
            {
                segment.lines.AddRange(lines);
                lines = segment.lines;
                return(true);
            }

            return(false);
        }