gpt4 book ai didi

javascript - 两个运动物体的交点

转载 作者:行者123 更新时间:2023-11-30 06:13:03 25 4
gpt4 key购买 nike

我正在尝试使用此处提供的答案:Intersection of two Moving Objects with Latitude/Longitude Coordinates

但是我有一些问题..

这个 Angular 是多少:

var angle = Math.PI + dir - target.dir

我在想余弦定律中应该使用的 Angular 已经是“alpha or target.dir”。那条线在做什么?同样在这两个步骤中:

 var x = target.x + target.vel * time * Math.cos(target.dir); 
var y = target.y + target.vel * time * Math.sin(target.dir);

代码不应该使用 x 轴或 y 轴与目标速度矢量之间的 Angular 吗?为什么作者在这里使用 alpha?

enter image description here

最佳答案

What is this angle:

var angle = Math.PI + dir - target.dir

名为angle 的变量确实是 Angular alpha。因为方向 dir 是从追赶者到目标的方向,而我们在计算中需要相反的方向,所以我们在减去 target.dir 之前加上 π。

也许使用 Angular 这个词作为变量名有点含糊;我会将其更改为 alpha,这是我在图像中用于此 Angular 名称。

Shouldn't the code be using the angle between x- or y-axis and the target velocity vector? Why is the author using alpha here?

var x = target.x + target.vel * time * Math.cos(target.dir);  
var y = target.y + target.vel * time * Math.sin(target.dir);

我们确实是使用target.dir,也就是目标的方向,即x轴与目标向量的夹 Angular ,来计算截取点的坐标,而不是 Angular 阿尔法。

关于javascript - 两个运动物体的交点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57745068/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com