Commit 159fb883 authored by Gaetan's avatar Gaetan

First commit

parents
package main;
public class Edge {
}
\ No newline at end of file
package main;
public class Point {
private double x;
private double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
public Point() {
this.x = 0.0;
this.y = 0.0;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public String toString(){
return "(" + x + "," + y + ")";
}
}
\ No newline at end of file
package main;
public class Polygon {
private Point[] points;
public Polygon(double[] x, double[] y) {
//Fill the list of the peaks
for (int i = 0; i < x.length; i++) {
this.points[i] = new Point(x[i], y[i]);
}
}
}
package main;
public class Ray {
}
package tests;
import main.Edge;
import main.Point;
import org.junit.Test;
public class TestEdge {
@Test
public void testCreatingEdge() {
Edge e = new Edge(new Point(1, 1), new Point(10,20));
//accès aux coordonnées des extrémités
//intersection avec un rayon
}
}
package tests;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import main.Point;
public class TestPoint {
@Test
public void testCreatingOriginPoint() {
Point p = new Point();
assertEquals(0, p.getX(), 1e-9);
assertEquals(0, p.getY(), 1e-9);
}
@Test
public void testCreatingPointFromCoordinates() {
Point p = new Point(4.2, 5.1);
assertEquals(4.2, p.getX(), 1e-9);
assertEquals(5.1, p.getY(), 1e-9);
}
}
package tests;
import main.Point;
import org.junit.Test;
import main.Polygon;
public class TestPolygon {
@Test
public void testCreatingPolygon() {
Polygon p = new Polygon();
p.add(new Point(1, 2));
}
}
package tests;
import org.junit.Test;
public class TestRay {
@Test
public void testCreatingRay() {
Ray r = new Ray();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment