/// <summary> /// Constructor /// </summary> /// <param name="from">The point which the bearing was taken from.</param> /// <param name="observation">The observed bearing. If this is outwith the range /// [0,2PI), the value stored will be fixed so that it is in the expected range. /// </param> internal BearingDirection(PointFeature from, IAngle observation) { double a = observation.Radians; m_Observation = new RadianValue(Direction.Normalize(a)); m_From = from; }
/// <summary> /// Creates a new <c>TextGeometry</c> /// </summary> /// <param name="pos">Position of the text's reference point (always the top left corner of the string).</param> /// <param name="font">The text style (defines the type-face and the height of the text).</param> /// <param name="height">The height of the text, in meters on the ground.</param> /// <param name="width">The total width of the text, in meters on the ground.</param> /// <param name="rotation">Clockwise rotation from horizontal</param> protected TextGeometry(PointGeometry pos, IFont font, double height, double width, float rotation) { m_Font = font; m_Position = pos; m_Height = (float)height; m_Width = (float)width; m_Rotation = new RadianValue((double)rotation); }
/// <summary> /// Initializes a new instance of the <see cref="Annotation"/> class with the /// <see cref="FontStyle"/> property set to <see cref="System.Drawing.FontStyle.Regular"/>. /// </summary> /// <param name="text">The annotation text.</param> /// <param name="position">The position for the text (center-baseline aligned).</param> /// <param name="height">The height of the text (in meters on the ground).</param> /// <param name="rotation">The rotation (in radians clockwise from horizontal).</param> internal Annotation(string text, IPosition position, double height, double rotation) { m_Text = text; m_Position = PointGeometry.Create(position); m_Height = height; m_Rotation = new RadianValue(rotation); m_FontStyle = FontStyle.Regular; }
/// <summary> /// Copy constructor (for use by the <see cref="RowTextContent"/> class) /// </summary> /// <param name="copy">The geometry to copy</param> protected TextGeometry(TextGeometry copy) { m_Font = copy.m_Font; m_Position = copy.m_Position; m_Height = copy.m_Height; m_Width = copy.m_Width; m_Rotation = copy.m_Rotation; }
private void OnServoPositionUpdated(byte id, ushort position) { if (id != this.id) { return; } this.angle = new Degrees(position); }
public void Vincenty_CorrectlyCalculatesBearingTo(double latA, double lonA, double latB, double lonB, double bearingInRadians, int maxIterations, double tolerance) { IGeographicCoordinate pointA = new GeographicCoordinate(latA, lonA); IGeographicCoordinate pointB = new GeographicCoordinate(latB, lonB); IAngle expected = new Angle(bearingInRadians, AngleMeasurement.Radians); IAngle result = pointA.BearingTo(pointB, maxIterations, tolerance); Assert.Equal(expected, result); }
/// <summary> /// Rotates a position by a clockwise angle. /// </summary> /// <param name="origin">The position to rotate around.</param> /// <param name="point">The position that needs to be rotated</param> /// <param name="rotation">The clockwise rotation (less than zero for a /// counter-clockwise rotation.</param> /// <returns></returns> public static IPosition Rotate(IPosition origin, IPosition point, IAngle rotation) { // What's the distance between the point we're rotating and the origin? double dist = Distance(origin, point); // Get the bearing of the rotated point with respect to the origin. double newbearing = BearingInRadians(origin, point) + rotation.Radians; // Figure out the new position. return(Polar(origin, newbearing, dist)); }
public Type_04_Field(string fieldName, IDistance posX, IDistance posY, IDistance posZ, IAngle rotX, IAngle rotY, IAngle rotZ) : base(4) { ResizeData(60); FieldName = fieldName; PosX = posX; PosY = posY; PosZ = posZ; RotX = rotX; RotY = rotY; RotZ = rotZ; }
public void Vincenty_CorrectlyCalculatesBearingFromPointBearingDistance(double latA, double lonA, double bearingInRadians, double distanceInMeters, double expectedBearing, int maxIterations, double tolerance) { IGeographicCoordinate pointA = new GeographicCoordinate(latA, lonA); IAngle initialBearing = new Angle(bearingInRadians, AngleMeasurement.Radians); IDistance distance = new Distance(distanceInMeters, DistanceMeasurement.Meters); IAngle expected = new Angle(expectedBearing, AngleMeasurement.Radians); IAngle result = pointA.BearingFrom(initialBearing, distance, maxIterations, tolerance); Assert.Equal(expected, result); }
public static bool TryParse(string input, out IAngle output) { #region Prepare Variables string capInput = input.ToUpperInvariant(); string extraction = input.ExtractNumberComponentFromMeasurementString(); double conversion = 0; #endregion #region Convert To Double bool failed = !double.TryParse(extraction, out conversion); if (failed) { Debug.AddDetailMessage("Measurement Input not successfully converted."); Debug.AddDetailMessage("----" + capInput); output = new Angles.Degree(0); return(false); } #endregion #endregion #region Convert To Angle if (capInput.EndsWithAny(Suffixes.Degree)) { output = new Angles.Degree(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.Gradian)) { output = new Angles.Gradian(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.Radian)) { output = new Angles.Radian(conversion); return(true); } #endregion #region ... Conversion #region Type Unrecognised Debug.AddDetailMessage("No Type for input angle conversion. Break here for details..."); Debug.AddDetailMessage("----" + capInput); output = new Angles.Degree(0); return(false); #endregion }
/// <summary> /// Returns the angle string value of this instance. /// </summary> /// <returns>A System.String containing this angle.</returns> public static string ToAbsAngleString(this IAngle angle) { var degree = angle.Degree; var minute = angle.Arcminute; var second = angle.Arcsecond; if (second == 0) { if (minute == 0) { return(string.Format("{0}{1}", degree, Angle.Symbols.DegreeUnit)); } return(string.Format("{0}{1}{2}{3}", degree, Angle.Symbols.DegreeUnit, minute, Angle.Symbols.ArcminuteUnit)); } return(string.Format("{0}{1}{2}{3}{4}{5}", degree, Angle.Symbols.DegreeUnit, minute, Angle.Symbols.ArcminuteUnit, second, Angle.Symbols.ArcsecondUnit)); }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="font">The text style</param> /// <param name="position">Position of the text's reference point</param> /// <param name="height">The height of the text, in meters on the ground.</param> /// <param name="width">The total width of the text, in meters on the ground.</param> /// <param name="rotation">Clockwise rotation from horizontal</param> static void ReadData(EditDeserializer editDeserializer, out IFont font, out PointGeometry position, out float height, out float width, out IAngle rotation) { if (editDeserializer.IsNextField(DataField.Font)) { int fontId = editDeserializer.ReadInt32(DataField.Font); font = EnvironmentContainer.FindFontById(fontId); } else { font = null; } position = editDeserializer.ReadPointGeometry(DataField.X, DataField.Y); width = (float)editDeserializer.ReadDouble(DataField.Width); height = (float)editDeserializer.ReadDouble(DataField.Height); rotation = editDeserializer.ReadRadians(DataField.Rotation); }
public Servo(byte id, bool winding, IAngle rootAngle, IAngle minAngle, IAngle maxAngle) { this.hardwareInterface = ServiceLocator.Get <IHardwareInterface>(); this.id = id; this.winding = winding; this.rootAngle = rootAngle; this.minAngle = minAngle; this.maxAngle = maxAngle; this.targetAngle = new Radians(0.0f); this.angle = new Radians(0.0f); this.ledState = false; this.speed = 1023 / 4; this.hardwareInterface.servoPositionUpdated += OnServoPositionUpdated; //this.SetTargetAngle(rootAngle); //this.FlushState(); }
public bool TryParse(string value, out IAngle output) => throw new NotImplementedException();
/// <summary> /// Constructor /// </summary> /// <param name="backsight">The backsight point.</param> /// <param name="occupied">The occupied station.</param> /// <param name="observation">The angle to an observed point, measured with respect /// to the projection of an orientation line defined by the backsight and the occupied /// station. Positive values indicate a clockwise rotation & negated values for /// counter-clockwise. /// </param> internal DeflectionDirection(PointFeature backsight, PointFeature occupied, IAngle observation) : base(backsight, occupied, observation) { }
/// <summary> /// Gets a value indicating whether the angle is an obtuse angle. /// </summary> public static bool IsObtuse(this IAngle angle) { return(angle.Degree < 180 && angle.Degrees > 90); }
public IOrientation3 CreateOrientation3(IAngle h, IAngle p, IAngle b) => new Orientation3(h, p, b);
public bool TryParse(string value, out IAngle output) => Angle.TryParse(value, out output);
public static float InDegrees(this IAngle self) { return(self.InCircles() * 360); }
/// <summary> /// Gets a value indicating whether the angle is less than 360 degrees and not less than 0 degree. /// </summary> public static bool LessThanRound(this IAngle angle) { var degree = angle.Degree; return(degree < 360 && degree >= 0); }
/// <summary> /// Returns the cosine of this angle. /// </summary> /// <returns>The cosine of this angle. If this angle is equal to System.Double.NaN, System.Double.NegativeInfinity, or System.Double.PositiveInfinity, this method returns System.Double.NaN.</returns> public static double Cos(this IAngle angle) { return(Math.Cos(angle.Degrees)); }
/// <summary> /// Returns the tangent of this angle. /// </summary> /// <returns>The tangent of this angle. If this angle is equal to System.Double.NaN, System.Double.NegativeInfinity, or System.Double.PositiveInfinity, this method returns System.Double.NaN.</returns> public static double Tan(this IAngle angle) { return(Math.Tan(angle.Degrees)); }
/// <summary> /// Rotates a position by a clockwise angle. /// </summary> /// <param name="origin">The position to rotate around.</param> /// <param name="point">The position that needs to be rotated</param> /// <param name="rotation">The clockwise rotation (less than zero for a /// counter-clockwise rotation.</param> /// <returns></returns> public static IPosition Rotate(IPosition origin, IPosition point, IAngle rotation) { // What's the distance between the point we're rotating and the origin? double dist = Distance(origin, point); // Get the bearing of the rotated point with respect to the origin. double newbearing = BearingInRadians(origin, point) + rotation.Radians; // Figure out the new position. return Polar(origin, newbearing, dist); }
public BearingDistance() { Distance = new Distance(); InitialBearing = new Angle(); FinalBearing = new Angle(); }
/// <summary> /// Initializes a new instance of the <see cref="AngleDirection"/> class. /// </summary> /// <param name="backsight">The backsight point.</param> /// <param name="occupied">The occupied station.</param> /// <param name="observation">The angle to an observed point, measured with respect /// to the reference orientation defined by the backsight. Positive values indicate /// a clockwise rotation & negated values for counter-clockwise.</param> internal AngleDirection(PointFeature backsight, PointFeature occupied, IAngle observation) { m_Backsight = backsight; m_From = occupied; m_Observation = new RadianValue(observation.Radians); }
public IOrientation2 CreateOrientation2(IAngle h, IAngle p) => throw new NotImplementedException();
public IOrientation3 CreateOrientation3(IAngle h, IAngle p, IAngle b) => throw new NotImplementedException();
public Parallelepiped(IFigure2D Base, IEdge Height, IAngle Incline) { this.Base = Base; this.Height = Height; this.Incline = Incline; }
public static float InRadians(this IAngle self) { return(self.InCircles() * MathF.PI * 2); }
public IOrientation2 CreateOrientation2(IAngle h, IAngle p) => new Orientation2(h, p);
/// <summary> /// Gets a value indicating whether the angle is a reflex angle. /// </summary> public static bool IsReflex(this IAngle angle) { return(angle.Degree < 360 && angle.Degrees > 180); }