I want to get a list of Y coordinate values from a Bezier curve path that I generated.
But all I got was a straight line, what went wrong?
Here's the code snippet:
private static ArrayList<Integer> ys;
path.moveTo(point0.x, point0.y); //the origin, 0,0
path.cubicTo(point1.x, point1.y, point2.x, point2.y, point3.x, point3.y);//nothing wrong with the coordinates of these points as I checked them repeatedly and used several online websites to verify
PathMeasure pm = new PathMeasure(path, false);
float aCoordinates[] = {0f, 0f};
for (int i = 1;i<=totalNumberOfDots;i++) {
pm.getPosTan(pm.getLength()*(float)i/totalNumberOfDots, aCoordinates, null);
ys.add(Math.round(aCoordinates[1]));
}
So instead of give the correct results - y coords that are huddled together in the beginning and the end and more scattered in the middle, I get an incremental series of integers with the increment being constant which suggests it's a straight line. What's wrong?