Class JavaRectangleRotated2D
- java.lang.Object
-
- science.aist.imaging.api.domain.AbstractSurface<T,L>
-
- science.aist.imaging.api.domain.AbstractJavaPolygon<JavaPoint2D,JavaLine2D>
-
- science.aist.imaging.api.domain.twodimensional.JavaPolygon2D
-
- science.aist.imaging.api.domain.twodimensional.JavaRectangleRotated2D
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
JavaRectangle2D
public class JavaRectangleRotated2D extends JavaPolygon2D
Java representation for a Rotated Rectangle.
- Since:
- 1.0
- Author:
- Andreas Pointner
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class science.aist.imaging.api.domain.AbstractJavaPolygon
points
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JavaRectangleRotated2D()
Empty constructor for deriving classesJavaRectangleRotated2D(JavaPoint2D centerPoint, double width, double height, double rotation)
Constructs a rotated rectangle by it's centerPoint, width, height and getRotation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<JavaLine2D>
calculateContour()
JavaPoint2D
calculateNormalvector()
boolean
containsJavaPoint(JavaPoint2D javaPoint2D)
boolean
equals(Object o)
Generated Codedouble
getArea()
List<JavaLine2D>
getBorderLines()
JavaPoint2D
getBottomLeft()
Calculate the bottom left point of the rectangleJavaLine2D
getBottomLine()
JavaPoint2D
getBottomRight()
Calculate the bottom right point of the rectangleJavaPoint2D
getCenterPoint()
double
getHeight()
JavaLine2D
getLeftLine()
JavaLine2D
getRightLine()
double
getRotation()
gets value of fieldrotation
JavaPoint2D
getTopLeft()
Calculate the top left point of the rectangleJavaLine2D
getTopLine()
JavaPoint2D
getTopRight()
Calculate the top right point of the rectangledouble
getWidth()
int
hashCode()
Generated CodeJavaRectangleRotated2D
move(JavaPoint2D distance)
Moves the rectangle by a given distanceJavaRectangleRotated2D
moveTo(JavaPoint2D newCenterPoint)
Moves the rectangle to a given positionJavaRectangle2D
normalize()
Normalizes the rotated rectanglesJavaRectangleRotated2D
rotate(double rotation)
adds the given getRotation to the current rectangle and returnsJavaRectangleRotated2D
stretch(double widthFactor, double heightFactor)
Stretches the rectangle by given factorsJavaRectangleRotated2D
stretchTo(double width, double height)
Stretches the rectangle to given width and heightsString
toString()
Generated Code-
Methods inherited from class science.aist.imaging.api.domain.twodimensional.JavaPolygon2D
calculateInnerDepth, createLine, createPoint, getIntersection, getPolygonFromUnsortedPointCloud, isInConvexHull, isInConvexHull, sort
-
Methods inherited from class science.aist.imaging.api.domain.AbstractJavaPolygon
getPoints, getSize, isEmpty
-
Methods inherited from class science.aist.imaging.api.domain.AbstractSurface
getIntersection
-
-
-
-
Constructor Detail
-
JavaRectangleRotated2D
protected JavaRectangleRotated2D()
Empty constructor for deriving classes
-
JavaRectangleRotated2D
public JavaRectangleRotated2D(JavaPoint2D centerPoint, double width, double height, double rotation)
Constructs a rotated rectangle by it's centerPoint, width, height and getRotation.- Parameters:
centerPoint
- the center point of the rectanglewidth
- the width of the rectangleheight
- the height of the rectanglerotation
- the getRotation in radians of the rectangle
-
-
Method Detail
-
getTopRight
public JavaPoint2D getTopRight()
Calculate the top right point of the rectangle- Returns:
- the top right point
-
getBottomLeft
public JavaPoint2D getBottomLeft()
Calculate the bottom left point of the rectangle- Returns:
- the bottom left point
-
getTopLeft
public JavaPoint2D getTopLeft()
Calculate the top left point of the rectangle- Returns:
- the top left point
-
getBottomRight
public JavaPoint2D getBottomRight()
Calculate the bottom right point of the rectangle- Returns:
- the bottom right point
-
getCenterPoint
public JavaPoint2D getCenterPoint()
- Returns:
- the center point
-
getWidth
public double getWidth()
- Returns:
- the width of the rectangle
-
getHeight
public double getHeight()
- Returns:
- return the height of the rectangle
-
getRotation
public double getRotation()
gets value of fieldrotation
- Returns:
- value of field getRotation
- See Also:
rotation
-
containsJavaPoint
public boolean containsJavaPoint(JavaPoint2D javaPoint2D)
-
getTopLine
public JavaLine2D getTopLine()
- Returns:
- top line (new object)
-
getRightLine
public JavaLine2D getRightLine()
- Returns:
- right line (new object)
-
getBottomLine
public JavaLine2D getBottomLine()
- Returns:
- bottom line (new object)
-
getLeftLine
public JavaLine2D getLeftLine()
- Returns:
- left line (new object)
-
getBorderLines
public List<JavaLine2D> getBorderLines()
- Returns:
- List of (top line, right line, bottom line and left line)
-
getArea
public double getArea()
- Returns:
- returns the size of the rectangle
-
rotate
public JavaRectangleRotated2D rotate(double rotation)
adds the given getRotation to the current rectangle and returns- Parameters:
rotation
- the getRotation in radians- Returns:
- the new java rectangle with the applied getRotation
-
normalize
public JavaRectangle2D normalize()
Normalizes the rotated rectangles- Returns:
- a normalized java rectangle
-
moveTo
public JavaRectangleRotated2D moveTo(JavaPoint2D newCenterPoint)
Moves the rectangle to a given position- Parameters:
newCenterPoint
- the new center point- Returns:
- the moved rectangle
-
move
public JavaRectangleRotated2D move(JavaPoint2D distance)
Moves the rectangle by a given distance- Parameters:
distance
- the given distance- Returns:
- the moved rectangle
-
stretch
public JavaRectangleRotated2D stretch(double widthFactor, double heightFactor)
Stretches the rectangle by given factors- Parameters:
widthFactor
- the factor for the widthheightFactor
- the factor for the height- Returns:
- the stretched rectangle
-
stretchTo
public JavaRectangleRotated2D stretchTo(double width, double height)
Stretches the rectangle to given width and heights- Parameters:
width
- new widthheight
- new height- Returns:
- the stretched rectangle
-
equals
public boolean equals(Object o)
Generated Code- Overrides:
equals
in classJavaPolygon2D
- Parameters:
o
- value to compare- Returns:
- true if values are equals else false
-
hashCode
public int hashCode()
Generated Code- Overrides:
hashCode
in classJavaPolygon2D
- Returns:
- hashCode for the object
-
calculateNormalvector
public JavaPoint2D calculateNormalvector()
- Overrides:
calculateNormalvector
in classJavaPolygon2D
- Returns:
- the normalvector of this surface
-
calculateContour
public List<JavaLine2D> calculateContour()
- Overrides:
calculateContour
in classAbstractJavaPolygon<JavaPoint2D,JavaLine2D>
- Returns:
- returns the path segments of this surface
-
-