Plane AABox::get_plane(int pidx) const
{
+ Vec3 c = (max - min) * 0.5f;
switch(pidx) {
case AABOX_PLANE_PX:
- return Plane(Vec3(max.x, 0, 0), Vec3(1, 0, 0));
+ return Plane(Vec3(max.x, c.y, c.z), Vec3(1, 0, 0));
case AABOX_PLANE_NX:
- return Plane(Vec3(min.x, 0, 0), Vec3(-1, 0, 0));
+ return Plane(Vec3(min.x, c.y, c.z), Vec3(-1, 0, 0));
case AABOX_PLANE_PY:
- return Plane(Vec3(0, max.x, 0), Vec3(0, 1, 0));
+ return Plane(Vec3(c.x, max.x, c.z), Vec3(0, 1, 0));
case AABOX_PLANE_NY:
- return Plane(Vec3(0, min.x, 0), Vec3(0, -1, 0));
+ return Plane(Vec3(c.x, min.x, c.z), Vec3(0, -1, 0));
case AABOX_PLANE_PZ:
- return Plane(Vec3(0, 0, max.z), Vec3(0, 0, 1));
+ return Plane(Vec3(c.x, c.y, max.z), Vec3(0, 0, 1));
case AABOX_PLANE_NZ:
- return Plane(Vec3(0, 0, min.z), Vec3(0, 0, -1));
+ return Plane(Vec3(c.x, c.y, min.z), Vec3(0, 0, -1));
default:
break;
}