|
using System;
using System.Windows;
namespace RegScanHarness.Helpers.Util
{
public static class Utils
{
/// <summary>
/// Converts a coordinate from the polar coordinate system to the cartesian coordinate system.
/// </summary>
/// <param name="angle"></param>
/// <param name="radius"></param>
/// <returns></returns>
public static Point ComputeCartesianCoordinate(double angle, double radius)
{
// convert to radians
double angleRad = (Math.PI / 180.0) * (angle - 90);
double x = radius * Math.Cos(angleRad);
double y = radius * Math.Sin(angleRad);
Point p = new Point(x, y);
return p;
}
public static Point Offset(this Point point, double X, double Y)
{
return new System.Windows.Point(point.X + X, point.Y + Y);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Network and programming specialist. Started in C, and have learned about 14 languages since then. Cisco programmer, and lately writing a lot of C# and WPF code, (learning Java too). If I can dream it up, I can probably put it to code. My software company, (VTDev), is on the verge of releasing a couple of very cool things.. keep you posted.