import { math } from '@galacean/effects'; import type { Plane } from './plane'; import { Vector3 } from './vector3'; /** * 三维射线扩展,提供沿单位方向取点、与平面求交等查询。 */ export declare class Ray extends math.Ray { origin: Vector3; direction: Vector3; /** * 构造射线。 * @param origin 射线起点,默认为原点 * @param direction 射线方向,默认 (1,0,0) */ constructor(origin?: Vector3, direction?: Vector3); /** * 沿单位方向取参数 `t` 处的点。 * @param t 距离参数 * @returns 射线上对应的点 */ at(t: number): Vector3; /** * 射线到平面的距离。 * * 单位向量之间的投影距离对称,方向与法线取点积后即可得到沿射线的有符号距离。 * @param plane 平面 * @returns 射线到平面的距离,不相交时返回 NaN */ distanceToPlane(plane: Plane): number; /** * 射线与平面求交,相交时将交点写入 `_target`。 * @param plane 目标平面 * @param _target 交点保存对象 * @returns 相交距离 `t`;不相交返回 NaN */ rayCastPlane(plane: Plane, _target: Vector3): number; /** * 克隆当前射线。 * @returns 新射线实例 */ clone(): Ray; }