You're talking about a spline!
Will there only ever be three points or merely looking at the current three points in an array of points.
Do you want the curve to pass through the points or use them as a guide for placing a smooth curve!
If you're on the curve then that means that they all have the same radius from the center of a circle right? Draw 3 points on a piece of paper. Take a compass draw some intersecting curves. Do you see your answer?
Now think ellipse.
Circumference of a circle is 2 PI r = PI (r + r)
Or think of r as x, so PI (x + x ) since x = y on a graph.
Circumference of an elipse is PI (x + y)
wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
im trying to draw a curved line using mouse. there are three points on a straight line. a starting point, an ending point and a point in between. i want to draw a curved line by dragging the middle point in any direction. the other two points remain constant.
Three points can produce all sorts of different curves, not just one. What kind of curve are you talking about? A Bezier curve?
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
What kind of curve! As Vernon Dozier indicates.
For example, if the moving point is between the two center points on a curve. Put it between them. Now move tangent to the line between the two end points. It's a circle, but if you get further the 1/2 the distance between the two points your circle flips. Instead of being between the two points on the acute angle formed by those two points and the circle midpoint of the circle. You are now on the obtuse side of the angle.
This is only one type of curve. There are others!
wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
Since you want any curve. Try working with what I just posted. Forget curve for now, think on full circule. change to an arc later once it works.
The one thing in common with what I posted is there is one center point, and all three points have the same radius from that point!
wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
i want any kind of curve which will contain the three points

i have attached a picture of how the curve should look like. the three points are shown
It may be a Bezier, I'm not sure. Being as this is the Java forum, Java has a tailor-made Bezier-Curve option, so go with what's already there. Here's an applet I made. http://www.derekscswebsite.com/MathStuff/BezierCurve/index.html
You're looking at using a GeneralPath, using curveTo, I would imagine. Three points will make your curve, so curveTo expects six doubles/floats (two doubles/floats per point).
http://java.sun.com/javase/6/docs/api/java/awt/geom/GeneralPath.html
http://java.sun.com/javase/6/docs/api/java/awt/geom/Path2D.Float.html#curveTo(double,%20double,%20double,%20double,%20double,%20double )
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711