@Test public void testLinearInterpolation() { assertEquals(1, PositionTime.linearInterpolation(1, 1, 3, 3, 1), 1e-16); assertEquals(3, PositionTime.linearInterpolation(1, 1, 3, 3, 3), 1e-16); assertEquals(2, PositionTime.linearInterpolation(1, 1, 3, 3, 2), 1e-16); assertEquals(10, PositionTime.linearInterpolation(1, 1, 3, 3, 10), 1e-16); assertEquals(2.5, PositionTime.linearInterpolation(0, 0, 5, 10, 5), 1e-16); assertEquals(4.5, PositionTime.linearInterpolation(0, 0, 5, 10, 9), 1e-16); }
static double linearInterpolation(double y1, long x1, double y2, long x2, long x) { return y1 + (y2 - y1) / (x2 - x1) * (x - x1); }
PositionTime extends Position { static double linearInterpolation(double y1, long x1, double y2, long x2, long x) { return y1 + (y2 - y1) / (x2 - x1) * (x - x1); } }
PositionTime extends Position { static double linearInterpolation(double y1, long x1, double y2, long x2, long x) { return y1 + (y2 - y1) / (x2 - x1) * (x - x1); } PositionTime(double latitude, double longitude, long time); }
PositionTime extends Position { static double linearInterpolation(double y1, long x1, double y2, long x2, long x) { return y1 + (y2 - y1) / (x2 - x1) * (x - x1); } PositionTime(double latitude, double longitude, long time); static PositionTime fromBinary(Binary b); Binary toBinary(); @Override boolean equals(Object other); @Override boolean equals(Position other); boolean equals(PositionTime other); PositionTime extrapolatePosition(float cog, float sog, long time); long getTime(); @Override int hashCode(); PositionTime interpolatedPosition(PositionTime laterPosition, long time); boolean positionEquals(Position other); @Override String toString(); Timestamp timestamp(); static PositionTime create(double latitude, double longitude); static PositionTime create(double latitude, double longitude, long time); static PositionTime create(Position position, long time); static PositionTime create(String pos); static PositionTime readFrom(MessageReader r); }
PositionTime extends Position { static double linearInterpolation(double y1, long x1, double y2, long x2, long x) { return y1 + (y2 - y1) / (x2 - x1) * (x - x1); } PositionTime(double latitude, double longitude, long time); static PositionTime fromBinary(Binary b); Binary toBinary(); @Override boolean equals(Object other); @Override boolean equals(Position other); boolean equals(PositionTime other); PositionTime extrapolatePosition(float cog, float sog, long time); long getTime(); @Override int hashCode(); PositionTime interpolatedPosition(PositionTime laterPosition, long time); boolean positionEquals(Position other); @Override String toString(); Timestamp timestamp(); static PositionTime create(double latitude, double longitude); static PositionTime create(double latitude, double longitude, long time); static PositionTime create(Position position, long time); static PositionTime create(String pos); static PositionTime readFrom(MessageReader r); static final MessageSerializer<PositionTime> SERIALIZER; }