From 9f65f5bb9c781626056871de5ab9abfac0d10464 Mon Sep 17 00:00:00 2001 From: Daniel Keenan Date: Sun, 26 Nov 2023 11:35:28 +1000 Subject: [PATCH] Split proposal into 3 --- ...al - 3.0 Additional math types - Angle.md} | 41 +++++-------------- ...- 3.0 Additional math types - Collision.md | 41 +++++++++++++++++++ ...sal - 3.0 Additional math types - Color.md | 37 +++++++++++++++++ 3 files changed, 89 insertions(+), 30 deletions(-) rename documentation/proposals/{Proposal - 3.0 Additional math types.md => Proposal - 3.0 Additional math types - Angle.md} (95%) create mode 100644 documentation/proposals/Proposal - 3.0 Additional math types - Collision.md create mode 100644 documentation/proposals/Proposal - 3.0 Additional math types - Color.md diff --git a/documentation/proposals/Proposal - 3.0 Additional math types.md b/documentation/proposals/Proposal - 3.0 Additional math types - Angle.md similarity index 95% rename from documentation/proposals/Proposal - 3.0 Additional math types.md rename to documentation/proposals/Proposal - 3.0 Additional math types - Angle.md index 325810403e..934649a16d 100644 --- a/documentation/proposals/Proposal - 3.0 Additional math types.md +++ b/documentation/proposals/Proposal - 3.0 Additional math types - Angle.md @@ -46,13 +46,14 @@ public readonly struct Angle where T : IFloatingPointIeee754 { - public readonly T Radians; + public readonly T TotalRadians; - public Angle(T radians) { } + public Angle(T totalRadians) { } public T Degrees { get; } - public T Gradians { get; } + public T TotalDegrees { get; } + public T TotalRdians { get; } public T Milliradians { get; } public T Minutes { get; } public T Seconds { get; } @@ -170,6 +171,12 @@ public readonly struct Angle public static implicit operator T(Angle angle) => default; } +``` + + + +```csharp + public static class Angle { public static Angle FromRadians(T radians) @@ -251,30 +258,4 @@ public static class Angle where T : IFloatingPointIeee754 => default; } -``` - -## "Collision" types. - -DirectX and other APIs include "collision shapes" that can be used for such things as culling. `Silk.Net.Maths` already includes some types i.e. `BoxF`, `PlaneF`. These are additional. - -### Frustum - -### OrientedBox - -### CollisionHelper - -### PlaneIntersectionType - -### ContainmentType - -## Color types. - -### Color - -### ColorBGRA - -### ColorHSV - -### Color3 - -### Color4 +``` \ No newline at end of file diff --git a/documentation/proposals/Proposal - 3.0 Additional math types - Collision.md b/documentation/proposals/Proposal - 3.0 Additional math types - Collision.md new file mode 100644 index 0000000000..fb1a638bb5 --- /dev/null +++ b/documentation/proposals/Proposal - 3.0 Additional math types - Collision.md @@ -0,0 +1,41 @@ +# Summary +Proposal API for additional math types to bring it up to feature parity with other popular math libraries i.e. `SlimDX`, `SharpDX`, or `Stride3D`. Leveraging modern .NET features such as `INumber` and vectorization. + +This proposal is regarding "collision shapes" for containment and intersection tests. + +# Contributors +- Daniel Keenan (dfkeenan) + +# Current Status +- [x] Proposed +- [ ] Discussed with API Review Board (ARB) +- [ ] Approved +- [ ] Implemented + +# Design Decisions +- This proposal should compliment/augment the proposed 3.0 implementation of `Silk.Net.Maths`, matching `System.Numerics` where possible, with concessions for design oversights in that api. +- This proposal assumes no knowledge of the 2.x Math library. +- Text herein marked **INFORMATIVE** does not form a normative part of this proposal, and is for background only. +- Within this proposal, the key words **must**, **required**, **shall**, **should**, **recommended**, **may**, **could**, and **optional** are to be interpreted as described in [RFC 2119 - Key words for use in RFCs to Indicate Requirement Levels](https://www.ietf.org/rfc/rfc2119.txt). The additional key word **optionally** is an alternate form of **optional**, for use where grammatically appropriate. These key words are highlighted in the proposal for clarity. + +# **INFORMATIVE** Integer and Floating Point Types +While investigating the use of generic math it was decided to provide both an integer and floating point variant for each vector type and every type built from them. See [Generic Math](Proposal%20-%20Generic%20Math.md) proposal for more details. + +# I types versus F Types +Where it is appropriate for a type in this proposal to have both integer and floating point variants they will have a name that ends in I or F, defining whether it is an integer type or floating point type. Integer types **must** use a generic type argument `T` with the constraint of `IBinaryInteger`. On the other hand, floating point types **must** use a generic type argument `T` with the constraint of `IFloatingPointIeee754`. + +# Proposed API + +DirectX and other APIs include "collision shapes" that can be used for such things as culling. `Silk.Net.Maths` already includes some types i.e. `BoxF`, `PlaneF`. These are additional. + +### Frustum + +### OrientedBox + +### CollisionHelper + +### PlaneIntersectionType + +### ContainmentType + + diff --git a/documentation/proposals/Proposal - 3.0 Additional math types - Color.md b/documentation/proposals/Proposal - 3.0 Additional math types - Color.md new file mode 100644 index 0000000000..79853831b0 --- /dev/null +++ b/documentation/proposals/Proposal - 3.0 Additional math types - Color.md @@ -0,0 +1,37 @@ +# Summary +Proposal API for additional math types to bring it up to feature parity with other popular math libraries i.e. `SlimDX`, `SharpDX`, or `Stride3D`. Leveraging modern .NET features such as `INumber` and vectorization. + +This proposal is regarding color type structs. + +# Contributors +- Daniel Keenan (dfkeenan) + +# Current Status +- [x] Proposed +- [ ] Discussed with API Review Board (ARB) +- [ ] Approved +- [ ] Implemented + +# Design Decisions +- This proposal should compliment/augment the proposed 3.0 implementation of `Silk.Net.Maths`, matching `System.Numerics` where possible, with concessions for design oversights in that api. +- This proposal assumes no knowledge of the 2.x Math library. +- Text herein marked **INFORMATIVE** does not form a normative part of this proposal, and is for background only. +- Within this proposal, the key words **must**, **required**, **shall**, **should**, **recommended**, **may**, **could**, and **optional** are to be interpreted as described in [RFC 2119 - Key words for use in RFCs to Indicate Requirement Levels](https://www.ietf.org/rfc/rfc2119.txt). The additional key word **optionally** is an alternate form of **optional**, for use where grammatically appropriate. These key words are highlighted in the proposal for clarity. + +# **INFORMATIVE** Integer and Floating Point Types +While investigating the use of generic math it was decided to provide both an integer and floating point variant for each vector type and every type built from them. See [Generic Math](Proposal%20-%20Generic%20Math.md) proposal for more details. + +# I types versus F Types +Where it is appropriate for a type in this proposal to have both integer and floating point variants they will have a name that ends in I or F, defining whether it is an integer type or floating point type. Integer types **must** use a generic type argument `T` with the constraint of `IBinaryInteger`. On the other hand, floating point types **must** use a generic type argument `T` with the constraint of `IFloatingPointIeee754`. + +# Proposed API + +### Color + +### ColorBGRA + +### ColorHSV + +### Color3 + +### Color4