Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Circle?



On Mon, 9 May 2005 14:00:00 -0700, Ralph Brunner <email@hidden> wrote:
>>      float c = ( sqrt ( v.x*v.x + v.y*v.y ) < 300. ? 0. : 1. );
> the built-in function distance() is usually faster than using sqrt

What he said plus if you're using the result with a comparison then it's
faster to square (multiply) the other side rather than do the sqrt:

float c = ( ( v.x*v.x + v.y*v.y ) < (300.0f * 300.0f) ? 0.0f : 1.0f );

-- 
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.