Plane¶
简要描述¶
粗麻布形式的平面。
描述¶
平面表示归一化平面方程。
成员¶
| 类型 | 属性名 | 默认值 |
|---|---|---|
| float | d | 0.0 |
| Vector3 | normal | Vector3( 0, 0, 0 ) |
| float | x | 0.0 |
| float | y | 0.0 |
| float | z | 0.0 |
方法¶
| 返回值类型 | 方法名称 |
|---|---|
| Plane | Plane(#method-Plane)(a: float, b: float, c: float, d: float) |
| Plane | Plane(#method-Plane)(v1: Vector3, v2: Vector3, v3: Vector3) |
| Plane | Plane(#method-Plane)(normal: Vector3, d: float) |
| Vector3 | center() |
| float | distance_to(point: Vector3) |
| Vector3 | get_any_point() |
| bool | has_point(point: Vector3, epsilon: float = 1e-05) |
| Vector3 | intersect_3(b: Plane, c: Plane) |
| Vector3 | intersects_ray(from: Vector3, dir: Vector3) |
| Vector3 | intersects_segment(begin: Vector3, end: Vector3) |
| bool | is_equal_approx(plane: Plane) |
| bool | is_point_over(point: Vector3) |
| Plane | normalized() |
| Vector3 | project(point: Vector3) |
常量¶
- PLANE_YZ = Plane( 1, 0, 0, 0 )
在Y和Z轴上延伸的平面。
- PLANE_XZ = Plane( 0, 1, 0, 0 )
在X和Z轴上延伸的平面。
- PLANE_XY = Plane( 0, 0, 1, 0 )
在X和Y轴上延伸的平面。
成员说明¶
- float d
| Default | 0.0 |
|---|---|
| getter | **** |
- Vector3 normal
| Default | Vector3( 0, 0, 0 ) |
|---|---|
| getter | **** |
- float x
| Default | 0.0 |
|---|---|
| getter | **** |
- float y
| Default | 0.0 |
|---|---|
| getter | **** |
- float z
| Default | 0.0 |
|---|---|
| getter | **** |
方法说明¶
- Plane Plane(a: float, b: float, c: float, d: float)
根据四个参数创建一个平面。平面的3个组件是normal a, b 和 c, 并且平面有一个离开源的距离 d.
- Plane Plane(v1: Vector3, v2: Vector3, v3: Vector3)
从三个点按顺时针顺序创建一个平面。
- Plane Plane(normal: Vector3, d: float)
从法线和平面到原点的距离创建平面。
- center center()
返回平面的中心。
- distance_to distance_to(point: Vector3)
返回从平面到位置point的最短距离。
- get_any_point get_any_point()
返回平面上的一个点。
- has_point has_point(point: Vector3, epsilon: float = 1e-05)
如果point在平面内(以最小的epsilon阈值),则返回true。
- intersect_3 intersect_3(b: Plane, c: Plane)
返回三个平面b,c与该平面的交点。如果没有找到相交的结果,那么返回空null
- intersects_ray intersects_ray(from: Vector3, dir: Vector3)
返回由位置from和方向dir组成的射线与此平面的交点。如果没有找到相交的结果,那么返回空null
- intersects_segment intersects_segment(begin: Vector3, end: Vector3)
返回此平面从位置begin到位置end的线段的相交点。如果没有找到相交的结果,那么返回空null
- is_equal_approx is_equal_approx(plane: Plane)
如果此平面和plane大致相等,则通过在每个组件上运行[@],返回true。
- is_point_over is_point_over(point: Vector3)
如果point位于平面上方,则返回true。
- normalized normalized()
返回标准化的平面副本。
- project project(point: Vector3)
返回点p到平面中一个点的正交投影。