Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-10-03 Thread Michael Robinson
I'll do that, thanks for the push in the right direction. “You know the world is going crazy when the best rapper is a white guy, the best golfer is a black guy, the tallest guy in the NBA is Chinese, the Swiss hold the America’s Cup, France is accusing the U.S. of arrogance, Germany doesn

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-10-03 Thread Graham Cox
On 4 Oct 2008, at 2:17 pm, Michael Robinson wrote: Now I'd like to replace this: NSGradient* aGradient = [[[NSGradient alloc] initWithColorsAndLocations:[gradientColour1 color], (CGFloat)0.0, [gradientColour2 color], (CGFloat)1.0,nil] autorelease]; [aGradient drawInBezierPath:

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-10-03 Thread Michael Robinson
On 2/10/2008, at 5:29 AM, David Duncan wrote: On Oct 1, 2008, at 5:46 AM, Michael Robinson wrote: Unsurprisingly, I need my hand held again. 1. how do I initialize a CGShading object, with my two colours (left right/top bottom) See the Quartz 2D Shadings sample at

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-10-01 Thread David Duncan
On Oct 1, 2008, at 5:46 AM, Michael Robinson wrote: Unsurprisingly, I need my hand held again. 1. how do I initialize a CGShading object, with my two colours (left right/top bottom) See the Quartz 2D Shadings sample at Th

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-10-01 Thread Michael Robinson
Ah, thank you for that. This will allow me to scrap much of my HTML generation code. The images spat out seem to be quite small, which is a real bonus. I need to use CGShading, because a lot of people will be running this on 10.4 (I assume they won't be able to use the other way)? Uns

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-10-01 Thread Alastair Houghton
On 1 Oct 2008, at 00:43, Michael Robinson wrote: On 1/10/2008, at 3:23 AM, Alastair Houghton wrote: If you're rendering this in advance using Cocoa, why not use the - appendBezierPathWithArcFromPoint:toPoint:radius: method on NSBezierPath to construct a rounded path? The code that outpu

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Andrew Farmer
On 30 Sep 08, at 16:43, Michael Robinson wrote: retVal = lround(size*(1-cos(asin((double)i/(double)size; if(retVal > 0 ) return retVal; Note that cos(asin(x)) = sqrt(1-x*x). HTH. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Michael Robinson
On 1/10/2008, at 3:23 AM, Alastair Houghton wrote: On 30 Sep 2008, at 12:59, Michael Robinson wrote: Thanks for your incredibly swift replies! changing "float retVal" to "double retVal", using "return lround(retVal);" and casting ints as doubles in the formula gave me some real values, wh

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Graff
On Oct 1, 2008, at 12:29 AM, Michael Robinson wrote: sin(90); returns 0 as well. When I use Apple's Calculator and ask it to tell me the result of sin(90), it gives me 1. The C function sin() takes radians as its parameter. In order to use degrees you need to multiply by M_PI and divide by

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Alastair Houghton
On 30 Sep 2008, at 12:59, Michael Robinson wrote: Thanks for your incredibly swift replies! changing "float retVal" to "double retVal", using "return lround(retVal);" and casting ints as doubles in the formula gave me some real values, which is wonderful! I could have saved myself two hou

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Michael Robinson
Thanks for your incredibly swift replies! changing "float retVal" to "double retVal", using "return lround(retVal);" and casting ints as doubles in the formula gave me some real values, which is wonderful! I could have saved myself two hours by asking the list when I first ran into this p

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Manfred Schwind
I think there is more than one problem here. You may want to get a good book about the C language (Obj-C is just a superset of C). Variables i, cornerSize are passed to the function from a for loop. i being the counter for the loop, cornerSize being the size of corner desired by the user.

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Graham Cox
On 30 Sep 2008, at 9:29 pm, Michael Robinson wrote: Variables i, cornerSize are passed to the function from a for loop. i being the counter for the loop, cornerSize being the size of corner desired by the user. float retVal; retVal = cornerSize*(1-cos(asin(i/cornerSize)))

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Jason Coco
On Sep 30, 2008, at 07:29 , Michael Robinson wrote: Hello, I am trying to convert the following from Javascript to Cocoa ObjC: var retVal = Math.round(cornerSize*(1-Math.cos(Math.asin(i/ cornerSize; return retVal; Now retVal _must_ be an int, because the value is used as a margin at

Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Memo Akten
I'm guessing cornerSize is an int? so i/cornerSize will always return 0, so asin(i/cornerSize) will always return 0 so cos(asin(i/cornerSize)) will always return 1 so (1- cos(asin(i/cornerSize))) will always return 0 you want to do i/(float) cornerSize -

[Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-09-30 Thread Michael Robinson
Hello, I am trying to convert the following from Javascript to Cocoa ObjC: var retVal = Math.round(cornerSize*(1-Math.cos(Math.asin(i/ cornerSize; return retVal; Now retVal _must_ be an int, because the value is used as a margin attribute ("rounding" corners of divs). This is what I'