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


C# IntPoint.GetLineSide方法代码示例

本文整理汇总了C#中IntPoint.GetLineSide方法的典型用法代码示例。如果您正苦于以下问题:C# IntPoint.GetLineSide方法的具体用法?C# IntPoint.GetLineSide怎么用?C# IntPoint.GetLineSide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IntPoint的用法示例。


在下文中一共展示了IntPoint.GetLineSide方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoesLineCrossBoundery

		private bool DoesLineCrossBoundery(IntPoint startPoint, IntPoint endPoint)
		{
			for (int bounderyIndex = 0; bounderyIndex < bounderyPolygons.Count; bounderyIndex++)
			{
				Polygon boundryPolygon = bounderyPolygons[bounderyIndex];
				if (boundryPolygon.Count < 1)
				{
					continue;
				}

				IntPoint lastPosition = boundryPolygon[boundryPolygon.Count - 1];
				for (int pointIndex = 0; pointIndex < boundryPolygon.Count; pointIndex++)
				{
					IntPoint currentPosition = boundryPolygon[pointIndex];
					int startSide = startPoint.GetLineSide(lastPosition, currentPosition);
					int endSide = endPoint.GetLineSide(lastPosition, currentPosition);
					if (startSide != 0)
					{
						if (startSide + endSide == 0)
						{
							// each point is distinctly on a different side
							return true;
						}
					}
					else
					{
						// if we terminate on the line that will count as crossing
						return true;
					}
					
					if (endSide == 0)
					{
						// if we terminate on the line that will count as crossing
						return true;
					}

					lastPosition = currentPosition;
				}
			}
			return false;
		}
开发者ID:broettge,项目名称:MatterSlice,代码行数:41,代码来源:AvoidCrossingPerimeters.cs


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