Exemple #1
0
        public List <Line> GetBoudingSquare()
        {
            XYZ  line1Parallel      = Line1.Direction;
            XYZ  line1Perpendicular = Transform.CreateRotation(new XYZ(0, 0, 1), Math.PI / 2).OfVector(line1Parallel);
            Line tempLine0          = CreateInfiniteLine(Point1, line1Parallel);
            Line tempLine1          = null;
            Line tempLine2          = null;
            Line tempLine3          = null;
            Line tempCentroidLine   = CreateInfiniteLine(GetCentroid(), line1Perpendicular);

            if (Line1.Distance(Point3) > Line1.Distance(Point4))
            {
                tempLine1 = CreateInfiniteLine(Point3, line1Parallel);
            }
            else
            {
                tempLine1 = CreateInfiniteLine(Point4, line1Parallel);
            }

            if (tempCentroidLine.Distance(Point1) > tempCentroidLine.Distance(Point3))
            {
                tempLine2 = CreateInfiniteLine(Point1, line1Perpendicular);
            }
            else
            {
                tempLine2 = CreateInfiniteLine(Point3, line1Perpendicular);
            }

            if (tempCentroidLine.Distance(Point2) > tempCentroidLine.Distance(Point4))
            {
                tempLine3 = CreateInfiniteLine(Point2, line1Perpendicular);
            }
            else
            {
                tempLine3 = CreateInfiniteLine(Point4, line1Perpendicular);
            }

            //CreateCurve(tempLine0);CreateCurve(tempLine1);CreateCurve(tempLine2);CreateCurve(tempLine3);

            return(GetSquare(tempLine0, tempLine1, tempLine2, tempLine3));
        }