コード例 #1
0
ファイル: Intersect2d.cs プロジェクト: ventor3000/guppy2
        public static Point2d[] ParabolaHyperbola(Parabola2d pab, Hyperbola2d hyp) //tested ok
        {
            Transform2d tr = pab.ToStandardPosition;                               //y=x^2

            hyp = new Hyperbola2d(hyp);                                            //copy for transformation
            hyp.Transform(tr);                                                     //to standard space of parabola for stabillity

            GeneralConic2d gencon = hyp.ToGeneralConic();
            var            ptset  = StandardPosParabolaGeneralConic(gencon);

            ptset.Transform(tr.Inversed);
            return(ptset.ToArray());
        }
コード例 #2
0
ファイル: Hyperbola2d.cs プロジェクト: ventor3000/guppy2
        public override bool Transform(Transform2d t)
        {
            //transform hyperbola centered at origin, because it's more stable general conic
            Hyperbola2d hyp = new Hyperbola2d(this);

            hyp.center = Point2d.Origo;
            var gencon = hyp.ToGeneralConic();

            if (!gencon.Transform(new Transform2d(t.AX, t.AY, t.BX, t.BY, 0.0, 0.0)))
            {
                return(false);
            }

            hyp = gencon.Reduce() as Hyperbola2d;
            if (hyp == null)
            {
                return(false);
            }

            //now transform centerpoint separately,
            //and write bac to this
            center    = center.GetTransformed(t);
            ratio     = hyp.ratio;
            majoraxis = hyp.majoraxis;

            return(true);


            /* double majax = majoraxis.Length;
             * double minax = -majax * ratio;
             * double rot = Rotation;
             * bool reverse;
             * Hyperbola_Transform(ref majax, ref minax, ref rot, ref center, t, out reverse);
             *
             * majoraxis = Vector2d.FromAngleAndLength(rot, majax);
             * ratio = minax / majax;
             *
             * return true;*/
        }