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


C# MyVector.GetAngleAroundAxis方法代码示例

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


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

示例1: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            MyVector v1 = new MyVector(1, 0, 0);
            MyVector v2 = new MyVector(0, 1, 0);

            MyVector rotationAxis;
            double radians;
            v1.GetAngleAroundAxis(out rotationAxis, out radians, v2);

            v2.GetAngleAroundAxis(out rotationAxis, out radians, v1);
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:11,代码来源:VectorTester.cs

示例2: FillPie

        public void FillPie(Brush brush, MyVector centerPoint, double radius, MyVector centerLine, double sweepRadians)
        {
            // Turn the centerline and sweep radians into angles that GDI likes
            MyVector dummy = new MyVector(1, 0, 0);
            double startDegrees;
            dummy.GetAngleAroundAxis(out dummy, out startDegrees, centerLine);
            startDegrees = Utility3D.GetRadiansToDegrees(startDegrees);

            if (centerLine.Y < 0)
            {
                startDegrees *= -1;
            }

            double sweepDegrees = Utility3D.GetRadiansToDegrees(sweepRadians);

            startDegrees -= sweepDegrees / 2d;

            // Call my overload
            FillPie(brush, centerPoint, radius, startDegrees, sweepDegrees);
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:20,代码来源:LargeMapViewer2D.cs

示例3: RotateMe

            private void RotateMe(MyVector localPos, MyVector rotateHandle, MyQuaternion rotation2D, MyVector rotateAround3D)
            {
                // Get Current Angle
                double curRadians = MyVector.GetAngleBetweenVectors(rotateHandle, rotation2D.GetRotatedVector(rotateHandle, true));

                // Rotate the 2D Handle
                MyQuaternion newRotationX;
                rotateHandle.GetAngleAroundAxis(out newRotationX, localPos);
                rotation2D.StoreNewValues(newRotationX);

                // Get New Angle
                double newRadians = MyVector.GetAngleBetweenVectors(rotateHandle, rotation2D.GetRotatedVector(rotateHandle, true));

                double rotateRadians = newRadians - curRadians;
                if (rotation2D.GetRotatedVector(rotateHandle, true).Y < 0) rotateRadians *= -1;		// This statement is cheating.  I'm using the fact that the rotate handles all lie on the XY plane

                // Apply the difference to the 3D object (me)
                this.RotateAroundAxis(this.Rotation.GetRotatedVector(rotateAround3D, true), rotateRadians);
            }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:19,代码来源:CollisionTester.cs

示例4: FindBlipsInCone

        private List<BallBlip> FindBlipsInCone(MyVector centerWorld, MyVector dirFacingWorld)
        {
            List<BallBlip> retVal = new List<BallBlip>();

            // Cache some stuff for use inside the loop
            double halfSweepAngle = _sweepAngle / 2d;
            double maxDistSquared = _maxDistance * _maxDistance;

            // Scan for objects in my path
            foreach (RadarBlip blip in _map.GetAllBlips())
            {
                if (blip.Token == _ship.Token)
                {
                    // Can't manipulate me
                    continue;
                }

                if (blip.CollisionStyle == CollisionStyle.Ghost)
                {
                    // Ghost blips don't interact with anything
                    continue;
                }

                if (!(blip is BallBlip))
                {
                    // The blip needs to be at least a ball
                    continue;
                }

                MyVector lineBetween = blip.Sphere.Position - centerWorld;
                if (lineBetween.GetMagnitudeSquared() > maxDistSquared)
                {
                    // The object is too far away
                    continue;
                }

                MyVector rotationAxis;
                double rotationRadians;
                dirFacingWorld.GetAngleAroundAxis(out rotationAxis, out rotationRadians, lineBetween);
                if (rotationRadians > halfSweepAngle)
                {
                    // The sweep angle is too great (not inside the cone)
                    continue;
                }

                // It's inside the cone
                retVal.Add(blip as BallBlip);
            }

            // Exit Function
            return retVal;
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:52,代码来源:TractorBeamCone.cs


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