Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Point {
- double x;
- double y;
- Point(double x, double y) {
- this.x = x;
- this.y = y;
- }
- double calculateDistance(Point point) {
- return Math.sqrt(Math.pow(this.x - point.x, 2) + Math.pow(this.y - point.y, 2));
- }
- void moveCloser(Point referencePoint, double ratio) {
- this.x = this.x + (referencePoint.x - this.x) * ratio;
- this.y = this.y + (referencePoint.y - this.y) * ratio;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement