1 package com.irtimaled.bbor.common.models;
3 import com.irtimaled.bbor.common.BoundingBoxType;
5 public class BoundingBoxSphere extends AbstractBoundingBox {
6 private final Coords center;
7 private final Integer radius;
8 private final int minX;
9 private final int minZ;
10 private final int maxX;
11 private final int maxZ;
13 private Double centerOffsetX = 0d;
14 private Double centerOffsetY = 0d;
15 private Double centerOffsetZ = 0d;
17 protected BoundingBoxSphere(BoundingBoxType type, Coords center, Integer radius) {
22 this.minX = center.getX() - radius;
23 this.minZ = center.getZ() - radius;
24 this.maxX = center.getX() + radius;
25 this.maxZ = center.getZ() + radius;
29 public Boolean intersectsBounds(int minX, int minZ, int maxX, int maxZ) {
30 return this.maxX >= minX &&
37 public String toString() {
38 return "(" + center.toString() + "; " + radius.toString() + ")";
41 public Integer getRadius() {
45 public Coords getCenter() {
49 public Double getCenterOffsetX() {
53 public Double getCenterOffsetY() {
57 public Double getCenterOffsetZ() {
61 void setCenterOffsets(double x, double y, double z) {
62 this.centerOffsetX = x;
63 this.centerOffsetY = y;
64 this.centerOffsetZ = z;