@Test public void testTranslate() throws Exception { Position thePosition = new Position(10, 10); Position theTranslated = thePosition.translate(new Angle(20), 5); assertNotSame(theTranslated, thePosition); assertEquals(11, (int) theTranslated.x); assertEquals(5, (int) theTranslated.y); }
public Position translate(Angle aAngle, double aDistance) { float theRadians = aAngle.toRadians(); double theMX = Math.sin(theRadians) * aDistance; double theMY = Math.cos(theRadians) * aDistance; return new Position(x + theMX, y - theMY); }
Position implements Reflectable<PositionClassInformation>, Distributable { public Position translate(Angle aAngle, double aDistance) { float theRadians = aAngle.toRadians(); double theMX = Math.sin(theRadians) * aDistance; double theMY = Math.cos(theRadians) * aDistance; return new Position(x + theMX, y - theMY); } }
Position implements Reflectable<PositionClassInformation>, Distributable { public Position translate(Angle aAngle, double aDistance) { float theRadians = aAngle.toRadians(); double theMX = Math.sin(theRadians) * aDistance; double theMY = Math.cos(theRadians) * aDistance; return new Position(x + theMX, y - theMY); } Position();  Position(float aX, float aY);  Position(double aX, double aY); }
Position implements Reflectable<PositionClassInformation>, Distributable { public Position translate(Angle aAngle, double aDistance) { float theRadians = aAngle.toRadians(); double theMX = Math.sin(theRadians) * aDistance; double theMY = Math.cos(theRadians) * aDistance; return new Position(x + theMX, y - theMY); } Position();  Position(float aX, float aY);  Position(double aX, double aY); @Override boolean equals(Object o); @Override int hashCode(); @Override PositionClassInformation getClassInformation(); @ReflectiveMethod Position add(Position aOffset); @ReflectiveMethod Position changeX(Float aNewX); @ReflectiveMethod Position changeY(Float aNewY); @ReflectiveMethod Position snapToGrid(int aGridWidth, int aGridHeight); @Override Map<String, Object> serialize(); static Position deserialize(Map<String, Object> aSerializedStructure); Position translate(Angle aAngle, double aDistance); }
Position implements Reflectable<PositionClassInformation>, Distributable { public Position translate(Angle aAngle, double aDistance) { float theRadians = aAngle.toRadians(); double theMX = Math.sin(theRadians) * aDistance; double theMY = Math.cos(theRadians) * aDistance; return new Position(x + theMX, y - theMY); } Position();  Position(float aX, float aY);  Position(double aX, double aY); @Override boolean equals(Object o); @Override int hashCode(); @Override PositionClassInformation getClassInformation(); @ReflectiveMethod Position add(Position aOffset); @ReflectiveMethod Position changeX(Float aNewX); @ReflectiveMethod Position changeY(Float aNewY); @ReflectiveMethod Position snapToGrid(int aGridWidth, int aGridHeight); @Override Map<String, Object> serialize(); static Position deserialize(Map<String, Object> aSerializedStructure); Position translate(Angle aAngle, double aDistance); @ReflectiveField
    final float x; @ReflectiveField
    final float y; }