实现 计算两个三维坐标点的 距离

internal class Vector3
{
    float x;
    float y;
    float z;
    public Vector3(float x, float y, float z)
    {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    internal static double Distance(Vector3 startAirportPos, Vector3 endAirportPos)
    {
        double sqrt = System.Math.Sqrt(System.Math.Pow(startAirportPos.x - endAirportPos.x, 2) + System.Math.Pow(startAirportPos.y - endAirportPos.y, 2) + System.Math.Pow(startAirportPos.z - endAirportPos.z, 2));
        return System.Math.Abs(sqrt);
    }
}

©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页