Class DefaultSegment1d
- java.lang.Object
-
- org.arakhne.afc.math.geometry.d1.d.DefaultSegment1d
-
public class DefaultSegment1d extends Object implements Segment1D<Point2d,Vector2d>
Basic implementation of a 1.5D segment.A 1.5D point is defined by its curviline position on a segment, and by a jutting/shifting distance. The jutting distance is positive or negative according to the side vector of the current
CoordinateSystem2D.A segment could be implemented by a line, a spline or a polyline.
- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Constructor Summary
Constructors Constructor Description DefaultSegment1d(Point2d start, Point2d end)Construct a segment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Point2dgetFirstPoint()Replies the 2D cooordinate of the first point of the segment.Point2dgetLastPoint()Replies the 2D cooordinates of the last point of the segment.doublegetLength()Replies the length of the segment.Vector2dgetTangentAt(double positionOnSegment)Replies the 2D tangent at the position on the segment.booleanisFirstPointConnectedTo(Segment1D<?,?> otherSegment)Replies if this segment is connected to the specified segment by its first point.booleanisLastPointConnectedTo(Segment1D<?,?> otherSegment)Replies if this segment is connected to the specified segment by its last point.voidprojectsOnPlane(double positionOnSegment, double shiftDistance, Point2D<?,?> position, Vector2D<?,?> tangent)Replies the 2D position and the 2D tangent at the position on the segment.voidprojectsOnPlane(double positionOnSegment, Point2D<?,?> position, Vector2D<?,?> tangent)Replies the 2D position and the 2D tangent at the position on the segment.voidsetLength(double length)Change the length of the segment.
-
-
-
Method Detail
-
getLength
@Pure public double getLength()
Description copied from interface:Segment1DReplies the length of the segment.
-
setLength
public void setLength(double length)
Change the length of the segment.- Parameters:
length- the new length.
-
getFirstPoint
@Pure public Point2d getFirstPoint()
Description copied from interface:Segment1DReplies the 2D cooordinate of the first point of the segment.- Specified by:
getFirstPointin interfaceSegment1D<Point2d,Vector2d>- Returns:
- the 2D coordinate or
nullif 2D mapping is impossible.
-
getLastPoint
@Pure public Point2d getLastPoint()
Description copied from interface:Segment1DReplies the 2D cooordinates of the last point of the segment.- Specified by:
getLastPointin interfaceSegment1D<Point2d,Vector2d>- Returns:
- the 2D coordinates or
nullif 2D mapping is impossible.
-
getTangentAt
@Pure public Vector2d getTangentAt(double positionOnSegment)
Description copied from interface:Segment1DReplies the 2D tangent at the position on the segment.- Specified by:
getTangentAtin interfaceSegment1D<Point2d,Vector2d>- Parameters:
positionOnSegment- is the position on the segment (in0..length).- Returns:
- the 2D tangent at the position on the segment.
-
projectsOnPlane
@Pure public void projectsOnPlane(double positionOnSegment, Point2D<?,?> position, Vector2D<?,?> tangent)Description copied from interface:Segment1DReplies the 2D position and the 2D tangent at the position on the segment.- Specified by:
projectsOnPlanein interfaceSegment1D<Point2d,Vector2d>- Parameters:
positionOnSegment- is the position on the segment (in0..length).position- is the position to fill.tangent- is the tangent to the segment at the given position.
-
projectsOnPlane
@Pure public void projectsOnPlane(double positionOnSegment, double shiftDistance, Point2D<?,?> position, Vector2D<?,?> tangent)Description copied from interface:Segment1DReplies the 2D position and the 2D tangent at the position on the segment.- Specified by:
projectsOnPlanein interfaceSegment1D<Point2d,Vector2d>- Parameters:
positionOnSegment- is the position on the segment (in0..length).shiftDistance- is the distance that permits to shift the position from the segment.position- is the position to fill.tangent- is the tangent to the segment at the given position.
-
isFirstPointConnectedTo
@Pure public boolean isFirstPointConnectedTo(Segment1D<?,?> otherSegment)
Description copied from interface:Segment1DReplies if this segment is connected to the specified segment by its first point.- Specified by:
isFirstPointConnectedToin interfaceSegment1D<Point2d,Vector2d>- Parameters:
otherSegment- is the segment to match.- Returns:
trueif this segment is connected to the given one, otherwisefalse.
-
isLastPointConnectedTo
@Pure public boolean isLastPointConnectedTo(Segment1D<?,?> otherSegment)
Description copied from interface:Segment1DReplies if this segment is connected to the specified segment by its last point.- Specified by:
isLastPointConnectedToin interfaceSegment1D<Point2d,Vector2d>- Parameters:
otherSegment- is the segment to match.- Returns:
trueif this segment is connected to the given one, otherwisefalse.
-
-