GianFossi.Geometry 2.0.0

dotnet add package GianFossi.Geometry --version 2.0.0
                    
NuGet\Install-Package GianFossi.Geometry -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GianFossi.Geometry" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GianFossi.Geometry" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="GianFossi.Geometry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GianFossi.Geometry --version 2.0.0
                    
#r "nuget: GianFossi.Geometry, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GianFossi.Geometry@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GianFossi.Geometry&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=GianFossi.Geometry&version=2.0.0
                    
Install as a Cake Tool

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.Space3D for 3D types and functions
  • Geometry.Space2D for 2D types and functions
  • Geometry for shared concepts (for example Tolerance)
  • Geometry.Kernel for the unified shapes and commands (Make, Transform, Boolean, Props, Inquiry)
  • Geometry.PressureVessel for the component classes and the Apparatus (separate assembly; the existing pressure-vessel calculators keep the Geometry.Space3D namespace)

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:

  1. v is the vector (3,4,0), a classic 3-4-5 triangle.
  2. Vector3d.length v returns 5.0.
  3. normalize scales the vector to unit length (length = 1) while preserving direction.
  4. Tolerance.Global controls 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:

  1. line is the X-axis through the origin.
  2. p is at coordinates (2,3,4).
  3. Projection onto X-axis keeps x and removes y,z, so proj becomes (2,0,0).
  4. Distance is sqrt(3² + 4²) = 5, so d = 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:

  1. A local coordinate system is created with origin (1,2), rotated by 45°.
  2. worldToLocal expresses pWorld in that rotated local frame.
  3. localToWorld converts back to global coordinates.
  4. pBack should match pWorld (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:

  1. c2 is a 2D circle with center (3,4) and radius 2.
  2. toCircle3d embeds that circle in the chosen plane.
  3. 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

  1. Start with Geometry/General.Tolerance.fs to understand numerical behavior.
  2. Read one primitive deeply (Space3D/Vector3d.fs or Space2D/Geometry.2D.Point.fs).
  3. Follow its matching test file in GeometryTests/.
  4. Move to relation-heavy objects (Line3d, Plane3d, CoordinateSystem2d/3d).
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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