1 /*
2 * Copyright (C) 2017 Alberto Irurueta Carro (alberto@irurueta.com)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.irurueta.geometry;
18
19 /**
20 * This class defines a 3D box area aligned with x, y, z axes.
21 * A box is defined by two corners, low, containing minimum coordinate values, and high,
22 * containing maximum coordinate values.
23 * This class is used internally by KD trees and quad trees.
24 */
25 public class Box3D extends Box<Point3D> {
26
27 /**
28 * Empty constructor.
29 * Creates a box centered at the origin and having unitary volume.
30 */
31 public Box3D() {
32 super();
33 lo = new InhomogeneousPoint3D(-0.5, -0.5, -0.5);
34 hi = new InhomogeneousPoint3D(0.5, 0.5, 0.5);
35 }
36
37 /**
38 * Constructor.
39 *
40 * @param lo low coordinate values.
41 * @param hi high coordinate values.
42 */
43 public Box3D(final Point3D lo, final Point3D hi) {
44 super(lo, hi);
45 }
46
47 /**
48 * Sets boundaries.
49 *
50 * @param loX x low coordinate.
51 * @param loY y low coordinate
52 * @param loZ z low coordinate.
53 * @param hiX x high coordinate.
54 * @param hiY y high coordinate.
55 * @param hiZ z high coordinate.
56 */
57 public final void setBounds(final double loX, final double loY, final double loZ,
58 final double hiX, final double hiY, final double hiZ) {
59 setBounds(new InhomogeneousPoint3D(loX, loY, loZ), new InhomogeneousPoint3D(hiX, hiY, hiZ));
60 }
61 }