Module org.dyn4j

Class TimeOfImpact


  • public class TimeOfImpact
    extends java.lang.Object
    Represents the time of impact information between two objects.

    The getTime() is in the range of [0, 1] and represents the time within the current timestep that the collision occurred.

    Since:
    1.2.0
    Version:
    3.1.5
    Author:
    William Bittle
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Separation separation
      The separation at the time of impact
      protected double time
      The time of impact in the range [0, 1]
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Separation getSeparation()
      Returns the separation at the time of impact.
      double getTime()
      Returns the time of impact in the range [0, 1].
      void setSeparation​(Separation separation)
      Sets the separation at the time of impact.
      void setTime​(double time)
      Sets the time of impact.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • time

        protected double time
        The time of impact in the range [0, 1]
      • separation

        protected Separation separation
        The separation at the time of impact
    • Constructor Detail

      • TimeOfImpact

        public TimeOfImpact()
        Default constructor.
      • TimeOfImpact

        public TimeOfImpact​(double time,
                            Separation separation)
        Full constructor.
        Parameters:
        time - the time of impact; in the range [0, 1]
        separation - the separation at the time of impact
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getTime

        public double getTime()
        Returns the time of impact in the range [0, 1].
        Returns:
        double
        Since:
        3.1.5
      • setTime

        public void setTime​(double time)
        Sets the time of impact.
        Parameters:
        time - the time of impact in the range [0, 1]
        Since:
        3.1.5
      • getSeparation

        public Separation getSeparation()
        Returns the separation at the time of impact.
        Returns:
        Separation
      • setSeparation

        public void setSeparation​(Separation separation)
        Sets the separation at the time of impact.
        Parameters:
        separation - the separation