M3D / M3D / Actions / RayPickHelper
Class: RayPickHelper
Memberof
M3D.Actions
Description
拾取帮助类
Table of contents
Constructors
Methods
Constructors
constructor
• new RayPickHelper(): RayPickHelper
Returns
Methods
getScreenDis
▸ getScreenDis(pnt1
, pnt
, viewport
): number
Parameters
Name | Type | Description |
---|---|---|
pnt1 | Vector3 | 空间点 |
pnt | Vector3 | 空间点 |
viewport | Viewport | 视口 |
Returns
number
距离值
Description
得到空间中两点,在屏幕空间中的距离
getScreenPntLineDis
▸ getScreenPntLineDis(pnt
, linePnt1
, linePnt2
, viewport
): any
[]
Parameters
Name | Type |
---|---|
pnt | Vector3 |
linePnt1 | Vector3 |
linePnt2 | Vector3 |
viewport | Viewport |
Returns
any
[]
Description
得到空间中点线,在屏幕空间中的距离
isIntersectRayAndTriangle
▸ isIntersectRayAndTriangle(tri
, ray
): Vector3
Parameters
Name | Type | Description |
---|---|---|
tri | number | 三角形 |
ray | Ray | 射线 |
Returns
i 交点 null表示没有交点
Description
射线和三角形相交判断
▸ isIntersectRayAndTriangle(v0
, v1
, v2
, ray
): Vector3
Parameters
Name | Type | Description |
---|---|---|
v0 | Vector3 | 第一个点 |
v1 | Vector3 | 第二个点 |
v2 | Vector3 | 第三个点 |
ray | Ray | 射线 |
Returns
i 交点 null表示没有交点
Description
射线和线段相交判断
isRayHitBox
▸ isRayHitBox(ray
, box
): boolean
Parameters
Name | Type | Description |
---|---|---|
ray | Ray | 射线 |
box | BoundingBox | 包围盒 |
Returns
boolean
true相交 false不相交
Description
射线和包围盒相交判断
rayIntersectBoxPnt
▸ rayIntersectBoxPnt(ray
, box
, intersectPnts
): boolean
Parameters
Name | Type | Description |
---|---|---|
ray | Ray | 射线 |
box | BoundingBox | 包围盒 |
intersectPnts | Vector3 [] | 交点数组 |
Returns
boolean
true相交 false不相交
Description
射线和包围盒相交判断