@@ -76,12 +76,24 @@ Object.assign(pc, function () {
76
76
th . z = ( tmaxz - tminz ) * 0.5 ;
77
77
} ,
78
78
79
+ /**
80
+ * @function
81
+ * @name pc.BoundingBox#copy
82
+ * @description Copies the contents of a source AABB.
83
+ * @param {pc.BoundingBox } src - The AABB to copy from.
84
+ */
79
85
copy : function ( src ) {
80
86
this . center . copy ( src . center ) ;
81
87
this . halfExtents . copy ( src . halfExtents ) ;
82
88
this . type = src . type ;
83
89
} ,
84
90
91
+ /**
92
+ * @function
93
+ * @name pc.BoundingBox#clone
94
+ * @description Returns a clone of the AABB
95
+ * @returns {pc.BoundingBox } A duplicate AABB.
96
+ */
85
97
clone : function ( ) {
86
98
return new pc . BoundingBox ( this . center . clone ( ) , this . halfExtents . clone ( ) ) ;
87
99
} ,
@@ -200,6 +212,14 @@ Object.assign(pc, function () {
200
212
return this . _fastIntersectsRay ( ray ) ;
201
213
} ,
202
214
215
+ /**
216
+ * @function
217
+ * @name pc.BoundingBox#setMinMax
218
+ * @description Sets the minimum and maximum corner of the AABB.
219
+ * Using this function is faster than assigning min and max separately.
220
+ * @param {pc.Vec3 } min - The minimum corner of the AABB.
221
+ * @param {pc.Vec3 } max - The maximum corner of the AABB.
222
+ */
203
223
setMinMax : function ( min , max ) {
204
224
this . center . add2 ( max , min ) . scale ( 0.5 ) ;
205
225
this . halfExtents . sub2 ( max , min ) . scale ( 0.5 ) ;
@@ -293,6 +313,12 @@ Object.assign(pc, function () {
293
313
) ;
294
314
} ,
295
315
316
+ /**
317
+ * @function
318
+ * @name pc.BoundingBox#compute
319
+ * @description Compute the size of the AABB to encapsulate all specified vertices.
320
+ * @param {number[]|Float32Array } vertices - The vertices used to compute the new size for the AABB.
321
+ */
296
322
compute : function ( vertices ) {
297
323
var min = tmpVecA . set ( vertices [ 0 ] , vertices [ 1 ] , vertices [ 2 ] ) ;
298
324
var max = tmpVecB . set ( vertices [ 0 ] , vertices [ 1 ] , vertices [ 2 ] ) ;
0 commit comments