如何根据X坐标获取路径的Y坐标?例如,假设我们有一条从起点[100,50]到终点[200,50]的线(路径)。当X坐标等于150时,我想知道Y坐标的值。(这只是一个简单的例子,我的路径可能会更弯曲)。谢谢任何帮助。
我可以像这样获取路径的两个坐标:
例如,这将返回路径中点的坐标。 我正在寻找类似于"getYCoordinate(myPath, xCoordinate)"的函数。
我可以像这样获取路径的两个坐标:
//Count coordinates of path of lineChart
PathMeasure pm = new PathMeasure(myPath, false);
//coordinates will be here
float aCoordinates[] = {0f, 0f};
pm.getPosTan(pm.getLength() * 0.5, aCoordinates, null);
例如,这将返回路径中点的坐标。 我正在寻找类似于"getYCoordinate(myPath, xCoordinate)"的函数。