Ray

Represents a ray that extends infinitely from the provided origin in the provided direction.

new Cesium.Ray(origin, direction)

Name Type Default Description
origin Cartesian3 Cartesian3.ZERO optional 射线的原点。
direction Cartesian3 Cartesian3.ZERO optional 射线的方向。

Members

射线的方向。
射线的原点。
Default Value: Cartesian3.ZERO

Methods

static Cesium.Ray.clone(ray, result)Ray

复制一个 Ray 实例。
Name Type Description
ray Ray 要复制的射线。
result Ray optional 用于存储结果的对象。
Returns:
修改后的 result 参数,如果未提供则返回一个新的 Ray 实例。(如果 ray 为 undefined 则返回 undefined)

static Cesium.Ray.getPoint(ray, t, result)Cartesian3

计算沿射线在给定 r(t) = o + t*d 处的点, 其中 o 是射线的原点,d 是方向。
Name Type Description
ray Ray 射线。
t number 一个标量值。
result Cartesian3 optional 存储结果的对象。
Returns:
修改后的 result 参数,如果未提供则返回新实例。
Example:
//Get the first intersection point of a ray and an ellipsoid.
const intersection = Cesium.IntersectionTests.rayEllipsoid(ray, ellipsoid);
const point = Cesium.Ray.getPoint(ray, intersection.start);
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。