how to draw the curve line?
I'm trying to draw a curve. But I do not know how to draw the point y, we ask for help.
int matWidth = 500;
int matHeight = 500;
int fromPointX = 50;
int fromPointY = 400;
int toPointX = 300;
int toPointY = 200;
ArrayList<Point> pointList = new ArrayList<Point>();
for(int i = fromPointX; i < toPointX; i++) {
Point point = new Point();
point.x = i;
// I do not know how to draw a curve.
point.y = fromPointY++;
pointList.add(point);
}
for(int i = 1; i < pointList.size(); i++) {
Core.line(mat, pointList.get(i-1), pointList.get(i),new Scalar(255,255,0), 5);
}
It would be interesting also in c++ if Java has not the possibility :p
I think your problem isn't that you don't know how to draw a curve but that you don't know how to define a curve. From your so called point x and point y in the figure, infinite curves can be defined. But once you have defined it, and you have a list of all its points (or a good number of them; the more the smoother the curve), then drawing is simple: either you use line iteratively with every pair of consecutive points (as shown in your code) or you use a probably better function such as polylines (you should check if it's available on the java wrapper)