- Object
-
- TimeOfImpact
-
- All Implemented Interfaces:
Copyable<TimeOfImpact>
public class TimeOfImpact extends Object implements Copyable<TimeOfImpact>
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:
- 4.0.0
- Author:
- William Bittle
-
-
Field Summary
Fields Modifier and Type Field Description protected Separation
separation
The separation at the time of impactprotected double
time
The time of impact in the range [0, 1]
-
Constructor Summary
Constructors Modifier Constructor Description TimeOfImpact()
Default constructor.protected
TimeOfImpact(double time, Separation separation)
Full constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeOfImpact
copy()
Returns a deep copy of this object.void
copy(TimeOfImpact toi)
Copies (deep) the givenTimeOfImpact
to thisTimeOfImpact
.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.String
toString()
-
-
-
Field Detail
-
time
protected double time
The time of impact in the range [0, 1]
-
separation
protected final Separation separation
The separation at the time of impact
-
-
Constructor Detail
-
TimeOfImpact
public TimeOfImpact()
Default constructor.
-
TimeOfImpact
protected 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
-
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
-
copy
public void copy(TimeOfImpact toi)
Copies (deep) the givenTimeOfImpact
to thisTimeOfImpact
.- Parameters:
toi
- the time of impact data to copy- Since:
- 4.0.0
-
copy
public TimeOfImpact copy()
Description copied from interface:Copyable
Returns a deep copy of this object.- Specified by:
copy
in interfaceCopyable<TimeOfImpact>
- Returns:
- T
-
-