当前位置: 首页>>代码示例>>C#>>正文


C# IPoint2D类代码示例

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


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


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