Skip to content

Commit d4ce6ed

Browse files
committed
Add Copy on function thath create new AABB
1 parent 4bef7cb commit d4ce6ed

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/AxisAlignedBB.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function addCoord(float $x, float $y, float $z) : AxisAlignedBB{
9292
*
9393
* @return $this
9494
*/
95-
public function expand(float $x, float $y, float $z){
95+
public function expandCopy(float $x, float $y, float $z){
9696
return new AxisAlignedBB(
9797
$this->minX - $x,
9898
$this->minY - $y,
@@ -108,7 +108,7 @@ public function expand(float $x, float $y, float $z){
108108
*
109109
* @return $this
110110
*/
111-
public function offset(float $x, float $y, float $z) : AxisAlignedBB{
111+
public function offsetCopy(float $x, float $y, float $z) : AxisAlignedBB{
112112
return new AxisAlignedBB(
113113
$this->minX + $x,
114114
$this->minY + $y,
@@ -124,18 +124,18 @@ public function offset(float $x, float $y, float $z) : AxisAlignedBB{
124124
*
125125
* @return $this
126126
*/
127-
public function offsetTowards(Facing $face, float $distance) : AxisAlignedBB{
127+
public function offsetTowardsCopy(Facing $face, float $distance) : AxisAlignedBB{
128128
[$offsetX, $offsetY, $offsetZ] = $face->offset();
129129

130-
return $this->offset($offsetX * $distance, $offsetY * $distance, $offsetZ * $distance);
130+
return $this->offsetCopy($offsetX * $distance, $offsetY * $distance, $offsetZ * $distance);
131131
}
132132

133133
/**
134134
* Insets the bounds of this AxisAlignedBB by the specified X, Y and Z.
135135
*
136136
* @return $this
137137
*/
138-
public function contract(float $x, float $y, float $z) : AxisAlignedBB{
138+
public function contractCopy(float $x, float $y, float $z) : AxisAlignedBB{
139139
return new AxisAlignedBB(
140140
$this->minX + $x,
141141
$this->minY + $y,
@@ -153,7 +153,7 @@ public function contract(float $x, float $y, float $z) : AxisAlignedBB{
153153
*
154154
* @return $this
155155
*/
156-
public function extend(Facing $face, float $distance) : AxisAlignedBB{
156+
public function extendCopy(Facing $face, float $distance) : AxisAlignedBB{
157157
return match($face){
158158
Facing::DOWN => new AxisAlignedBB($this->minX, $this->minY - $distance, $this->minZ, $this->maxX, $this->maxY, $this->maxZ),
159159
Facing::UP => new AxisAlignedBB($this->minX, $this->minY, $this->minZ, $this->maxX + $distance, $this->maxY, $this->maxZ),
@@ -166,14 +166,14 @@ public function extend(Facing $face, float $distance) : AxisAlignedBB{
166166

167167
/**
168168
* Inverse of extend().
169-
* @see AxisAlignedBB::extend()
169+
* @see AxisAlignedBB::extendCopy()
170170
*
171171
* @param float $distance Positive values pull the face in, negative values push out.
172172
*
173173
* @return $this
174174
*/
175-
public function trim(Facing $face, float $distance) : AxisAlignedBB{
176-
return $this->extend($face, -$distance);
175+
public function trimCopy(Facing $face, float $distance) : AxisAlignedBB{
176+
return $this->extendCopy($face, -$distance);
177177
}
178178

179179
/**
@@ -183,7 +183,7 @@ public function trim(Facing $face, float $distance) : AxisAlignedBB{
183183
*
184184
* @return $this
185185
*/
186-
public function stretch(Axis $axis, float $distance) : AxisAlignedBB{
186+
public function stretchCopy(Axis $axis, float $distance) : AxisAlignedBB{
187187
return match($axis){
188188
Axis::Y => new AxisAlignedBB($this->minX, $this->minY - $distance, $this->minZ, $this->maxX, $this->maxY + $distance, $this->maxZ),
189189
Axis::Z => new AxisAlignedBB($this->minX, $this->minY, $this->minZ - $distance, $this->maxX, $this->maxY, $this->maxZ + $distance),
@@ -193,12 +193,12 @@ public function stretch(Axis $axis, float $distance) : AxisAlignedBB{
193193

194194
/**
195195
* Reduces the dimension of the AABB on the given axis. Inverse of stretch().
196-
* @see AxisAlignedBB::stretch()
196+
* @see AxisAlignedBB::stretchCopy()
197197
*
198198
* @return $this
199199
*/
200-
public function squash(Axis $axis, float $distance) : AxisAlignedBB{
201-
return $this->stretch($axis, -$distance);
200+
public function squashCopy(Axis $axis, float $distance) : AxisAlignedBB{
201+
return $this->stretchCopy($axis, -$distance);
202202
}
203203

204204
public function calculateXOffset(AxisAlignedBB $bb, float $x) : float{

0 commit comments

Comments
 (0)