Example #1
0
        void Update()
        {
            if (celestialOrigin.coordinateType != CelestialCoordinateType.Horizontal)
            {
                text.text = "";
                return;
            }
            switch (coordsType)
            {
            case CelestialCoordinateType.Horizontal:
            default:
                var horiz = new HorizontalCoords(cameraRotation.value);
                text.text = $"Az: {horiz.azimuth.ToString("0.0")}\nAlt: {horiz.altitude.ToString("0.0")}";
                break;

            case CelestialCoordinateType.Equatorial:
                var rot = Quaternion.Inverse(equatorialOrigin.value) * cameraRotation.value;
                var equ = new EquatorialCoords(rot);
                text.text = $"RA: {equ.rightAscention.ToString("0.0")}\nDec: {(equ.declination).ToString("0.0")}";
                break;

            case CelestialCoordinateType.Ecliptic:
                var ecl = EclipticCoords.FromQuaternionUntested(cameraRotation.value);
                text.text = $"Lon: {ecl.longitude.ToString("0.0")}\nLat: {ecl.latitude.ToString("0.0")}";
                break;
            }
        }
Example #2
0
        public static EclipticCoords FromQuaternionUntested(Quaternion rotation, double radius = 1)
        {
            var euler = rotation.eulerAngles;
            var ecl   = new EclipticCoords(0, 0);

            ecl.latitude  = euler.x;
            ecl.longitude = euler.y;
            ecl.radius    = radius;
            return(ecl);
        }
Example #3
0
        public EclipticCoords ToEclipticSpherical()
        {
            var ecl = new EclipticCoords(
                Math.Atan2(z, Math.Sqrt(x * x + y * y)) * StarMath.rad2deg,
                Math.Atan2(y, x) * StarMath.rad2deg,
                this.Length());

            ecl.longitude = StarMath.WrapDeg(ecl.longitude);            //nesecary?
            return(ecl);
        }