Class DefaultSegment1d

  • All Implemented Interfaces:
    Segment1D<Point2d,​Vector2d>

    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 Detail

      • DefaultSegment1d

        public DefaultSegment1d​(Point2d start,
                                Point2d end)
        Construct a segment.
        Parameters:
        start - the start point.
        end - the end point.
    • Method Detail

      • getLength

        @Pure
        public double getLength()
        Description copied from interface: Segment1D
        Replies the length of the segment.
        Specified by:
        getLength in interface Segment1D<Point2d,​Vector2d>
        Returns:
        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 interface Segment1D<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 interface Segment1D<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 interface Segment1D<Point2d,​Vector2d>
        Parameters:
        positionOnSegment - is the position on the segment (in 0..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 interface Segment1D<Point2d,​Vector2d>
        Parameters:
        positionOnSegment - is the position on the segment (in 0..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 interface Segment1D<Point2d,​Vector2d>
        Parameters:
        positionOnSegment - is the position on the segment (in 0..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 interface Segment1D<Point2d,​Vector2d>
        Parameters:
        otherSegment - is the segment to match.
        Returns:
        true if this segment is connected to the given one, otherwise false.
      • 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 interface Segment1D<Point2d,​Vector2d>
        Parameters:
        otherSegment - is the segment to match.
        Returns:
        true if this segment is connected to the given one, otherwise false.