public void CosFTest() { float angle = 100; float expected = MathF.Cos(angle); float result = SharedUtilities.CosF(angle); Assert.AreEqual(expected, result); }
public static void FillNgonAtCenter(this Graphics g, Brush b, int n, float x, float y, float diameter = 10, float phase = 0) { float radius = diameter / 2f; PointF[] points = new PointF[n]; float angle = SharedUtilities.DegToRad(phase); float deltaAngle = SharedUtilities.PI * 2f / n; for (int i = 0; i < n; i++) { points[i] = new PointF( x + radius * SharedUtilities.CosF(angle), y + radius * SharedUtilities.SinF(angle)); angle += deltaAngle; } g.FillPolygon(b, points); }
public void CosFTest() { Assert.IsTrue(SharedUtilities.CosF(0).Equals((float)Math.Cos(0))); }