3.5 KiB
Planck.js API Doc › Globals › DistanceProxy
Class: DistanceProxy
A distance proxy is used by the GJK algorithm. It encapsulates any shape.
Hierarchy
- DistanceProxy
Index
Constructors
Properties
Methods
Constructors
constructor
+ new DistanceProxy(): DistanceProxy
Defined in src/collision/Distance.ts:235
Returns: DistanceProxy
Properties
m_buffer
• m_buffer: Vec2[]
Defined in src/collision/Distance.ts:232
internal
m_count
• m_count: number
Defined in src/collision/Distance.ts:234
internal
m_radius
• m_radius: number
Defined in src/collision/Distance.ts:235
internal
m_vertices
• m_vertices: Vec2[]
Defined in src/collision/Distance.ts:233
internal
Methods
getSupport
▸ getSupport(d: Vec2): number
Defined in src/collision/Distance.ts:263
Get the supporting vertex index in the given direction.
Parameters:
| Name | Type |
|---|---|
d |
Vec2 |
Returns: number
getSupportVertex
▸ getSupportVertex(d: Vec2): Vec2
Defined in src/collision/Distance.ts:279
Get the supporting vertex in the given direction.
Parameters:
| Name | Type |
|---|---|
d |
Vec2 |
Returns: Vec2
getVertex
▸ getVertex(index: number): Vec2
Defined in src/collision/Distance.ts:255
Get a vertex by index. Used by Distance.
Parameters:
| Name | Type |
|---|---|
index |
number |
Returns: Vec2
getVertexCount
▸ getVertexCount(): number
Defined in src/collision/Distance.ts:248
Get the vertex count.
Returns: number
set
▸ set(shape: Shape, index: number): void
Defined in src/collision/Distance.ts:287
Initialize the proxy using the given shape. The shape must remain in scope while the proxy is in use.
Parameters:
| Name | Type |
|---|---|
shape |
Shape |
index |
number |
Returns: void