These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

How to map the universe?

Author
Trenker
#1 - 2011-10-13 17:37:16 UTC
Hi everyone

Currently I try to create a map of all solar systems. The problem is: how to get those 3d vectors onto a plain canvas. My current approach looks like this:


systems = 'SELECT x,y,z, solarSystemID AS `id`, solarSystemName AS `name` FROM mapSolarSystems'
canvasWidth = 1000
canvasHeight = 1000
cameraDistance = canvasWidth * SIN(45)

FOR EACH systems AS system
x = system.x / 10
y = system.y / 10
z = system.z / 10
point.x = x / z * cameraDistance + ( canvasWidth / 2 )
point.y = y / z * cameraDistance + ( canvasHeight / 2 )


Apparently the math is way off. Any ideas?
FloppieTheBanjoClown
Arcana Imperii Ltd.
#2 - 2011-10-13 23:16:33 UTC
Use http://evemaps.dotlan.net/

Saves a lot of headache.

Founding member of the Belligerent Undesirables movement.

Trenker
#3 - 2011-10-15 19:23:39 UTC
I know dotlan (who doesn't?). The example above is for something entirely different. No math ninjas in here?
Fortune Taker
#4 - 2011-10-16 02:55:09 UTC
Trenker wrote:

.....
point.x = x / z * cameraDistance + ( canvasWidth / 2 )
point.y = y / z * cameraDistance + ( canvasHeight / 2 )


Apparently the math is way off. Any ideas?



what are you trying to do here?

point.y = y / z * cameraDistance + ( canvasHeight / 2 )

depending on how you group these it will come out different
i.e.

point.y = y / z *( cameraDistance + ( canvasHeight / 2 ))
point.y = y / (z * cameraDistance + ( canvasHeight / 2 ))
point.y = (y / z * cameraDistance) + ( canvasHeight / 2 ) <--- this is how your equation is currently grouped


are you trying to get the map to look 3d on a 2d surface?
why not just implement in 3d and render to surface?
Trenker
#5 - 2011-10-17 15:30:09 UTC
Got it, the problem was not the math, but my stupidity.

If you switch y and z values, something weird comes up! Roll

Thanks anyway