/// <summary> /// Instantiates a new Orientation object. /// </summary> public Orientation3D() { forwardVector = new Vector3D(1, 0, 0); downVector = new Vector3D(0, 0, 1); angleMeasurement = AngleMeasurement.Degrees; }
public static void Render(RenderManager.CameraInfo cameraInfo, AngleMeasurement angle) { if (angle.HideOverlay) { return; } var renderManager = RenderManager.instance; var centreAngle = Vector3.Angle(Vector3.right, angle.AngleNormal); if (Vector3.Cross(Vector3.right, angle.AngleNormal).y > 0f) { centreAngle = -centreAngle; } var arcs = BezierUtil.CreateArc(angle.Position, GetAngleDistance(angle.Flags), centreAngle - angle.AngleSize * .5f, centreAngle + angle.AngleSize * .5f); for (var i = 0; i < arcs.Count; i++) { var isFirst = i == 0; var isLast = i == arcs.Count - 1; renderManager.OverlayEffect.DrawBezier(cameraInfo, GetAngleColor(angle.Flags), arcs[i], .7f, 0f, 0f, angle.Position.y - 20f, angle.Position.y + 20f, false, true); } }
/// <summary> /// Creates a deep copy of an existing orientation object. /// </summary> /// <param name="source">The source orientation for the copy.</param> private Orientation3D(Orientation3D source) { forwardVector = source.ForwardVector; downVector = source.downVector; angleMeasurement = source.angleMeasurement; }
public void Angle_AngleMeasurement_DefaultsToDegrees() { const AngleMeasurement expected = AngleMeasurement.Degrees; var result = InstantiateNewCoordinate().AngleMeasurement; Assert.Equal(expected, result); }
public void Angle_CanInstantiateWithValueAndMeasurement(double value) { var expectedValue = value; const AngleMeasurement angleMeasurement = AngleMeasurement.Radians; var sut = new Angle(value, AngleMeasurement.Radians); var resultValue = sut.Value; var resultMeasurement = sut.AngleMeasurement; Assert.Equal(expectedValue, resultValue); Assert.Equal(angleMeasurement, resultMeasurement); }
public double GetArgument(AngleMeasurement m) { switch (m) { case AngleMeasurement.Degrees: return(getArg() * 180.0 / Math.PI); case AngleMeasurement.Radians: return(getArg()); default: throw new ArgumentOutOfRangeException("Invalid angle measurement"); } }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParameters"/> class. /// </summary> /// <param name="angleMeasurement">The angle measurement.</param> /// <param name="variables">The collection of variables' values.</param> /// <param name="functions">The collection of user functions.</param> public ExpressionParameters(AngleMeasurement angleMeasurement, ParameterCollection variables, FunctionCollection functions) { this.AngleMeasurement = angleMeasurement; this.Variables = variables; this.Functions = functions; }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParameters"/> class. /// </summary> /// <param name="angleMeasurement">The angle measurement.</param> /// <param name="functions">The collection of user functions.</param> public ExpressionParameters(AngleMeasurement angleMeasurement, FunctionCollection functions) : this(angleMeasurement, new ParameterCollection(), functions) { }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParameters"/> class. /// </summary> /// <param name="angleMeasurement">The angle measurement.</param> /// <param name="variables">The collection of variables' values.</param> public ExpressionParameters(AngleMeasurement angleMeasurement, ParameterCollection variables) : this(angleMeasurement, variables, new FunctionCollection()) { }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParameters"/> class. /// </summary> /// <param name="angleMeasuremnt">The angle measuremnt.</param> public ExpressionParameters(AngleMeasurement angleMeasuremnt) : this(angleMeasuremnt, new ParameterCollection(), new FunctionCollection()) { }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParameters"/> class. /// </summary> /// <param name="angleMeasuremnt">The angle measuremnt.</param> /// <param name="functions">The collection of user functions.</param> public ExpressionParameters(AngleMeasurement angleMeasuremnt, FunctionCollection functions) : this(angleMeasuremnt, new ParameterCollection(), functions) { }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParameters"/> class. /// </summary> /// <param name="angleMeasuremnt">The angle measuremnt.</param> /// <param name="parameters">The collection of variables' values.</param> public ExpressionParameters(AngleMeasurement angleMeasuremnt, ParameterCollection parameters) : this(angleMeasuremnt, parameters, new FunctionCollection()) { }
public static Complex ComplexNumberFromMagnitudeAndPhase(double r, double phi, AngleMeasurement m) { switch (m) { case AngleMeasurement.Degrees: return(ComplexNumberFromMagnitudeAndPhaseInDegrees(r, phi)); case AngleMeasurement.Radians: return(ComplexNumberFromMagnitudeAndPhaseInRadians(r, phi)); default: throw new ArgumentOutOfRangeException("Invalid angle measurement"); } }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParameters"/> class. /// </summary> /// <param name="angleMeasuremnt">The angle measuremnt.</param> /// <param name="variables">The collection of variables' values.</param> /// <param name="functions">The collection of user functions.</param> public ExpressionParameters(AngleMeasurement angleMeasuremnt, ParameterCollection variables, FunctionCollection functions) { this.angleMeasuremnt = angleMeasuremnt; this.variables = variables; this.functions = functions; }
public void Render(Plotter3D p) { Point3D startLocation = p.Location; Orientation3D startOrientation = p.Orientation.Clone(); bool startPenDown = p.IsPenDown; AngleMeasurement startAngleMeasurement = p.AngleMeasurement; p.AngleMeasurement = AngleMeasurement.Degrees; // Move to the back edge of the domino p.IsPenDown = false; p.Forward(depth); p.TurnUp(90); p.IsPenDown = startPenDown; // Tilt the domino accordingly p.Orientation.RollLeft(90 - fallAngle); // Draw the back surface of the domino p.Forward(width); p.TurnLeft(90); p.Forward(height); p.TurnLeft(90); p.Forward(width); p.TurnLeft(90); p.Forward(height); p.TurnLeft(90); // Draw the middle bits of the domino p.TurnUp(90); p.Forward(depth); p.TurnDown(90); p.IsPenDown = false; p.Forward(width); p.TurnDown(90); p.IsPenDown = startPenDown; p.Forward(depth); p.TurnUp(90); p.TurnLeft(90); p.IsPenDown = false; p.Forward(height); p.TurnUp(90); p.IsPenDown = startPenDown; p.Forward(depth); p.TurnDown(90); p.TurnLeft(90); p.IsPenDown = false; p.Forward(width); p.TurnDown(90); p.IsPenDown = startPenDown; p.Forward(depth); p.IsPenDown = false; p.TurnUp(180); p.Forward(depth); p.TurnUp(90); p.Orientation.RollRight(180); p.IsPenDown = startPenDown; // Draw the front of the domino p.Forward(width); p.TurnRight(90); p.Forward(height); p.TurnRight(90); p.Forward(width); p.TurnRight(90); p.Forward(height); // Return the the start orientation and location, then advance to the back edge of the domino. p.IsPenDown = false; p.Orientation = startOrientation; p.Location = startLocation; p.Forward(depth); p.IsPenDown = startPenDown; p.AngleMeasurement = startAngleMeasurement; }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParameters"/> class. /// </summary> /// <param name="angleMeasuremnt">The angle measuremnt.</param> /// <param name="parameters">The collection of variables' values.</param> /// <param name="functions">The collection of user functions.</param> public ExpressionParameters(AngleMeasurement angleMeasuremnt, ParameterCollection parameters, FunctionCollection functions) { this.angleMeasuremnt = angleMeasuremnt; this.parameters = parameters; this.functions = functions; }
public static Vector3 GetLabelWorldPosition(AngleMeasurement angle) { return(angle.Position + angle.AngleNormal * GetAngleDistance(angle.Flags)); }