Пример #1
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            if(n!=0)
            {
                lp.phi=xy.y;
                int i=MAX_ITER;
                for(; i>0; i--)
                {
                    double v=(n*lp.phi+n1*Math.Sin(lp.phi)-xy.y)/(n+n1*Math.Cos(lp.phi));
                    lp.phi-=v;
                    if(Math.Abs(v)<LOOP_TOL) break;
                }

                if(i==0) lp.phi=xy.y<0.0?-Proj.HALFPI:Proj.HALFPI;
            }
            else lp.phi=Proj.aasin(ctx, xy.y);

            double V=Math.Cos(lp.phi);
            lp.lam=xy.x*(n+n1*V)/V;

            return lp;
        }
Пример #2
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=xy.y/FYC;
            if(Math.Abs(lp.phi)>=1.0)
            {
                if(Math.Abs(lp.phi)>ONEEPS) { Proj.pj_ctx_set_errno(ctx, -20); return lp; }
                else lp.phi=(lp.phi<0.0)?-Proj.HALFPI:Proj.HALFPI;
            }
            else lp.phi=Math.Asin(lp.phi);

            lp.phi*=3.0;
            lp.lam=xy.x/(FXC*(2.0*Math.Cos(C23*lp.phi)-1.0));
            lp.phi=Math.Sin(lp.phi)/CS;
            if(Math.Abs(lp.phi)>=1.0)
            {
                if(Math.Abs(lp.phi)>ONEEPS) { Proj.pj_ctx_set_errno(ctx, -20); return lp; }
                else lp.phi=(lp.phi<0.0)?-Proj.HALFPI:Proj.HALFPI;
            }
            else lp.phi=Math.Asin(lp.phi);

            return lp;
        }
Пример #3
0
		// spheroid
		LP s_inverse(XY xy)
		{
			double yc = xy.y;

			// make sure y is inside valid range
			if (xy.y > MAX_Y) xy.y = MAX_Y;
			else if (xy.y < -MAX_Y) xy.y = -MAX_Y;

			for (;;)
			{ // Newton-Raphson
				double y2 = yc * yc;
				double f = yc * (K1 + y2 * y2 * (K2 + y2 * (K3 + K4 * y2))) - xy.y;
				double fder = C1 + y2 * y2 * (C2 + y2 * (C3 + C4 * y2));
				double tol = f / fder;
				yc -= tol;

				if (Math.Abs(tol) < EPS11) break;
			}

			LP lp;
			lp.phi = yc;
			lp.lam = xy.x; // longitude

			return lp;
		}
Пример #4
0
        // ellipsoid & spheroid
        LP e_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            double phipp=2.0*(Math.Atan(Math.Exp(xy.y/kR))-Proj.FORTPI);
            double lampp=xy.x/kR;
            double cp=Math.Cos(phipp);
            double phip=Proj.aasin(ctx, cosp0*Math.Sin(phipp)+sinp0*cp*Math.Cos(lampp));
            double lamp=Proj.aasin(ctx, cp*Math.Sin(lampp)/Math.Cos(phip));
            double con=(K-Math.Log(Math.Tan(Proj.FORTPI+0.5*phip)))/c;

            int i=NITER;
            for(; i>0; i--)
            {
                double esp=e*Math.Sin(phip);
                double delp=(con+Math.Log(Math.Tan(Proj.FORTPI+0.5*phip))-hlf_e*Math.Log((1.0+esp)/(1.0-esp)))*(1.0-esp*esp)*Math.Cos(phip)*rone_es;
                phip-=delp;
                if(Math.Abs(delp)<EPS) break;
            }

            if(i==0) { Proj.pj_ctx_set_errno(ctx, -20); return lp; }
            lp.phi=phip;
            lp.lam=lamp/c;

            return lp;
        }
Пример #5
0
 LP inverse(XY xy)
 {
     LP lp;
     lp.phi=xy.y*Proj.DEG_TO_RAD*a;
     lp.lam=xy.x*Proj.DEG_TO_RAD*a;
     return lp;
 }
Пример #6
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            double t;

            lp.phi=RYC*xy.y;
            if(Math.Abs(lp.phi)>1.0)
            {
                if(Math.Abs(lp.phi)>ONETOL) { Proj.pj_ctx_set_errno(ctx, -20); return lp; }
                else if(lp.phi<0.0) { t=-1.0; lp.phi=-Proj.PI; }
                else { t=1.0; lp.phi=Proj.PI; }
            }
            else
            {
                t=lp.phi;
                lp.phi=2.0*Math.Asin(t);
            }

            lp.lam=RXC*xy.x/(1.0+2.0*Math.Cos(lp.phi)/Math.Cos(0.5*lp.phi));
            lp.phi=RC*(t+Math.Sin(lp.phi));
            if(Math.Abs(lp.phi)>1.0)
            {
                if(Math.Abs(lp.phi)>ONETOL) { Proj.pj_ctx_set_errno(ctx, -20); return lp; }
                else lp.phi=lp.phi<0.0?-Proj.HALFPI:Proj.HALFPI;
            }
            else lp.phi=Math.Asin(lp.phi);

            return lp;
        }
Пример #7
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            int i;
            double p=0.5*xy.y;

            for(i=NITER; i>0; i--)
            {
                double c=Math.Cos(0.5*lp.phi);
                double V=(lp.phi-Math.Tan(lp.phi/2)-p)/(1.0-0.5/(c*c));
                lp.phi-=V;
                if(Math.Abs(V)<EPS) break;
            }

            if(i==0)
            {
                lp.phi=p<0.0?-Proj.HALFPI:Proj.HALFPI;
                lp.lam=2.0*xy.x;
            }
            else lp.lam=2.0*xy.x/(1.0+Math.Cos(lp.phi));

            return lp;
        }
Пример #8
0
    public Vector2 GetScreenCorner(XY screenCoord)
    {
        XYZ screenSize = GameData.World.Config.ScreenSize;

        return new Vector2((float)screenCoord.X * screenSize.X,
                           (float)screenCoord.Y * screenSize.Z);
    }
Пример #9
0
    // calculates how well a color fits at the given coordinates
    float calcdiff(Color[,] pixels, XY xy, Color c)
    {
        // get the diffs for each neighbor separately
        List<float> diffs = new List<float>(8);
        foreach (var nxy in getneighbors(xy))
        {
            diffs.Add(coldiff(pixels[nxy.x, nxy.y], c));
        }

        // average or minimum selection
        if (AVERAGE)
        {
            float sum = 0 ;
            foreach(float i in diffs )
                sum += i;
            return sum / diffs.Count;
        }
        else
        {
            float min = 9999f;
            foreach(float i in diffs )
                min = (min>i)?i:min;
            return min;
        }
    }
Пример #10
0
 // Helper Methods
 public bool ContainsPoint(XY p)
 {
     if (p.x > center.x + half.x) return false;
     if (p.y > center.y + half.y) return false;
     if (p.x < center.x - half.x) return false;
     if (p.y < center.y - half.y) return false;
     return true;
 }
Пример #11
0
    public void CreateScreen(XY screenCoord)
    {
        if(!IsValidScreenCoord(screenCoord)) return;

        GameObject screenMesh = GenerateScreenMesh(screenCoord);

        _screenMeshes[screenCoord] = screenMesh;
    }
Пример #12
0
    public void DestroyScreen(XY screenCoord)
    {
        if(!IsValidScreenCoord(screenCoord)) return;

        Destroy(_screenMeshes[screenCoord]);

        _screenMeshes.Remove(screenCoord);
    }
Пример #13
0
    public Vector2 GetScreenCenter(XY screenCoord)
    {
        XYZ screenSize = GameData.World.Config.ScreenSize;

        Vector2 corner = GetScreenCorner(screenCoord);

        return corner + new Vector2(screenSize.X / 2, screenSize.Z / 2);
    }
Пример #14
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=xy.y/C_y;
            lp.lam=xy.x/(C_x*(A+Proj.asqrt(1.0-B*lp.phi*lp.phi)));
            return lp;
        }
Пример #15
0
 public DefaultCell(int x, int y, CellState state)
 {
     this.state = state;
     next_state = CellState.Unknown;
     last_state = CellState.Unknown;
     this.location = location;
     location = new XY(x, y);
     hasChanges = false;
 }
Пример #16
0
    public Rect GetScreenBounds(XY screenCoord)
    {
        Vector2 corner = GetScreenCorner(screenCoord);
        Vector2 dimensions = GetScreenDimensions();

        int chunkSize = GameData.World.Config.ChunkSize;

        return new Rect(corner.x, corner.y, dimensions.x, dimensions.y);
    }
Пример #17
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.lam=xy.x/rc;
            lp.phi=xy.y+phi0;
            return lp;
        }
Пример #18
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=xy.y/FC;
            lp.lam=xy.x/(FC*(1.0-RP*Math.Abs(lp.phi)));
            return lp;
        }
Пример #19
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=3.0*Math.Asin(xy.y*RYM);
            lp.lam=xy.x*RXM/(2.0*Math.Cos((lp.phi+lp.phi)*THIRD)-1);

            return lp;
        }
Пример #20
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=xy.y/C;
            lp.lam=xy.x/(C*(A-B*Math.Sqrt(1.0+D*lp.phi*lp.phi)));

            return lp;
        }
Пример #21
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=RYF*xy.y;
            lp.lam=RXF*xy.x/(1.0+Math.Cos(lp.phi));

            return lp;
        }
Пример #22
0
    public XY GetMapCoordFromWorldCoord(XY worldCoord)
    {
        int blockSize = GameConfig.BLOCK_SIZE;
        int halfBlockSize = GameConfig.BLOCK_SIZE / 2;

        float worldX = (worldCoord.X + halfBlockSize * (worldCoord.X < 0 ? -1 : 1)) / blockSize;
        float worldZ = (worldCoord.Y + halfBlockSize * (worldCoord.Y < 0 ? -1 : 1)) / blockSize;

        return new XY((int)worldX, (int)worldZ);
    }
Пример #23
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=xy.y/C;
            lp.lam=xy.x/(C*(1.0-A*lp.phi*lp.phi));

            return lp;
        }
Пример #24
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=xy.y;
            lp.lam=2.0*xy.x/(cosphi1+Math.Cos(lp.phi));

            return lp;
        }
Пример #25
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.lam=2.0*xy.x/(1.0+Math.Cos(xy.y));
            lp.phi=Proj.aasin(ctx, 0.5*(xy.y+Math.Sin(xy.y)));

            return lp;
        }
Пример #26
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.lam=RXF*xy.x;
            lp.phi=2.0*Math.Atan(xy.y*RYF);

            return lp;
        }
Пример #27
0
    public List<WallPiece> GetCrossPieces(XY coord)
    {
        List<WallPiece> pieces = new List<WallPiece>();

        foreach(WallPiece piece in WallPieces) {
            if(piece.Coord.X == coord.X || piece.Coord.Y == coord.Y)
                pieces.Add(piece);
        }

        return pieces;
    }
Пример #28
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            lp.phi=xy.y/C_y;
            lp.lam=xy.x/(C_x*Math.Cos(lp.phi));
            lp.phi=Proj.aasin(ctx, Math.Sin(lp.phi)/C_p1)/C_p2;

            return lp;
        }
Пример #29
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            xy.y/=1.819152;
            lp.phi=2.0*Math.Atan(xy.y);
            xy.y=1.0-xy.y*xy.y;
            lp.lam=Math.Abs(xy.y)<TOL?0.0:xy.x/(0.819152*Math.Sqrt(xy.y));

            return lp;
        }
Пример #30
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;
            lp.lam=lp.phi=0;

            double L=Math.Atan(Math.Sinh((xy.x*a-XS)/n2)/Math.Cos((xy.y*a-YS)/n2));
            double sinC=Math.Sin((xy.y*a-YS)/n2)/Math.Cosh((xy.x*a-XS)/n2);
            double LC=Math.Log(Proj.pj_tsfn(-1.0*Math.Asin(sinC), 0.0, 0.0));
            lp.lam=L/n1;
            lp.phi=-1.0*Proj.pj_phi2(ctx, Math.Exp((LC-c)/n1), e);

            return lp;
        }
Пример #31
0
 protected abstract XY GetValue(int seed, float amptitude, float frequency, XY xy);
Пример #32
0
 public Trajectory(XY p0)
 {
     throw new NotImplementedException();
 }
Пример #33
0
        /// <inheritdoc />
        public bool Equals([AllowNull] PointCloud other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Visible == other.Visible ||
                     Visible != null &&
                     Visible.Equals(other.Visible)
                 ) &&
                 (
                     ShowLegend == other.ShowLegend ||
                     ShowLegend != null &&
                     ShowLegend.Equals(other.ShowLegend)
                 ) &&
                 (
                     LegendGroup == other.LegendGroup ||
                     LegendGroup != null &&
                     LegendGroup.Equals(other.LegendGroup)
                 ) &&
                 (
                     Opacity == other.Opacity ||
                     Opacity != null &&
                     Opacity.Equals(other.Opacity)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     UId == other.UId ||
                     UId != null &&
                     UId.Equals(other.UId)
                 ) &&
                 (
                     Equals(Ids, other.Ids) ||
                     Ids != null && other.Ids != null &&
                     Ids.SequenceEqual(other.Ids)
                 ) &&
                 (
                     Equals(CustomData, other.CustomData) ||
                     CustomData != null && other.CustomData != null &&
                     CustomData.SequenceEqual(other.CustomData)
                 ) &&
                 (
                     Meta == other.Meta ||
                     Meta != null &&
                     Meta.Equals(other.Meta)
                 ) &&
                 (
                     Equals(MetaArray, other.MetaArray) ||
                     MetaArray != null && other.MetaArray != null &&
                     MetaArray.SequenceEqual(other.MetaArray)
                 ) &&
                 (
                     HoverInfo == other.HoverInfo ||
                     HoverInfo != null &&
                     HoverInfo.Equals(other.HoverInfo)
                 ) &&
                 (
                     Equals(HoverInfoArray, other.HoverInfoArray) ||
                     HoverInfoArray != null && other.HoverInfoArray != null &&
                     HoverInfoArray.SequenceEqual(other.HoverInfoArray)
                 ) &&
                 (
                     HoverLabel == other.HoverLabel ||
                     HoverLabel != null &&
                     HoverLabel.Equals(other.HoverLabel)
                 ) &&
                 (
                     Stream == other.Stream ||
                     Stream != null &&
                     Stream.Equals(other.Stream)
                 ) &&
                 (
                     UiRevision == other.UiRevision ||
                     UiRevision != null &&
                     UiRevision.Equals(other.UiRevision)
                 ) &&
                 (
                     Equals(X, other.X) ||
                     X != null && other.X != null &&
                     X.SequenceEqual(other.X)
                 ) &&
                 (
                     Equals(Y, other.Y) ||
                     Y != null && other.Y != null &&
                     Y.SequenceEqual(other.Y)
                 ) &&
                 (
                     Equals(XY, other.XY) ||
                     XY != null && other.XY != null &&
                     XY.SequenceEqual(other.XY)
                 ) &&
                 (
                     Equals(Indices, other.Indices) ||
                     Indices != null && other.Indices != null &&
                     Indices.SequenceEqual(other.Indices)
                 ) &&
                 (
                     Equals(XBounds, other.XBounds) ||
                     XBounds != null && other.XBounds != null &&
                     XBounds.SequenceEqual(other.XBounds)
                 ) &&
                 (
                     Equals(YBounds, other.YBounds) ||
                     YBounds != null && other.YBounds != null &&
                     YBounds.SequenceEqual(other.YBounds)
                 ) &&
                 (
                     Text == other.Text ||
                     Text != null &&
                     Text.Equals(other.Text)
                 ) &&
                 (
                     Equals(TextArray, other.TextArray) ||
                     TextArray != null && other.TextArray != null &&
                     TextArray.SequenceEqual(other.TextArray)
                 ) &&
                 (
                     Marker == other.Marker ||
                     Marker != null &&
                     Marker.Equals(other.Marker)
                 ) &&
                 (
                     XAxis == other.XAxis ||
                     XAxis != null &&
                     XAxis.Equals(other.XAxis)
                 ) &&
                 (
                     YAxis == other.YAxis ||
                     YAxis != null &&
                     YAxis.Equals(other.YAxis)
                 ) &&
                 (
                     IdsSrc == other.IdsSrc ||
                     IdsSrc != null &&
                     IdsSrc.Equals(other.IdsSrc)
                 ) &&
                 (
                     CustomDataSrc == other.CustomDataSrc ||
                     CustomDataSrc != null &&
                     CustomDataSrc.Equals(other.CustomDataSrc)
                 ) &&
                 (
                     MetaSrc == other.MetaSrc ||
                     MetaSrc != null &&
                     MetaSrc.Equals(other.MetaSrc)
                 ) &&
                 (
                     HoverInfoSrc == other.HoverInfoSrc ||
                     HoverInfoSrc != null &&
                     HoverInfoSrc.Equals(other.HoverInfoSrc)
                 ) &&
                 (
                     XSrc == other.XSrc ||
                     XSrc != null &&
                     XSrc.Equals(other.XSrc)
                 ) &&
                 (
                     YSrc == other.YSrc ||
                     YSrc != null &&
                     YSrc.Equals(other.YSrc)
                 ) &&
                 (
                     XYSrc == other.XYSrc ||
                     XYSrc != null &&
                     XYSrc.Equals(other.XYSrc)
                 ) &&
                 (
                     IndicesSrc == other.IndicesSrc ||
                     IndicesSrc != null &&
                     IndicesSrc.Equals(other.IndicesSrc)
                 ) &&
                 (
                     XBoundsSrc == other.XBoundsSrc ||
                     XBoundsSrc != null &&
                     XBoundsSrc.Equals(other.XBoundsSrc)
                 ) &&
                 (
                     YBoundsSrc == other.YBoundsSrc ||
                     YBoundsSrc != null &&
                     YBoundsSrc.Equals(other.YBoundsSrc)
                 ) &&
                 (
                     TextSrc == other.TextSrc ||
                     TextSrc != null &&
                     TextSrc.Equals(other.TextSrc)
                 ));
        }
Пример #34
0
    static void Main()
    {
        XY xy = new XY(1, 2);

        Console.WriteLine(xy.X + "," + xy.Y);
    }
Пример #35
0
        public void Manhattan_ComputedCorrectly(int x1, int y1, int x2, int y2, int expected)
        {
            var actual = new XY(x1, y1).Manhattan(new XY(x2, y2));

            Assert.Equal(expected, actual);
        }
Пример #36
0
 public float DistanceTo(XY tarGet)
 {
     return(DistanceTo(tarGet, false));
 }
Пример #37
0
 public WaterStreamBuilder(XY sourceLocation, ClayMap clayMap)
 {
     this.sourceLocation = sourceLocation;
     this.clayMap        = clayMap;
 }
Пример #38
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;

            lp.lam = lp.phi = 0;

            if (Math.Abs(xy.x) < EPSILON && Math.Abs(xy.y) < EPSILON)
            {
                return(lp);
            }

            int    iter, round = 0;
            double x, y, dp, dl;

            // intial values for Newton-Raphson method
            lp.lam = xy.x;
            lp.phi = xy.y;

            do
            {
                iter = 0;
                do
                {
                    double sl = Math.Sin(lp.lam * 0.5);
                    double cl = Math.Cos(lp.lam * 0.5);
                    double sp = Math.Sin(lp.phi);
                    double cp = Math.Cos(lp.phi);

                    double d = cp * cl;
                    double c = 1.0 - d * d;
                    d = Math.Acos(d) / Math.Pow(c, 1.5);

                    double f1  = 2.0 * d * c * cp * sl;
                    double f2  = d * c * sp;
                    double f1p = 2.0 * (sl * cl * sp * cp / c - d * sp * sl);
                    double f1l = cp * cp * sl * sl / c + d * cp * cl * sp * sp;
                    double f2p = sp * sp * cl / c + d * sl * sl * cp;
                    double f2l = 0.5 * (sp * cp * sl / c - d * sp * cp * cp * sl * cl);

                    if (mode)                    // Winkel Tripel
                    {
                        f1   = 0.5 * (f1 + lp.lam * cosphi1);
                        f2   = 0.5 * (f2 + lp.phi);
                        f1p *= 0.5;
                        f1l  = 0.5 * (f1l + cosphi1);
                        f2p  = 0.5 * (f2p + 1.0);
                        f2l *= 0.5;
                    }

                    f1 -= xy.x;
                    f2 -= xy.y;

                    dp = f1p * f2l - f2p * f1l;
                    dl = (f2 * f1p - f1 * f2p) / dp;
                    dp = (f1 * f2l - f2 * f1l) / dp;

                    // set to interval [-π, π]
                    while (dl > Math.PI)
                    {
                        dl -= Math.PI;
                    }
                    while (dl < -Math.PI)
                    {
                        dl += Math.PI;
                    }

                    lp.lam -= dl;
                    lp.phi -= dp;
                } while((Math.Abs(dp) > EPSILON || Math.Abs(dl) > EPSILON) && iter++ < MAXITER);

                // correct if symmetrical solution for Aitoff
                if (lp.phi > HALFPI)
                {
                    lp.phi -= 2.0 * (lp.phi - HALFPI);
                }
                if (lp.phi < -HALFPI)
                {
                    lp.phi -= 2.0 * (lp.phi + HALFPI);
                }

                // if pole in Aitoff, return longitude of 0
                if ((Math.Abs(Math.Abs(lp.phi) - HALFPI) < EPSILON) && !mode)
                {
                    lp.lam = 0.0;
                }

                // calculate x, y coordinates with solution obtained
                double C = 0.5 * lp.lam;
                double D = Math.Acos(Math.Cos(lp.phi) * Math.Cos(C));

                if (D != 0)              // Aitoff
                {
                    y  = 1.0 / Math.Sin(D);
                    x  = 2.0 * D * Math.Cos(lp.phi) * Math.Sin(C) * y;
                    y *= D * Math.Sin(lp.phi);
                }
                else
                {
                    x = y = 0;
                }

                if (mode)                // Winkel Tripel
                {
                    x = (x + lp.lam * cosphi1) * 0.5;
                    y = (y + lp.phi) * 0.5;
                }

                // if too far from given values of x, y, repeat with better approximation of phi, lam
            } while((Math.Abs(xy.x - x) > EPSILON || Math.Abs(xy.y - y) > EPSILON) && round++ < MAXROUND);

            if (iter == MAXITER && round == MAXROUND)
            {
                Proj.pj_log(ctx, PJ_LOG.ERROR, "Warning: Accuracy of 1e-12 not reached. Last increments: dlat={0} and dlon={0}", dp, dl);
            }

            return(lp);
        }
Пример #39
0
        private void button1_Click(object sender, EventArgs e)
        {
            String[] infoY;

            double[] space;
            double   spaceMax;
            double   spaceMin;

            double[]   runtimes;
            double[]   stoptimes;
            double[]   downtimes;
            double     spaceExtra;
            double     proportionY;
            int        mulit;
            int        Xview;
            int        sLength;
            bool       flag = true;//用来选择加哪一个时间
            float      X, Y;
            double     sumX = 0, sumY = 0;
            XY         xy;
            IList <XY> mList = new List <XY>(); //上行
            IList <XY> dList = new List <XY>(); //下行



            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.FileName = null;
            openFileDialog1.Filter   = "Excel2007~2013文件(.xlsx)|*xlsx|Excel97~2003文件(.xls)|*.xls";

            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DataTable dt = excelControl.datafromexceltable("sevenData", openFileDialog1);

            dataGridView1.DataSource = dt;
            infoY       = dataY(dt);
            space       = spaceY(dt);
            spaceMax    = space.Max();
            spaceMin    = space.Min();
            spaceExtra  = spaceMax - spaceMin;
            proportionY = 750 / spaceExtra;//比例值


            runtimes  = runtime(dt);
            stoptimes = stoptime(dt);
            downtimes = downtime(dt);
            Array.Reverse(runtimes);
            Array.Reverse(stoptimes);



            Graphics g = this.CreateGraphics();

            g.Clear(this.BackColor);
            ColorName colorName  = (ColorName)comboBox1.SelectedItem;
            Brush     brush      = new SolidBrush(colorName.Color);
            Pen       mypenBlue  = new Pen(brush, 1);       //线条
            Pen       mypenGreen = new Pen(Color.Green, 1); //线条
            Pen       mypenRed   = new Pen(Color.Red, 1);   //线条
            Pen       mypenDash  = new Pen(Color.Gray, 1);  //线条

            mypenDash.DashStyle   = System.Drawing.Drawing2D.DashStyle.Custom;
            mypenDash.DashPattern = new float[] { 5, 5 };
            //设置字体颜色
            Font font = new System.Drawing.Font("Arial", 9, FontStyle.Regular);
            //绘制横向线条
            Space SpaceMultile = (Space)comboBox2.SelectedItem;

            mulit = SpaceMultile.Multiple;


            IList <int> XList = new List <int>();
            int         b     = 0;

            for (int i = 0; i < 2 * runtimes.Length; i++)
            {
                b = b + 10;
                XList.Add(b);
            }


            float y = 50;

            for (int i = 0; i < infoY.Length; i++)
            {
                if (i > 0)
                {
                    y = y + (float)(proportionY * (space[i - 1] - space[i]));
                }
                g.DrawLine(mypenBlue, 80, y, 80 + XList.Count * 40, y);
                //y轴上对应的标记
                g.DrawString(infoY[i].ToString(), font, Brushes.Green, 10, y - 5); //设置文字内容及输出位置
            }

            //绘制纵向线条
            float x = 120;

            for (int i = 0; i < XList.Count; i++)
            {
                g.DrawLine(mypenBlue, x, 50, x, y);
                x = x + 40;
            }
            x = 80;
            for (int i = 0; i < XList.Count * 5; i++)
            {
                g.DrawLine(mypenDash, x, 50, x, y);
                x = x + 8;
            }



            //x轴上对应的标记
            x = 110;


            for (int i = 0; i < XList.Count; i++)
            {
                Xview = mulit * XList[i];
                g.DrawString(Xview.ToString(), font, Brushes.Green, x, y); //设置文字内容及输出位置

                x = x + 40;
            }


            ////y轴上对应的标记
            //y = 50;
            //for (int i = 0; i < infoY.Length; i++)
            //{

            //    y = y + 15;
            //}


            PointF startPoint      = new PointF(80, y);
            PointF endPointX       = new PointF(x + 40, y);
            PointF endPointY       = new PointF(80, 20);
            PointF endPointXtop    = new PointF(x + 20, y - 10);
            PointF endPointXbottom = new PointF(x + 20, y + 10);
            PointF endPointYtop    = new PointF(70, 40);
            PointF endPointYbottom = new PointF(90, 40);

            //X轴
            g.DrawLine(mypenGreen, startPoint, endPointX);
            g.DrawLine(mypenGreen, endPointX, endPointXtop);
            g.DrawLine(mypenGreen, endPointX, endPointXbottom);
            g.DrawString("(t/s)", font, Brushes.Green, x + 20, y + 10);

            //Y轴
            g.DrawLine(mypenGreen, startPoint, endPointY);
            g.DrawLine(mypenGreen, endPointY, endPointYtop);
            g.DrawLine(mypenGreen, endPointY, endPointYbottom);
            g.DrawString("(s/km)", font, Brushes.Green, 30, 25);

            //组装上行数据
            sLength = stoptimes.Length + runtimes.Length;
            Array.Reverse(space);
            for (int i = 1; i <= sLength - 2; i++)
            {
                if (flag)
                {
                    sumX = sumX + runtimes[(i + 1) / 2];
                    sumY = space[(i + 1) / 2];
                    flag = false;
                }
                else
                {
                    sumX = sumX + stoptimes[i / 2];
                    flag = true;
                }
                X  = (float)(sumX * 40 / (mulit * XList[0]) + 80);
                Y  = (float)(y - (sumY - spaceMin) * proportionY);
                xy = new XY(X, Y);
                mList.Add(xy);
            }

            PointF[] points = new PointF[mList.Count + 1];
            points[0] = new PointF(80, y);


            for (int i = 0; i < mList.Count; i++)
            {
                points[i + 1] = new PointF(Convert.ToSingle(mList[i].X), Convert.ToSingle(mList[i].Y));
            }

            g.DrawLines(mypenRed, points);


            //组装下行数据、
            sLength = stoptimes.Length + downtimes.Length;
            Array.Reverse(space);
            Array.Reverse(stoptimes);
            flag = true;
            for (int i = 1; i <= sLength - 2; i++)
            {
                if (flag)
                {
                    sumX = sumX + downtimes[(i + 1) / 2];
                    sumY = space[(i + 1) / 2];
                    flag = false;
                }
                else
                {
                    sumX = sumX + stoptimes[i / 2];
                    flag = true;
                }
                X  = (float)(sumX * 40 / (mulit * XList[0]) + 80);
                Y  = (float)(y - (sumY - spaceMin) * proportionY);
                xy = new XY(X, Y);
                dList.Add(xy);
            }

            PointF[] pointDowns = new PointF[dList.Count + 1];
            pointDowns[0] = points[points.Length - 1];


            for (int i = 0; i < dList.Count; i++)
            {
                pointDowns[i + 1] = new PointF(Convert.ToSingle(dList[i].X), Convert.ToSingle(dList[i].Y));
            }

            g.DrawLines(mypenRed, pointDowns);
            pointDowns = null;
            points     = null;
        }
 public void PutFloor(XY xy)
 {
     PutFloor(xy.X, xy.Y);
 }
Пример #41
0
 public DownLeftTurnTrack(XY location) : base(location)
 {
 }
Пример #42
0
        public override Cart TurnCart(Cart cart)
        {
            var newDirection = new XY(-cart.Direction.Y, -cart.Direction.X);

            return(cart.TurnInDirection(newDirection));
        }
Пример #43
0
 public void Sine(XY p, int t)
 {
     throw new NotImplementedException();
 }
Пример #44
0
 private bool IsLocationEmpty(XY location, WaterStream stream)
 {
     return(!clayMap.IsClayAtLocation(location) && !stream.HasWaterAtLocation(location));
 }
Пример #45
0
 public CircleBase(XY center, int radius)
 {
     Center = center;
     Radius = radius;
 }
 public LayerBuilder(XY size)
 {
     _layer = new FacilityLayer(size.X, size.Y);
 }
Пример #47
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (ShowLegend != null)
         {
             hashCode = hashCode * 59 + ShowLegend.GetHashCode();
         }
         if (LegendGroup != null)
         {
             hashCode = hashCode * 59 + LegendGroup.GetHashCode();
         }
         if (Opacity != null)
         {
             hashCode = hashCode * 59 + Opacity.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (UId != null)
         {
             hashCode = hashCode * 59 + UId.GetHashCode();
         }
         if (Ids != null)
         {
             hashCode = hashCode * 59 + Ids.GetHashCode();
         }
         if (CustomData != null)
         {
             hashCode = hashCode * 59 + CustomData.GetHashCode();
         }
         if (Meta != null)
         {
             hashCode = hashCode * 59 + Meta.GetHashCode();
         }
         if (MetaArray != null)
         {
             hashCode = hashCode * 59 + MetaArray.GetHashCode();
         }
         if (HoverInfo != null)
         {
             hashCode = hashCode * 59 + HoverInfo.GetHashCode();
         }
         if (HoverInfoArray != null)
         {
             hashCode = hashCode * 59 + HoverInfoArray.GetHashCode();
         }
         if (HoverLabel != null)
         {
             hashCode = hashCode * 59 + HoverLabel.GetHashCode();
         }
         if (Stream != null)
         {
             hashCode = hashCode * 59 + Stream.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         if (X != null)
         {
             hashCode = hashCode * 59 + X.GetHashCode();
         }
         if (Y != null)
         {
             hashCode = hashCode * 59 + Y.GetHashCode();
         }
         if (XY != null)
         {
             hashCode = hashCode * 59 + XY.GetHashCode();
         }
         if (Indices != null)
         {
             hashCode = hashCode * 59 + Indices.GetHashCode();
         }
         if (XBounds != null)
         {
             hashCode = hashCode * 59 + XBounds.GetHashCode();
         }
         if (YBounds != null)
         {
             hashCode = hashCode * 59 + YBounds.GetHashCode();
         }
         if (Text != null)
         {
             hashCode = hashCode * 59 + Text.GetHashCode();
         }
         if (TextArray != null)
         {
             hashCode = hashCode * 59 + TextArray.GetHashCode();
         }
         if (Marker != null)
         {
             hashCode = hashCode * 59 + Marker.GetHashCode();
         }
         if (XAxis != null)
         {
             hashCode = hashCode * 59 + XAxis.GetHashCode();
         }
         if (YAxis != null)
         {
             hashCode = hashCode * 59 + YAxis.GetHashCode();
         }
         if (IdsSrc != null)
         {
             hashCode = hashCode * 59 + IdsSrc.GetHashCode();
         }
         if (CustomDataSrc != null)
         {
             hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
         }
         if (MetaSrc != null)
         {
             hashCode = hashCode * 59 + MetaSrc.GetHashCode();
         }
         if (HoverInfoSrc != null)
         {
             hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode();
         }
         if (XSrc != null)
         {
             hashCode = hashCode * 59 + XSrc.GetHashCode();
         }
         if (YSrc != null)
         {
             hashCode = hashCode * 59 + YSrc.GetHashCode();
         }
         if (XYSrc != null)
         {
             hashCode = hashCode * 59 + XYSrc.GetHashCode();
         }
         if (IndicesSrc != null)
         {
             hashCode = hashCode * 59 + IndicesSrc.GetHashCode();
         }
         if (XBoundsSrc != null)
         {
             hashCode = hashCode * 59 + XBoundsSrc.GetHashCode();
         }
         if (YBoundsSrc != null)
         {
             hashCode = hashCode * 59 + YBoundsSrc.GetHashCode();
         }
         if (TextSrc != null)
         {
             hashCode = hashCode * 59 + TextSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #48
0
 private const double Exp = 2;     // 2=euclid, 1=manhatten
 //Minkowski dist
 public static double Distance(XY a, XY b)
 {
     return(Math.Pow(Math.Pow(Math.Abs(a.X - b.X), Exp) +
                     Math.Pow(Math.Abs(a.Y - b.Y), Exp), 1.0 / Exp));
 }
 private void Button_Click_5(object sender, RoutedEventArgs e)
 {
     XY.Send("奇遇上传#" + JsonConvert.SerializeObject(Origin_Custom_Card.Adventure));
 }
 public Square(XY position, int squareSize)
 {
     Position = position;
     Size     = squareSize;
 }
Пример #51
0
        // spheroid
        LP s_inverse(XY xy)
        {
            LP lp;

            lp.lam = lp.phi = 0;

            double y90 = dy0 + Math.Sqrt(2);         // lt=90 corresponds to y=y0+sqrt(2)

            int z = 0;

            if (xy.y > y90 + EPSLN || xy.y < -y90 + EPSLN)
            {
                z = 0;                                          // 0
            }
            else if (xy.y >= d4044118)
            {
                z = (xy.x <= -d40?1:2);                             // 1|2
            }
            else if (xy.y >= 0)
            {
                z = (xy.x <= -d40?3:4);                      // 3|4
            }
            else if (xy.y >= -d4044118)
            {             // 5|6|7|8
                if (xy.x <= -d100)
                {
                    z = 5;                           // 5
                }
                else if (xy.x <= -d20)
                {
                    z = 6;                               // 6
                }
                else if (xy.x <= d80)
                {
                    z = 7;                              // 7
                }
                else
                {
                    z = 8;                // 8
                }
            }
            else
            {             // 9|10|11|12
                if (xy.x <= -d100)
                {
                    z = 9;                           // 9
                }
                else if (xy.x <= -d20)
                {
                    z = 10;                               // 10
                }
                else if (xy.x <= d80)
                {
                    z = 11;                              // 11
                }
                else
                {
                    z = 12;                // 12
                }
            }

            if (z != 0)
            {
                bool ok = false;

                xy.x   -= pj[z - 1].x0;
                xy.y   -= pj[z - 1].y0;
                lp      = pj[z - 1].inv(xy);
                lp.lam += pj[z - 1].lam0;

                switch (z)
                {
                case 1: ok = (lp.lam >= -d180 - EPSLN && lp.lam <= -d40 + EPSLN) || ((lp.lam >= -d40 - EPSLN && lp.lam <= -d10 + EPSLN) &&
                                                                                     (lp.phi >= d60 - EPSLN && lp.phi <= d90 + EPSLN)); break;

                case 2: ok = (lp.lam >= -d40 - EPSLN && lp.lam <= d180 + EPSLN) || ((lp.lam >= -d180 - EPSLN && lp.lam <= -d160 + EPSLN) &&
                                                                                    (lp.phi >= d50 - EPSLN && lp.phi <= d90 + EPSLN)) || ((lp.lam >= -d50 - EPSLN && lp.lam <= -d40 + EPSLN) &&
                                                                                                                                          (lp.phi >= d60 - EPSLN && lp.phi <= d90 + EPSLN)); break;

                case 3: ok = (lp.lam >= -d180 - EPSLN && lp.lam <= -d40 + EPSLN); break;

                case 4: ok = (lp.lam >= -d40 - EPSLN && lp.lam <= d180 + EPSLN); break;

                case 5: ok = (lp.lam >= -d180 - EPSLN && lp.lam <= -d100 + EPSLN); break;

                case 6: ok = (lp.lam >= -d100 - EPSLN && lp.lam <= -d20 + EPSLN); break;

                case 7: ok = (lp.lam >= -d20 - EPSLN && lp.lam <= d80 + EPSLN); break;

                case 8: ok = (lp.lam >= d80 - EPSLN && lp.lam <= d180 + EPSLN); break;

                case 9: ok = (lp.lam >= -d180 - EPSLN && lp.lam <= -d100 + EPSLN); break;

                case 10: ok = (lp.lam >= -d100 - EPSLN && lp.lam <= -d20 + EPSLN); break;

                case 11: ok = (lp.lam >= -d20 - EPSLN && lp.lam <= d80 + EPSLN); break;

                case 12: ok = (lp.lam >= d80 - EPSLN && lp.lam <= d180 + EPSLN); break;
                }

                z = (!ok?0:z);               // projectable?
            }
            //if(z==0) { Proj.pj_ctx_set_errno(ctx, -15); return null; } // invalid x or y
            if (z == 0)
            {
                lp.lam = Libc.HUGE_VAL;
            }
            if (z == 0)
            {
                lp.phi = Libc.HUGE_VAL;
            }
            return(lp);
        }
Пример #52
0
 public RocketSpawner(XY p)
 {
     _p = p;
 }
Пример #53
0
 static Text()
 {
     indexer['A']  = new XY(0, 0);
     indexer['B']  = new XY(1, 0, 6);
     indexer['C']  = new XY(2, 0);
     indexer['D']  = new XY(3, 0, 5);
     indexer['E']  = new XY(4, 0, 6);
     indexer['F']  = new XY(5, 0, 6);
     indexer['G']  = new XY(6, 0);
     indexer['H']  = new XY(7, 0, 5);
     indexer['I']  = new XY(0, 1, 6);
     indexer['J']  = new XY(1, 1, 5);
     indexer['K']  = new XY(2, 1, 6);
     indexer['L']  = new XY(3, 1, 7);
     indexer['M']  = new XY(4, 1);
     indexer['N']  = new XY(5, 1);
     indexer['O']  = new XY(6, 1);
     indexer['P']  = new XY(7, 1, 5);
     indexer['Q']  = new XY(0, 2);
     indexer['R']  = new XY(1, 2, 5);
     indexer['S']  = new XY(2, 2, 5);
     indexer['T']  = new XY(3, 2);
     indexer['U']  = new XY(4, 2);
     indexer['V']  = new XY(5, 2);
     indexer['W']  = new XY(6, 2);
     indexer['X']  = new XY(7, 2);
     indexer['Y']  = new XY(0, 3);
     indexer['Z']  = new XY(1, 3);
     indexer['a']  = new XY(2, 3, 6);
     indexer['b']  = new XY(3, 3, 6);
     indexer['c']  = new XY(4, 3, 7);
     indexer['d']  = new XY(5, 3, 6);
     indexer['e']  = new XY(6, 3, 7);
     indexer['f']  = new XY(7, 3, 7);
     indexer['g']  = new XY(0, 4, 7);
     indexer['h']  = new XY(1, 4, 7);
     indexer['i']  = new XY(2, 4, 10);
     indexer['j']  = new XY(3, 4, 9);
     indexer['k']  = new XY(4, 4, 8);
     indexer['l']  = new XY(5, 4, 11);
     indexer['m']  = new XY(6, 4, 6);
     indexer['n']  = new XY(7, 4, 7);
     indexer['o']  = new XY(0, 5, 6);
     indexer['p']  = new XY(1, 5, 6);
     indexer['q']  = new XY(2, 5, 5);
     indexer['r']  = new XY(3, 5, 8);
     indexer['s']  = new XY(4, 5, 8);
     indexer['t']  = new XY(5, 5, 8);
     indexer['u']  = new XY(6, 5, 7);
     indexer['v']  = new XY(7, 5, 6);
     indexer['w']  = new XY(0, 6);
     indexer['x']  = new XY(1, 6, 8);
     indexer['y']  = new XY(2, 6, 8);
     indexer['z']  = new XY(3, 6, 8);
     indexer['.']  = new XY(4, 6, 11);
     indexer[',']  = new XY(5, 6, 11);
     indexer['!']  = new XY(6, 6, 11);
     indexer['?']  = new XY(7, 6, 6);
     indexer['"']  = new XY(0, 7, 8);
     indexer['\''] = new XY(1, 7, 11);
     indexer['(']  = new XY(2, 7, 10);
     indexer[')']  = new XY(3, 7, 10);
     indexer['/']  = new XY(4, 7, 8);
     indexer['\\'] = new XY(5, 7, 8);
     indexer[';']  = new XY(6, 7, 11);
     indexer[':']  = new XY(7, 7, 11);
     indexer['1']  = new XY(0, 8, 8);
     indexer['2']  = new XY(1, 8, 6);
     indexer['3']  = new XY(2, 8, 6);
     indexer['4']  = new XY(3, 8, 5);
     indexer['5']  = new XY(4, 8, 6);
     indexer['6']  = new XY(5, 8, 6);
     indexer['7']  = new XY(6, 8, 6);
     indexer['8']  = new XY(7, 8, 6);
     indexer['9']  = new XY(0, 9, 6);
     indexer['0']  = new XY(1, 9);
     indexer['+']  = new XY(2, 9);
     indexer['-']  = new XY(3, 9);
     indexer['=']  = new XY(4, 9);
     indexer['[']  = new XY(5, 9, 9);
     indexer[']']  = new XY(6, 9, 9);
     indexer['{']  = new XY(7, 9, 7);
     indexer['}']  = new XY(0, 10, 7);
     indexer['%']  = new XY(1, 10, 2);
     indexer['<']  = new XY(2, 10, 7);
     indexer['>']  = new XY(3, 10, 7);
     indexer['&']  = new XY(4, 10);
     indexer['$']  = new XY(5, 10, 7);
     indexer['#']  = new XY(6, 10, 1);
     indexer['^']  = new XY(7, 10, 6);
     indexer['*']  = new XY(0, 11, 8);
     indexer['_']  = new XY(1, 11);
     indexer['☺']  = new XY(2, 11);
     indexer['☻']  = new XY(3, 11);
     indexer['♥']  = new XY(4, 11);
     indexer['♦']  = new XY(5, 11);
     indexer['♣']  = new XY(6, 11);
     indexer['♠']  = new XY(7, 11);
     indexer['•']  = new XY(0, 12);
     indexer['◘']  = new XY(1, 12);
     indexer['○']  = new XY(2, 12);
     indexer['◙']  = new XY(3, 12);
     indexer['♂']  = new XY(4, 12);
     indexer['♀']  = new XY(5, 12);
     indexer['♪']  = new XY(6, 12);
     indexer['♫']  = new XY(7, 12);
     indexer[' ']  = new XY(7, 15, 8);
 }
Пример #54
0
 public SquareShape(XY topLeft, double sideLength, double tilt = 0)
     : base(topLeft, sideLength, sideLength, tilt)
 {
 }
Пример #55
0
            public static bool DistWithin(XY a, XY b, double d)
            {
                var dist = Distance(a, b);

                return(dist < d);
            }
Пример #56
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     XY.Send_To_Server("获取奇遇");
 }
Пример #57
0
 .Select(i => new Light(XY.Parse(i.positionInput, ','), XY.Parse(i.velocityInput, ',')))
 .ToArray();
 public void PutFloor(XY start, XY end)
 {
     start.Thru(end).ForEach(PutFloor);
 }
Пример #59
0
 public static XY Round(XY xy)
 {
     return(new XY(Mathf.RoundToInt(xy.x), Mathf.RoundToInt(xy.y)));
 }
Пример #60
0
 public RashkaOpenerNonspell(XY p)
 {
     _p      = p;
     _angle  = Mathf.PI / 2;
     _angle2 = -Mathf.PI / 2 + Mathf.PI / 36;
 }