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(Coords center, Integer radius, BoundingBoxType type) {
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 &&
36 public Integer getRadius() {
40 public Coords getCenter() {
44 public Double getCenterOffsetX() {
48 public Double getCenterOffsetY() {
52 public Double getCenterOffsetZ() {
56 public void setCenterOffsets(double x, double y, double z) {
57 this.centerOffsetX = x;
58 this.centerOffsetY = y;
59 this.centerOffsetZ = z;