Пример #1
0
    private Vector3 CalcPosition(StarDataStruct star)
    {
        //in radians
        // var x = DistanceMultiplier *
        //         star.Distance *
        //         Mathf.Sin(f: Mathf.Deg2Rad * star.Declination) *
        //         Mathf.Cos(Mathf.Deg2Rad * star.RightAscension);
        // var y = DistanceMultiplier *
        //         star.Distance *
        //         Mathf.Sin(f: Mathf.Deg2Rad * star.Declination) *
        //         Mathf.Sin(Mathf.Deg2Rad * star.RightAscension);
        // var z = DistanceMultiplier * star.Distance *
        //         Mathf.Cos(Mathf.Deg2Rad * star.Declination);

        //In degrees
        var x = (MinDistance + DistanceMultiplier * star.Distance) *
                Mathf.Sin(star.Declination) *
                Mathf.Cos(star.RightAscension);
        var y = (MinDistance + DistanceMultiplier * star.Distance) *
                Mathf.Sin(star.Declination) *
                Mathf.Sin(star.RightAscension);
        var z = (MinDistance + DistanceMultiplier * star.Distance) *
                Mathf.Cos(star.Declination);

        return(new Vector3(x, y, z));
    }
Пример #2
0
    public StarDataStruct ParseData(string line)
    {
        var data          = new StarDataStruct();
        var separatedData = line.Split('|');

        if (separatedData[DecDataPosition] == null ||
            separatedData[RaDataPosition] == null ||
            separatedData[ParallaxDataPosition] == null)
        {
            data.HasPosition = false;
            return(data);
        }

        data.Declination    = ParseDeclination(separatedData[DecDataPosition]);
        data.RightAscension = ParseRightAscension(separatedData[RaDataPosition]);
        data.Magnitude      = ParseMagnitude(separatedData[MagDataPosition]);
        data.Distance       = ParseDistance(separatedData[ParallaxDataPosition]);
        data.Position       = CalcPosition(data);
        data.HasPosition    = true;


        return(data);
    }