Record Class SegmentedLine
java.lang.Object
java.lang.Record
nl.colorize.multimedialib.math.SegmentedLine
- All Implemented Interfaces:
Shape
Line that consists of multiple segments, where each segment is a straight
line but the combination still allows for more complex line shapes. The
line is defined by a number of points, where each point except the "head"
and the "tail" acts as both the end of the previous segment and the start
of the next segment. Alternatively, segments can also be described by
Line instances using getSegments().-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSegmentedLine(List<Point2D> points) Creates an instance of aSegmentedLinerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this shape contains the specified point.final booleanIndicates whether some other object is "equal to" this one.Returns a newSegmentedLinethat consists of the same segments as this one plus one extra segment between this line's tail and the specified point.Returns the smallest possible rectangular bounding box that can fit this shape.getHead()getTail()final inthashCode()Returns a hash code value for this object.points()Returns the value of thepointsrecord component.reposition(Point2D offset) Returns a newShapeinstance that is repositioned by the specified offset.Returns a direct line that points from this segmented line's head to its tail.toString()Returns a string representation of this record class.Methods inherited from interface Shape
reposition
-
Constructor Details
-
SegmentedLine
-
-
Method Details
-
getSegments
-
getHead
-
getTail
-
contains
-
getBoundingBox
Description copied from interface:ShapeReturns the smallest possible rectangular bounding box that can fit this shape.- Specified by:
getBoundingBoxin interfaceShape
-
getCenter
-
reposition
Description copied from interface:ShapeReturns a newShapeinstance that is repositioned by the specified offset.- Specified by:
repositionin interfaceShape
-
toDirectLine
Returns a direct line that points from this segmented line's head to its tail. -
extend
Returns a newSegmentedLinethat consists of the same segments as this one plus one extra segment between this line's tail and the specified point. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
points
-