SFML community forums
Help => Graphics => Topic started by: chessguy on June 21, 2014, 06:20:29 pm
-
Greetings.
When designing things making use of angles - movement, for example - I generally use radians now, as the underlying mechanism, though I may specify initial angles in degrees, as I still find them easier to picture (for example, 1 degree is much more clear to me than the radian equivalent). This works well as the trig functions generally takes radians.
SFML, however, does not.
Due to this, I was trying to convert to and from these different units.
In detail. Radians starting on the positive x axis, counted counterclockwise. SFML degrees, it seems, start on the positive y axis, and are counted clockwise.
I imagine this may be of use to future searches for the same thing.
I seem to have inconsistent success with the functions.
What math would be required for each?
-
SFML degrees, it seems, start on the positive y axis, and are counted clockwise.
No, the degrees are counted naturally, 0° corresponds to "right" (+X). There may be confusion because the Y axis points downwards, unlike in mathematical coordinate systems. But this only related to rendering, not angle computations themselves.
I imagine this may be of use to future searches for the same thing.
Have you also imagined that there may be past discussions about degrees and radians? ;)
There were quite a lot of them, actually.
What math would be required for each?
What do you mean?
-
Ah. It seems (I was using a pointed sprite) I mistook an edge of the sprite to be the angle rotation, but it starts upwards.
I made this after finding all of them google made available to me. Some were talks about API changes, but I recall at least two talking about the conversion. Though given the mistake I just realized, it is likely I adapted it wrong.
Conversion functions, basically.
-
Please explain your problem in a meaningful way. Converting between radians and degrees is a trivial task that can be found within seconds on the Internet, so I assume you mean something else... but what?
-
It had been for SFML, but it had one less step than I had thought. It seems it is simply the radian-degree calculation (respective of which direction) along with a negation.
As far as I can tell, it is fixed and working as expected.