Skip to content

Commit

Permalink
Split proposal into 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dfkeenan committed Nov 26, 2023
1 parent 4b4798a commit 9f65f5b
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ public readonly struct Angle<T>
where T : IFloatingPointIeee754<T>
{

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; }
Expand Down Expand Up @@ -170,6 +171,12 @@ public readonly struct Angle<T>
public static implicit operator T(Angle<T> angle) => default;
}

```



```csharp

public static class Angle
{
public static Angle<T> FromRadians<T>(T radians)
Expand Down Expand Up @@ -251,30 +258,4 @@ public static class Angle
where T : IFloatingPointIeee754<T>
=> 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
```
Original file line number Diff line number Diff line change
@@ -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<T>` 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<T>`. On the other hand, floating point types **must** use a generic type argument `T` with the constraint of `IFloatingPointIeee754<T>`.

# 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


Original file line number Diff line number Diff line change
@@ -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<T>` 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<T>`. On the other hand, floating point types **must** use a generic type argument `T` with the constraint of `IFloatingPointIeee754<T>`.

# Proposed API

### Color

### ColorBGRA

### ColorHSV

### Color3

### Color4

0 comments on commit 9f65f5b

Please sign in to comment.