Package com.algo.rendering.shapes
Class Diamond
- java.lang.Object
-
- com.algo.rendering.shapes.RenderingShape
-
- com.algo.rendering.shapes.Diamond
-
- All Implemented Interfaces:
java.io.Serializable
public class Diamond extends RenderingShape
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.algo.rendering.shapes.RenderingShape
renderingShapeClasses, sizeBox, strokeWidth
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsCoordinate(Vector2D point, Vector2D center)
Returns true if the given vector is overlapping with this shapeVector2D
getEdgePoint(double alpha, Vector2D center)
Calculates the (closest) point X on the edge of the shape so that (X-center) has an euler angle of alpha.Vector2D
getIntersection(Vector2D a, Vector2D b, Vector2D center)
Calculates the point of intersection between a line and the shape (Basically a RayCast)void
render(GralogGraphicsContext gc, Vector2D center, java.lang.String label, GralogColor strokeColor, GralogColor fillColor)
Renders a shape on the provided graphics context.-
Methods inherited from class com.algo.rendering.shapes.RenderingShape
isShape, render, setHeight, setWidth
-
-
-
-
Constructor Detail
-
Diamond
public Diamond(SizeBox s)
-
-
Method Detail
-
render
public void render(GralogGraphicsContext gc, Vector2D center, java.lang.String label, GralogColor strokeColor, GralogColor fillColor)
Description copied from class:RenderingShape
Renders a shape on the provided graphics context. RenderingShape will depend on the internal state of the shape object (e.g. parameters such as size, fill, color, etc..)- Overrides:
render
in classRenderingShape
- Parameters:
gc
- The graphics context on which the shape is renderedstrokeColor
- Stroke colorfillColor
- Filling color
-
containsCoordinate
public boolean containsCoordinate(Vector2D point, Vector2D center)
Description copied from class:RenderingShape
Returns true if the given vector is overlapping with this shape- Specified by:
containsCoordinate
in classRenderingShape
- Parameters:
point
- Vector that is being tested for overlapping- Returns:
- True if the shape contains
-
getEdgePoint
public Vector2D getEdgePoint(double alpha, Vector2D center)
Description copied from class:RenderingShape
Calculates the (closest) point X on the edge of the shape so that (X-center) has an euler angle of alpha.- Specified by:
getEdgePoint
in classRenderingShape
- Parameters:
alpha
- The angle of the point in degreescenter
- The point of reference for calculating X- Returns:
- The closest such point as a Vector2D
-
getIntersection
public Vector2D getIntersection(Vector2D a, Vector2D b, Vector2D center)
Description copied from class:RenderingShape
Calculates the point of intersection between a line and the shape (Basically a RayCast)- Specified by:
getIntersection
in classRenderingShape
- Parameters:
a
- Start of the lineb
- The end of the line INSIDE the shape. For a normal edge calculation, lineEnd = centercenter
- The center of the object with this shape
-
-