CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Posts
    14

    solar system coordinates in java

    Hi
    I am making a simulation of the inner planets of the solar system using the three-step Beeman scheme. I am confused about how to display the planets. for my starting inputs I have the data from NASA JPL website, so for the Earth I have the following:
    Code:
     Planet Name	 positionX		     positionY		    velocityX(km/s)	    velocityY(km/s)      radius	 acceleration	 mass(kg)
    Earth		-1.685246520883574E-01  9.687833042792607E-01	-1.723394582127405E-02	-3.007660313409631E-03	   50	     0		 5.9736e+24
    These values are huge so how do I convert these to the cartesian coordinates that JAVA uses?

    Thanks

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: solar system coordinates in java

    These values are huge so how do I convert these to the cartesian coordinates that JAVA uses?
    You scale them to fit the display area you have available to you.

    Find the largest planet coordinate (call it A), find the largest screen co-ordinate you want to use (call it B) and divide all the planet coordinates by A and multiply them by B. This will give you the screen location co-ordinates.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured