javafx.animation.Interpolatable does not specify:
1. If the returned object is always a new one or if it can be an existing one, as is done with 'if t<=0 return this'.
2. What happens with double values that are out of the [0, 1] range.
I suggest that 1 is defined in the implementing class docs because it depends on the mutability of the class, the cost to create a new one etc. Interpolatable can mention that the decision on what to return is class-specific.
As for 2, it's possible to either clamp the values to [0, 1], or throw an IllegalArgumentException. However, because double values are not exact, it's risky to throw an exception on t<0. Maybe a safety delta is needed.
1. If the returned object is always a new one or if it can be an existing one, as is done with 'if t<=0 return this'.
2. What happens with double values that are out of the [0, 1] range.
I suggest that 1 is defined in the implementing class docs because it depends on the mutability of the class, the cost to create a new one etc. Interpolatable can mention that the decision on what to return is class-specific.
As for 2, it's possible to either clamp the values to [0, 1], or throw an IllegalArgumentException. However, because double values are not exact, it's risky to throw an exception on t<0. Maybe a safety delta is needed.
- relates to
-
JDK-8226454 Point2D and Point3D should implement Interpolatable
- Resolved
-
JDK-8226753 Point2D and Point3D should implement Interpolatable
- Closed
- links to
-
Commit(master) openjdk/jfx/01e9e7ea
-
Review(master) openjdk/jfx/1471
-
Review(master) openjdk/jfx/1522