本文整理汇总了C#中System.Angle类的典型用法代码示例。如果您正苦于以下问题:C# Angle类的具体用法?C# Angle怎么用?C# Angle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Angle类属于System命名空间,在下文中一共展示了Angle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rotate
public static void Rotate(this IEnumerable<PlaneRegion> passedPlaneRegions, Line passedAxisLine, Angle passedRotationAngle)
{
foreach (var planeRegion in passedPlaneRegions)
{
planeRegion.Rotate(passedAxisLine, passedRotationAngle);
}
}
示例2: FindNearestNeighbors
private static Dictionary<Cluster, Cluster> FindNearestNeighbors(List<Cluster> c1l, List<Cluster> c2l, out List<Angle> angles, Angle angleBase, Angle angleTolerance)
{
Dictionary<Cluster, Cluster> neighbors = new Dictionary<Cluster, Cluster>();
angles = new List<Angle>();
foreach (Cluster c1 in c1l)
{
float shortestDistance = 999999;
Cluster shortestCluster = null;
foreach (Cluster c2 in c2l)
{
if (new Angle(Math.Abs((c1.GetAngle(c2) - angleBase).angleDegrees)).angleDegrees > angleTolerance.angleDegrees)
continue;
//if (Math.Abs(Cluster.CompareAngles(c1.GetAngle(c2), angleBase)) > angleTolerance.angleDegrees)
float currentDistance = c1.Distance(c2);
if (currentDistance < shortestDistance)
{
shortestCluster = c2;
shortestDistance = currentDistance;
}
if (shortestDistance == 0)
{
}
}
if (shortestCluster != null)
{
neighbors.Add(c1, shortestCluster);
angles.Add(c1.GetAngle(shortestCluster));
}
}
return neighbors;
}
示例3: PolarCoordinate
public PolarCoordinate(float r, double theta, Azimuth origin, PolarCoordinateOrientation orientation)
{
_R = r;
_Theta = new Angle(theta);
_Origin = origin;
_Orientation = orientation;
}
示例4: Button_Click1
private void Button_Click1(object sender, RoutedEventArgs e)
{
int aangle, bangle;
Csubbox.Text = "";
aangle = Convert.ToInt32(Asubbox.Text);
bangle = Convert.ToInt32(Bsubbox.Text);
if (aangle < 0 || aangle > 360 || bangle < 0 || bangle > 360)
{
MessageBox.Show("Углы должны быть в диапазоне от 0 до 360 градусов");
return;
}
Angle A = new Angle();
Angle B = new Angle();
A.deg = aangle;
B.deg = bangle;
double res;
res = A.Sub(B);
Csubbox.Text = res.ToString();
}
示例5: Arc
/// <summary>
/// Creates a new Arc
/// </summary>
/// <param name="radius">The radius of the arc</param>
/// <param name="angle">The arc angle</param>
/// <param name="baseVector">A vector of the arc start</param>
public Arc(double? radius, Angle? angle, Vector2 baseVector)
{
_angle = angle;
_radius = radius;
_base = baseVector;
_bowlen = null;
}
示例6: CalculateNewPosition
//////////////////////////////////////////////////////////////////////////////////////
// This method takes in present position (LatLongClass) and range/bearing from the
// present position. It returns a new position (LatLongClass)
//
// Distance is IN
// Azimuth in degrees
public static LatLongClass CalculateNewPosition(LatLongClass PresentPosition, double Distance, double Azimuth)
{
LatLongClass NewPosition = new LatLongClass();
// instantiate the calculator
GeodeticCalculator geoCalc = new GeodeticCalculator();
// select a reference elllipsoid
Ellipsoid reference = Ellipsoid.WGS84;
// set Lincoln Memorial coordinates
GlobalCoordinates Present_Pos;
Present_Pos = new GlobalCoordinates(new Angle(PresentPosition.GetLatLongDecimal().LatitudeDecimal), new Angle(PresentPosition.GetLatLongDecimal().LongitudeDecimal));
// now, plug the result into to direct solution
GlobalCoordinates dest;
Angle endBearing = new Angle();
double Distance_In_Meeters = (Distance * NMtoKM * 1000.0);
dest = geoCalc.CalculateEndingGlobalCoordinates(reference, Present_Pos, Azimuth, Distance_In_Meeters, out endBearing);
NewPosition.SetPosition(new LatLongDecimal(dest.Latitude.Degrees, dest.Longitude.Degrees));
return NewPosition;
}
示例7: SetType
internal void SetType(ParticleType type)
{
Type = type;
Scale = Type.ScaleModifier.Random;
Angle = Type.AngleModifier.Random;
Alpha = Type.AlphaModifier.Random;
LifeMax = (int)Math.Round(Type.realLife.Random);
Life = 0;
LifePercent = 0;
if (Type.Mode == ParticleType.FrameMode.Random)
Frame = (int)Calc.Random.Next(Type.Sprite.Length);
else
Frame = 0;
if (Type.BlendWithTime)
Color = Type.Blend[0];
else
Color = Calc.Random.Choose(Type.Blend);
Velocity = new Angle(Type.Direction.Random, true).ToVector(Type.Speed.Random);
DrawScale = new Vector2(Type.ScaleX.Min, Type.ScaleY.Min) * Type.Size.Min * Scale;
DrawAngle = new Angle(Type.Angle.Min + Angle, true);
}
示例8: QuadTile
/// <summary>
/// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.QuadTile"/> class.
/// </summary>
/// <param name="south"></param>
/// <param name="north"></param>
/// <param name="west"></param>
/// <param name="east"></param>
/// <param name="level"></param>
/// <param name="quadTileSet"></param>
public QuadTile(double south, double north, double west, double east, int level, QuadTileSet quadTileSet)
{
this.South = south;
this.North = north;
this.West = west;
this.East = east;
CenterLatitude = Angle.FromDegrees(0.5f*(North + South));
CenterLongitude = Angle.FromDegrees(0.5f*(West + East));
LatitudeSpan = Math.Abs(North - South);
LongitudeSpan = Math.Abs(East - West);
this.Level = level;
this.QuadTileSet = quadTileSet;
BoundingBox = new BoundingBox((float) south, (float) north, (float) west, (float) east, (float) quadTileSet.LayerRadius, (float) quadTileSet.LayerRadius + 300000f);
//localOrigin = BoundingBox.CalculateCenter();
localOrigin = MathEngine.SphericalToCartesianD(CenterLatitude, CenterLongitude, quadTileSet.LayerRadius);
// To avoid gaps between neighbouring tiles truncate the origin to
// a number that doesn't get rounded. (nearest 10km)
localOrigin.X = (float) (Math.Round(localOrigin.X/10000)*10000);
localOrigin.Y = (float) (Math.Round(localOrigin.Y/10000)*10000);
localOrigin.Z = (float) (Math.Round(localOrigin.Z/10000)*10000);
Row = MathEngine.GetRowFromLatitude(South, North - South);
Col = MathEngine.GetColFromLongitude(West, North - South);
}
示例9: TwoDimensionalDirectCalculation
/// <summary>
/// Calculate the destination if we start at:
/// Lincoln Memorial in Washington, D.C --> 38.8892N, 77.04978W
/// and travel at
/// 51.7679 degrees for 6179.016136 kilometers
///
/// WGS84 reference ellipsoid
/// </summary>
static void TwoDimensionalDirectCalculation()
{
// instantiate the calculator
GeodeticCalculator geoCalc = new GeodeticCalculator();
// select a reference elllipsoid
Ellipsoid reference = Ellipsoid.WGS84;
// set Lincoln Memorial coordinates
GlobalCoordinates lincolnMemorial;
lincolnMemorial = new GlobalCoordinates(
new Angle(38.88922), new Angle(-77.04978)
);
// set the direction and distance
Angle startBearing = new Angle(51.7679);
double distance = 6179016.13586;
// find the destination
Angle endBearing;
GlobalCoordinates dest = geoCalc.CalculateEndingGlobalCoordinates(reference, lincolnMemorial, startBearing, distance, out endBearing);
Console.WriteLine("Travel from Lincoln Memorial at 51.767921 deg for 6179.016 km");
Console.Write(" Destination: {0:0.0000}{1}", dest.Latitude.Degrees, (dest.Latitude > 0) ? "N" : "S" );
Console.WriteLine(", {0:0.0000}{1}", dest.Longitude.Degrees, (dest.Longitude > 0) ? "E" : "W");
Console.WriteLine(" End Bearing: {0:0.00} degrees", endBearing.Degrees);
}
示例10: TestRotateAroundOrigin
public void TestRotateAroundOrigin()
{
Angle a = new Angle(90, Angle.Representation.Degree);
Point p1 = new Point(2.5, 0.0);
var rotated = Rotation.AroundOrigin(a, p1);
Assert.AreEqual(0.0, rotated.X, 0.01);
Assert.AreEqual(2.5, rotated.Y, 0.01);
}
示例11: GetPoint
/// <summary>
/// Returns a point on this circle at the given angle offset.
/// </summary>
/// <param name="angle"></param>
/// <returns></returns>
public Vector2 GetPoint(Angle angle){
var circlePoint = new Vector2(
Math.Cos(angle.Radians) * this.Radius,
Math.Sin(angle.Radians) * this.Radius);
circlePoint += this.Location;
return circlePoint;
}
示例12: ConvertDegreesMinutesSeconds
public void ConvertDegreesMinutesSeconds()
{
Angle angle = new Angle(10, 30, 20);
Assert.IsTrue(TestingUtils.AreEqualWithinTolerance(angle.Degrees, 10.505555556));
angle = new Angle(-10, 30, 20);
Assert.IsTrue(TestingUtils.AreEqualWithinTolerance(angle.Degrees, 10.505555556));
}
示例13: Rotate_100x0yPlus45_71x71y
public void Rotate_100x0yPlus45_71x71y()
{
var velocity = new Velocity(10, 0);
var angle = new Angle(Math.PI / 4d);
var act = velocity.Rotate(angle);
var exp = new Velocity(Math.Sqrt(50), Math.Sqrt(50));
CloudBallAssert.AreEqual(exp, act);
}
示例14: TestRotateAroundPoint
public void TestRotateAroundPoint()
{
Angle a = new Angle(45, Angle.Representation.Degree);
Point c1 = new Point(0.5, 0.5);
Point p1 = new Point(1, 2);
var rotated = Rotation.AroundPoint(c1, a, p1);
Assert.AreEqual(-0.2071, rotated.X, 0.01);
Assert.AreEqual(1.9142, rotated.Y, 0.01);
}
示例15: Latitude
// Prevent null reference access
/// <summary>Initializes a new instance of the Latitude class.</summary>
/// <param name="angle">The angle of the latitude.</param>
/// <exception cref="ArgumentNullException">angle is null.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// angle is greater than 90 degrees or less than -90 degrees.
/// </exception>
public Latitude(Angle angle)
: base((angle ?? new Angle(0)).Radians)
{
if (angle == null)
{
throw new ArgumentNullException("angle");
}
ValidateRange("angle", angle.Radians, -Math.PI / 2.0, Math.PI / 2.0);
}