示例#1
0
        public static Point2d[] HyperbolaEllipse(Hyperbola2d hyp, Ellipse2d elp)
        {
            //TODO: this is probably more stable intersecting hyperbola with unitcircle. Rewrite.

            Transform2d tr = hyp.ToStandardPosition;

            hyp = new Hyperbola2d(hyp);
            elp = new Ellipse2d(elp);
            hyp.Transform(tr);
            elp.Transform(tr);

            GeneralConic2d hcon = new GeneralConic2d(1, 0.0, -1 / (hyp.B * hyp.B), 0.0, 0.0, -1);

            Point2dSet pset = new Point2dSet();

            pset.AddRange(ConicConic(hcon, elp.ToGeneralConic()));
            pset.Transform(tr.Inversed);
            return(pset.ToArray());
        }
示例#2
0
        public static Point2d[] EllipseEllipse2(Ellipse2d elp1, Ellipse2d elp2)
        {
            //TODO: check if this is better than EllipseEllipse in stabillity and replace it or remove this function

            Transform2d tr = elp1.ToStandardPosition;

            elp2 = new Ellipse2d(elp2); //dont alter the original ellipse
            elp2.Transform(tr);

            elp1 = new Ellipse2d(elp1);
            elp1.Transform(tr);

            GeneralConic2d con1 = new GeneralConic2d(1.0, 0.0, 1 / (elp1.Ratio * elp1.Ratio), 0.0, 0.0, -1.0);
            GeneralConic2d con2 = elp2.ToGeneralConic(); // GeneralConic2d.FromEllipse(elp2);

            Point2dSet pset = new Point2dSet();

            pset.AddRange(ConicConic(con1, con2));
            pset.Transform(tr.Inversed);
            return(pset.ToArray());
        }