Static Readonly BOTTOM_index of bottom edge in Polygon from makeBlock()
Static IDCounter used for naming shapes.
Static Readonly LEFT_index of left edge in Polygon from makeBlock()
Static Readonly RIGHT_index of right edge in Polygon from makeBlock()
Static Readonly TOP_index of top edge in Polygon from makeBlock()
Static makeStatic makeMakes a rectangular Polygon with given width and height; in body coords the center is at the origin, and width is along the x-axis, height along the y-axis.
width of the block, horizontal dimension in body orientation
height of the block, vertical dimension in body orientation
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
a rectangular Polygon
Static makeMakes a rectangular Polygon with given width and height; in body coords the origin is at the bottom left corner.
width of the block, horizontal dimension in body orientation
height of the block, vertical dimension in body orientation
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
a rectangular Polygon
Static makeReturns a rectangle centered at origin with the given width and height, but rotated by the given angle in the body coordinate system. The purpose is to ensure that angled straight lines are tested.
width in unrotated position
height in unrotated position
angle to rotate by in radians, must be between +/- PI/2
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
a rectangle centered at origin with the given width and height, but rotated by the given angle
Static makeMakes a hollow box or 'square doughnut' shape.
width of frame, measured to center of walls
height of frame, measured to center of walls
thickness of walls
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
Static makeStatic makeCreates a pendulum shaped Polygon: a circle with a long stick attached. The center of mass and drag point is at the center of the circle. In body coordinates, the center of the circle is at the origin and the stick is straight above.
width of the stick
length of the stick
radius of the circle
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
a pendulum-shaped Polygon
Static makeCreates a Polygon whose vertices are at the given points.
array of points giving location of vertices in body coordinates
the value of outsideIsUp for each edge
moment about center of mass
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
Polygon whose vertices are at the given points
Static makeCreates a randomly shaped polygon with given number of sides. The corners lie on a circle with given radius centered at origin.
number of sides, minumum is 3
radius of circle that the Polygon fits inside of
Optional minAngle: numberthe minimum distance between corners on the circle in radians
Optional maxAngle: numberthe maximum distance between corners on the circle in radians
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
a block with round corners
Static makeCreates a block with rounded ends. Height must be greater than width.
width in unrotated position
height in unrotated position
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
a block with rounded ends
Static makeCreates a rectangular block with small round corners. In body coords the center is at the origin, and width is along the x-axis, height along the y-axis.
width of the block
height of the block
radius of each corner
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
a block with round corners
Static makeMakes a rectangular Polygon with a special edge that causes special proximity testing to be done for this Polygon. The other edges of this Polygon are given zero centroid radius, so that they are effectively never used for collision testing. See Polygon.getSpecialNormalWorld.
width of the wall, horizontal dimension in body orientation
height of the wall, vertical dimension in body orientation
index of the special edge: use the constants BOTTOM_EDGE, LEFT_EDGE, RIGHT_EDGE, TOP_EDGE
Optional opt_name: stringname of the Polygon
Optional opt_localName: stringlocalized name of the Polygon
a rectangular Polygon with a special edge
Generated using TypeDoc
Provides static functions to make Polygons of various shapes.