-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.java
More file actions
40 lines (31 loc) · 1.27 KB
/
Main.java
File metadata and controls
40 lines (31 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import geometry.Plane;
import geometry.Point;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Main {
public static void main(String[] argv) throws IOException, ParseException {
new Main(argv);
}
public Main(String[] arguments) throws IOException, ParseException {
JSONObject configuration = (JSONObject) new JSONParser().parse(new FileReader(new File(arguments[0])));
Plane[] planes = Plane.fromJson((JSONArray)((JSONObject)configuration.get("target")).get("planes"));
List<Point> pointArrayList = new ArrayList<>();
for(Plane p : planes) {
Point[] points = Point.generatePointPlane(p, 0.3, 4);
pointArrayList.addAll(Arrays.asList(points));
}
Point[] points = new Point[pointArrayList.size()];
pointArrayList.toArray(points);
Point.applyTranslation(points, 10, 30);
Point.applyRotation(points, new Point(250, 250), 45 * (Math.PI / 180));
new Scene("Sparse ICP test", planes, points);
}
}