Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 176961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:58:13+00:00 2026-05-11T13:58:13+00:00

I’m moving through the atmosphere with Microsoft Virtual Earth 3D and I can descend

  • 0

I’m moving through the atmosphere with Microsoft Virtual Earth 3D and I can descend smoothly, but I don’t know the math to ascend smoothly.

I’m descending like this:

for(int curAlt = startAlt; curAlt < endAlt; curAlt--){     //do something     curAlt -= curAlt/150 } 

This works by decreasing the size of the jump the closer I get to the earth (lower altitude). I need a solution that would do similar, just in reverse, while still keeping the smaller jumps at the lower altitude.

How can I do this? Or is what I am doing unacceptable and should be done differently (say with logarithms)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:58:13+00:00Added an answer on May 11, 2026 at 1:58 pm

    An even better solution might be to use a function like the Logistic function.

    Double minAlt = 0.0; Double maxAlt = 500000.0;  Int32 numberSteps = 1000;  Double boundary = +6.0;  for (Int32 step = 0; step < numberSteps; step++) {    Double t = -boundary + 2.0 * boundary * step / (numberSteps - 1);    Double correction = 1.0 / (1.0 + Math.Exp(Math.Abs(boundary)));    Double value = 1.0 / (1.0 + Math.Exp(-t));    Double correctedValue = (value - correction) / (1.0 - 2.0 * correction);    Double curAlt = correctedValue * (maxAlt - minAlt) + minAlt; } 

    Because the current altitude is explicitly calculated you do not have to rely on a iterative calculation introducing all sorts of precision releated errors.

    See the sample code for how to tune the function shape.


    Here is a sample console application that displays the function. You can play a bit with the parameters to get a feeling for the behavior.

    using System;  namespace LogisticFunction {     class Program     {         static void Main(string[] args)         {             Double minAlt = 5.0;             Double maxAlt = 95.0;              Int32 numberSteps = 60;              // Keep maxAlt and numberSteps small if you don't want a giant console window.             Console.SetWindowSize((Int32)maxAlt + 12, numberSteps + 1);              // Positive values produce ascending functions.             // Negative values produce descending functions.             // Values with smaller magnitude produce more linear functions.             // Values with larger magnitude produce more step like functions.             // Zero causes an error.             // Try for example +1.0, +6.0, +20.0 and -1.0, -6.0, -20.0             Double boundary = +6.0;              for (Int32 step = 0; step < numberSteps; step++)             {                 Double t = -boundary + 2.0 * boundary * step / (numberSteps - 1);                 Double correction = 1.0 / (1.0 + Math.Exp(Math.Abs(boundary)));                 Double value = 1.0 / (1.0 + Math.Exp(-t));                 Double correctedValue = (value - correction) / (1.0 - 2.0 * correction);                 Double curAlt = correctedValue * (maxAlt - minAlt) + minAlt;                  Console.WriteLine(String.Format('{0, 10:N4} {1}', curAlt, new String('#', (Int32)Math.Round(curAlt))));             }              Console.ReadLine();         }     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.