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


C# Vector3d.Rotate方法代码示例

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


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

示例1: CalculateDesiredVelocity

    protected override Vector3d CalculateDesiredVelocity()
    {
      Vector3d desired = new Vector3d();
      int count = 0;
      double angle = 0;
      Point3d position = agent.Position;
      Vector3d velocity = agent.Velocity;
      Plane pl = new Plane(position, velocity, Vector3d.ZAxis);
      foreach (IQuelea neighbor in neighbors)
      {
        Point3d neighborPosition2D = agent.Environment.Wrap ? wrappedPositions[count] : neighbor.Position;
        Vector3d diff = Util.Vector.Vector2Point(position, neighborPosition2D);
        angle = Vector3d.VectorAngle(velocity, diff, pl);
        //angle = Util.Vector.RadToDeg(angle);
        if (angle > Math.PI) angle = angle - RS.TWO_PI;
        desired = desired + (Vector3d)neighborPosition2D;
        //For an average, we need to keep track of how many boids
        //are in our vision.
        count++;
      }

      if (count > 0)
      {
        //We desire to go in that direction at maximum speed.
        desired = desired / count;
        desired = Util.Agent.Seek(agent, new Point3d(desired));
        Plane nrml = new Plane(position, velocity);
        if (angle >= 0) desired.Rotate(Math.PI / 2, nrml.YAxis);
        else desired.Rotate(-Math.PI / 2, nrml.YAxis);
      }
      //Seek the average location of our neighbors.
      return desired;
    }
开发者ID:lxfschr,项目名称:Quelea,代码行数:33,代码来源:ViewForceComponent.cs

示例2: GetFeelerCrv

 //visionAngle in radians
 private static Curve GetFeelerCrv(Vector3d feelerVec, Point3d position,
                                   double bodySize, double visionAngle,
                                   Vector3d rotAxis)
 {
   feelerVec.Rotate(visionAngle, rotAxis);
   feelerVec = Vector3d.Multiply(feelerVec, bodySize);
   return new Line(position, feelerVec).ToNurbsCurve();
 }
开发者ID:lxfschr,项目名称:Quelea,代码行数:9,代码来源:AvoidObstacleForceComponent.cs


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