# Bounding Box for a disc?

This topic is 3674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey! I have following problem. I have a Disc, represented by position, radius and normal. Now i want to make a Bounding Box for of it. The easiest way i imagined was to grap some points on the border of the disc and extend an empty bounding box with them. But now, how do i get these points? Deciding wether a given point is in the plane is quite easy, but to get a point from a given plane...i don't have a idea.

##### Share on other sites
I have coded a method for generating a coordinate system out of a single normal after PBRT. Here is the whole sourcefile.

The function goes like

void computeCoordinateSystem (Vector3d &v1, Vector3d &v2, Vector3d &v3) const {    v1 = computeNormal();    // from PBRT    if (fabs (v1.m[0]) > fabs (v1.m[1])) {        real ilen = 1.0 / sqrt (v1.m[0]*v1.m[0] + v1.m[2]*v1.m[2]);        v2 = Vector3d (-v1.m[2] * ilen, 0.0, v1.m[0] * ilen);    } else {        real ilen = 1.0 / sqrt (v1.m[1]*v1.m[1] + v1.m[2]*v1.m[2]);        v2 = Vector3d (0.0, v1.m[2] * ilen, -v1.m[1] * ilen);    }    v3 = v1.computeCross (v2);}

Now you could take your plane's normal, build an orthonormal basis with the above function, and e.g. random-sample points a disc in 2d and then transform them.

There's probably a better solution, but right now I have a day of regex-work behind me (kinda like 500 chars long ... so my brain is a bit, ..., like pudding), at least this should give a solution to your generate-point-on-disc problem. Maybe generate n=circumference*f points on the radius gives a satisfying solution for now.

##### Share on other sites
Thank you very much for the code & the hints. This will solve my problem.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013734
×