public List <HealCoor> GetLevelDots(int level, double angleFromCenter = 5) { var l = new List <HealCoor>(); for (double latitude = _center.Y - angleFromCenter; latitude < _center.Y + angleFromCenter; latitude += _accuracyMin / 60.0) { for (double longitude = _center.X - angleFromCenter; longitude < _center.X + angleFromCenter; longitude += _accuracyMin / 60.0) { var coor = new HealCoor { X = longitude, Y = latitude }; var diff = GetAltitude(coor) - level; if (Math.Abs(diff) <= AltitudeAccuracy) { l.Add(coor); } } } return(l); }
public override double?GetAltitude(HealCoor basin) { var altitude = Relief.GetAltitude(basin); if (altitude == 0) { altitude = ReliefBed.GetAltitude(basin); } return(altitude); }
public override double?GetAltitude(HealCoor basin) { var surface = Relief.GetAltitude(basin); if (surface > 0) { // lakes in ice are ignored return(1); } return(0); }
public override double?GetAltitude(HealCoor basin) { var altitude = Relief.GetAltitude(basin); var altitudeShape = ReliefBed.GetAltitude(basin) + Earth2014Manager.Radius2Add; var thetaTan = Math.Tan(basin.Beta.Value); /* may be out of range */ var undulation = altitudeShape - altitude - Ellipsoid.Radius(Ellipsoid.CalcVarPhi(thetaTan)); return(undulation); }
public override double?GetAltitude(HealCoor basin) { var surface = Relief.GetAltitude(basin); if (surface > 0) { _landPixelsCount++; } var middle = HealpixManager.Npix / 2d; return(Math.Abs(basin.P - middle) <= middle * _percentageOfLand / 100d ? 1 : 0); }
public void DistanceTo() { var coor = new HealCoor { X = 0, Y = 0 }; Assert.AreEqual(0, coor.DistanceTo(new HealCoor { X = 0, Y = 0 })); Assert.AreEqual(Math.PI / 2, coor.DistanceTo(new HealCoor { X = 90, Y = 0 })); }
public void Rotate_Matrix() { var coor = new HealCoor(-90, 90); var normalCalm = Matrixes.Rotate(coor); //todo why angle with opposite sign? var rotation = Matrix3D.RotationAroundYAxis(new Angle(-coor.Phi, AngleUnit.Radians)) * Matrix3D.RotationAroundZAxis(new Angle(coor.Lambda.Value, AngleUnit.Radians)); var normalCalmByMatrix = new UnitVector3D(Matrixes.RotationVector * rotation); Assert.AreEqual(normalCalm.X, normalCalmByMatrix.X, .00000001); Assert.AreEqual(normalCalm.Y, normalCalmByMatrix.Y, .00000001); Assert.AreEqual(normalCalm.Z, normalCalmByMatrix.Z, .00000001); }
/// <summary> /// initial atoms grouping /// </summary> public void AddAtom(HealCoor coor, int bed, int surface) { var isAtomAlone = true; // look back (right) in the same ring if (coor.PixelInRing > 1) { var otherEddy = GetEddy(coor.P - 1); isAtomAlone = false; } if (isAtomAlone) { EddiesPair.Add(coor.P, new EddyPair(coor)); } }
public List <object> GetPerimeter(int level) { // look for west and then tracking path north, east, south var westStart = new HealCoor(_center); int diff; do { diff = GetAltitude(westStart) - level; westStart.X -= _accuracyMin / 60.0; } while (Math.Abs(diff) > AltitudeAccuracy); var l = new List <object>(); return(l); }
public int GetHeights(HealCoor coor, int rOfEllipse, out int waterHeight) { var surface = Relief.GetAltitude(coor); var hOQ = surface; if (IsReliefShape) { // hOQ includes undulation hOQ += Earth2014Manager.Radius2Add - rOfEllipse; } var bed = ReliefBed.GetAltitude(coor); waterHeight = surface - bed; if (waterHeight > 0) /* lakes in ice are ignored */ { } return(hOQ); }
public void GetAltitude() { var mangup = new HealCoor { Y = 44.58, X = 33.8, Precision = 0.0166 }; var sevastopol = new HealCoor { Y = 44.6, X = 33.53 }; using (var man = new Earth2014Manager(_crimeaCenter, 5)) { Assert.IsTrue(man.GetAltitude(mangup) > 200 && man.GetAltitude(mangup) < 600); Assert.IsTrue(man.GetAltitude(sevastopol) > 0 && man.GetAltitude(sevastopol) <= 160); //// why 160? } using (var man = new Earth2014Manager(_crimeaCenter)) { Assert.IsTrue(man.GetAltitude(mangup) > 200 && man.GetAltitude(mangup) < 600); Assert.IsTrue(man.GetAltitude(sevastopol) > 0 && man.GetAltitude(sevastopol) < 60); } }
public void OffsetEarth2014() { var coor = new HealCoor { Latitude = -89.9917, Longitude = -179.9917 }; Assert.AreEqual(0, coor.Offset()); var allRecords = 10800 * 21600; // 233280000; coor = new HealCoor { Latitude = 0, Longitude = 0 }; // not accurate transforming Assert.AreEqual(allRecords / 2d, coor.Offset(), 11000); // not accurate transforming coor = new HealCoor { Latitude = 89.9917, Longitude = 179.9917 }; Assert.AreEqual(allRecords - 1, coor.Offset()); }
public int GetAltitude(HealCoor place) { var position = place.Offset(_accuracyMin) * 2; int a, b; if (_readAllAtStart) { a = _buf[position]; b = _buf[position + 1]; } else { _stream.Position = position; a = _stream.ReadByte(); b = _stream.ReadByte(); } var int16 = (ushort)(a << 8) + b; if (a >= 0x80) { return(-((int16 ^ 0xffff) + 1)); } return(int16); }
public EddyPair(HealCoor coor) { }
public void AddWater(HealCoor coor, int bed, int surface) { _atoms[coor.P] = new Atom(); }
public static UnitVector3D Rotate(HealCoor coor) { var normal = RotationVector.Rotate(new UnitVector3D(0, 1, 0), new Angle(coor.Phi, AngleUnit.Radians)); return(normal.Rotate(new UnitVector3D(0, 0, 1), new Angle(-coor.Lambda.Value, AngleUnit.Radians))); }