Ray

表示一条从指定原点沿指定方向无限延伸的射线。

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

复制射线实例。
Name Type Description
ray Ray 要复制的射线。
result Ray optional 存储结果的对象。
Returns:
修改后的结果参数,如果未提供则返回新的射线实例。(如果射线未定义则返回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:
修改后的结果参数,如果未提供则返回新实例。
Example:
//获取射线与椭球的第一个交点。
const intersection = Cesium.IntersectionTests.rayEllipsoid(ray, ellipsoid);
const point = Cesium.Ray.getPoint(ray, intersection.start);
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.