public abstract class Shape
extends java.lang.Object
Constructor and Description |
---|
Shape() |
Modifier and Type | Method and Description |
---|---|
void |
add(float x,
float y)
Adds components to the position of this
Shape |
abstract boolean |
contains(float x,
float y)
Returns if a set of coordinates are contained inside this
Shape |
abstract boolean |
contains(Shape shape)
|
abstract boolean |
contains(com.badlogic.gdx.math.Vector2 vector2)
Returns if a
Vector2 is contained inside this Shape |
abstract Shape |
copy()
Returns an exact copy of this
Shape |
abstract void |
draw(Graphics g)
Draws this shape using a
Graphics instance |
abstract EdgeIterator |
edgeIterator()
Returns an
EdgeIterator for looping over the edges of this
Shape |
abstract void |
fill(Graphics g)
Fills this shape using a
Graphics instance |
abstract float |
getCenterX()
Returns the center x coordinate of this object.
|
abstract float |
getCenterY()
Returns the center y coordinate of this object.
|
abstract float |
getDistanceTo(float x,
float y)
Returns the distance from this
Shape to a set of coordinates |
float |
getDistanceTo(Point point)
|
abstract float |
getMaxX()
Returns the right-most x coordinate
|
abstract float |
getMaxY()
Returns the bottom-most y coordinate
|
abstract float |
getMinX()
Returns the left-most x coordinate
|
abstract float |
getMinY()
Returns the top-most y coordinate
|
abstract int |
getNumberOfSides()
Returns the number of edges of this object
|
abstract Polygon |
getPolygon()
|
abstract float |
getRotation()
Returns the rotation of this
Shape |
abstract float |
getX()
Returns the x coordinate of this object
|
abstract float |
getY()
Returns the y coordinate of this object
|
boolean |
intersects(LineSegment lineSegment)
Returns if this
Shape intersects the specified
LineSegment |
abstract boolean |
intersects(Shape shape)
|
abstract boolean |
intersectsLineSegment(float x1,
float y1,
float x2,
float y2)
Returns if this
Shape intersects a line segment |
abstract boolean |
intersectsLineSegment(com.badlogic.gdx.math.Vector2 pointA,
com.badlogic.gdx.math.Vector2 pointB)
Returns if this
Shape intersects a line segment |
abstract boolean |
isCircle()
|
abstract void |
rotate(float degrees)
Rotates this
Shape by a specified amount of degrees with its
first point as the origin |
abstract void |
rotateAround(float originX,
float originY,
float degrees)
Rotates this
Shape by a specified amount of degrees around a
specified point |
abstract void |
scale(float scale)
Scales the radius of this shape.
|
abstract void |
set(float x,
float y)
Sets the x and y coordinate of this object
|
abstract void |
setRadius(float radius)
Sets the radius of this shape.
|
abstract void |
setRotation(float degrees)
Sets the rotation of this
Shape with its first point as the
origin |
abstract void |
setRotationAround(float originX,
float originY,
float degrees)
Sets the rotation of this
Shape with a specified point as the
origin |
abstract void |
setX(float x)
Sets the x coordinate of this object
|
abstract void |
setY(float y)
Sets the y coordinate of this object
|
void |
subtract(float x,
float y)
Subtracts components from the position of this
Shape |
abstract void |
translate(float translateX,
float translateY)
Translates the x and y coordinate of this object
|
public abstract Shape copy()
Shape
Shape
public abstract boolean contains(float x, float y)
Shape
x
- The x coordinate to checky
- The y coordinate to checkShape
contains the specified coordinatespublic abstract boolean contains(com.badlogic.gdx.math.Vector2 vector2)
Vector2
is contained inside this Shape
vector2
- The Vector2
to checkShape
contains the specified Vector2
public abstract boolean contains(Shape shape)
public boolean intersects(LineSegment lineSegment)
Shape
intersects the specified
LineSegment
lineSegment
- The LineSegment
to checkShape
intersects the LineSegment
public abstract boolean intersectsLineSegment(com.badlogic.gdx.math.Vector2 pointA, com.badlogic.gdx.math.Vector2 pointB)
Shape
intersects a line segmentpointA
- The first point in the line segmentpointB
- The second point in the line segmentShape
intersects the line segmentpublic abstract boolean intersectsLineSegment(float x1, float y1, float x2, float y2)
Shape
intersects a line segmentx1
- The x coordinate of the first pointy1
- The y coordinate of the first pointx2
- The x coordinate of the second pointy2
- The y coordinate of the second pointShape
intersects the line segmentpublic abstract boolean intersects(Shape shape)
public abstract float getDistanceTo(float x, float y)
Shape
to a set of coordinatesx
- The x coordinatey
- The y coordinatepublic float getDistanceTo(Point point)
point
- The Point
to get the distance topublic void add(float x, float y)
Shape
x
- The x componenty
- The y componentpublic void subtract(float x, float y)
Shape
x
- The x componenty
- The y componentpublic abstract float getRotation()
Shape
public abstract void setRotation(float degrees)
Shape
with its first point as the
origindegrees
- The rotation in degreespublic abstract void setRotationAround(float originX, float originY, float degrees)
Shape
with a specified point as the
originoriginX
- The origin/center x coordinateoriginY
- The origin/center y coordinatedegrees
- The rotation in degreespublic abstract void rotate(float degrees)
Shape
by a specified amount of degrees with its
first point as the origindegrees
- The rotation in degreespublic abstract void rotateAround(float originX, float originY, float degrees)
Shape
by a specified amount of degrees around a
specified pointoriginX
- The origin/center x coordinateoriginY
- The origin/center y coordinatedegrees
- The rotation in degreespublic abstract void draw(Graphics g)
Graphics
instanceg
- The Graphics
context to render withpublic abstract void fill(Graphics g)
Graphics
instanceg
- The Graphics
context to render withpublic abstract float getX()
public abstract float getY()
public abstract float getCenterX()
Circle
this is the same as x.public abstract float getCenterY()
Circle
this is the same as y.public abstract void setX(float x)
x
- The x coordinatepublic abstract void setY(float y)
y
- The y coordinatepublic abstract void set(float x, float y)
x
- The x coordinatey
- The y coordinatepublic abstract void setRadius(float radius)
Polygon
shapes, this will
stretch in/out the shape from its center. Note that Polygon
s must
be equilateral.radius
- The radius in pixelspublic abstract void scale(float scale)
Polygon
shapes, this will
stretch in/out the shape from its center. Note that Polygon
s must
be equilateral.scale
- The amount to scale by (e.g. 2.0 = double the size)public abstract float getMinX()
public abstract float getMinY()
public abstract float getMaxX()
public abstract float getMaxY()
public abstract void translate(float translateX, float translateY)
translateX
- The x translation amounttranslateY
- The y translation amountpublic abstract int getNumberOfSides()
public abstract EdgeIterator edgeIterator()
EdgeIterator
for looping over the edges of this
Shape
EdgeIterator