本文整理汇总了C#中Radian类的典型用法代码示例。如果您正苦于以下问题:C# Radian类的具体用法?C# Radian怎么用?C# Radian使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Radian类属于命名空间,在下文中一共展示了Radian类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestExplicitOperator
public void TestExplicitOperator()
{
var rad = new Radian(1.0f);
Assert.AreEqual((Radian)1.0f, rad);
Assert.AreEqual(1.0f, (float)rad);
}
示例2: SetCameraOrientation
public virtual void SetCameraOrientation(Radian roll, Radian yaw, Radian pitch)
{
_lastOrientation = new Quaternion(roll, Vector3.UNIT_Z)
* new Quaternion(yaw, Vector3.UNIT_Y)
* new Quaternion(pitch, Vector3.UNIT_X);
CameraOrientation = _lastOrientation;
}
示例3: MakeOrthoMatrix
public override void MakeOrthoMatrix( Radian fovy, Real aspectRatio, Real near, Real far, out Matrix4 dest,
bool forGpuPrograms )
{
var thetaY = fovy/2.0f;
var tanThetaY = Utility.Tan( thetaY );
var tanThetaX = tanThetaY*aspectRatio;
var half_w = tanThetaX*near;
var half_h = tanThetaY*near;
var iw = 1.0f/( half_w );
var ih = 1.0f/( half_h );
Real q = 0.0f;
if ( far != 0 )
{
q = 1.0/( far - near );
}
dest = Matrix4.Zero;
dest.m00 = iw;
dest.m11 = ih;
dest.m22 = q;
dest.m23 = -near/( far - near );
dest.m33 = 1;
if ( forGpuPrograms )
{
dest.m22 = -dest.m22;
}
}
示例4: MakeOrthoMatrix
public override void MakeOrthoMatrix(Radian fov, Real aspectRatio, Real near, Real far, out Matrix4 dest, bool forGpuPrograms)
{
float thetaY = Utility.DegreesToRadians(fov / 2.0f);
float tanThetaY = Utility.Tan(thetaY);
float tanThetaX = tanThetaY * aspectRatio;
float halfW = tanThetaX * near;
float halfH = tanThetaY * near;
var w = 1.0f / (halfW);
var h = 1.0f / (halfH);
var q = 0.0f;
if (far != 0)
{
q = 1.0f / (far - near);
}
dest = Matrix4.Zero;
dest.m00 = w;
dest.m11 = h;
dest.m22 = q;
dest.m23 = -near / (far - near);
dest.m33 = 1;
if (forGpuPrograms)
{
dest.m22 = -dest.m22;
}
}
示例5: SphericCameraMode
/**
* @param relativePositionToCameraTarget Default camera position with respecto to camera target
* @param autoResetTime If greater than zero the camera will be resetted to its initial position after the amount of seconds specified.
* @param resetDistance true for correcting the camera distance to the target when resetting. If false, the camera will maintaing the current distance to target.
* @param resetRotationFactor Speed factor for correcting the camera rotation when resetting.
* @param offset Offset applied to the center of the sphere.
*/
public SphericCameraMode(CameraControlSystem cam
, Vector3 relativePositionToCameraTarget
, float outerSphereRadius
, Vector3 offset
, Vector3 fixedAxis, float innerSphereRadius = 0.0f
, float autoResetTime = 3.0f
, bool resetDistance = true
, float resetRotationFactor = 1.0f)
: base(cam)
{
_relativePositionToCameraTarget = relativePositionToCameraTarget;
_outerSphereRadius = outerSphereRadius;
_innerSphereRadius = innerSphereRadius;
_autoResetTime = autoResetTime;
_resetDistance = resetDistance;
_resetRotationFactor = resetRotationFactor;
_offset = offset;
_fixedAxis = fixedAxis;
_resseting = false;
_LastRessetingDiff = new Radian(2.0f * Mogre.Math.PI);
if (innerSphereRadius > outerSphereRadius) { throw new Exception("Inner radious greater than outer radious"); }
if (innerSphereRadius > relativePositionToCameraTarget.Length
|| outerSphereRadius < relativePositionToCameraTarget.Length) {
throw new Exception("relativePositionToCameraTarget param value not valid.");
}
}
示例6: Euler
/// <summary>
/// Constructor to create a new Euler Angle struct from angle values.
/// The rotation will be applied in the order Yaw-Pitch- Roll, which are related to the axis order Y-X-Z.
/// </summary>
public Euler(Radian yaw, Radian pitch, Radian roll)
{
mYaw = yaw;
mPitch = pitch;
mRoll = roll;
mChanged = true;
mCachedQuaternion = Quaternion.IDENTITY;
}
示例7: CreateRotater
/// <summary>
/// Creates a Rotater. This removes any existing nlerpers and rotaters attached to the lthing.
/// </summary>
/// <param name="owner">What lthing are we affecting?</param>
/// <param name="duration">How long as we going to rotate?</param>
/// <param name="angle">Rotation angle</param>
/// <param name="mode">Rotation axis mode</param>
/// <returns>The new rotater</returns>
public Rotater CreateRotater(LThing owner, float duration, Radian angle, RotaterAxisMode mode)
{
RemoveRotater(owner);
Rotater newRotater = new Rotater(owner, duration, angle, mode);
Rotaters.TryAdd(owner, newRotater);
return newRotater;
}
示例8: OrbitalWithMouseCameraMode
public OrbitalWithMouseCameraMode(CameraControlSystem cam
, MOIS.MouseButtonID activateButton
, Radian initialHorizontalRotation
, Radian initialVerticalRotation, float initialZoom = 1)
: base(cam, initialHorizontalRotation, initialVerticalRotation, initialZoom)
{
_activateButton = activateButton;
}
示例9: Sprite
public Sprite(Texture texture)
{
Texture = texture;
Color = Color.White;
Position = Vector2.Zero;
Scale = new Vector2(1.0f, 1.0f);
Rotation = new Radian(0.0f);
SourceRect = new Rectangle(0, 0, Texture.Width, Texture.Height);
}
示例10: TestEquatable
public void TestEquatable()
{
var rad = new Radian(1.0f);
var f = 1.0f;
Assert.IsTrue(rad.Equals(rad));
Assert.IsTrue(rad.Equals(f));
Assert.IsFalse(rad.Equals(null));
}
示例11: SetDesiredVelocity
public override void SetDesiredVelocity( Radian velocity, float maxTorque )
{
if( joint.jointID == dJointID.Zero )
return;
Ode.dJointSetHingeParam( joint.jointID, Ode.dJointParams.dParamVel,
joint.Body1.Static ? velocity : -velocity );
Ode.dJointSetHingeParam( joint.jointID, Ode.dJointParams.dParamFMax, maxTorque );
}
示例12: Update
public override void Update(int elapsed)
{
float rotateFactor = elapsed * 0.125f / 1000.0f;
var yawAmount = new Radian((0.4f + 0.25f * MathUtils.Sin(new Radian(this.game.TotalGameTime / 15040))) * rotateFactor);
Yaw(yawAmount);
var pitchAmount = new Radian((0.35f + 0.212f * MathUtils.Cos(new Radian(this.game.TotalGameTime / 38040))) * rotateFactor);
float moveFactor = elapsed * 27.5f / 1000.0f;
MoveRelative(Vector3.UnitZ * moveFactor);
}
示例13: SetCameraRelativePosition
public virtual void SetCameraRelativePosition(Vector3 posRelativeToCameraTarget
, Radian roll, Radian yaw, Radian pitch)
{
RelativePosToTarget = posRelativeToCameraTarget;
_rotationOffset = new Quaternion(roll, Vector3.UNIT_Z)
* new Quaternion(yaw, Vector3.UNIT_Y)
* new Quaternion(pitch, Vector3.UNIT_X);
InstantUpdate();
}
示例14: Rotate
protected override void Rotate(Radian yawAngle, Radian pitchAngle)
{
base.Rotate(yawAngle,pitchAngle);
var debugOverlay = OverlayManager.Singleton.GetByName("Core/DebugOverlay");
debugOverlay.Show();
var myCurr = OverlayManager.Singleton.GetOverlayElement("Core/CurrFps");
myCurr.Caption = State.CameraManager.RenderWindow.LastFPS.ToString();
}
示例15: Rotater
/// <summary>
/// USE THE LThingHelperManager FOR THIS!
/// </summary>
public Rotater(LThing thingToRotate, float duration, Radian angle, Vector3 axis, RotaterAxisMode mode = RotaterAxisMode.Explicit)
{
this.thing = thingToRotate;
this.duration = duration;
this.angle = angle;
this.axis = axis;
this.mode = mode;
orient = new Quaternion();
PhysicsMain.PreSimulate += PreSimulate;
}