As Kathy and other have said, it's better to let the session control application do the math for you than trying to get the dome controller to do it. In all case you would need to be able to send the
Ra/
Dec for the mount to the dome controller and implement all the matrix convolution in your Arduino code (not sure you'll have enough memory in the Mega 2560). So you'd be better of only dealing with what azimuth to go to.
Usually dome controller only deal with going to an azimuth as instructed (they only need to know how many steps are required for a full rotation and the home position to be able to position the slit at the requested azimuth, this math is a lot simpler
), and doing shutter control and safety monitoring to close all things in case of weather events (rain, very high win speed, ....).
In my controller I used an Arduino DUE because I wanted to put the AccelStepper library in a proper timer interrupt (the older code base from when it wa used by NexDome, to which I contributed quite a bit, was too slow on the Arduino Leonardo). The DUE has the computing speed to allow this (ARM Cortex M3 at 84MHz, lots of RAM and flash). This way I can do proper acceleration/deceleration in the interrupt without much impact on the main loop dealing with communication, command parsing, ...
Once I had this working, I added more and more feature (automatic calibration, automatic reconnection to shutter controller via the XBee, Ethernet support, ....).
The whole project is open source and I use it myself in my dome... feel free to re-use, modify, tweak, remove, .. anything from it.
Rodolphe