コード例 #1
0
ファイル: Fxyf.cs プロジェクト: imbasimba/wwt-webgl-engine
        public static Fxyf Create(double x, double y, int f)
        {
            Fxyf temp = new Fxyf();

            temp.fx   = x;
            temp.fy   = y;
            temp.face = f;
            return(temp);
        }
コード例 #2
0
ファイル: Fxyf.cs プロジェクト: imbasimba/wwt-webgl-engine
        private static Fxyf FromHploc(Hploc loc)
        {
            Fxyf   temp = new Fxyf();
            double z = loc.z, phi = loc.phi;

            double za = Math.Abs(z);
            double tt = HealpixUtils.fmodulo((phi * Fxyf.inv_halfpi), 4.0); // in [0,4)

            if (za <= Fxyf.twothird)                                        // Equatorial region
            {
                double temp1    = 0.5 + tt;
                double temp2    = z * 0.75;
                double jp       = temp1 - temp2; // index of  ascending edge line
                double jm       = temp1 + temp2; // index of descending edge line
                long   ifp      = (long)jp;      // in {0,4}
                long   ifm      = (long)jm;
                long   face_num = (ifp == ifm) ? (ifp | 4) : ((ifp < ifm) ? ifp : (ifm + 8));
                temp.fx   = HealpixUtils.fmodulo(jm, 1d);
                temp.fy   = 1d - HealpixUtils.fmodulo(jp, 1d);
                temp.face = (int)face_num;
            }
            else // polar region, za > 2/3
            {
                int    ntt = Math.Min(3, (int)tt);
                double tp  = tt - ntt;
                double tmp;
                if ((za < 0.99) || (!loc.have_sth))
                {
                    tmp = Math.Sqrt(3 * (1 - za));
                }
                else
                {
                    tmp = loc.sth / Math.Sqrt((1d + za) / 3d);
                }

                double jp = tp * tmp;         // increasing edge line index
                double jm = (1.0 - tp) * tmp; // decreasing edge line index
                if (jp >= 1d)
                {
                    jp = 1d;           // for points too close to the boundary
                }
                if (jm >= 1d)
                {
                    jm = 1d;
                }
                if (z >= 0)
                {
                    temp.fx = 1d - jm; temp.fy = 1d - jp; temp.face = ntt;
                }
                else
                {
                    temp.fx = jp; temp.fy = jm; temp.face = ntt + 8;
                }
            }
            return(temp);
        }
コード例 #3
0
        private void SetCorners()
        {
            Xyf    xyf = Xyf.Create(tileX, tileY, face);
            double dc  = 0.5 / nside;
            double xc  = (xyf.ix + 0.5) / nside;
            double yc  = (xyf.iy + 0.5) / nside;

            TopLeft     = Fxyf.Create(xc + dc, yc + dc, xyf.face).toVec3();
            BottomLeft  = Fxyf.Create(xc - dc, yc + dc, xyf.face).toVec3();
            BottomRight = Fxyf.Create(xc - dc, yc - dc, xyf.face).toVec3();
            TopRight    = Fxyf.Create(xc + dc, yc - dc, xyf.face).toVec3();
        }
コード例 #4
0
        private Vector3d[] Boundaries(int x, int y, int step)
        {
            int nside = step * Math.Pow(2, Level);

            Vector3d[] points = new Vector3d[4];
            Xyf        xyf    = Xyf.Create(x + faceX * step, y + faceY * step, face);
            double     dc     = 0.5 / nside;
            double     xc     = (xyf.ix + 0.5) / nside;
            double     yc     = (xyf.iy + 0.5) / nside;

            points[0] = Fxyf.Create(xc + dc, yc + dc, xyf.face).toVec3();
            points[1] = Fxyf.Create(xc - dc, yc + dc, xyf.face).toVec3();
            points[2] = Fxyf.Create(xc - dc, yc - dc, xyf.face).toVec3();
            points[3] = Fxyf.Create(xc + dc, yc - dc, xyf.face).toVec3();

            return(points);
        }
コード例 #5
0
ファイル: Fxyf.cs プロジェクト: imbasimba/wwt-webgl-engine
 public static Fxyf FromVector(Vector3d v)
 {
     return(Fxyf.FromHploc(Hploc.Create(v)));
 }