public static Point2d[] ParabolaParabola(Parabola2d pab1, Parabola2d pab2) //tested ok { Transform2d tr = pab1.ToStandardPosition; pab2 = new Parabola2d(pab2); //copy for transformation pab2.Transform(tr); var ptset = StandardPosParabolaGeneralConic(pab2.ToGeneralConic()); ptset.Transform(tr.Inversed); return(ptset.ToArray()); }
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()); }
public static double[] ParabolaLineParamteric(Parabola2d pab, Line2d lin) //tested ok { double x1, y1, x2, y2; //line points in parabola standard position Transform2d tr = pab.ToStandardPosition; //intersect line with y=x^2 => easier tr.Apply(lin.X1, lin.Y1, out x1, out y1, true); tr.Apply(lin.X2, lin.Y2, out x2, out y2, true); double dx = x2 - x1; double dy = y2 - y1; double c2 = -dx * dx; double c1 = dy - 2 * dx * x1; double c0 = y1 - x1 * x1; //y1-x1^2+t*(dy-2*dx*x1)-dx^2*t^2=0 double[] ts = RealPolynomial.SolveQuadric(c2, c1, c0); return(ts); }
public static Point2d[] ParabolaLine(Parabola2d pab, Line2d lin) { return(LineParamsToPoints(ParabolaLineParamteric(pab, lin), lin, double.NegativeInfinity, double.PositiveInfinity)); }
public Parabola2d(Parabola2d tocopy) { vertex = tocopy.vertex; rotation = tocopy.rotation; a = tocopy.a; }