Ejemplo n.º 1
0
        private void ExpandBase(Coordinate endPoint)
        {
            var        axis = _base.Plane.GetClosestAxisToNormal();
            var        start = _base.Vertices[0] - _base.Vertices[0].ComponentMultiply(axis);
            var        end = endPoint - endPoint.ComponentMultiply(axis);
            var        diff = end - start;
            Coordinate addx, addy;

            if (axis == Coordinate.UnitX)
            {
                addx = diff.ComponentMultiply(Coordinate.UnitY);
                addy = diff.ComponentMultiply(Coordinate.UnitZ);
            }
            else if (axis == Coordinate.UnitY)
            {
                addx = diff.ComponentMultiply(Coordinate.UnitX);
                addy = diff.ComponentMultiply(Coordinate.UnitZ);
            }
            else
            {
                addx = diff.ComponentMultiply(Coordinate.UnitX);
                addy = diff.ComponentMultiply(Coordinate.UnitY);
            }
            var linex = new Line(start + addx, start + addx + axis);
            var liney = new Line(start + addy, start + addy + axis);

            _base.Vertices[1] = _base.Plane.GetIntersectionPoint(linex, true, true);
            _base.Vertices[2] = endPoint;
            _base.Vertices[3] = _base.Plane.GetIntersectionPoint(liney, true, true);
        }