# Class PolygonShape

java.lang.Object
com.codename1.gaming.physics.box2d.collision.shapes.Shape
com.codename1.gaming.physics.box2d.collision.shapes.PolygonShape

public class PolygonShape extends Shape

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final Vec2`
  `m_centroid`
  `int`
  `m_count`
  `final Vec2[]`
  `m_normals`
  `final Vec2[]`
  `m_vertices`

  ### Fields inherited from class Shape

  `m_radius, m_type`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PolygonShape()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Vec2`
  `centroid(Transform xf)`
  `Vec2`
  `centroidToOut(Transform xf, Vec2 out)`
  `final Shape`
  `clone()`
  `final void`
  `computeAABB(AABB aabb, Transform xf, int childIndex)`
  `final void`
  `computeCentroidToOut(Vec2[] vs, int count, Vec2 out)`
  `void`
  `computeMass(MassData massData, float density)`
  `int`
  `getChildCount()`
  `Vec2[]`
  `getNormals()`
  `final Vec2`
  `getVertex(int index)`
  `final int`
  `getVertexCount()`
  `Vec2[]`
  `getVertices()`
  `final boolean`
  `raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex)`
  `final void`
  `set(Vec2[] vertices, int count)`
  `final void`
  `set(Vec2[] verts, int num, Vec2Array vecPool, IntArray intPool)`
  `final void`
  `setAsBox(float hx, float hy)`
  `final void`
  `setAsBox(float hx, float hy, Vec2 center, float angle)`
  `final boolean`
  `testPoint(Transform xf, Vec2 p)`
  `boolean`
  `validate()`

  ### Methods inherited from class Shape

  `getRadius, getType, setRadius`

  ### Methods inherited from class Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### m_centroid

    public final Vec2 m_centroid

  - ### m_vertices

    public final Vec2[] m_vertices

  - ### m_normals

    public final Vec2[] m_normals

  - ### m_count

    public int m_count

- ## Constructor Details

  - ### PolygonShape

    public PolygonShape()

- ## Method Details

  - ### clone

    public final Shape clone()
    Specified by:
      `clone` in class `Shape`

  - ### set

    public final void set(Vec2[] vertices, int count)

  - ### set

    public final void set(Vec2[] verts, int num, Vec2Array vecPool, IntArray intPool)

  - ### setAsBox

    public final void setAsBox(float hx, float hy)

  - ### setAsBox

    public final void setAsBox(float hx, float hy, Vec2 center, float angle)

  - ### getChildCount

    public int getChildCount()
    Specified by:
      `getChildCount` in class `Shape`

  - ### testPoint

    public final boolean testPoint(Transform xf, Vec2 p)
    Specified by:
      `testPoint` in class `Shape`

  - ### computeAABB

    public final void computeAABB(AABB aabb, Transform xf, int childIndex)
    Specified by:
      `computeAABB` in class `Shape`

  - ### getVertexCount

    public final int getVertexCount()

  - ### getVertex

    public final Vec2 getVertex(int index)

  - ### raycast

    public final boolean raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex)
    Specified by:
      `raycast` in class `Shape`

  - ### computeCentroidToOut

    public final void computeCentroidToOut(Vec2[] vs, int count, Vec2 out)

  - ### computeMass

    public void computeMass(MassData massData, float density)
    Specified by:
      `computeMass` in class `Shape`

  - ### validate

    public boolean validate()

  - ### getVertices

    public Vec2[] getVertices()

  - ### getNormals

    public Vec2[] getNormals()

  - ### centroid

    public Vec2 centroid(Transform xf)

  - ### centroidToOut

    public Vec2 centroidToOut(Transform xf, Vec2 out)