2 import java
.util
.ArrayList
;
3 import java
.util
.Random
;
6 * Represents a 2d point with double coordinates
10 public class PointDouble
{
15 public PointDouble() {
19 public PointDouble(double x
, double y
) {
24 public double getX() {
28 public double getY() {
33 public boolean equals(Object obj
) {
34 if (obj
== null
|| getClass() != obj
.getClass()) {
37 final PointDouble other
= (PointDouble
) obj
;
38 if (Double
.doubleToLongBits(this.x
) != Double
.doubleToLongBits(other
.x
)) {
41 if (Double
.doubleToLongBits(this.y
) != Double
.doubleToLongBits(other
.y
)) {
48 * returns a array of n points on a circle
50 public static ArrayList
<PointDouble
> getNPointsOnCircle(double radius
, int n
) {
51 ArrayList
<PointDouble
> points
= new ArrayList
<>();
52 Random generator
= new Random(0);
53 for(int i
= 0; i
< n
; i
++){
54 double angle
= generator
.nextFloat() * Math
.PI
* 2;
55 PointDouble p
= new PointDouble(Math
.cos(angle
) * radius
, Math
.sin(angle
) * radius
);