Class Transform1D<S extends Segment1D<?,​?>>

  • Type Parameters:
    S - is the type of the segments supported by this transformation.

    public class Transform1D<S extends Segment1D<?,​?>>
    extends Object
    Is represented internally as curviline translation and a shift translation.

    The shift distance is positive or negative according to the side vector of the current CoordinateSystem2D.

    If a path was given, this transformation uses this list of the segments to translate a point and change its associated segment if required. If no path was given to this transformation, all the translation will be located on the current segment space (even if the coordinates are too big or too low to be on the segment). The transformed entities (Point1D5...) is supposed to be on the segments of the path if it was supplied. The path is the list of the segments which must follow the current segment of the entity.

    Caution, the stored path is the reference passed to the functions, not a copy.

    If a path was given, the translation is positive along the path. If a path was not given, the translation will be directly applied to the coordinates.

    Version:
    17.0 2020-01-04 14:41:43
    Author:
    Stéphane GALLAND
    See Also:
    Point1D
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    mathgeom
    • Field Detail

      • isIdentity

        protected Boolean isIdentity
        Indicates if the matrix is identity. If null the identity flag must be determined.
    • Constructor Detail

      • Transform1D

        public Transform1D()
        Constructs a new Transform1D object and sets it to the identity.
      • Transform1D

        public Transform1D​(Transform1D<? extends S> transform)
        Constructs a new Transform1D object and initializes it from the specified transform.
        Parameters:
        transform - the transformation to copy.
      • Transform1D

        public Transform1D​(double curvilineMove,
                           double shiftMove)
        Constructs a new Transform1D object and initializes it from the specified parameters.
        Parameters:
        curvilineMove - is the distance along the segments.
        shiftMove - is the distance to move on the left or the right
      • Transform1D

        public Transform1D​(List<? extends S> path,
                           double curvilineMove,
                           double shiftMove)
        Constructs a new Transform1D object and initializes it from the specified parameters.

        If the given path contains only one segment, the transformation will follow the segment's direction.

        Parameters:
        path - is the path to use.
        curvilineMove - is the distance along the segments.
        shiftMove - is the distance to move on the left or the right
      • Transform1D

        public Transform1D​(List<? extends S> path,
                           Direction1D direction,
                           double curvilineMove,
                           double shiftMove)
        Constructs a new Transform1D object and initializes it from the specified parameters.
        Parameters:
        path - is the path to use.
        direction - is the direction to follow on the path if the path contains only one segment.
        curvilineMove - is the distance along the segments.
        shiftMove - is the distance to move on the left or the right
      • Transform1D

        public Transform1D​(List<? extends S> path)
        Constructs a new Transform1D object and initializes it from the specified parameters.

        If the given path contains only one segment, the transformation will follow the segment's direction.

        Parameters:
        path - is the path to use.
      • Transform1D

        public Transform1D​(List<? extends S> path,
                           Direction1D direction)
        Constructs a new Transform1D object and initializes it from the specified parameters.
        Parameters:
        path - is the path to use.
        direction - is the direction to follow on the path if the path contains only one segment.
    • Method Detail

      • hasPath

        @Pure
        public boolean hasPath()
        Replies if this transformation has a path.
        Returns:
        true if this transformation has a path, otherwise false.
      • getPath

        @Pure
        public List<S> getPath()
        Replies the path used by this transformation.
        Returns:
        the path.
      • getFirstSegmentPathDirection

        @Pure
        public Direction1D getFirstSegmentPathDirection()
        Replies the direction to follow along the first segment.
        Returns:
        the direction in case of a one-segment path.
      • setPath

        public void setPath​(List<? extends S> path)
        Set the path used by this transformation.

        If the given path contains only one segment, the transformation will follow the segment's direction.

        Parameters:
        path - is the new path
      • setPath

        public void setPath​(List<? extends S> path,
                            Direction1D direction)
        Set the path used by this transformation.
        Parameters:
        path - is the new path
        direction - is the direction to follow on the path if the path contains only one segment.
      • setIdentity

        public void setIdentity()
        Set this transformation as identify, ie all set to zero and no path.
      • isIdentity

        @Pure
        public boolean isIdentity()
        Replies if the transformation is the identity transformation.
        Returns:
        true if the transformation is identity.
      • setTranslation

        public void setTranslation​(double curvilineCoord,
                                   double shiftCoord)
        Set the position. This function does not change the path.
        Parameters:
        curvilineCoord - the curviline translation.
        shiftCoord - the shifting translation.
      • setTranslation

        public void setTranslation​(List<? extends S> path,
                                   double curvilineCoord,
                                   double shiftCoord)
        Set the position.

        If the given path contains only one segment, the transformation will follow the segment's direction.

        Parameters:
        path - the path to follow.
        curvilineCoord - the curviline translation.
        shiftCoord - the shifting translation.
      • setTranslation

        public void setTranslation​(List<? extends S> path,
                                   Direction1D direction,
                                   double curvilineCoord,
                                   double shiftCoord)
        Set the position.
        Parameters:
        path - the path to follow.
        direction - is the direction to follow on the path if the path contains only one segment.
        curvilineCoord - the curviline translation.
        shiftCoord - the shifting translation.
      • setTranslation

        public void setTranslation​(Tuple2D<?> position)
        Set the position. This function does not change the path.
        Parameters:
        position - where x is the curviline coordinate and y is the shift coordinate.
      • setTranslation

        public void setTranslation​(List<? extends S> path,
                                   Tuple2D<?> position)
        Set the position.

        If the given path contains only one segment, the transformation will follow the segment's direction.

        Parameters:
        path - the path to follow.
        position - where x is the curviline coordinate and y is the shift coordinate.
      • setTranslation

        public void setTranslation​(List<? extends S> path,
                                   Direction1D direction,
                                   Tuple2D<?> position)
        Set the position.
        Parameters:
        path - the path to follow.
        direction - is the direction to follow on the path if the path contains only one segment.
        position - where x is the curviline coordinate and y is the shift coordinate.
      • translate

        public void translate​(double curvilineCoord,
                              double shiftCoord)
        Translate the coordinates. This function does not change the path.
        Parameters:
        curvilineCoord - the curviline translation.
        shiftCoord - the shifting translation.
      • translate

        public void translate​(List<? extends S> thePath,
                              double curvilineCoord,
                              double shiftCoord)
        Translate.

        If the given path contains only one segment, the transformation will follow the segment's direction.

        Parameters:
        thePath - the path to follow.
        curvilineCoord - the curviline translation.
        shiftCoord - the shifting translation.
      • translate

        public void translate​(List<? extends S> thePath,
                              Direction1D direction,
                              double curvilineCoord,
                              double shiftCoord)
        Translate.
        Parameters:
        thePath - the path to follow.
        direction - is the direction to follow on the path if the path contains only one segment.
        curvilineCoord - the curviline translation.
        shiftCoord - the shifting translation.
      • translate

        public void translate​(Tuple2D<?> move)
        Translate the coordinates. This function does not change the path.
        Parameters:
        move - where x is the curviline coordinate and y is the shift coordinate.
      • translate

        public void translate​(List<? extends S> thePath,
                              Tuple2D<?> move)
        Translate.

        If the given path contains only one segment, the transformation will follow the segment's direction.

        Parameters:
        thePath - the path to follow.
        move - where x is the curviline coordinate and y is the shift coordinate.
      • translate

        public void translate​(List<? extends S> thePath,
                              Direction1D direction,
                              Tuple2D<?> move)
        Translate.
        Parameters:
        thePath - the path to follow.
        direction - is the direction to follow on the path if the path contains only one segment.
        move - where x is the curviline coordinate and y is the shift coordinate.
      • getCurvilineTransformation

        @Pure
        public double getCurvilineTransformation()
        Replies the curviline transformation.
        Returns:
        the amount
      • getShiftTransformation

        @Pure
        public double getShiftTransformation()
        Replies the shift transformation.
        Returns:
        the amount
      • transform

        public int transform​(Point1D<?,​?,​? super S> point)
        Transform the specified 1.5D point. If the point is on a segment from the Transform1D path, it will be transformed to follow the path. If the point is not on a segment from the Transform1D path, the curviline and shift transformations will be simply added.
        Parameters:
        point - the point to transform.
        Returns:
        the index of the segment on which the point lies in the segment path; or -1 if the segment of the point is not the first segment in the path.
      • transform

        @Pure
        public int transform​(Point1D<?,​?,​? super S> point,
                             Tuple2D<?> appliedTranslation)
        Transform the specified 1.5D point. If the point is on a segment from the Transform1D path, it will be transformed to follow the path. If the point is not on a segment from the Transform1D path, the curviline and shift transformations will be simply added.
        Parameters:
        point - the point to transform.
        appliedTranslation - is set by this function with the really applied distances. The values are always positives.
        Returns:
        the index of the segment on which the point lies in the segment path; or -1 if the segment of the point is not the first segment in the path.
      • toTransform2D

        @Pure
        public final Transform2D toTransform2D​(Segment1D<?,​?> segment)
        Replies a 2D transformation that is corresponding to this transformation.
        Parameters:
        segment - is the segment.
        Returns:
        the 2D transformation or null if the segment could not be mapped to 2D.
      • toTransform2D

        @Pure
        public final Transform2D toTransform2D​(Point2D<?,​?> startPoint,
                                               Point2D<?,​?> endPoint)
        Replies a 2D transformation that is corresponding to this transformation.
        Parameters:
        startPoint - is the 2D position of the start point of the segment.
        endPoint - is the 2D position of the end point of the segment
        Returns:
        the 2D transformation.
      • toTransform2D

        @Pure
        public final Transform2D toTransform2D​(double startX,
                                               double startY,
                                               double endX,
                                               double endY)
        Replies a 2D transformation that is corresponding to this transformation.

        The used coordinate system is replied by CoordinateSystem2D.getDefaultCoordinateSystem().

        Parameters:
        startX - is the 2D x coordinate of the start point of the segment.
        startY - is the 2D y coordinate of the start point of the segment.
        endX - is the 2D x coordinate of the end point of the segment
        endY - is the 2D y coordinate of the end point of the segment
        Returns:
        the 2D transformation.
      • equals

        @Pure
        public boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • hashCode

        @Pure
        public int hashCode()
        Overrides:
        hashCode in class Object