org.jrabbit.base.graphics.skins.primitive
Class CircleSkin

java.lang.Object
  extended by org.jrabbit.base.graphics.skins.primitive.PrimitiveSkin
      extended by org.jrabbit.base.graphics.skins.primitive.CircleSkin
All Implemented Interfaces:
Renderable, Skin, Dimensioned, Vertexed

public class CircleSkin
extends PrimitiveSkin

A CircleSkin renders and contains geometric data approximating a circle.

Author:
Chris Molini

Field Summary
private static float[][] CIRCLE_VERTICES
          We approximate a circle by supplying a regular hexadecagon of diameter 1.
 
Constructor Summary
CircleSkin()
           
 
Method Summary
 void render()
          CircleSkin delegates rendering to PrimitivePainter's renderCircle() method.
 float[][] vertices()
          Accesses geometric data representing a circle.
 
Methods inherited from class org.jrabbit.base.graphics.skins.primitive.PrimitiveSkin
height, width
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CIRCLE_VERTICES

private static final float[][] CIRCLE_VERTICES
We approximate a circle by supplying a regular hexadecagon of diameter 1. This means circle collisions are close enough to the real thing, but geometry calculations are much faster than using Bezier curves to represent a true circle.

Constructor Detail

CircleSkin

public CircleSkin()
Method Detail

render

public void render()
CircleSkin delegates rendering to PrimitivePainter's renderCircle() method.


vertices

public float[][] vertices()
Accesses geometric data representing a circle. For speed and efficiency reasons, Bezier curves are not returned, but a heptadecagon of radius 1 is returned.

Returns:
Vertex data approximating a circle.