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


C# Turn.GetAngle方法代码示例

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


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

示例1: AssertConsistent

 private static void AssertConsistent(Basis basis, double angle, Turn turn)
 {
     var eps = Turn.OneTurnClockwise * 0.00001;
     Assert.IsTrue(basis.AngleToTurn(angle).Equals(turn, eps));
     Assert.IsTrue(Turn.FromAngle(angle, basis).Equals(turn, eps));
     Assert.AreEqual(basis.TurnToAngle(turn), angle, 0.00001);
     Assert.AreEqual(turn.GetAngle(basis), angle, 0.00001);
 }
开发者ID:Strilanc,项目名称:Angle,代码行数:8,代码来源:BasisTest.cs

示例2: TurnToAngle

 ///<summary>Returns the angle corresponding to a rotation by the given turn in this basis.</summary>
 public double TurnToAngle(Turn turn)
 {
     return turn.GetAngle(this);
 }
开发者ID:Strilanc,项目名称:Angle,代码行数:5,代码来源:Basis.cs

示例3: SetSortValues

        /// <summary>
        /// Assigns sort values to the supplied intersections (each sort value
        /// indicates the distance from the start of this line).
        /// </summary>
        /// <param name="data">The intersection data to update</param>
        internal override void SetSortValues(List<IntersectionData> data)
        {
            // Get the position of the centre of the circle for this curve,
            // along with the stored radius.
            IPosition centre = m_Circle.Center;
            double radius = m_Circle.Radius;

            // Define reference directions to the start and end of curve,
            // ordered clockwise.
            Turn start = new Turn(centre, First);
            Turn end = new Turn(centre, Second);

            // If we are dealing with a counter-clockwise curve, note
            // the total length of the curve. This is because the lengths
            // we will be calculating below are reckoned in a clockwise
            // direction.
            double crvlen = 0.0;
            if (!m_IsClockwise)
                crvlen = this.Length.Meters;

            // For each intersection, get the angle with respect to the start of the curve.

            double angle;		// Angle of the intersection.
            double angle2;		// Angle of 2nd intersection.

            // Figure out an angular tolerance for comparing bearings to the curve ends.
            //double angtol = Constants.XYTOL/radius;
            double angtol = 0.002/radius;

            foreach (IntersectionData xd in data)
            {
                // Get the angle to the first intersection (calculate with
                // respect to the end of curve, to check for an intersection
                // that is REAL close to the end).

                IPosition xpos = xd.P1;
                double xi = xpos.X;
                double yi = xpos.Y;

                if (end.GetAngleInRadians(xpos, angtol) < Constants.TINY)
                    angle = start.GetAngle(end);
                else
                    angle = start.GetAngleInRadians(xpos, angtol);

                // If we have a graze, process the 2nd intersection too.
                // If it's closer than the distance we already have, use
                // the second intersection as the sort value, and treat
                // it subsequently as the first intersection.

                if (xd.IsGraze)
                {
                    xpos = xd.P2;
                    xi = xpos.X;
                    yi = xpos.Y;

                    if (end.GetAngleInRadians(xpos, angtol) < Constants.TINY)
                        angle2 = start.GetAngle(end);
                    else
                        angle2 = start.GetAngleInRadians(xpos, angtol);

                    if (m_IsClockwise)
                    {
                        if (angle2 < angle)
                        {
                            xd.Reverse();
                            angle = angle2;
                        }
                    }
                    else
                    {
                        if (angle < angle2)
                        {
                            xd.Reverse();
                            angle = angle2;
                        }
                    }
                }

                // Set the sort value. For counterclockwise curves, remember
                // that the length is from the wrong end.
                double dset = angle*radius;
                if (dset < Constants.TINY)
                    dset = 0.0;
                if (!m_IsClockwise)
                    dset = crvlen-dset;
                xd.SortValue = dset;
            }
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:93,代码来源:ArcGeometry.cs


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