Go Back   IceInSpace > General Astronomy > Astronomy and Amateur Science

Reply
 
Thread Tools Rate Thread
  #1  
Old 14-12-2018, 02:51 PM
angelof (Angelo)
Registered User

angelof is offline
 
Join Date: Nov 2012
Location: newcastle australia
Posts: 14
Conversion of Coordinates to RA and Dec

Greetings.

I have been given a 3D vector and I need to convert this to RA and Dec.

The following vector is for Acrux
j2000":"[-0.449409, -0.0523899, -0.891789]

I need a formula to convert the x, y, and z to the RA and Dec

http://stellarium.org/doc/0.18/remoteControlApi.html

Is someone able to provide me with a formula so I can create a couple of functions in Java to return the values for a program I am writing? I would prefer that the RA and Dec be returned in degrees.

Thanks
Reply With Quote
  #2  
Old 14-12-2018, 04:45 PM
kens (Ken)
Registered User

kens is offline
 
Join Date: Oct 2014
Location: Melbourne, Australia
Posts: 314
Declination is the arcsin of z
RA is the arctan of y/x.
Use atan2 or its equivalent to avoid div by zero error if x=0

EDIT: Looks like you need to add 180 degrees to get RA

Last edited by kens; 14-12-2018 at 09:41 PM.
Reply With Quote
  #3  
Old 14-12-2018, 06:43 PM
Eratosthenes's Avatar
Eratosthenes (Peter)
Trivial High Priest

Eratosthenes is offline
 
Join Date: Apr 2015
Location: Melbourne, Australia
Posts: 392
Could try one of these two sources?

http://www.castor2.ca/04_Propagation...uat/index.html
https://en.wikipedia.org/wiki/Spheri...an_coordinates
Reply With Quote
  #4  
Old 16-12-2018, 12:31 PM
angelof (Angelo)
Registered User

angelof is offline
 
Join Date: Nov 2012
Location: newcastle australia
Posts: 14
Thanks. I worked it out with a little help
To get dec in degrees and ra in hours I did this


double dec = Math.asin(z) / Math.PI * 180;

double ra = (((Math.atan2(x, y) * 180 / Math.PI -90) * -1 / 360 * 24) + 24) % 24;

Thanks
Reply With Quote
  #5  
Old 16-12-2018, 07:13 PM
Eratosthenes's Avatar
Eratosthenes (Peter)
Trivial High Priest

Eratosthenes is offline
 
Join Date: Apr 2015
Location: Melbourne, Australia
Posts: 392
Quote:
Originally Posted by angelof View Post
Thanks. I worked it out with a little help
To get dec in degrees and ra in hours I did this


double dec = Math.asin(z) / Math.PI * 180;

double ra = (((Math.atan2(x, y) * 180 / Math.PI -90) * -1 / 360 * 24) + 24) % 24;

Thanks

Math.?
Reply With Quote
  #6  
Old 19-12-2018, 03:42 PM
lazjen's Avatar
lazjen (Chris)
PI cult member

lazjen is offline
 
Join Date: Dec 2012
Location: Flaxton, Qld
Posts: 2,064
Quote:
Originally Posted by Eratosthenes View Post
Math.?
Java language - package
Reply With Quote
Reply

Bookmarks

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time is now 09:19 PM.

Powered by vBulletin Version 3.8.7 | Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Advertisement
Bintel
Advertisement
Testar
Advertisement