2 Replies - 200 Views - Last Post: 05 December 2012 - 10:43 AM Rate Topic: -----

#1 afortunado  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 09-November 12

Creating a Range from Sun function, help?

Posted 05 December 2012 - 08:48 AM

Ok, so I need to calculate each individuals planets distance from the sun. These are the values.

Sun (0)
Mercury (0.579)
Venus (1.082)
Earth (1.496)
Mars (2.279)
Jupiter (7.786)
Saturn (14.335)
Uranus (28.725)
Neptune (44.951)
Moon (0.0)
Moon2 (0.0)

I need to create a function, so I was trying to define the above as double range. And then put a separate function like below


void rangefromSun (){
        
range*scaleDistance


}



I then could easily get the distance in the code by using
glTranslated(rangefromsun, 0.0, 4.9);




Any help of how to do this properly?

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Creating a Range from Sun function, help?

#2 raghav.naganathan  Icon User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 408
  • View blog
  • Posts: 1,440
  • Joined: 14-September 12

Re: Creating a Range from Sun function, help?

Posted 05 December 2012 - 09:01 AM

Can you please post your entire code?

It will be more helpful to understand what exactly you want.

regards,
Raghav
Was This Post Helpful? 0
  • +
  • -

#3 jimblumberg  Icon User is offline

  • member icon


Reputation: 4074
  • View blog
  • Posts: 12,566
  • Joined: 25-December 09

Re: Creating a Range from Sun function, help?

Posted 05 December 2012 - 10:43 AM

You may want to study the excellent function tutorials linked in my signature. They should help explain how to properly create and use functions.

Jim
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1