position of the rounded rectangle
position of the rounded rectangle
the rectangle width
the rectangle height
Optionalradius: number = DEFAULT_RADIUS
the radius of the rounded corner
OptionalcollisionOptionalcollisionOptional per-shape collision settings, honoured by Body#addShape
and defaulted there. Declared rather than initialized: the body writes
them when the shape joins it, so a class field here would emit an
undefined own property on every shape ever built. See addShape for
the table of defaults and what each one does.
The edges here are the direction of the nth edge of the polygon, relative to
the nth point. If you want to draw a given edge from the edge value, you must
first translate to the position of the starting point.
a list of indices for all vertices composing this polygon, filled in by Polygon#getIndices and invalidated by Polygon#recalc.
A subclass may repurpose this name for geometry of its own: a
Mesh holds a GPU index buffer here, a typed array rather than a
plain one. recalc therefore only clears the slot when it owns it —
anything else reading it should check what it got.
Optionalisfalse takes this shape out of collision without removing it
Optionalistrue reports contacts but skips the position correction
Array of points defining the Polygon
Note: If you manually change points, you must call recalcafterwards so that the changes get applied correctly.
origin point of the Polygon
the shape type (used internally)
bottom coordinate of the RoundRect
absolute center of this RoundRect on the horizontal axis
absolute center of this RoundRect on the vertical axis
height of the RoundRect
left coordinate of the RoundRect
right coordinate of the RoundRect
top coordinate of the RoundRect
width of the RoundRect
Returns true if the rounded rectangle contains the given point
x coordinate or a vector point
Optionaly: number
y coordinate
True if the rounded rectangle contains the given point
Returns true if the rounded rectangle contains the given point
True if the rounded rectangle contains the given point
Returns true if the rounded rectangle contains the given rectangle
rectangle to test
bottom coordinate
left coordinate
right coordinate
top coordinate
true if contained
check if this RoundRect is identical to the specified one
Other rounded rectangle.
true if equals
returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
this shape bounding box Rectangle object
returns a list of indices for all triangles defined in this polygon
an array of vertex indices for all triangles forming this polygon.
Returns true if the vertices composing this polygon form a convex shape (vertices must be in clockwise order).
true if the vertices are convex, false if not, null if not computable
Computes the calculated collision polygon.
This must be called if the points array, angle, or offset is modified manually.
Reference to this object for method chaining
resize the rounded rectangle
new width
new height
this rounded rectangle
Scales the polygon by the given factors along the x and y axes.
The factor by which to scale the polygon along the x-axis.
Optionaly: number = x
The factor by which to scale the polygon along the y-axis. Defaults to the value of x.
Reference to this object for method chaining
set new value to the Polygon
position of the Polygon
position of the Polygon
array of vector or vertices defining the Polygon
this instance for object chaining
Set new dimensions for the rounded rectangle.
The new width.
The new height.
set the vertices defining this Polygon
array of vector or vertices defining the Polygon
this instance for object chaining
apply an isometric projection to this shape
Reference to this object for method chaining
Translates the Polygon by the specified offset.
The x offset or a vector point to translate by.
Optionaly: number
The y offset. This parameter is required if the first parameter is a number.
Reference to this object for method chaining
a rectangle object with rounded corners