This repository was archived by the owner on Dec 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +38
-86
lines changed
src/MadnessInteractiveReloaded/Shared Expand file tree Collapse file tree 2 files changed +38
-86
lines changed Original file line number Diff line number Diff line change 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+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments