GianFossi.Geometry
2.0.0
dotnet add package GianFossi.Geometry --version 2.0.0
NuGet\Install-Package GianFossi.Geometry -Version 2.0.0
<PackageReference Include="GianFossi.Geometry" Version="2.0.0" />
<PackageVersion Include="GianFossi.Geometry" Version="2.0.0" />
<PackageReference Include="GianFossi.Geometry" />
paket add GianFossi.Geometry --version 2.0.0
#r "nuget: GianFossi.Geometry, 2.0.0"
#:package GianFossi.Geometry@2.0.0
#addin nuget:?package=GianFossi.Geometry&version=2.0.0
#tool nuget:?package=GianFossi.Geometry&version=2.0.0
Geometry Repository Guide
This repository contains an F# geometry kernel (Geometry), a pressure-vessel component library built on it (Geometry.PressureVessel) and their test suite (GeometryTests).
What this codebase is
- A .NET 8 class library focused on 2D and 3D geometric primitives and operations
- Organized around immutable value types (points, vectors, lines, planes, circles, segments, etc.)
- Includes tolerance-aware comparisons to reduce floating-point instability
Key technologies
- Language: F#
- Runtime/SDK: .NET 8 (
net8.0) - Testing: xUnit (
Microsoft.NET.Test.Sdk,xunit,xunit.runner.visualstudio)
Repository structure
.
├── Geometry.sln
├── Geometry/ # KERNEL → Geometry.dll (GianFossi.Geometry)
│ ├── Geometry.fsproj
│ ├── General.*.fs # shared errors/tolerance infrastructure
│ ├── Space3D/ # 3D primitives, topology, meshes, CSG, intersections
│ │ ├── Vector3d.fs, Point3d.fs, Line3d.fs, Segment3d.fs, Plane3d.fs, ...
│ │ └── Revolution/ # meridian profiles, revolved physical properties, classified surfaces
│ ├── Space2D/ # 2D primitives and operations
│ └── Kernel/ # unified Shape3d and OpenCascade-like commands
│ ├── Profile2d.fs, SectionIntegrals.fs, SolidProperties3d.fs, Shape3d.fs
│ └── Make.fs, Transform.fs, Props.fs, Inquiry.fs, Boolean.fs
├── Geometry.PressureVessel/ # COMPONENTS → Geometry.PressureVessel.dll (GianFossi.Geometry.PressureVessel)
│ ├── Legacy/ # existing calculators (namespace Geometry.Space3D, unchanged)
│ ├── Components/ # PressureComponent base class and families
│ └── Apparatus/ # Apparatus: composition, mass, center of gravity, surfaces
└── GeometryTests/
├── GeometryTests.fsproj
└── Tests.*.fs # behavior-focused unit tests per domain object
See docs/KERNEL_COMMANDS.md for the kernel command map (Make, Transform, Boolean, Props, Inquiry ↔ OpenCascade), the component families and the apparatus model.
How code is organized
1) Namespace split by dimensional domain
Geometry.Space3Dfor 3D types and functionsGeometry.Space2Dfor 2D types and functionsGeometryfor shared concepts (for exampleTolerance)Geometry.Kernelfor the unified shapes and commands (Make,Transform,Boolean,Props,Inquiry)Geometry.PressureVesselfor the component classes and theApparatus(separate assembly; the existing pressure-vessel calculators keep theGeometry.Space3Dnamespace)
2) Type + module pattern
Most files define:
- a struct-like type (example:
Vector3d,Point2d) - a module with operations over that type (example:
module Vector3d,module Point2d)
This keeps data representation and reusable operations close together.
3) Tolerance-aware numerical behavior
- Shared tolerance values are exposed via
Tolerance.Global - Many equality/parallel/perpendicular checks accept tolerance to avoid strict floating-point comparisons
4) Tests mirror the domain model
Tests.Vector3d.fs,Tests.Point3d.fs,Tests.Line3d.fs, etc.- Each file verifies one geometric concept and common edge conditions (coincident points, parallel lines, round-trip transforms, etc.)
Build and test
From the repository root:
dotnet build Geometry.sln
dotnet test GeometryTests/GeometryTests.fsproj
dotnet build Geometry.PressureVessel/Geometry.PressureVessel.fsproj -c Release
The release DLLs are generated at Geometry/bin/Release/net8.0/Geometry.dll (kernel) and
Geometry.PressureVessel/bin/Release/net8.0/Geometry.PressureVessel.dll (components; it references the kernel).
Publishing a GitHub release triggers .github/workflows/release-dll.yml, which rebuilds both libraries in Release, runs the test suite, uploads a zip containing both DLLs with their .deps.json and .pdb files to the release assets, packs two NuGet packages (lib/net8.0/Geometry.dll and lib/net8.0/Geometry.PressureVessel.dll, each with readme.md), validates those package entries, and publishes the packages to both the GitHub release and NuGet.org.
The packages are published on NuGet.org with IDs GianFossi.Geometry (kernel) and GianFossi.Geometry.PressureVessel (components, depends on the kernel package). Moving the pressure-vessel types to their own assembly keeps source compatibility (open Geometry.Space3D unchanged) but not binary compatibility: release it as a new major version.
The workflow can also be triggered manually via Actions → Release DLL → Run workflow to attach assets to an already-published release. Supply the release tag (e.g. V1.0.0) as the input when running manually.
Fully explained examples
Below are representative examples based on existing APIs and test scenarios.
Example 1: Vector length and normalization (3D)
open Geometry
open Geometry.Space3D
let v = Vector3d(3.0, 4.0, 0.0)
let len = Vector3d.length v
let u = Vector3d.normalize Tolerance.Global v
What happens:
vis the vector (3,4,0), a classic 3-4-5 triangle.Vector3d.length vreturns5.0.normalizescales the vector to unit length (length = 1) while preserving direction.Tolerance.Globalcontrols numerical checks used internally for safe normalization logic.
Why this matters:
- Many geometric algorithms assume unit vectors for direction, angle, and projection computations.
Example 2: Project a point onto a 3D line and compute distance
open Geometry.Space3D
let line = Line3d(Point3d.origin, Vector3d.ex)
let p = Point3d(2.0, 3.0, 4.0)
let proj = Line3d.projection p line
let d = Line3d.distance p line
What happens:
lineis the X-axis through the origin.pis at coordinates (2,3,4).- Projection onto X-axis keeps x and removes y,z, so
projbecomes (2,0,0). - Distance is
sqrt(3² + 4²) = 5, sod = 5.0.
Why this matters:
- Projection + distance are foundational for closest-point, fitting, and constraint problems.
Example 3: 2D local/world coordinate conversion round-trip
open System
open Geometry.Space2D
let cs = CoordinateSystem2d.fromAngle (Point2d(1.0, 2.0)) (Math.PI / 4.0)
let pWorld = Point2d(5.0, 7.0)
let pLocal = CoordinateSystem2d.worldToLocal cs pWorld
let pBack = CoordinateSystem2d.localToWorld cs pLocal
What happens:
- A local coordinate system is created with origin (1,2), rotated by 45°.
worldToLocalexpressespWorldin that rotated local frame.localToWorldconverts back to global coordinates.pBackshould matchpWorld(up to tolerance), proving transform consistency.
Why this matters:
- CAD, robotics, and graphics frequently chain transforms between local and global frames.
Example 4: Lift a 2D circle onto an arbitrary 3D plane
open Geometry
open Geometry.Space2D
open Geometry.Space3D
let plane = Plane3d(Point3d.origin, Vector3d.ez) // XY plane
let c2 = Circle2d(Point2d(3.0, 4.0), 2.0)
let c3 = Circle2d.toCircle3d plane c2
What happens:
c2is a 2D circle with center (3,4) and radius 2.toCircle3dembeds that circle in the chosen plane.- The 3D circle keeps:
- center lying on the plane,
- same radius,
- normal aligned with plane normal.
Why this matters:
- This bridges planar geometry and full 3D workflows without rewriting algorithms.
Practical reading path for newcomers
- Start with
Geometry/General.Tolerance.fsto understand numerical behavior. - Read one primitive deeply (
Space3D/Vector3d.fsorSpace2D/Geometry.2D.Point.fs). - Follow its matching test file in
GeometryTests/. - Move to relation-heavy objects (
Line3d,Plane3d,CoordinateSystem2d/3d).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- FSharp.Core (>= 10.1.401)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on GianFossi.Geometry:
| Package | Downloads |
|---|---|
|
GianFossi.Geometry.PressureVessel
Pressure-vessel and heat-exchanger components (shells, heads, flanges, tubesheets, nozzles, supports, tubes) and apparatus composition built on the GianFossi.Geometry kernel: geometry and mass properties only, no strength checks. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 134 | 10/27/2026 |