1 package org.simantics.g3d.shape;
3 import java.util.ArrayList;
6 import javax.vecmath.Vector3d;
13 public Vector3d getMin() {
16 public Vector3d getMax() {
20 public Box(Vector3d min, Vector3d max) {
25 public Box(double minx, double miny, double minz, double maxx, double maxy, double maxz) {
26 min = new Vector3d(minx, miny, minz);
27 max = new Vector3d(maxx, maxy, maxz);
30 public Box(double min[], double max[]) {
31 this.min = new Vector3d(min);
32 this.max = new Vector3d(max);
35 public Mesh createMesh() {
36 List<Vector3d> vertices = new ArrayList<Vector3d>();
37 vertices.add(new Vector3d(min.x, min.y, min.z));
38 vertices.add(new Vector3d(min.x, min.y, max.z));
39 vertices.add(new Vector3d(min.x, max.y, min.z));
40 vertices.add(new Vector3d(min.x, max.y, max.z));
41 vertices.add(new Vector3d(max.x, min.y, min.z));
42 vertices.add(new Vector3d(max.x, min.y, max.z));
43 vertices.add(new Vector3d(max.x, max.y, min.z));
44 vertices.add(new Vector3d(max.x, max.y, max.z));
45 List<Integer> indices = new ArrayList<Integer>();
93 return Mesh.create(vertices, indices);