« Return to Thread: Trouble rendering with TBoundsphere

Re: Trouble rendering with TBoundsphere

by matthewf :: Rate this Message:

Reply to Author | View in Thread

On Tue, Mar 18, 2008 at 10:06:41AM -0700, Phua Khai Fong wrote:

>    initBounds
>
>        | length x y z |
>        length := xLength max: (yLength max: (zEnd - zStart)).
>
>        x := xLength/2.
>        y := yLength/2.
>        z := (zEnd - zStart)/2.
>
>        boundSphere := TBoundSphere localPosition: (self startingPoint +
>    (x@y@z)) radius: length.
>        boundSphere frame: self.

Dunno if this is the main problem, but I'm pretty sure tha
bounding sphere is too small, and the corners are outside the
sphere. the radius should be, by the pythagorean theorem:

length := (x squared + y squared + z squared) sqrt

where x, y, and z are as you defined them above: one half of the
rectangle edge lengths.

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/

 « Return to Thread: Trouble rendering with TBoundsphere