本文整理汇总了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;
}
示例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();
}