Skip to content

Instantly share code, notes, and snippets.

@fahickman
Created April 28, 2015 01:39
Show Gist options
  • Save fahickman/8b05e7e43bf0798b3709 to your computer and use it in GitHub Desktop.
Save fahickman/8b05e7e43bf0798b3709 to your computer and use it in GitHub Desktop.
void discAabb(Vec3 *minOut, Vec3 *maxOut, Vec3 center, Vec3 normal, float radius)
{
Vec3 half;
float x2 = normal.x * normal.x;
float y2 = normal.y * normal.y;
float z2 = normal.z * normal.z;
half.x = radius * sqrtf(y2 + z2);
half.y = radius * sqrtf(z2 + x2);
half.z = radius * sqrtf(x2 + y2);
*minOut = center - half;
*maxOut = center + half;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment