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


C# Vertices.forceCounterClockWise方法代码示例

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


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

示例1: setVerticesNoCopy

		/// <summary>
		/// sets the vertices without copying over the data from verts to the local List.
		/// </summary>
		/// <param name="verts">Verts.</param>
		public void setVerticesNoCopy( Vertices verts )
		{
			Debug.Assert( verts.Count >= 3 && verts.Count <= Settings.maxPolygonVertices );
			_vertices = verts;

			if( Settings.useConvexHullPolygons )
			{
				// FPE note: This check is required as the GiftWrap algorithm early exits on triangles
				// So instead of giftwrapping a triangle, we just force it to be clock wise.
				if( _vertices.Count <= 3 )
					_vertices.forceCounterClockWise();
				else
					_vertices = GiftWrap.getConvexHull( _vertices );
			}

			if( _normals == null )
				_normals = new Vertices( _vertices.Count );
			else
				_normals.Clear();

			// Compute normals. Ensure the edges have non-zero length.
			for( var i = 0; i < _vertices.Count; ++i )
			{
				var next = i + 1 < _vertices.Count ? i + 1 : 0;
				var edge = _vertices[next] - _vertices[i];
				Debug.Assert( edge.LengthSquared() > Settings.epsilon * Settings.epsilon );

				// FPE optimization: Normals.Add(MathHelper.Cross(edge, 1.0f));
				var temp = new Vector2( edge.Y, -edge.X );
				temp.Normalize();
				_normals.Add( temp );
			}

			// Compute the polygon mass data
			computeProperties();
		}
开发者ID:prime31,项目名称:Nez,代码行数:40,代码来源:PolygonShape.cs


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