Re: [Algorithms] Pack My Spheres Up Your Frustum
Brought to you by:
vexxed72
|
From: <Chr...@Pl...> - 2000-10-13 18:14:35
|
Dave Eberly wrote:
>From: "Pierre Terdiman" <p.t...@wa...>
>>[...]
>> bool MgcTestIntersection (const MgcSphere& rkS0, const MgcSphere& rkS1)
>> {
>> MgcVector3 kDiff = rkS1.Center() - rkS0.Center();
>> MgcReal fSqrLen = kDiff.SquaredLength();
>> MgcReal fRSum = rkS0.Radius() + rkS1.Radius();
>> MgcReal fRSumSqr = fRSum*fRSum;
>>
>> return fSqrLen <= fRSumSqr;
>> }
>[...]
>Perhaps you can clarify? In the sphere-sphere code, I count 7
>floating-point operations and 1 floating-point compare.
As written: one vector subtract (3 subs), one vector dot product (3 mul,
2 add), a scalar add (1 add), a scalar multiply (1 mul), and a compare
(1 compare).
I get 3+3+2+1+1 = 10 FP operations and 1 FP compare.
Christer Ericson
SCEA, Santa Monica
|