I had to add a new method `Vector.withTime` to work around
the error checking that throws an exception if vectors
from different times are added.
Also made Kotlin constants public:
MINUTES_PER_DAY
SECONDS_PER_DAY
MILLISECONDS_PER_DAY
1014 B
//astronomy/io.github.cosinekitty.astronomy/Vector/withTime
withTime
fun withTime(time: Time): Vector
Creates a new vector with the same coordinates but a different time.
Usually it is a mistake to add or subtract vectors corresponding to different times. The overloaded operators for adding and subtracting vectors will throw an exception if the times do not match. However, occasionally it is helpful to adjust the time associated with a vector to get around this safety check. For example, the time an event occurs may be different from the time it is observed. The geoVector function stores the observation time in the returned vector, while helioVector stores the event time.
Return
A cloned vector that has the same coordinates as this one, but at a different time.
Parameters
| time | A time to include in a new vector with the same coordinates as this one. |