1 package com.irtimaled.bbor.client.models;
3 import com.irtimaled.bbor.common.BoundingBoxType;
4 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
5 import com.irtimaled.bbor.common.models.Coords;
7 public class BoundingBoxSphere extends AbstractBoundingBox {
8 private final double radius;
9 private final double minX;
10 private final double minZ;
11 private final double maxX;
12 private final double maxZ;
13 private final Point point;
15 public BoundingBoxSphere(Point point, double radius, BoundingBoxType type) {
20 Coords center = point.getCoords();
21 this.minX = center.getX() - radius;
22 this.minZ = center.getZ() - radius;
23 this.maxX = center.getX() + radius;
24 this.maxZ = center.getZ() + radius;
28 public Boolean intersectsBounds(int minX, int minZ, int maxX, int maxZ) {
29 return this.maxX >= minX &&
36 protected double getDistanceX(double x) {
37 return x - point.getX();
41 protected double getDistanceY(double y) {
42 return y - point.getY();
46 protected double getDistanceZ(double z) {
47 return z - point.getZ();
50 public double getRadius() {
54 public Point getPoint() {