void Start() { if (myRig == null) { myRig = gameObject.GetComponent <Rigidbody>(); myRotateUpdate = new RotateUpdateHelper(); myRotateUpdate.transf = transform; myAngle = new AngleUnit(); angleChecker = new AngleUnit(); angleChecker.myObject = gameObject; if (gameObject.transform.GetChild(1).name == "Unit_body") { Transform body = gameObject.transform.GetChild(1); barHander = body.GetComponentInChildren <AttachBarHandler>(); weaponHolder = body.GetComponentsInChildren <WeaponController>(); } else { Debug.Log("Unit_body not found"); } } }
public RollPitchYaw(float r, float p, float y, AngleUnit unit = AngleUnit.RADIAN) { roll = r; pitch = p; yaw = y; this.unit = unit; }
// Use this for initialization void Start() { //init // upAngle = new AngleUnit(); // upAngle.myObject = gameObject; rightAngle = new AngleUnit(); rightAngle.myObject = gameObject; walls = new List <BoxCollider>(); //get wall GameObject board = GameObject.FindGameObjectWithTag("board"); if (board != null) { BoxCollider[] getwalls = board.GetComponentsInChildren <BoxCollider>(); if (getwalls.Length > 0) { foreach (BoxCollider coll in getwalls) { if (coll.gameObject.tag == "wall") { walls.Add(coll); } } } } }
/// <summary> /// Creates 2-dimensional rotation matrix using the specified angle. /// </summary> public static double[,] Create2DRotationMatrix(double angle, AngleUnit unit, MatrixRotationDirection direction) { // sin and cos accept only radians double angleRadians = angle; if (unit == AngleUnit.Degrees) { angleRadians = Converters.DegreesToRadians(angleRadians); } double[,] output = new double[2, 2]; output[0, 0] = Math.Cos(angleRadians); output[1, 0] = Math.Sin(angleRadians); output[0, 1] = Math.Sin(angleRadians); output[1, 1] = Math.Cos(angleRadians); if (direction == MatrixRotationDirection.Clockwise) { output[1, 0] *= -1; } else { output[0, 1] *= -1; } return(output); }
public AngleUnitBuilder(AngleUnit unit) { _name = unit.Name; _abbreviation = unit.Abbreviation; _symbol = unit.Symbol; _unitsPerTurn = unit.UnitsPerTurn; }
public string ToString(AngleUnit unit, [CanBeNull] Culture culture, int significantDigitsAfterRadix) { double value = As(unit); string format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); return(ToString(unit, culture, format)); }
/// <summary> /// 解析字符串为实例。 /// </summary> /// <param name="toString"></param> /// <returns></returns> public static new GeoCoord Parse(string toString, AngleUnit from = AngleUnit.Degree, AngleUnit to = AngleUnit.Degree, AngleUnit fromDegFormat = AngleUnit.Degree) { toString = toString.Replace("(", "").Replace(")", ""); string[] spliters = new string[] { ",", "\t", " " }; string[] strs = toString.Split(spliters, StringSplitOptions.RemoveEmptyEntries); double lon = double.Parse(strs[0]); double lat = double.Parse(strs[1]); if (from == AngleUnit.Degree)//转换为标准的度小数再说。 { lon = AngularConvert.ConvertDegree(lon, fromDegFormat); lat = AngularConvert.ConvertDegree(lat, fromDegFormat); } lon = AngularConvert.Convert(lon, from, to); lat = AngularConvert.Convert(lat, from, to); double h = 0; if (strs.Length > 2) { h = double.Parse(strs[2]); } return(new GeoCoord(lon, lat, h)); }
public void SetAngle(AngleUnit units, double resolution) { FieldType = PGNFieldType.Angle; Units = units; Resolution = resolution; }
public PlanePolar(double radius, double azimuth, AngleUnit unit = AngleUnit.Degree) : this() { this.Unit = unit; this.Range = radius; this.Azimuth = azimuth; }
/// <summary> /// Converts the <paramref name="value"/> in the specified <paramref name="sourceUnit"/> to a new <see cref="Angle"/> in radians. /// </summary> /// <param name="value">Source value.</param> /// <param name="sourceUnit">Source value units.</param> /// <returns>New <see cref="Angle"/> from the specified <paramref name="value"/> in <paramref name="sourceUnit"/>.</returns> public static Angle ConvertFrom(double value, AngleUnit sourceUnit) { switch (sourceUnit) { case AngleUnit.Radians: return(value); case AngleUnit.Degrees: return(FromDegrees(value)); case AngleUnit.Grads: return(FromGrads(value)); case AngleUnit.ArcMinutes: return(FromArcMinutes(value)); case AngleUnit.ArcSeconds: return(FromArcSeconds(value)); case AngleUnit.AngularMil: return(FromAngularMil(value)); default: throw new ArgumentOutOfRangeException(nameof(sourceUnit), sourceUnit, null); } }
public static PolarGeoCoordinate ChangeUnits(PolarGeoCoordinate original, AngleUnit changeTo) { if (original.Units == changeTo) { return(new PolarGeoCoordinate( original.Lat, original.Lon, original.Height, original.Units, original.CoordinateSystem)); } if (original.Units == AngleUnit.Degrees && changeTo == AngleUnit.Radians) { return(new PolarGeoCoordinate( Converter.DegToRad(original.Lat), Converter.DegToRad(original.Lon), original.Height, AngleUnit.Radians, original.CoordinateSystem)); } if (original.Units == AngleUnit.Radians && changeTo == AngleUnit.Degrees) { return(new PolarGeoCoordinate( Converter.RadToDeg(original.Lat), Converter.RadToDeg(original.Lon), original.Height, AngleUnit.Degrees, original.CoordinateSystem)); } throw new NotImplementedException("Invalid conversion requested"); }
private void button_xyzTogeo_Click(object sender, EventArgs e) { try { string splliter = "\t"; AngleUnit unit = AngleUnit; Geo.Referencing.Ellipsoid ellipsoid = Ellipsoid; List <XYZ> xyzs = new List <XYZ>(); foreach (var item in this.textBox_xyz.Lines) { if (item == "") { continue; } xyzs.Add(XYZ.Parse(item)); } StringBuilder sb = new StringBuilder(); var spliter = IsOutSplitByTab ? "\t" : ", "; foreach (var item in xyzs) { GeoCoord geeCoord = CoordTransformer.XyzToGeoCoord(item, ellipsoid, unit); sb.AppendLine(geeCoord.ToString("0.0000000000", spliter)); } this.textBox_geo.Text = sb.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void DeserializeCustomUnitAsPredefined_ShouldReturnValidResult() { // arrange var someUnit = new AngleUnit( name: "some unit", abbreviation: "su", symbol: "?", unitsPerTurn: (number)123.456m); string json = @"{ 'unit': 'su' }"; var converter = new AngleUnitJsonConverter( serializationFormat: LinearUnitJsonSerializationFormat.PredefinedAsString, tryReadCustomPredefinedUnit: (string value, out AngleUnit predefinedUnit) => { if (value == someUnit.Abbreviation) { predefinedUnit = someUnit; return(true); } predefinedUnit = default(AngleUnit); return(false); }); // act var result = JsonConvert.DeserializeObject <SomeUnitOwner <AngleUnit> >(json, converter); // assert result.Unit.Should().Be(someUnit); }
private static IEnumerable <ITestDataProvider> GetToNormalizedTestData() { yield return(new ToNormalizedTestData(new Angle(), new Angle())); var units = AngleUnit.GetPredefinedUnits(); const number zero = (number)0m; const number half = (number)0.5m; const number almostOne = (number)0.9999m; const number positiveEven = (number)73m; foreach (var unit in units) { yield return(new ToNormalizedTestData(0m, unit, 0m, unit)); yield return(new ToNormalizedTestData(-0m, unit, 0m, unit)); yield return(new ToNormalizedTestData(unit.UnitsPerTurn * half, unit, unit.UnitsPerTurn * half, unit)); yield return(new ToNormalizedTestData(-unit.UnitsPerTurn * half, unit, -unit.UnitsPerTurn * half, unit)); yield return(new ToNormalizedTestData(unit.UnitsPerTurn * almostOne, unit, unit.UnitsPerTurn * almostOne, unit)); yield return(new ToNormalizedTestData(-unit.UnitsPerTurn * almostOne, unit, -unit.UnitsPerTurn * almostOne, unit)); yield return(new ToNormalizedTestData(unit.UnitsPerTurn, unit, zero, unit)); yield return(new ToNormalizedTestData(-unit.UnitsPerTurn, unit, zero, unit)); yield return(new ToNormalizedTestData(unit.UnitsPerTurn * positiveEven + unit.UnitsPerTurn * half, unit, unit.UnitsPerTurn * half, unit)); yield return(new ToNormalizedTestData(-unit.UnitsPerTurn * positiveEven - unit.UnitsPerTurn * half, unit, -unit.UnitsPerTurn * half, unit)); } }
public Engine(Display display, Memory memory, Program program, Reader reader, Stack stack, AutoResetEvent keyWasTyped) { string [] appSettingsEnableBlur = System.Configuration.ConfigurationSettings.AppSettings.GetValues ("EnableBlur"); if (appSettingsEnableBlur == null) { enableBlur = true; } else { enableBlur = bool.Parse(appSettingsEnableBlur [0]); } flags = new bool [4]; unit = AngleUnit.Degree; this.display = display; this.display.EnteringNumber += new Display.DisplayEvent(Enter); this.memory = memory; this.program = program; this.reader = reader; this.stack = stack; this.keyWasTyped = keyWasTyped; Card.ReadFromDataset += new Card.DatasetImporterDelegate(ReadFromDataset); Card.WriteToDataset += new Card.DatasetExporterDelegate(WriteToDataset); }
/// <summary> /// 坐标旋转。 /// </summary> /// <param name="alphaX">绕 X 轴旋转的角度</param> /// <param name="alphaY">绕 Y 轴旋转的角度</param> /// <param name="alphaZ">绕 Z 轴旋转的角度</param> /// <returns></returns> public XYZ Rotate(double alphaX, double alphaY, double alphaZ, AngleUnit angleUnit = AngleUnit.Degree) { if (angleUnit == AngleUnit.Degree) { alphaX *= CoordConsts.DegToRadMultiplier; alphaY *= CoordConsts.DegToRadMultiplier; alphaZ *= CoordConsts.DegToRadMultiplier; } double x, y, z; // 在处理三维坐标旋转时,使用标准的数学公式是没有问题的。 // 可是把二维坐标旋转调用三次,也可以实现三维坐标的旋转,并且有易读易懂,処理速度快的优点。 //Z Axis Rotation double x2 = X * Math.Cos(alphaZ) + Y * Math.Sin(alphaZ); double y2 = -X *Math.Sin(alphaZ) + Y * Math.Cos(alphaZ); double z2 = Z; //Y Axis Rotation double z3 = z2 * Math.Cos(alphaY) + x2 * Math.Sin(alphaY); double x3 = -z2 *Math.Sin(alphaY) + x2 * Math.Cos(alphaY); double y3 = y2; //X Axis Rotation y = y3 * Math.Cos(alphaX) + z3 * Math.Sin(alphaX); z = -y3 *Math.Sin(alphaX) + z3 * Math.Cos(alphaX); x = x3; return(new XYZ(x, y, z)); }
/// <summary> /// Converts the <see cref="Angle"/> to the specified <paramref name="targetUnit"/>. /// </summary> /// <param name="targetUnit">Target units.</param> /// <returns><see cref="Angle"/> converted to <paramref name="targetUnit"/>.</returns> public double ConvertTo(AngleUnit targetUnit) { switch (targetUnit) { case AngleUnit.Radians: return(m_value); case AngleUnit.Degrees: return(ToDegrees()); case AngleUnit.Grads: return(ToGrads()); case AngleUnit.ArcMinutes: return(ToArcMinutes()); case AngleUnit.ArcSeconds: return(ToArcSeconds()); case AngleUnit.AngularMil: return(ToAngularMil()); default: throw new ArgumentOutOfRangeException(nameof(targetUnit), targetUnit, null); } }
public static PolarGeoCoordinate ChangeUnits(PolarGeoCoordinate original, AngleUnit changeTo) { if (original.Units == changeTo) { return new PolarGeoCoordinate( original.Lat, original.Lon, original.Height, original.Units, original.CoordinateSystem); } if (original.Units == AngleUnit.Degrees && changeTo == AngleUnit.Radians) { return new PolarGeoCoordinate( Converter.DegToRad(original.Lat), Converter.DegToRad(original.Lon), original.Height, AngleUnit.Radians, original.CoordinateSystem); } if (original.Units == AngleUnit.Radians && changeTo == AngleUnit.Degrees) { return new PolarGeoCoordinate( Converter.RadToDeg(original.Lat), Converter.RadToDeg(original.Lon), original.Height, AngleUnit.Degrees, original.CoordinateSystem); } throw new NotImplementedException("Invalid conversion requested"); }
public static string GetAbbreviation(AngleUnit unit, [CanBeNull] string cultureName) { // Windows Runtime Component does not support CultureInfo and IFormatProvider types, so we use culture name for public methods: https://msdn.microsoft.com/en-us/library/br230301.aspx IFormatProvider provider = cultureName == null ? UnitSystem.DefaultCulture : new CultureInfo(cultureName); return(UnitSystem.GetCached(provider).GetDefaultAbbreviation(unit)); }
public PolarGeoCoordinate(double lat, double lon, double height, AngleUnit units, CoordinateSystems coordinateSystem) { Lat = lat; Lon = lon; Height = height; Units = units; CoordinateSystem = coordinateSystem; }
public Settings(double limitInUnits, AngleUnit angularUnit, bool is3D) { LimitInUnits = limitInUnits; Is3D = is3D; QueryPoint = new PointClass(); AngularUnit = angularUnit; }
/// <summary> /// 坐标旋转。 /// </summary> /// <param name="angle">在三个轴的旋转角度</param> /// <returns></returns> public XYZ Rotate(XYZ angle, AngleUnit angleUnit = AngleUnit.Degree) { double alphaX = angle.X; double alphaY = angle.Y; double alphaZ = angle.Z; return(Rotate(alphaX, alphaY, alphaZ, angleUnit)); }
/// <summary> /// Rotates a 2D matrix to a specific angle in a spcific direction (clockwise / counter-clockwise.) /// </summary> public virtual Matrix Rotate(double angle, AngleUnit unit, MatrixRotationDirection direction) { if (Is2DMatrix == false) { throw new InvalidOperationException(Properties.Resources.Exception_2DRequired); } return(new Matrix(MatrixFunctions.Create2DRotationMatrix(angle, unit, direction))); }
/// <summary> /// Rotates a 3D matrix to a specific angle in a given axis. /// </summary> public virtual Matrix Rotate(double angle, AngleUnit unit, MatrixAxis axis) { if (Is3DMatrix == false) { throw new InvalidOperationException(Properties.Resources.Exception_3DRequired); } return(new Matrix(MatrixFunctions.Create3DRotationMatrix(angle, unit, axis))); }
public Polar(double radius, double azimuth, double elevatAngle, AngleUnit unit = AngleUnit.Degree) : this() { this.Unit = unit; this.Range = radius; this.Azimuth = azimuth; this.Elevation = elevatAngle; }
public void RefreshUnits() { speedUnit = PreferencesManager.PlayerPreferences.SpeedUnit; accelerationUnit = PreferencesManager.PlayerPreferences.AccelerationUnit; angleUnit = PreferencesManager.PlayerPreferences.AngleUnit; angularVelocityUnit = PreferencesManager.PlayerPreferences.AngularVelocityUnit; angularAccelerationUnit = PreferencesManager.PlayerPreferences.AngularAccelerationUnit; }
public void AngleConversions(double value1, AngleUnit units1, double value2, AngleUnit units2) { new Angle(value1, units1) { Units = units2 }.Value.ShouldBeWithinEpsilonOf(value2); new Angle(value2, units2) { Units = units1 }.Value.ShouldBeWithinEpsilonOf(value1); }
// Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx #if !WINDOWS_UWP /// <summary> /// Dynamically convert from value and unit enum <see cref="AngleUnit" /> to <see cref="Angle" />. /// </summary> /// <param name="value">Value to convert from.</param> /// <param name="fromUnit">Unit to convert from.</param> /// <returns>Angle unit value.</returns> public static Angle?From(QuantityValue?value, AngleUnit fromUnit) { if (!value.HasValue) { return(null); } return(new Angle((double)value.Value, fromUnit)); }
/// <summary> /// 笛卡尔右手空间直角坐标系 转换到 球面坐标 /// </summary> /// <param name="xyz"></param> /// <param name="unit"></param> /// <returns></returns> public static SphereCoord XyzToSphere(XYZ xyz, AngleUnit unit = AngleUnit.Degree) { double x = xyz.X; double y = xyz.Y; double z = xyz.Z; SphereCoord sphere = XyzToSphere(x, y, z, unit); return(sphere); }
public CalibrationHelper() { speedUnit = PreferencesManager.PlayerPreferences.SpeedUnit; accelerationUnit = PreferencesManager.PlayerPreferences.AccelerationUnit; angleUnit = PreferencesManager.PlayerPreferences.AngleUnit; angularVelocityUnit = PreferencesManager.PlayerPreferences.AngularVelocityUnit; angularAccelerationUnit = PreferencesManager.PlayerPreferences.AngularAccelerationUnit; calibrator = calibrationLine; }
public PolarGeoCoordinate( double lat, double lon, double height, AngleUnit units, CoordinateSystems coordinateSystem) { this.Lat = lat; this.Lon = lon; this.Height = height; this.Units = units; this.CoordinateSystem = coordinateSystem; }
/// <summary> /// 空间直角坐标系到地心椭球坐标系。此法没有循环,会快一些。与另一方法相比高程有分米以下差别。 /// </summary> /// <param name="xyz"></param> /// <param name="a">长半径</param> /// <param name="b">短半径</param> /// <param name="unit"></param> /// <returns></returns> public static GeoCoord XyzToGeoCoord2(XYZ xyz, double a, double b, AngleUnit unit = AngleUnit.Degree) { double x = xyz.X; double y = xyz.Y; double z = xyz.Z; double x2 = x * x; double y2 = y * y; double z2 = z * z; //double a = 6378137.0000; // earth radius in meters //double b = 6356752.3142; // earth semiminor in meters double e = Math.Sqrt(1 - Math.Pow((b / a), 2)); double b2 = b * b; double e2 = e * e; double ep = e * (a / b); double r = Math.Sqrt(x2 + y2); double r2 = r * r; double E2 = a * a - b * b; double F = 54 * b2 * z2; double G = r2 + (1 - e2) * z2 - e2 * E2; double c = (e2 * e2 * F * r2) / (G * G * G); double s = Math.Pow(1 + c + Math.Sqrt(c * c + 2 * c), 1 / 3); double P = F / (3 * Math.Pow(s + 1 / s + 1, 2) * G * G); double Q = Math.Sqrt(1 + 2 * e2 * e2 * P); double ro = -(P * e2 * r) / (1 + Q) + Math.Sqrt((a * a / 2) * (1 + 1 / Q) - (P * (1 - e2) * z2) / (Q * (1 + Q)) - P * r2 / 2); double tmp = Math.Pow(r - e2 * ro, 2); double U = Math.Sqrt(tmp + z2); double V = Math.Sqrt(tmp + (1 - e2) * z2); double zo = (b2 * z) / (a * V); double height = U * (1 - b2 / (a * V)); double lat = Math.Atan((z + ep * ep * zo) / r); double temp = Math.Atan(y / x); double lon; if (x >= 0) { lon = temp; } else if ((x < 0) && (y >= 0)) { lon = CoordConsts.PI + temp; } else { lon = temp - CoordConsts.PI; } if (unit == AngleUnit.Degree) { lon *= ScreenCoordTransformer.RadToDegMultiplier; lat *= ScreenCoordTransformer.RadToDegMultiplier; } return(new GeoCoord(lon, lat, height)); }
/** メソッド ********************************************************************/ /// <summary> /// コンストラクタ /// </summary> /// <param name="unit">単位(°or rad)</param> /// <param name="datum">測地系</param> public FieldParameter(AngleUnit unit = AngleUnit.Degree, Datum datum = Datum.WGS84) { this.unit = unit; this.datum = datum; this.upperLat = double.NaN; this.eastLon = double.NaN; this.lowerLat = double.NaN; this.westLon = double.NaN; this.centerLon = double.NaN; }
public double GetAngle(ushort angle, double precision, AngleUnit units) { double result = angle * precision; if (units == AngleUnit.Radians) { result = RadianToDegree(result); } return result; }
/// <summary> /// Blhのコンストラクタ /// <para>引数は省略可能です。</para> /// </summary> /// <param name="B">緯度: Latitude</param> /// <param name="L">経度: Longitude</param> /// <param name="H">高度: Ellipsoidal altitude</param> /// <param name="unit">単位(°or rad)</param> /// <param name="datum">測地系<para>省略するとWGS84となる。</para></param> public Blh(double B = 0.0d, double L = 0.0d, double H = 0.0d, AngleUnit unit = AngleUnit.Degree, Datum datum = Datum.WGS84) { FilterAsLatitudeAndLongitude(ref B, ref L, unit); this.b = B; this.l = L; this.h = H; this._unit = unit; this._datum = datum; }
protected static string CreateSuffix(SymbolFormat format, AngleUnit unit) { return default(Angle).ToString(unit, format).Trim('0'); }
/// <summary> /// 緯度と経度にフィルタをかける /// <para>緯度は-90~90 degの範囲とする。経度は-180~180 degの範囲とする。</para> /// <example> /// <code> /// double lat = 125.3, lon = -186.36; // 極を挟んで向こう側に行って、さらに地球を半周以上している /// GNSS.Blh.FilterAsLatitudeAndLongitude(ref lat, ref lon, GNSS.AngleUnit.Degree); /// </code> /// </example> /// </summary> /// <param name="lat">緯度</param> /// <param name="lon">経度</param> /// <param name="unit">単位</param> private static void FilterAsLatitudeAndLongitude(ref double lat, ref double lon, AngleUnit unit) { double quarter = 90.0, half = 180.0, circle = 360.0; if (unit == AngleUnit.Radian) { quarter = quarter * Math.PI / 180.0; half = half * Math.PI / 180.0; circle = circle * Math.PI / 180.0; } lat %= circle; // 地球をn周していたら、1周未満に収める if (lat > half) // 地球を半周以上していれば360°引く(又は足す)ことで±180°以内に収める lat -= circle; else if (lat < -180.0) lat += circle; if (lat > quarter || lat < -quarter) // 極を超えているかチェック { if (lat > quarter) lat = half - lat; else if (lat < -quarter) lat = -half - lat; lon += half; // 極を挟んだ反対側に行ったわけなので、経度を180°足す } FilterAsLongitude(ref lon, unit); // 経度に関して処理 return; }
/// <summary> /// Blhを文字列で初期化するコンストラクタ /// <para>引数は省略可能です。</para> /// </summary> /// <param name="B">緯度: Latitude</param> /// <param name="L">経度: Longitude</param> /// <param name="H">高度: Ellipsoidal altitude</param> /// <param name="unit">単位(°or rad)</param> /// <param name="datum">測地系<para>省略するとWGS84となる。</para></param> public Blh(string B = "0.0", string L = "0.0", string H = "0.0", AngleUnit unit = AngleUnit.Degree, Datum datum = Datum.WGS84) { double b = 0.0, l = 0.0, h = 0.0; try { b = double.Parse(B); l = double.Parse(L); h = double.Parse(H); } catch(Exception) { throw new Exception("Blh構造体のコンストラクタにおいてエラーがスローされました。パラメータの文字列が解析不能です。"); } FilterAsLatitudeAndLongitude(ref b, ref l, unit); this.b = b; this.l = l; this.h = h; this._unit = unit; this._datum = datum; }
/// <summary> /// 経度にフィルタをかける /// <para>経度は-180~180 degの範囲とする。</para> /// <example> /// <code> /// double lon = -186.36; // 地球を半周以上している /// GNSS.Blh.FilterAsLongitude(ref lon, GNSS.AngleUnit.Degree); /// </code> /// </example> /// </summary> /// <param name="lon">経度</param> /// <param name="unit">単位</param> private static void FilterAsLongitude(ref double lon, AngleUnit unit) { double quarter = 90.0, half = 180.0, circle = 360.0; if (unit == AngleUnit.Radian) { quarter = quarter * Math.PI / 180.0; half = half * Math.PI / 180.0; circle = circle * Math.PI / 180.0; } lon %= circle; // 地球をn周していたら、1周未満に収める if (lon > half) // 地球を半周以上していれば360°引く(又は足す)ことで±180°以内に収める lon -= circle; else if (lon < -180.0) lon += circle; return; }
/// <summary> /// 自身の単位を度へ変換する /// </summary> /// private void ChangeToDegree() { if (this._unit == AngleUnit.Radian) { this.B = this.B * 180.0 / Math.PI; this.L = this.L * 180.0 / Math.PI; this._unit = AngleUnit.Degree; } return; }
/// <summary> /// 自身の単位をラジアン単位へ変換する /// </summary> private void ChangeToRadian() { if (this._unit == AngleUnit.Degree) { this.B = this.B * Math.PI / 180.0; this.L = this.L * Math.PI / 180.0; this._unit = AngleUnit.Radian; } return; }
/// <summary> /// コンストラクタ /// <para>2つの座標を指定すると、大小関係からマップの座標を自動的に決定する。</para> /// <para>経度に関しては、より小さな領域となる座標を選択する。</para> /// </summary> /// <param name="x1">座標1</param> /// <param name="x2">座標2</param> /// <param name="unit">単位(°or rad)</param> /// <param name="datum">測地系</param> public RectangleField(Blh x1, Blh x2, AngleUnit unit = AngleUnit.Degree, Datum datum = Datum.WGS84) { this.param = new FieldParameter(unit, datum); RectangleField.SetLatAndEastWestLon(x1, ref this.param); RectangleField.SetLatAndEastWestLon(x2, ref this.param); }
/// <summary> /// 座標省略時のコンストラクタ /// <para>内部パラメータには非値が代入され、使用準備は完了しますが値をセットしない限り運用できません。</para> /// </summary> /// <param name="unit">単位(°or rad)</param> /// <param name="datum">測地系</param> public RectangleField(AngleUnit unit = AngleUnit.Degree, Datum datum = Datum.WGS84) { this.param = new FieldParameter(unit, datum); }