我想从我生成的贝塞尔曲线路径中获取 Y 坐标值的列表。
但我得到的只是一条直线,出了什么问题?
这是代码片段:
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]));
}
因此,我没有给出正确的结果 - y 坐标在开始和结束时挤在一起,而在中间更分散,我得到了一个增量整数系列,增量是恒定的,这表明它是一条直线。怎么了?