AABB<float> Bezier::getAABB() const { float maxv[3]; float minv[3]; bool havevals[6]; for (int n = 0; n < 6; ++n) havevals[n] = false; for (int x = 0; x < 4; ++x) { for (int y = 0; y < 4; ++y) { MathVector<float,3> temp(points[x][y]); // Cache for bounding box stuff for (int n = 0; n < 3; ++n) { if (!havevals[n]) { maxv[n] = temp[n]; havevals[n] = true; } else if (temp[n] > maxv[n]) maxv[n] = temp[n]; if (!havevals[n+3]) { minv[n] = temp[n]; havevals[n+3] = true; } else if (temp[n] < minv[n]) minv[n] = temp[n]; } } } MathVector<float, 3>bboxmin(minv[0], minv[1], minv[2]); MathVector<float, 3>bboxmax(maxv[0], maxv[1], maxv[2]); AABB <float> box; box.setFromCorners(bboxmin, bboxmax); return box; }
AABB <float> BEZIER::GetAABB() const { float maxv[3]; float minv[3]; bool havevals[6]; for (int n = 0; n < 6; n++) havevals[n] = false; for (int x = 0; x < 4; x++) { for (int y = 0; y < 4; y++) { MATHVECTOR<float,3> temp(points[x][y]); //cache for bbox stuff for ( int n = 0; n < 3; n++ ) { if (!havevals[n]) { maxv[n] = temp[n]; havevals[n] = true; } else if (temp[n] > maxv[n]) maxv[n] = temp[n]; if (!havevals[n+3]) { minv[n] = temp[n]; havevals[n+3] = true; } else if (temp[n] < minv[n]) minv[n] = temp[n]; } } } MATHVECTOR<float,3> bboxmin(minv[0], minv[1], minv[2]); MATHVECTOR<float,3> bboxmax(maxv[0], maxv[1], maxv[2]); AABB <float> box; box.SetFromCorners(bboxmin, bboxmax); return box; }
Aabb <float> Bezier::GetAABB() const { float maxv[3] = {-1E38, -1E38, -1E38}; float minv[3] = {+1E38, +1E38, +1E38}; for (int x = 0; x < 4; x++) { for (int y = 0; y < 4; y++) { const Vec3 temp = points[x][y]; for (int n = 0; n < 3; n++) { if (temp[n] > maxv[n]) maxv[n] = temp[n]; if (temp[n] < minv[n]) minv[n] = temp[n]; } } } Vec3 bboxmin(minv[0], minv[1], minv[2]); Vec3 bboxmax(maxv[0], maxv[1], maxv[2]); Aabb <float> box(bboxmin, bboxmax); return box; }