Static
areaReturns the area of the set of vertices.
Optional
signed: booleanThe area
area
Static
centreStatic
chamferChamfers a set of vertices by giving them rounded corners, returns a new set of vertices. The radius parameter is a single number or an array to specify the radius for each vertex.
chamfer
Static
clockwiseStatic
containsStatic
createCreates a new set of Matter.Body
compatible vertices.
The points
argument accepts an array of Matter.Vector
points orientated around the origin (0, 0)
, for example:
[{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }]
The Vertices.create
method returns a new array of vertices, which are similar to Matter.Vector objects,
but with some additional references required for efficient collision detection routines.
Vertices must be specified in clockwise order.
Note that the body
argument is not optional, a Matter.Body
reference must be provided.
create
Static
fromParses a string containing ordered x y pairs separated by spaces (and optionally commas),
into a Matter.Vertices
object for the given Matter.Body
.
For parsing SVG paths, see Svg.pathToVertices
.
Optional
body: IBodyvertices
fromPath
Static
hullStatic
inertiaStatic
isStatic
meanStatic
rotateStatic
scaleStatic
translateGenerated using TypeDoc
The
Matter.Vertices
module contains methods for creating and manipulating sets of vertices. A set of vertices is an array ofMatter.Vector
with additional indexing properties inserted byVertices.create
. AMatter.Body
maintains a set of vertices to represent the shape of the object (its convex hull).See the included usage examples.