Esempio n. 1
0
        public static Point2d[] EllipseEllipse(Ellipse2d el1, Ellipse2d el2)
        {
            //reduce this problem to a circle-ellipse problem by
            //rotating ellipse 1 down, scaling it to circle and then
            //rotate ellipse2 down.
            Transform2d tr = Transform2d.Rotate(-el1.Rotation) * Transform2d.Stretch(1.0, 1.0 / el1.Ratio);

            //dont modify originals:
            el1 = new Ellipse2d(el1);
            el2 = new Ellipse2d(el2);
            el1.Transform(tr);
            el2.Transform(tr);

            Point2d[] res = EllipseCircle(el2, new Circle2d(el1.X, el1.Y, el1.MajorRadius));

            if (res == null)
            {
                return(null);
            }

            Transform2d trinv = (tr).Inversed;

            for (int l = 0; l < res.Length; l++)
            {
                res[l] = res[l].GetTransformed(trinv);
            }

            return(res);
        }