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


C# Angle.Cos方法代码示例

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


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

示例1: ComputeGeometry

		/// <summary>
		/// Computes the ellipse geometry.
		/// </summary>
		/// <remarks>
		/// This is based on the psuedocode in http://en.wikipedia.org/wiki/Ellipse.
		/// </remarks>
		public override void ComputeGeometry()
		{
			base.ComputeGeometry();
			
			if (Anchor2 == null)
				return;

			// allocate the points
			int N = ModelingOptions.Global.CircleDivs;
			if (solidPoints.Length != N)
			{
				solidPoints = new Vector[N];
				directions = new Vector[N];
			}

			// get the major and minor axes
			Vector x = Sketch.Plane.LocalX;
			Vector y = Sketch.Plane.LocalY;
			Vector center = Center.ToVector();
			double a = x.Dot(Anchor2.ToVector() - center);
			double b = y.Dot(Anchor2.ToVector() - center);
			
			// compute the locations of the points
			var sinbeta = Tilt.Sin();
			var cosbeta = Tilt.Cos();
			Angle theta = new Angle();
			Angle dTheta = Angle.TwoPi / (N-1);
			_bounds.Reset();
			for (int i = 0; i < N; i ++)
			{
				double dx = a * theta.Cos() * cosbeta - b * theta.Sin() * sinbeta;
				double dy = a * theta.Cos() * sinbeta + b * theta.Sin() * cosbeta;
				solidPoints[i] = center + x * dx + y * dy;
				_bounds.Resize(solidPoints[i]);
				theta += dTheta;
			}

			// generate the directions
			for (int i = 0; i < N; i++)
			{
				if (i == 0)
					directions[i] = (solidPoints[i+1] - solidPoints[N - 1]).Normalize();
				else if (i == N - 1)
					directions[i] = (solidPoints[0] - solidPoints[i - 1]).Normalize();
				else
					directions[i] = (solidPoints[i + 1] - solidPoints[i - 1]).Normalize();
			}

			// generate the wireframe points
			wireframePoints[0] = center + x * a;
			wireframePoints[1] = center + y * b;
			wireframePoints[2] = center - x * a;
			wireframePoints[3] = center - y * b;
		}
开发者ID:erisonliang,项目名称:monoworks,代码行数:60,代码来源:Ellipse.cs

示例2: Rotate

		/// <summary>
		/// Rotates the coord around the origina by the given angle.
		/// </summary>
		public Coord Rotate(Angle angle)
		{
			return new Coord(X * angle.Cos() - Y * angle.Sin(),
				X * angle.Sin() - Y * angle.Cos());
		}
开发者ID:erisonliang,项目名称:monoworks,代码行数:8,代码来源:Coord.cs


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