Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Setting rotation with radians  (Read 33502 times)

0 Members and 1 Guest are viewing this topic.

Kingdom of Fish

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Setting rotation with radians
« on: February 03, 2008, 08:13:40 pm »
Hi, I was wondering if you are planning to add functionality to set the rotation of a sprite using radians instead of degrees?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Setting rotation with radians
« Reply #1 on: February 04, 2008, 02:11:39 am »
Hum, no. This should be enough if you need it :
Code: [Select]
inline float RadToDeg(float Rad)
{
    return Deg / M_PI * 180.f;
}

sprite.SetRotation(RadToDeg(1.158f));
Laurent Gomila - SFML developer

Kingdom of Fish

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Setting rotation with radians
« Reply #2 on: February 04, 2008, 11:21:26 am »
My original thought was that most libraries uses radians for rotation and that opengl did so too, which would mean you already did the conversion once... but looking at the code i noticed i was wrong.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Setting rotation with radians
« Reply #3 on: February 04, 2008, 01:36:17 pm »
Well, I don't think it makes much difference, as one can easily write and use DegToRad and RadToDeg functions.

I just wanted to use something "human-friendly" by default, so that you can write Sprite.Rotate(90) instead of Sprite.Rotate(M_PI / 2.f).
Laurent Gomila - SFML developer

Kingdom of Fish

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Setting rotation with radians
« Reply #4 on: February 05, 2008, 01:23:30 am »
Well thats a good enough reason, I'm just in favor of options... more so then necessary probably.

zarka

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Setting rotation with radians
« Reply #5 on: February 05, 2008, 09:03:21 pm »
Quote from: "Laurent"
Well, I don't think it makes much difference, as one can easily write and use DegToRad and RadToDeg functions.

I just wanted to use something "human-friendly" by default, so that you can write Sprite.Rotate(90) instead of Sprite.Rotate(M_PI / 2.f).


but radians are more programmer friendly! :)
//Zzzarka

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Setting rotation with radians
« Reply #6 on: February 06, 2008, 01:47:49 am »
I guess everyone has its own preference ;)
Laurent Gomila - SFML developer

LanceJZ

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Setting rotation with radians
« Reply #7 on: March 29, 2014, 08:13:41 am »
Well, I don't think it makes much difference, as one can easily write and use DegToRad and RadToDeg functions.

I just wanted to use something "human-friendly" by default, so that you can write Sprite.Rotate(90) instead of Sprite.Rotate(M_PI / 2.f).

Funny you should say that, as I find radian way more human friendly than degrees. I hate having to figure out degrees to radians and back. I love Pi, why the hate on pi? I'm actually annoyed that degrees is what sprite uses for rotation.
Just my thoughts on the matter.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Setting rotation with radians
« Reply #8 on: March 29, 2014, 08:34:11 am »
Thanks for reviving a 6 year-old thread just to complain about something that will never change anyway.
Laurent Gomila - SFML developer

Deathbeam

  • Jr. Member
  • **
  • Posts: 82
  • VB6, VB.NET, C#, HTML, PHP, CSS, JavaScript nerd.
    • View Profile
    • My portfolio
    • Email
Re: Setting rotation with radians
« Reply #9 on: April 02, 2014, 09:20:09 pm »
Thanks for reviving a 6 year-old thread just to complain about something that will never change anyway.
(y) Degrees 4ever
Spooker Framework - Open source gaming library
My portfolio
Indie Armory - Small community of a game developers. Everyone is welcome. Bring your friends, family, pets...

Cleroth

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Setting rotation with radians
« Reply #10 on: April 25, 2014, 09:04:56 am »
The degrees are most likely converted to radians internally at some point anyway, hence why using radians could be benificial (but unlikely).

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Setting rotation with radians
« Reply #11 on: April 25, 2014, 11:49:41 am »
The degrees are most likely converted to radians internally at some point anyway, hence why using radians could be benificial (but unlikely).

beneficial? -> look up «premature optimization».
SFML / OS X developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6288
  • Thor Developer
    • View Profile
    • Bromeon
Re: Setting rotation with radians
« Reply #12 on: April 25, 2014, 12:09:16 pm »
This 6-year old thread has already been necromanced, there's no need to artificially keep it alive. I think it should be closed, no new arguments have been brought anyway.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything