Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Fix ray query default options to include backfaces

Yuechen Li382d91138c96
diff --git a/Aetheris.Kernel.Core/Brep/Queries/BrepSpatialQueries.cs b/Aetheris.Kernel.Core/Brep/Queries/BrepSpatialQueries.cs
index 56e0463c..5e54ad86 100644
--- a/Aetheris.Kernel.Core/Brep/Queries/BrepSpatialQueries.cs
+++ b/Aetheris.Kernel.Core/Brep/Queries/BrepSpatialQueries.cs
@@ -21,7 +21,9 @@ public static class BrepSpatialQueries
ToleranceContext? tolerance = null)
{
var context = tolerance ?? ToleranceContext.Default;
- var queryOptions = options ?? new RayQueryOptions();
+ // RayQueryOptions is a value type; `new RayQueryOptions()` would produce CLR default values
+ // (IncludeBackfaces=false), so use the explicit query default profile for v1 semantics.
+ var queryOptions = options ?? RayQueryOptions.Default;
if (!TryResolvePrimitive(body, out var primitive, out var diagnostic))
{
diff --git a/Aetheris.Kernel.Core/Brep/Queries/RayQueryOptions.cs b/Aetheris.Kernel.Core/Brep/Queries/RayQueryOptions.cs
index 4df71d38..32d87b45 100644
--- a/Aetheris.Kernel.Core/Brep/Queries/RayQueryOptions.cs
+++ b/Aetheris.Kernel.Core/Brep/Queries/RayQueryOptions.cs
@@ -2,4 +2,7 @@ namespace Aetheris.Kernel.Core.Brep.Queries;
public readonly record struct RayQueryOptions(
double? MaxDistance = null,
- bool IncludeBackfaces = true);
+ bool IncludeBackfaces = true)
+{
+ public static RayQueryOptions Default => new(null, IncludeBackfaces: true);
+}