# Creating a Range from Sun function, help?

Page 1 of 1

## 2 Replies - 296 Views - Last Post: 05 December 2012 - 10:43 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=302846&amp;s=5bd1769d7eade856d3099e13910e26d1&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

Reputation: 0
• 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

• Perfectly Squared ;)

Reputation: 410
• Posts: 1,440
• Joined: 14-September 12

## Re: Creating a Range from Sun function, help?

Posted 05 December 2012 - 09:01 AM

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

regards,
Raghav

### #3 jimblumberg

Reputation: 4736
• Posts: 14,769
• 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