public class DrawUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
drawArc(float centerX,
float centerY,
float radius,
float startAngle,
float arcAngle,
int numSegments,
boolean drawFilled)
Draws an arc made up of line segments.
|
static void |
drawCircle(float centerX,
float centerY,
float radius,
int numSegments,
boolean drawFilled)
Draws a simple circle made of line segments, or a filled circle if
drawFilled is true. |
static void |
drawEllipse(float centerX,
float centerY,
float width,
float height,
float angleOffset,
int numSegments,
boolean drawFilled)
Draws an elliptical shape made of line segments, or a filled ellipse if
drawFilled is true. |
public static void drawCircle(float centerX, float centerY, float radius, int numSegments, boolean drawFilled)
drawFilled
is true.
This method only contains the actual drawing code and assumes all OpenGL flags, color, line width etc have been set by the user beforehand.
Optimized circle-drawing algorithm based on code taken from: http://slabode.exofire.net/circle_draw.shtml
centerX
- The x value of the center point of the circle.centerY
- The y value of the center point of the circle.radius
- The radius of the circle to be drawn.numSegments
- How many line segments the circle should be made up
of (higher number = smoother circle, but higher GPU
cost).drawFilled
- Whether the circle should be hollow or filled.public static void drawEllipse(float centerX, float centerY, float width, float height, float angleOffset, int numSegments, boolean drawFilled)
drawFilled
is true.
This method only contains the actual drawing code and assumes all OpenGL flags, color, line width etc have been set by the user beforehand.
Optimized circle-drawing algorithm based on code taken from: http://slabode.exofire.net/circle_draw.shtml
centerX
- The x value of the center point of the circle.centerY
- The y value of the center point of the circle.width
- The width (size on unrotated x-axis) of the ellipse.height
- The height (size on unrotated y-axis) of the ellipse.angleOffset
- How much to rotate the ellipse from its original axis,
in degrees.numSegments
- How many line segments the ellipse should be made up
of (higher number = smoother ellipse, but higher GPU
cost).drawFilled
- Whether the ellipse should be hollow or filled.public static void drawArc(float centerX, float centerY, float radius, float startAngle, float arcAngle, int numSegments, boolean drawFilled)
This method only contains the actual drawing code and assumes all OpenGL flags, color, line width etc have been set by the user beforehand.
Optimized arc-drawing algorithm based on code taken from: http://slabode.exofire.net/circle_draw.shtml
centerX
- The x value of the center point of the arc.centerY
- The y value of the center point of the arc.radius
- The radius of the arc to be drawn.startAngle
- The angle the arc should start at, in degrees.arcAngle
- The size of the arc, in degrees.numSegments
- How many line segments the arc should be made up
of (higher number = smoother arc, but higher GPU
cost).drawFilled
- Whether to draw the arc filled.