• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IPoint2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IPoint2D的典型用法代码示例。如果您正苦于以下问题:C# IPoint2D类的具体用法?C# IPoint2D怎么用?C# IPoint2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IPoint2D类属于命名空间,在下文中一共展示了IPoint2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DistanceSqrt

        public static double DistanceSqrt( IPoint2D from, IPoint2D to )
        {
            float xDelta = Math.Abs( from.X - to.X );
            float yDelta = Math.Abs( from.Y - to.Y );

            return Math.Sqrt( xDelta*xDelta + yDelta*yDelta );
        }
开发者ID:WildGenie,项目名称:Razor,代码行数:7,代码来源:Utility.cs


示例2: Distance

        public static int Distance( IPoint2D from, IPoint2D to )
        {
            int xDelta = Math.Abs( from.X - to.X );
            int yDelta = Math.Abs( from.Y - to.Y );

            return ( xDelta > yDelta ? xDelta : yDelta );
        }
开发者ID:WildGenie,项目名称:Razor,代码行数:7,代码来源:Utility.cs


示例3: Find

 public static NestArea Find(IPoint2D p)
 {
     foreach (NestArea area in m_Areas)
     {
         if (area.Contains(p))
             return area;
     }
     return null;
 }
开发者ID:FreeReign,项目名称:forkuo,代码行数:9,代码来源:NestArea.cs


示例4: Contains

 public bool Contains(IPoint2D p)
 {
     foreach (Rectangle2D rect in this.m_Rects)
     {
         if (rect.Contains(p))
             return true;
     }
     return false;
 }
开发者ID:Crome696,项目名称:ServUO,代码行数:9,代码来源:NestArea.cs


示例5: Contains

 public bool Contains(IPoint2D p)
 {
     foreach (var rect in m_Rects)
     {
         if (rect.Contains(p))
             return true;
     }
     return false;
 }
开发者ID:rokann,项目名称:JustUO,代码行数:9,代码来源:NestArea.cs


示例6: DistanceBetween

        /// <summary>
        /// Calculates the distance between two points
        /// </summary>
        /// <param name="origin">the starting point</param>
        /// <param name="target">the ending point</param>
        /// <returns>an integer of the distance between the origin and target</returns>
        public static int DistanceBetween( IPoint2D origin, IPoint2D target )
        {
            if( origin.X == target.X )
                return Math.Abs((origin.Y - target.Y));

            if( origin.Y == target.Y )
                return Math.Abs((origin.Y - target.Y));

            //pythagorean theorem... dist = sqrt of (x2-x1)^2 + (y2-y1)^2
            return (int)Math.Sqrt(Math.Pow(Math.Abs(target.X - origin.X), 2) + Math.Pow(Math.Abs(target.Y - origin.Y), 2));
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:17,代码来源:Util.cs


示例7: FindBoatAt

		public static BaseBoat FindBoatAt( IPoint2D loc, Map map )
		{
			Sector sector = map.GetSector( loc );

			for ( int i = 0; i < sector.Multis.Count; i++ )
			{
				BaseBoat boat = sector.Multis[i] as BaseBoat;

				if ( boat != null && boat.Contains( loc.X, loc.Y ) )
					return boat;
			}

			return null;
		}
开发者ID:PepeBiondi,项目名称:runsa,代码行数:14,代码来源:BaseBoat.cs


示例8: ConsumeJumpStamina

        private static bool ConsumeJumpStamina( Player pm, IPoint2D start, IPoint2D end )
        {
            double weightRatio = (pm.TotalWeight / pm.MaxWeight);
            int weightInducedLoss = (int)(5 * weightRatio);

            int dist = Util.DistanceBetween(start, end);
            int toConsume = (int)(dist * 5);
            toConsume += weightInducedLoss;

            if( (pm.Stam - toConsume) <= 0 )
                return false;

            pm.Stam -= toConsume;

            return true;
        }
开发者ID:ITLongwell,项目名称:Ulmeta,代码行数:16,代码来源:JumpCommand.cs


示例9: FindMultiAt

		public static BaseMulti FindMultiAt(IPoint2D loc, Map map)
		{
			Sector sector = map.GetSector(loc);

			for (int i = 0; i < sector.Multis.Count; i++)
			{
				BaseMulti multi = sector.Multis[i];

				if (multi != null && multi.Contains(loc.X, loc.Y))
				{
					return multi;
				}
			}

			return null;
		}
开发者ID:rokann,项目名称:JustUO,代码行数:16,代码来源:BaseMulti.cs


示例10: Contains

		public static bool Contains(IPoint2D p, IPoint2D a, IPoint2D b, IPoint2D c)
		{
			var x = p.X - a.X;
			var y = p.Y - a.Y;

			var delta = (b.X - a.X) * y - (b.Y - a.Y) * x > 0;

			if ((c.X - a.X) * y - (c.Y - a.Y) * x > 0 == delta)
			{
				return false;
			}

			if ((c.X - b.X) * (p.Y - b.Y) - (c.Y - b.Y) * (p.X - b.X) > 0 != delta)
			{
				return false;
			}

			return true;
		}
开发者ID:Ravenwolfe,项目名称:Core,代码行数:19,代码来源:Triangle2D.cs


示例11: GetLine2D

		/// <summary>
		///     Gets a Point2D collection representing all locations between 'start' and 'end', including 'start' and 'end', on the given 'map'.
		/// </summary>
		public static Point2D[] GetLine2D(this IPoint2D start, IPoint2D end, Map map)
		{
			var path = new List<Point2D>();

			Geometry.Line2D(ToPoint3D(start), ToPoint3D(end), map, (p, m) => path.Add(ToPoint2D(p)));

			var arr = path.OrderBy(p => GetDistance(start, p)).ToArray();

			path.Clear();
			path.TrimExcess();

			return arr;
		}
开发者ID:jasegiffin,项目名称:JustUO,代码行数:16,代码来源:GeoExt.cs


示例12: InSquareRange

 public bool InSquareRange(IPoint2D p, int xyRange)
 {
     return ((((this.m_X >= (p.X - xyRange)) && (this.m_X <= (p.X + xyRange))) && (this.m_Y >= (p.Y - xyRange))) && (this.m_Y <= (p.Y + xyRange)));
 }
开发者ID:Skinny1001,项目名称:PlayUO,代码行数:4,代码来源:Mobile.cs


示例13: Rectangle2D

		public Rectangle2D(IPoint2D start, IPoint2D end)
			: this(start.X, start.Y, end.X, end.Y) {
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:3,代码来源:Rectangle2D.cs


示例14: GetStaticTiles

		public static StaticTile[] GetStaticTiles(this Map map, IPoint2D p)
		{
			return map.Tiles.GetStaticTiles(p.X, p.Y);
		}
开发者ID:Ravenwolfe,项目名称:Core,代码行数:4,代码来源:MapExt.cs


示例15: HasLand

		public static bool HasLand(this Map map, IPoint2D p)
		{
			return !GetLandTile(map, p).Ignored;
		}
开发者ID:Ravenwolfe,项目名称:Core,代码行数:4,代码来源:MapExt.cs


示例16: GetAngle

		/// <summary>
		/// Returns the angle towards a target spot in degrees, clockwise
		/// </summary>
		/// <param name="tx">target x</param>
		/// <param name="ty">target y</param>
		/// <returns>the angle towards the spot</returns>
		public float GetAngle( IPoint2D point )
		{
			float headingDifference = ( GetHeading( point ) & 0xFFF ) - ( this.Heading & 0xFFF );

			if (headingDifference < 0)
				headingDifference += 4096.0f;

			return (headingDifference * 360.0f / 4096.0f);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:15,代码来源:GameObject.cs


示例17: GetDirection

		public static Direction GetDirection(this IPoint2D from, IPoint2D to)
		{
			int dx = to.X - from.X, dy = to.Y - from.Y, adx = Math.Abs(dx), ady = Math.Abs(dy);

			if (adx >= ady * 3)
			{
				if (dx > 0)
				{
					return Direction.East;
				}

				return Direction.West;
			}

			if (ady >= adx * 3)
			{
				if (dy > 0)
				{
					return Direction.South;
				}

				return Direction.North;
			}

			if (dx > 0)
			{
				if (dy > 0)
				{
					return Direction.Down;
				}

				return Direction.Right;
			}

			if (dy > 0)
			{
				return Direction.Left;
			}

			return Direction.Up;
		}
开发者ID:jasegiffin,项目名称:JustUO,代码行数:41,代码来源:GeoExt.cs


示例18: InRange

 public static bool InRange(IPoint2D from, IPoint2D to, int range)
 {
     return (from.X >= (to.X - range)) && (from.X <= (to.X + range)) && (from.Y >= (to.Y - range)) && (from.Y <= (to.Y + range));
 }
开发者ID:muratsu,项目名称:Poyyo-Fat-Client,代码行数:4,代码来源:SharedMethods.cs


示例19: Rotate2D

		public static Point2D Rotate2D(this IPoint2D from, IPoint2D to, int count)
		{
			int rx = from.X - to.X, ry = from.Y - to.Y;

			for (int i = 0; i < count; ++i)
			{
				int temp = rx;
				rx = -ry;
				ry = temp;
			}

			return new Point2D(to.X + rx, to.Y + ry);
		}
开发者ID:jasegiffin,项目名称:JustUO,代码行数:13,代码来源:GeoExt.cs


示例20: IsInHavenIsland

		public static bool IsInHavenIsland( IPoint2D loc )
		{
			return ( loc.X >= 3314 && loc.X <= 3814 && loc.Y >= 2345 && loc.Y <= 3095 );
		}
开发者ID:Leorgrium,项目名称:runuo,代码行数:4,代码来源:TreasureMap.cs



注:本文中的IPoint2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPoint3D类代码示例发布时间:2022-05-24
下一篇:
C# IPoint类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap