Hi, I hope you guys stay safe.
There is one simple thing I hope to discuss with you.
Box3 class has a function to check if Box3 contains a box,
containsBox( box ) {
return this.min.x <= box.min.x && box.max.x <= this.max.x &&
this.min.y <= box.min.y && box.max.y <= this.max.y &&
this.min.z <= box.min.z && box.max.z <= this.max.z;
}
,and also has a function to check if Box3 contains a point, but it use different logical operator, ||
so this method actually trying to check if the point is outside the Box3.
containsPoint( point ) {
return point.x < this.min.x || point.x > this.max.x ||
point.y < this.min.y || point.y > this.max.y ||
point.z < this.min.z || point.z > this.max.z ? false : true;
}
Of course, the method works correctly as it returns false
if the point is outside of the Box3, however using &&
may seems to be easier to understand at a glance and maybe it could be more consistent with containsBox( box )
method imao.
containsPoint( point ) {
return this.min.x <= point.min.x && point.max.x <= this.max.x &&
this.min.y <= point.min.y && point.max.y <= this.max.y &&
this.min.z <= point.min.z && point.max.z <= this.max.z;
}