Class CircleShape

java.lang.Object
org.jbox2d.collision.shapes.Shape
org.jbox2d.collision.shapes.CircleShape

public class CircleShape extends Shape
A circle shape.
Author:
Daniel Murphy
Repolink:
Github: erincatto/box2d src/collision/b2_collide_circle.cpp
  • Field Details

    • p

      public final Vec2 p
  • Constructor Details

    • CircleShape

      public CircleShape()
  • Method Details

    • clone

      public final Shape clone()
      Specified by:
      clone in class Shape
    • getChildCount

      public final int getChildCount()
      Description copied from class: Shape
      Get the number of child primitives
      Specified by:
      getChildCount in class Shape
    • getSupport

      public final int getSupport(Vec2 d)
      Get the supporting vertex index in the given direction.
    • getSupportVertex

      public final Vec2 getSupportVertex(Vec2 d)
      Get the supporting vertex in the given direction.
    • getVertexCount

      public final int getVertexCount()
      Get the vertex count.
    • getVertex

      public final Vec2 getVertex(int index)
      Get a vertex by index.
    • testPoint

      public final boolean testPoint(Transform transform, Vec2 p)
      Description copied from class: Shape
      Test a point for containment in this shape. This only works for convex shapes.
      Specified by:
      testPoint in class Shape
      Parameters:
      transform - The shape world transform.
      p - A point in world coordinates.
    • computeDistanceToOut

      public float computeDistanceToOut(Transform xf, Vec2 p, int childIndex, Vec2 normalOut)
      Description copied from class: Shape
      Compute the distance from the current shape to the specified point. This only works for convex shapes.
      Specified by:
      computeDistanceToOut in class Shape
      Parameters:
      xf - The shape world transform.
      p - A point in world coordinates.
      normalOut - Returns the direction in which the distance increases.
      Returns:
      distance returns the distance from the current shape.
    • raycast

      public final boolean raycast(RayCastOutput output, RayCastInput input, Transform transform, int childIndex)
      Description copied from class: Shape
      Cast a ray against a child shape.
      Specified by:
      raycast in class Shape
      Parameters:
      output - The ray-cast results.
      input - The ray-cast input parameters.
      transform - The transform to be applied to the shape.
      childIndex - The child shape index
      Returns:
      if hit
    • computeAABB

      public final void computeAABB(AABB aabb, Transform transform, int childIndex)
      Description copied from class: Shape
      Given a transform, compute the associated axis aligned bounding box for a child shape.
      Specified by:
      computeAABB in class Shape
      Parameters:
      aabb - Returns the axis aligned box.
      transform - The world transform of the shape.
    • computeMass

      public final void computeMass(MassData massData, float density)
      Description copied from class: Shape
      Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin.
      Specified by:
      computeMass in class Shape
      Parameters:
      massData - Returns the mass data for this shape.
      density - The density in kilograms per meter squared.