Box includes the entirety of box(mesh)

Is there something like Three.js API

Box3.containsBox

Returns true if this box includes the entirety of box. If this and box are identical, 
this function also returns true.

Any good suggestions?

I’m not sure there is such function, but can easily write it, given that it is defined as this in threejs:

	containsBox: function ( 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;

	},

Use BoundingInfo instances for box. Something like:

	function containsBox(box0, box) {
		return box0.minimum.x <= box.minimum.x && box.maximum.x <= box0.maximum.x &&
			box0.minimum.y <= box.minimum.y && box.maximum.y <= box0.maximum.y &&
			box0.minimum.z <= box.minimum.z && box.maximum.z <= box0.maximum.z;
	},
1 Like

Thank you @Evgeni_Popov , I just found boundinginfo in documentation.

1 Like