第四章第二题(几何:最大圆距离)(Geometry: great circle distance)

第四章第二题(几何:最大圆距离)(Geometry: great circle distance)

  • *4.2(几何:最大圆距离)最大圆距离是指球面上两个点之间的距离。假设(x1,y1)和(x2,y2)是两个点的地理经纬度。两个点之间的最大圆距离可以使用以下公式计算:
    在这里插入图片描述

编写一个程序,提示用户以度为单位输入地球上两个点的经纬度,显示其最大圆距离值。地球的平均半径为6371.01km。注意,你需要使用Math.toRadians方法将度转换为弧度值。公式中的经纬度是相对北边和西边的,使用负数表示相对南边和东边的度数。
下面是一个运行示例:

Enter point 1 (latitude and longitude) in degrees: 39.55 -116.25

Enter point 2 (latitude and longitude) in degrees: 41.5 87.37

The distance between the two points is 10691.79183231593 km

*4.2(Geometry: great circle distance) The great circle distance is the distance between two points on the surface of a sphere. Let (x1, y1) and (x2, y2) be the geographical latitude and longitude of two points. The great circle distance between the two
points can be computed using the following formula:
在这里插入图片描述
Write a program that prompts the user to enter the latitude and longitude of two points on the earth in degrees and displays its great circle distance. The average radius of the earth is 6,371.01 km. Note you need to convert the degrees into radians using the Math.toRadians method since the Java trigonometric methods use radians. The latitude and longitude degrees in the formula are for north and west. Use negative to indicate south and east degrees.

Here is a sample run:

Enter point 1 (latitude and longitude) in degrees: 39.55 -116.25

Enter point 2 (latitude and longitude) in degrees: 41.5 87.37

The distance between the two points is 10691.79183231593 km

  • 参考代码:
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值