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?



Hi,

On May 9, 2005, at 3:00 PM, George Warner wrote:
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 );
True -- I was just assuming that everybody wants anti-aliased circles :) The simple inside/outside test above is indeed faster if you don't care about AA edges.
- Ralph


_______________________________________________
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
References: 
 >Re: Circle? (From: George Warner <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.