0

I use QuadCurve2D (Quadratic Curve Segment) in Java. Can I get y-coordinate by x-coordinate from this object?

Something like this:

QuadCurve2D q = new QuadCurve2D.Float ();
q.setCurve (x1, y1, ctrlx, ctrly, x2, y2);

int X = 100;
int Y = q.getY (X); // (?)
user3102393
  • 87
  • 2
  • 9
  • no, because there can be one *or two* Y values for any single X. – Mike 'Pomax' Kamermans Dec 15 '13 at 17:06
  • This question implies a misconception, I think. The formula by which this type of curves are defined relate points in the segment (1D) with points in space (2D). You can certainly obtain the point yourself by coding the specific function and choosing any point in the segment, but you'd need to know exactly which function is this class using. – cangrejo Dec 15 '13 at 17:11
  • Yes, you are right. I ask because I want try make animation of point's movement on curve. – user3102393 Dec 15 '13 at 17:22
  • Then yes, you need to know the function and go through the segment interpolating the point every step of the way. – cangrejo Dec 15 '13 at 17:31

0 Answers0