Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@

## Build and test workflows
- Solution: `FixedMathSharp.sln` with library project and test project.
- Target frameworks are multi-targeted in both projects: `net48;net8`.
- Target frameworks are configured in the respective `.csproj` files; `net8.0` is the primary TFM.
- Typical local workflow:
- `dotnet restore`
- `dotnet build --configuration Debug --no-restore`
- `dotnet test --configuration Debug`
- CI detail from `.github/workflows/dotnet.yml`:
- Linux runs `net48` tests via Mono + `xunit.console.exe` and `net8` via `dotnet test -f net8`.
- Windows runs `dotnet test` for both TFMs.
- Linux and Windows both run `dotnet test` against the supported TFMs (with `net8.0` as the primary test target).
- Refer to the workflow file for the exact matrix of OS/TFM combinations.
- Packaging/versioning comes from `src/FixedMathSharp/FixedMathSharp.csproj`: GitVersion variables are consumed when present, otherwise version falls back to `0.0.0`.

## Code conventions specific to this repo
- Prefer `Fixed64` constants (`Fixed64.Zero`, `Fixed64.One`, `FixedMath.PI`) over primitive literals in math-heavy code.
- Preserve saturating/guarded semantics in operators and math helpers (for example `Fixed64` add/sub overflow behavior).
- When touching bounds logic, maintain cross-type dispatch shape in `Intersects(IBound)` and shared clamping projection via `IBoundExtensions.ProjectPointWithinBounds`.
- Serialization compatibility is intentional:
- MessagePack attributes on serializable structs (`[MessagePackObject]`, `[Key]`) across TFMs.
- Conditional serializers in tests (`BinaryFormatter` for `NET48`, `System.Text.Json` for `NET8`).
- Serialization compatibility is intentional and now uses MemoryPack:
- MemoryPack attributes on serializable structs (for example `[MemoryPackable]`, `[MemoryPackInclude]`) are the source of truth for serialized layouts.
- Tests use MemoryPack-based roundtrips (and `System.Text.Json` where appropriate) instead of legacy `MessagePack`/`BinaryFormatter` serializers.
- `ThreadLocalRandom` is marked `[Obsolete]`; new deterministic RNG work should prefer `DeterministicRandom` and `DeterministicRandom.FromWorldFeature(...)` in `src/FixedMathSharp/Utility/DeterministicRandom.cs`.

## Testing patterns to mirror
Expand Down
1 change: 0 additions & 1 deletion src/FixedMathSharp/Bounds/BoundingArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ public bool Intersects(IBound other)

default: return false; // Default case for unknown or unsupported types
}
;
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/FixedMathSharp/Bounds/BoundingBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public partial struct BoundingBox : IBound, IEquatable<BoundingBox>
public Vector3d Max { get; private set; }

/// <summary>
///
/// Serialization/compatibility version of this <see cref="BoundingBox"/> instance.
/// </summary>
[MemoryPackOrder(2)]
public byte Version { get; private set; }
Expand Down Expand Up @@ -238,7 +238,6 @@ public bool Intersects(IBound other)
default:
return false; // Default case for unknown or unsupported types
}
;
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/FixedMathSharp/Bounds/BoundingSphere.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public bool Intersects(IBound other)

default: return false; // Default case for unknown or unsupported types
}
;
}

/// <summary>
Expand Down
6 changes: 1 addition & 5 deletions src/FixedMathSharp/FixedMathSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<!-- Define the target framework and compatibility -->
<LangVersion>11.0</LangVersion>
<TargetFrameworks>netstandard2.1;net8</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
<!-- Versioning and Build Configuration -->
<!-- Set SemVer to GitVersion_FullSemVer if available, otherwise fallback to 0.0.0 -->
<SemVer Condition="'$(GitVersion_FullSemVer)' != ''">$(GitVersion_FullSemVer)</SemVer>
Expand Down Expand Up @@ -68,10 +68,6 @@
<!-- Dependencies and Package References -->
<ItemGroup>
<PackageReference Include="MemoryPack" Version="1.21.4" />
<PackageReference Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<!-- Ensure LICENSE, README, & icon files are included in the NuGet package -->
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/FixedMathSharp/Numerics/FixedQuaternion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public static FixedQuaternion FromAxisAngle(Vector3d axis, Fixed64 angle)

// Check if the angle is in a valid range (-pi, pi)
if (angle < -FixedMath.PI || angle > FixedMath.PI)
throw new ArgumentOutOfRangeException($"Angle must be in the range ({-FixedMath.PI}, {FixedMath.PI}), but was {angle}");
throw new ArgumentOutOfRangeException(nameof(angle), angle, $"Angle must be in the range ({-FixedMath.PI}, {FixedMath.PI}), but was {angle}");

Fixed64 halfAngle = angle / Fixed64.Two; // Half-angle formula
Fixed64 sinHalfAngle = FixedMath.Sin(halfAngle);
Expand Down Expand Up @@ -412,7 +412,7 @@ public static FixedQuaternion FromEulerAngles(Fixed64 pitch, Fixed64 yaw, Fixed6
yaw < -FixedMath.PI || yaw > FixedMath.PI ||
roll < -FixedMath.PI || roll > FixedMath.PI)
{
throw new ArgumentOutOfRangeException($"Euler angles must be in the range ({-FixedMath.PI}, {FixedMath.PI}), but were ({pitch}, {yaw}, {roll})");
throw new ArgumentOutOfRangeException(nameof(pitch), $"Euler angles must be in the range ({-FixedMath.PI}, {FixedMath.PI}), but were ({pitch}, {yaw}, {roll})");
}

Fixed64 c1 = FixedMath.Cos(yaw / Fixed64.Two);
Expand Down
6 changes: 1 addition & 5 deletions tests/FixedMathSharp.Tests/FixedMathSharp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>11.0</LangVersion>
<TargetFrameworks>net8</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -16,10 +16,6 @@
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
<PackageReference Include="MemoryPack" Version="1.21.4" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Loading