Class AgentMotion

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class AgentMotion
    extends Object
    implements Serializable, Cloneable
    Describes the motion of an agent.

    This class is typically an output of the agent motion algorithms.

    The units of the values depend on the agent motion algorithm that is creating this object:

    • kinematic: linear motion is in meter per second (or km/s, etc.); angular motion is in radians per second (or d/s).
    • steering: linear motion is in meter per squared second (or km/(s*s), etc.); angular motion is in radians per squared second (or d/(s*s)).
    Since:
    14.0
    Version:
    17.0 2020-01-04 14:41:51
    Author:
    Stéphane GALLAND
    See Also:
    Serialized Form
    Maven Group Id:
    org.arakhne.afc.advanced
    Maven Artifact Id:
    agentmotion
    • Constructor Detail

      • AgentMotion

        public AgentMotion()
        Construct a zero motion.
      • AgentMotion

        public AgentMotion​(AgentMotion outputToCopy)
        Constructor by copy.
        Parameters:
        outputToCopy - is the output to copy.
      • AgentMotion

        public AgentMotion​(double angularMotion)
        Construct a motion.
        Parameters:
        angularMotion - the angular motion.
      • AgentMotion

        public AgentMotion​(double linearx,
                           double lineary)
        Construct a motion.
        Parameters:
        linearx - the motion along the x axis.
        lineary - the motion along the y axis.
      • AgentMotion

        public AgentMotion​(double linearx,
                           double lineary,
                           double angularMotion)
        Construct a motion.
        Parameters:
        linearx - the motion along the x axis.
        lineary - the motion along the y axis.
        angularMotion - the angular motion.
      • AgentMotion

        public AgentMotion​(Vector2D<?,​?> linearMotion)
        Construct a motion.
        Parameters:
        linearMotion - the linear motion.
      • AgentMotion

        public AgentMotion​(Vector2D<?,​?> linearMotion,
                           double angularMotion)
        Construct a motion.
        Parameters:
        linearMotion - the linear motion.
        angularMotion - the angular motion.
    • Method Detail

      • $minus

        @Pure
        public AgentMotion $minus​(AgentMotion motion)
        Replies the subtraction of the given linear and angular motion and this motion: this - motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the subtraction.
      • $minus

        @Pure
        public AgentMotion $minus​(double motion)
        Replies the subtraction of the given angular and angular motion and this motion: this - motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the subtraction.
      • $minus

        @Pure
        public AgentMotion $minus​(Vector2D<?,​?> motion)
        Replies the subtraction of the given linear motion and this motion: this - motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the subtraction.
      • $plus

        @Pure
        public AgentMotion $plus​(AgentMotion motion)
        Replies the addition of the given linear and angular motion and this motion: this + motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the sum.
      • $plus

        @Pure
        public AgentMotion $plus​(double motion)
        Replies the addition of the given angular motion and this motion: this + motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the sum.
      • $plus

        @Pure
        public AgentMotion $plus​(Vector2D<?,​?> motion)
        Replies the addition of the given linear motion and this motion: this + motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the sum.
      • equals

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

        @Pure
        public double getAngular()
        Replies the rotation.
        Returns:
        the angular motion.
      • getLinear

        @Pure
        public Vector2D<?,​?> getLinear()
        Replies the motion on the plane.
        Returns:
        the linear motion.
      • hashCode

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

        @Pure
        public void operator_add​(AgentMotion motion)
        Add the given linear and angular motion to this motion: this += motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
      • operator_add

        @Pure
        public void operator_add​(double motion)
        Add the given angular motion to this motion: this += motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
      • operator_add

        @Pure
        public void operator_add​(Vector2D<?,​?> motion)
        Add the given linear motion to this motion: this += motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
      • operator_minus

        @Pure
        public AgentMotion operator_minus​(AgentMotion motion)
        Replies the subtraction of the given linear and angular motion and this motion: this - motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the subtraction.
      • operator_minus

        @Pure
        public AgentMotion operator_minus​(double motion)
        Replies the subtraction of the given angular motion and this motion: this - motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the subtraction.
      • operator_minus

        @Pure
        public AgentMotion operator_minus​(Vector2D<?,​?> motion)
        Replies the subtraction of the given linear motion and this motion: this - motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the subtraction.
      • operator_plus

        @Pure
        public AgentMotion operator_plus​(AgentMotion motion)
        Replies the addition of the given linear and angular motion and this motion: this + motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the sum.
      • operator_plus

        @Pure
        public AgentMotion operator_plus​(double motion)
        Replies the addition of the given angular motion and this motion: this + motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the sum.
      • operator_plus

        @Pure
        public AgentMotion operator_plus​(Vector2D<?,​?> motion)
        Replies the addition of the given linear motion and this motion: this + motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to add.
        Returns:
        the sum.
      • operator_remove

        @Pure
        public void operator_remove​(AgentMotion motion)
        Subtract the given linear and angular motion to this motion: this -= motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to subtract.
      • operator_remove

        @Pure
        public void operator_remove​(double motion)
        Subtract the given angular motion to this motion: this -= motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to subtract.
      • operator_remove

        @Pure
        public void operator_remove​(Vector2D<?,​?> motion)
        Subtract the given linear motion to this motion: this -= motion.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        motion - the motion to subtract.
      • set

        public void set​(AgentMotion motionToCopy)
        Set the linear and angular motion by copying the motion from the given object.
        Parameters:
        motionToCopy - the motion to copy.
      • setAngular

        public void setAngular​(AgentMotion motionToCopy)
        Set the angular motion by copying the motion from the given object.
        Parameters:
        motionToCopy - the object to copy.
      • setAngular

        public void setAngular​(double angular)
        Set the angular motion.
        Parameters:
        angular - the rotation.
      • setLinear

        public void setLinear​(AgentMotion motionToCopy)
        Set the linear motion by copying the motion from the given object.
        Parameters:
        motionToCopy - the object to copy.
      • setLinear

        public void setLinear​(double dx,
                              double dy)
        Set the linear motion.
        Parameters:
        dx - the motion along the x axis.
        dy - the motion along the y axis.
      • setLinear

        public void setLinear​(Vector2D<?,​?> linear)
        Set the linear motion.
        Parameters:
        linear - the motion vector.