public class FixedRectShape extends VertexFixedSizeShape
Modifier and Type | Field and Description |
---|---|
static FixedRectShape |
DEFAULT |
static FixedRectShape |
ENTITY |
Constructor and Description |
---|
FixedRectShape()
Creates an instance with the x and y dimensions 0.06 and 0.045
|
FixedRectShape(double halfWidth,
double halfHeight)
Creates an instance with the given dimensions
|
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics gfx,
int x,
int y,
ProjectionPlane plane,
boolean filled,
DimensionD scale)
Draws the shape depending on the given values
|
static Vector2D |
getDockingCoordinates(Vector2D direction,
double rX,
double rY)
Given a direction from the center, returns the position on the edge of the rectangle with the given dimensions
|
double |
getHeight()
Returns the normalized height of the shape
|
double |
getWidth()
Returns the normalized width of the shape
|
Vector2D |
normalizedDockingCoordinates(Vector2D direction,
DimensionD scale)
Returns the position of where to dock an edge pointing to the given direction
|
boolean |
pick(double relX,
double relY,
DimensionD scale)
Tells whether or not, the given coordinates lay within the shape
|
addDockingVector, pick
public static final FixedRectShape DEFAULT
public static final FixedRectShape ENTITY
public FixedRectShape(double halfWidth, double halfHeight)
public FixedRectShape()
public static Vector2D getDockingCoordinates(Vector2D direction, double rX, double rY)
direction
- the direction from center outwardsrX
- the x dimension of the rectanglerY
- the y dimension of the rectanglepublic void draw(java.awt.Graphics gfx, int x, int y, ProjectionPlane plane, boolean filled, DimensionD scale)
VertexShape
draw
in class VertexShape
gfx
- the target graphics object to draw intox
- the pixel x-coordinate of the center of the vertexy
- the pixel y-coordinate of the center of the vertexplane
- the projection datafilled
- if true, the shape will be filledscale
- the x and y scale factorspublic boolean pick(double relX, double relY, DimensionD scale)
VertexShape
pick
in class VertexShape
relX
- the normalized x-coordinate relative to the center of the vertexrelY
- the normalized y-coordinate relative to the center of the vertexscale
- the x and y scale factors for the shapepublic Vector2D normalizedDockingCoordinates(Vector2D direction, DimensionD scale)
VertexShape
normalizedDockingCoordinates
in class VertexShape
direction
- the direction from where to dockscale
- an x and y scale factorpublic double getWidth()
VertexFixedSizeShape
getWidth
in class VertexFixedSizeShape
public double getHeight()
VertexFixedSizeShape
getHeight
in class VertexFixedSizeShape