Skip to content
This repository was archived by the owner on Dec 13, 2024. It is now read-only.

Commit 0e77e63

Browse files
committed
Rename "MadnessVector2" to "MadnessVector" and remove unnecessary methods.
1 parent 3dacca1 commit 0e77e63

File tree

2 files changed

+38
-86
lines changed

2 files changed

+38
-86
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Diagnostics;
3+
using System.Numerics;
4+
using Walgelijk;
5+
6+
namespace MIR;
7+
/// <summary>
8+
/// Includes methods for manual <see cref="Vector2"/> manipulation.
9+
/// and old cpu supported methods instead of Walgelijk's utilities.
10+
/// It also has some additional methods if you want to use it, I will use this
11+
/// as an argument in my pull request reasoning
12+
/// </summary>
13+
public class MadnessVector2
14+
{
15+
/// <summary>
16+
/// Returns a new normalized version of the provided <see cref="Vector2"/>, without hardware acceleration.
17+
/// and without changing the original <see cref="Vector2"/>. Also checks if the <see cref="Vector2"/>
18+
/// is NaN or Infinite.
19+
/// </summary>
20+
/// <param name="ToNormalize"> the <see cref="Vector2"/> to normalize.</param>
21+
/// <returns><see cref="Vector2"/></returns>
22+
public static Vector2 Normalize(Vector2 ToNormalize)
23+
{
24+
return ToNormalize / ToNormalize.Length();
25+
}
26+
27+
/// <summary>
28+
/// A replacement for Walgelijk's built-in "GetRandomPointInCircle" method, utilising
29+
/// MadnessVector normalization instead.
30+
/// </summary>
31+
/// <param name="minRadius"></param>
32+
/// <param name="maxRadius"></param>
33+
/// <returns></returns>
34+
public static Vector2 RandomPointInCircle(float minRadius = 0f, float maxRadius = 1f)
35+
{
36+
return Normalize(new Vector2(Utilities.RandomFloat(-1f), Utilities.RandomFloat(-1f))) * Utilities.RandomFloat(minRadius, maxRadius);
37+
}
38+
}

src/MadnessInteractiveReloaded/Shared/MadnessVector2.cs

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)