calculateWorldAABB method
void
calculateWorldAABB(
- Vector3 pos,
- Quaternion quat,
- Vector3 min,
- Vector3 max,
override
@todo use abstract for these kind of methods
Implementation
@override
void calculateWorldAABB(Vector3 pos, Quaternion quat, Vector3 min, Vector3 max) {
final verts = vertices;
double? minx;
double? miny;
double? minz;
double? maxx;
double? maxy;
double? maxz;
Vector3 tempWorldVertex = Vector3.zero();
for (int i = 0; i < verts.length; i++) {
tempWorldVertex.setFrom(verts[i]);
quat.vmult(tempWorldVertex, tempWorldVertex);
pos.add2(tempWorldVertex, tempWorldVertex);
final v = tempWorldVertex;
if (minx == null || v.x < minx) {
minx = v.x;
}
if (maxx == null || v.x > maxx) {
maxx = v.x;
}
if (miny == null || v.y < miny) {
miny = v.y;
}
if (maxy == null || v.y > maxy) {
maxy = v.y;
}
if (minz == null || v.z < minz) {
minz = v.z;
}
if (maxz == null || v.z > maxz) {
maxz = v.z;
}
}
min.setValues(minx!, miny!, minz!);
max.setValues(maxx!, maxy!, maxz!);
}