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 Point2d
getFirstPoint()
Replies the 2D cooordinate of the first point of the segment.Point2d
getLastPoint()
Replies the 2D cooordinates of the last point of the segment.double
getLength()
Replies the length of the segment.Vector2d
getTangentAt(double positionOnSegment)
Replies the 2D tangent at the position on the segment.boolean
isFirstPointConnectedTo(Segment1D<?,?> otherSegment)
Replies if this segment is connected to the specified segment by its first point.boolean
isLastPointConnectedTo(Segment1D<?,?> otherSegment)
Replies if this segment is connected to the specified segment by its last point.void
projectsOnPlane(double positionOnSegment, double shiftDistance, Point2D<?,?> position, Vector2D<?,?> tangent)
Replies the 2D position and the 2D tangent at the position on the segment.void
projectsOnPlane(double positionOnSegment, Point2D<?,?> position, Vector2D<?,?> tangent)
Replies the 2D position and the 2D tangent at the position on the segment.void
setLength(double length)
Change the length of the segment.
-
-
-
Method Detail
-
getLength
@Pure public double getLength()
Description copied from interface:Segment1D
Replies 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:Segment1D
Replies the 2D cooordinate of the first point of the segment.- Specified by:
getFirstPoint
in interfaceSegment1D<Point2d,Vector2d>
- Returns:
- the 2D coordinate or
null
if 2D mapping is impossible.
-
getLastPoint
@Pure public Point2d getLastPoint()
Description copied from interface:Segment1D
Replies the 2D cooordinates of the last point of the segment.- Specified by:
getLastPoint
in interfaceSegment1D<Point2d,Vector2d>
- Returns:
- the 2D coordinates or
null
if 2D mapping is impossible.
-
getTangentAt
@Pure public Vector2d getTangentAt(double positionOnSegment)
Description copied from interface:Segment1D
Replies the 2D tangent at the position on the segment.- Specified by:
getTangentAt
in 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:Segment1D
Replies the 2D position and the 2D tangent at the position on the segment.- Specified by:
projectsOnPlane
in 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:Segment1D
Replies the 2D position and the 2D tangent at the position on the segment.- Specified by:
projectsOnPlane
in 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:Segment1D
Replies if this segment is connected to the specified segment by its first point.- Specified by:
isFirstPointConnectedTo
in interfaceSegment1D<Point2d,Vector2d>
- Parameters:
otherSegment
- is the segment to match.- Returns:
true
if this segment is connected to the given one, otherwisefalse
.
-
isLastPointConnectedTo
@Pure public boolean isLastPointConnectedTo(Segment1D<?,?> otherSegment)
Description copied from interface:Segment1D
Replies if this segment is connected to the specified segment by its last point.- Specified by:
isLastPointConnectedTo
in interfaceSegment1D<Point2d,Vector2d>
- Parameters:
otherSegment
- is the segment to match.- Returns:
true
if this segment is connected to the given one, otherwisefalse
.
-
-