protected Coordinates ThreeDeeToGeo(Vector3d vector)
        {
            Matrix3d mat = dataset.Matrix;

            mat.Invert();

            Coordinates result = Coordinates.CartesianToSpherical(Vector3d.TransformCoordinate(vector, mat));

            result.Lng = -result.Lng;
            return(result);
        }
Example #2
0
        public Vector2d GetImagePixel(Coordinates sky)
        {
            Vector2d result = new Vector2d();
            //Vector3 tangent = GeoTo3dWithAltitude(sky.Lat, sky.Lng);
            Vector3d tangent = Coordinates.RADecTo3d(sky.RA + 12, sky.Dec, 1);
            Matrix3d mat     = dataset.Matrix;

            mat.Invert();

            tangent = Vector3d.TransformCoordinate(tangent, mat);

            Coordinates imagePoint = Coordinates.CartesianToSpherical(tangent);

            result.X = (float)((imagePoint.Lng / ScaleX) + PixelCenterX);
            result.Y = (float)((imagePoint.Lat / -ScaleY) + PixelCenterY);

            return(result);
        }
Example #3
0
        public IPlace HoverCheck(Vector3 searchPoint, IPlace defaultPlace, float distance)
        {
            searchPoint = -searchPoint;
            Vector3 dist;

            if (defaultPlace != null)
            {
                Vector3 testPoint = Coordinates.RADecTo3d(defaultPlace.RA, -defaultPlace.Dec, -1.0).Vector311;
                dist     = searchPoint - testPoint;
                distance = dist.Length();
            }

            int closestItem = -1;
            int index       = 0;

            foreach (Vector3 point in positions)
            {
                dist = searchPoint - point;
                if (dist.Length() < distance)
                {
                    distance    = dist.Length();
                    closestItem = index;
                }
                index++;
            }

            lastHoverIndex = closestItem;

            if (closestItem == -1)
            {
                return(defaultPlace);
            }

            Coordinates pnt  = Coordinates.CartesianToSpherical(positions[closestItem]);
            string      name = this.names[closestItem];

            if (String.IsNullOrEmpty(name))
            {
                name = string.Format("RA={0}, Dec={1}", Coordinates.FormatHMS(pnt.RA), Coordinates.FormatDMS(pnt.Dec));
            }
            TourPlace place = new TourPlace(name, pnt.Dec, pnt.RA, Classification.Unidentified, "", ImageSetType.Sky, -1);

            return(place);
        }