This class inherits {@linkplain #x x} and {@linkplain #y y} fields.But despite their names, they don't need to be oriented toward {@linkplain AxisDirection#EAST East} and{@linkplain AxisDirection#NORTH North} respectively. The (x,y) axis can have anydirection and should be understood as ordinate 0 and ordinate 1 values instead. This is not specific to this implementation; in Java2D too, the visual axis orientation depend on the {@linkplain java.awt.Graphics2D#getTransform() affine transform in the graphics context}.
{@note The rational for avoiding axis orientation restriction is that otherDirectPosition
implementations do not have such restriction, and it would be hard to generalize. For example there is no clear "x" or "y" classification for North-East direction.}{@section Caution when used in collections}Do not mix instances of this class with ordinary {@link Point2D} instancesin a {@code HashSet} or as {@code HashMap} keys.It is not possible to meet both {@link Point2D#hashCode()} and {@link DirectPosition#hashCode()}contracts, and this class chooses to implements the later. Consequently, the {@link #hashCode()}method of this class is inconsistent with {@link Point2D#equals(Object)} but is consistent with{@link DirectPosition#equals(Object)}. In other words, it is safe to add instances of {@code DirectPosition2D} in a{@code HashSet
|
|