-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeometries.java
More file actions
36 lines (29 loc) · 929 Bytes
/
Copy pathGeometries.java
File metadata and controls
36 lines (29 loc) · 929 Bytes
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
package geometries;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import primitives.*;
public class Geometries implements Intersectable {
private List<Intersectable> _geometries;
// ***************** Constructors ******************** //
public Geometries() {
_geometries = new ArrayList<Intersectable>();
}
// ***************** Operations ******************** //
/**
* adds a shape to the list
*
* @param shape
* - Geometry
*/
public void addGeometry(Intersectable shape) {
_geometries.add(shape);
}
public Map<Geometry, List<Point_3D>> findIntersections(Ray ray) {
Map<Geometry, List<Point_3D>> intersectionsPoints = new HashMap<Geometry, List<Point_3D>>();
for (Intersectable shape : _geometries)
intersectionsPoints.putAll(shape.findIntersections(ray));
return intersectionsPoints;
}
}