本文整理汇总了C#中XY类的典型用法代码示例。如果您正苦于以下问题:C# XY类的具体用法?C# XY怎么用?C# XY使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XY类属于命名空间,在下文中一共展示了XY类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: s_inverse
// 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: s_inverse
// 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: e_inverse
// 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;
}
示例4: GetScreenCorner
public Vector2 GetScreenCorner(XY screenCoord)
{
XYZ screenSize = GameData.World.Config.ScreenSize;
return new Vector2((float)screenCoord.X * screenSize.X,
(float)screenCoord.Y * screenSize.Z);
}
示例5: s_inverse
// 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;
}
示例6: inverse
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;
}
示例7: s_inverse
// 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;
}
示例8: calcdiff
// 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;
}
}
示例9: s_inverse
// 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;
}
示例10: ContainsPoint
// 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: CreateScreen
public void CreateScreen(XY screenCoord)
{
if(!IsValidScreenCoord(screenCoord)) return;
GameObject screenMesh = GenerateScreenMesh(screenCoord);
_screenMeshes[screenCoord] = screenMesh;
}
示例12: DestroyScreen
public void DestroyScreen(XY screenCoord)
{
if(!IsValidScreenCoord(screenCoord)) return;
Destroy(_screenMeshes[screenCoord]);
_screenMeshes.Remove(screenCoord);
}
示例13: GetScreenCenter
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: s_inverse
// 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: DefaultCell
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;
}