假设我在笛卡尔坐标平面上有两个点,A并且B,其x和y坐标是双精度floats。如何找到C它们之间距离的任意百分比的点的位置?
换句话说,以下方法中的内容是什么而不是“ //Do magic to C”?请记住,AandB每个都由两个doubles 组成,它们分别代表它们的x和y坐标。
public static findProgressPoint(DoublePoint A, DoublePoint B, double position)
{
if (position > 1 || position < 0) //Ensure that position is between 0 and 1, inclusive
position = position - (int)position;
DoublePoint C = new DoublePoint(0.0, 0.0);
//Do magic to C
return C;
}