> Hm, I'm not sure why you need an arc() -- note that arc() doesn't

The translate method however needs coords to move to. I think it's

> actually draw anything, it just adds an arc to the current path.

> drawText ignores the current path (or should!). What you want is

> something like:

just some trig I need. And to get said trig working. Unfortunately the

JS Math.sin function comes out differently tro my calculator.

To recap, I'm trying to get horizontal text (ie readable) text at a

point but only knowing the angle in relation of the hypotenuse, and

the length of said line. So the equation would be:

Opposite = Math.sin(45) * 100

Where 100 is the radius of the circle I'm drawing (for example) and 45

is 45 degrees. I've just got to get it working... :-/

--

Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:

http://www.phpguru.org/RGraph- --- In canvas-developers@yahoogroups.com, "Richard Heyes"

<richard.heyes@...> wrote:>

[...]

> Unfortunately the

> JS Math.sin function comes out differently tro my calculator

> Opposite = Math.sin(45) * 100

Javascript's trig functions work in radians, not degrees (as do most

>

> Where 100 is the radius of the circle I'm drawing (for example) and 45

> is 45 degrees. I've just got to get it working... :-/

other programming languages and libraries). To convert from degrees to

radians, multiply by Math.PI/180 (e.g. Math.sin(45 * Math.PI/180) in

this case). More generally though, for this sort of thing it helps to

get into the habit of 'thinking' in radians and using them

consistently across your application rather than having to convert

between radians and degrees...

- Matt > Javascript's trig functions work in radians, not degrees

Ah, that explains a lot... :-)

> (as do most

Well it's a public API, and people recognise degrees. Most probably

> other programming languages and libraries). To convert from degrees to

> radians, multiply by Math.PI/180 (e.g. Math.sin(45 * Math.PI/180) in

> this case). More generally though, for this sort of thing it helps to

> get into the habit of 'thinking' in radians and using them

> consistently across your application rather than having to convert

> between radians and degrees...

don't even know what a radian is (radioactive?), so for said API, I

think I'll have to stick with convertiong to radians.

>

--

> - Matt

>

>

Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:

http://www.phpguru.org/RGraph