Пример #1
0
        public static Point3DCollection ExtendLineBothDirections(Point3DCollection inputline, double offsetamount)
        {
            Vector3D v1 = inputline[0] - inputline[inputline.Count - 1];
            Vector3D v2 = inputline[inputline.Count - 1] - inputline[0];

            v1.Normalize();
            v2.Normalize();

            Point3D startPoint = inputline[0];
            Point3D endPoint   = inputline[inputline.Count - 1];

            startPoint.Offset(offsetamount * v1.X, offsetamount * v1.Y, offsetamount * v1.Z);
            inputline.Insert(0, startPoint);
            endPoint.Offset(offsetamount * v2.X, offsetamount * v2.Y, offsetamount * v2.Z);
            inputline.Add(endPoint);

            return(inputline);
        }