npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ledoug/cadex-kernel

v0.1.6

Published

CADEX geometric kernel — pure ESM, runs in Node.js and the browser.

Readme

CADEX Kernel

Moteur géométrique B-Rep / NURBS en JavaScript pur.

Un noyau de modélisation géométrique exact, sans dépendance native, conçu pour reconstruire intégralement une géométrie CAD à partir de sa seule paramétrisation. Il offre une représentation B-Rep adossée à des courbes et surfaces NURBS, des opérations booléennes robustes, et un modèle de tolérance par entité.

Robustesse SSI : ~98% vs référence industrielle · Sections exactes genus-1 sans NURBS · Pcurves exactes pour ExactSectionCurve · RK4 fallback pour surfaces aéro · Performance : -21% via 7 optimisations (LRU, hint-aware, bulk eval)


Pourquoi CADEX Kernel ?

CADEX Kernel reproduit, en JavaScript pur, le comportement d'un noyau de modélisation géométrique de qualité industrielle :

  • Géométrie exacte — B-Rep + NURBS, pas un maillage. Courbes et surfaces définies mathématiquement, évaluables à n'importe quelle résolution.
  • Opérations booléennes robustes — Union, différence, intersection via CSG/BSP avec prédicats géométriques exacts (Shewchuk) et filtrage par intervalles.
  • Features paramétriques — Extrusion, révolution, perçage, congés, chanfreins, dépouilles, coque… avec persistent naming pour le rejeu d'arbre.
  • Zéro dépendance native — ESM pur, exécutable dans Node.js comme dans un navigateur (Chromium/CEF). Aucun WASM, aucun binding C++.
  • Validation intégrée — Euler-Poincaré, manifoldité, fermeture des loops, coïncidence des endpoints. Chaque solide peut être audité.
  • Format .CADEX natif — Sérialisation lossless avec round-trip garanti.

Installation

npm install cadex-kernel

Démarrage rapide

import { makeBox, makeCylinder, fuse, checkSolid, serializeSolid } from 'cadex-kernel';

// Créer des primitives
const box = makeBox(10, 20, 5);
const cyl = makeCylinder(3, 8);

// Opération booléenne
const result = fuse(box, cyl);
const solid = result.toSolid();

// Valider
const report = checkSolid(solid);
console.log(report.valid); // true

// Sauvegarder au format .CADEX
const json = serializeSolid(solid);

Architecture en couches

┌──────────────────────────────────────────┐
│ L12  serialization  (.CADEX natif)       │
│ L11  healing        (ShapeFix)           │
│ L10  tessellation   (B-Rep → mesh)       │
│ L9   features       (persistent naming)  │
│ L8   construct      (sweep, loft, hole)  │
│ L7   dressing       (fillet, chamfer)    │
│ L6   booleans       (union, cut, common) │
│ L5   intersect      (CCI, CSI, SSI)      │
│ L4   binding        (pcurves, project)   │
│ L3   topology       (B-Rep entities)     │
│ L2   geometry       (NURBS, courbes)     │
│ L1   algebra        (Vec3, Mat4, etc.)   │
│ L0   numerics       (prédicats exacts)   │
└──────────────────────────────────────────┘

L0 — numerics (Fondations numériques)

Fonctions de base utilisées en interne. Pas destiné à l'usage direct.

| Export | Description | |---|---| | Precision | Constantes de tolérance (confusion, angular, intersection) | | Interval | Arithmétique d'intervalles pour filtrage | | predicates | Prédicats géométriques exacts (Shewchuk) | | simulationOfSimplicity | Perturbation symbolique | | solvers | Solveurs numériques |


L1 — algebra (Algèbre linéaire & primitives)

Types immuables

Tous les types de cette couche sont immuables : les méthodes renvoient de nouvelles instances.

Vec3

import { Vec3 } from 'cadex-kernel';

Vecteur 3D. Fondation de toute la géométrie.

| Constructeur / Statique | Description | |---|---| | new Vec3(x, y, z) | (0, 0, 0) par défaut | | Vec3.zero() | (0, 0, 0) | | Vec3.unitX(), .unitY(), .unitZ() | Vecteurs unitaires | | Vec3.fromArray(arr, offset?) | Depuis [x, y, z] |

| Méthode | Description | |---|---| | .clone() | Copie | | .add(v) | Somme vectorielle | | .sub(v) | Différence | | .scale(s) | Multiplication scalaire | | .dot(v) | Produit scalaire | | .cross(v) | Produit vectoriel | | .negate() | Opposé | | .length() | Norme | | .lengthSq() | Norme au carré | | .normalize() | Normalisé (nouveau) | | .distanceTo(v) | Distance euclidienne | | .distanceSqTo(v) | Distance au carré | | .lerp(v, t) | Interpolation linéaire | | .midpoint(v) | Point milieu | | .angleTo(v) | Angle (radians) | | .projectOnVector(v) | Projection | | .toArray(out?, offset?) | Vers Float64Array |

Statiques *Into (écriture dans un buffer, sans allocation) : .addInto, .subInto, .crossInto, .normalizeInto, etc. — utiles dans les boucles chaudes.

Vec2

Vecteur 2D. Mêmes méthodes que Vec3 sans la composante Z.

Vec4

Vecteur 4D homogène.

Mat3

Matrice 3×3, stockage column-major en Float64Array(9).

| Constructeur | Description | |---|---| | new Mat3(elements?) | Identité par défaut | | Mat3.identity() | Identité | | Mat3.fromRows(r0, r1, r2) | Depuis 3 rangées [a,b,c] | | Mat3.fromColumns(c0, c1, c2) | Depuis 3 Vec3 | | Mat3.scale(sx, sy, sz) | Diagonale |

| Méthode | Description | |---|---| | .multiply(m) | Produit matriciel | | .transformVec3(v) | this · v | | .transpose() | Transposée | | .determinant() | Déterminant | | .inverse() | Inverse (si inversible) | | .clone() | Copie |

Mat4

Matrice 4×4, colonnes-major, compatible Three.js.

Quaternion

import { Quaternion } from 'cadex-kernel';

| Statique | Description | |---|---| | Quaternion.identity() | Identité | | Quaternion.fromAxisAngle(axis, angle) | Rotation axe/angle | | Quaternion.fromBetweenVectors(from, to) | Rotation alignant deux vecteurs |

| Méthode | Description | |---|---| | .rotateVec3(v) | Applique la rotation | | .multiply(q) | Composition | | .inverse() | Conjugué (unitaire) | | .slerp(q, t) | Interpolation sphérique |

Transform

Transformation rigide + échelle uniforme : $\mathbf{x} \mapsto s \cdot R\mathbf{x} + \mathbf{t}$.

| Constructeur | Description | |---|---| | new Transform(rotation?, translation?, scale?) | Identité par défaut | | Transform.fromTranslation(v) | Translation pure | | Transform.fromRotation(q) | Rotation pure | | Transform.fromAxisAngle(axis, angle) | Rotation autour d'un axe |

| Méthode | Description | |---|---| | .transformPoint(p) | Transforme un point | | .transformDirection(d) | Transforme une direction | | .transformNormal(n) | Transforme une normale (rotation seule) | | .inverse() | Transforme inverse | | .multiply(t) | Composition |

Autres exports

| Export | Description | |---|---| | Plane | Plan (point + normale) | | Line3 | Droite 3D (point + direction) | | Ray3 | Demi-droite (point + direction) | | Circle3 | Cercle 3D | | BoundingBox | AABB (boîte englobante alignée) | | OBB | Boîte englobante orientée | | AxisSystem | Repère orthonormé 3D | | orthonormalBasisFromZ(axis) | Construit une base orthonormée à partir de Z |


L2 — geometry (Courbes & Surfaces NURBS)

Courbes

import { NurbsCurve, Line3Curve, CircleCurve, ... } from 'cadex-kernel';

| Classe | Description | |---|---| | Curve3 | Classe abstraite | | NurbsCurve | NURBS (rationnelle, degré quelconque) | | Line3Curve | Segment de droite | | CircleCurve | Arc de cercle | | EllipseCurve | Arc d'ellipse | | BezierCurve | Courbe de Bézier | | ParabolaCurve | Arc de parabole | | HyperbolaCurve | Arc d'hyperbole | | HelixCurve | Hélice | | PolyCurve | Polyligne | | TrimmedCurve | Courbe restreinte à un sous-domaine | | CompositeCurve | Concaténation de courbes | | OffsetCurve | Courbe décalée | | ProjectedCurve | Projection sur surface | | ExactSectionCurve | Section conique exacte |

NurbsCurve

const curve = new NurbsCurve(degree, knots, controlPoints, weights?);
// degree     : number — degré (1=linéaire, 2=quadratique, 3=cubique)
// knots      : number[] — vecteur de nœuds clampé, longueur = nCP + degree + 1
// controlPoints : Vec3[]
// weights    : number[] — poids (1 par défaut = B-spline non rationnelle)

| Méthode | Description | |---|---| | .value(t) | Point 3D au paramètre t | | .derivative(t, order?) | Dérivée(s) | | .domain() | Interval du domaine paramétrique | | .isClosed() | Courbe fermée ? | | .isRational() | Rationnelle (poids non uniformes) ? | | .insertKnot(u, r?) | Insertion de nœud | | .decomposeToBezier() | Décomposition en Béziers | | .clone() | Copie profonde | | .transform(t) | Applique une Transform |

Surfaces

import { NurbsSurface, PlaneSurface, CylinderSurface, ... } from 'cadex-kernel';

| Classe | Description | |---|---| | Surface | Classe abstraite | | NurbsSurface | NURBS tensorielle | | PlaneSurface | Plan | | CylinderSurface | Cylindre | | ConeSurface | Cône | | SphereSurface | Sphère | | TorusSurface | Tore | | SurfaceOfExtrusion | Surface extrudée | | SurfaceOfRevolution | Surface de révolution |

NurbsSurface

const surf = new NurbsSurface(degU, degV, knotsU, knotsV, controlPoints, weights?);
// degU, degV       : number — degrés en u et v
// knotsU, knotsV   : number[] — vecteurs de nœuds clampés
// controlPoints    : Vec3[][] — grille 2D [numU][numV]
// weights          : number[][] — grille de poids 2D

| Méthode | Description | |---|---| | .value(u, v) | Point 3D | | .derivative(u, v, orderU?, orderV?) | Dérivée(s) | | .normal(u, v) | Normale unitaire | | .domainU(), .domainV() | Domaines paramétriques | | .isUClosed(), .isVClosed() | Périodique ? | | .isoCurveU(v) | Courbe isoparamétrique en u | | .isoCurveV(u) | Courbe isoparamétrique en v | | .clone() | Copie profonde |

NURBS — Algorithmes

import { findSpan, basisFunctions, interpolateCurve, makeRevolvedSurface } from 'cadex-kernel';

| Fonction | Description | |---|---| | findSpan(n, p, u, knots) | Index du nœud span | | basisFunctions(span, u, p, knots) | Fonctions de base $N_{i,p}(u)$ | | basisFunctionDerivs(span, u, p, n, knots) | Dérivées des fonctions de base | | uniformClampedKnots(nCP, degree) | Vecteur de nœuds uniforme clampé | | interpolateCurve(points, degree) | Interpolation NURBS par points | | approximateCurve(points, degree, nCP) | Approximation NURBS | | interpolateSurface(points, degU, degV) | Interpolation surface | | approximateSurface(points, degU, degV, nU, nV) | Approximation surface | | makeRevolvedSurface(curve, axis, angle) | Surface de révolution depuis une courbe | | parameterize(points) | Paramétrisation par longueur de corde |


L3 — topology (B-Rep)

Hiérarchie d'entités

Body → Solid → Shell → Face → Loop → CoEdge → Edge → Vertex
import { Vertex, Edge, CoEdge, Loop, Face, Shell, Solid, Body,
         sewSolid, sewSolidNurbs, isShellClosed, linkMates, checkSolid,
         ToleranceContext, ModificationHistory,
         makeBox, makeCylinder, makeCone, makeSphere, makeTorus } from 'cadex-kernel';

| Classe | Rôle | |---|---| | Vertex | Point 3D + tolérance + liste d'arêtes incidentes | | Edge | Arête entre 2 sommets, porte une NurbsCurve (v3) | | CoEdge | Utilisation orientée d'une Edge dans un Loop (FORWARD/REVERSED) | | Loop | Cycle fermé de CoEdge (OUTER = contour, INNER = trou) | | Face | Portion de Surface délimitée par des Loop | | Shell | Ensemble connexe de Face (fermé → volume) | | Solid | Shell extérieur + cavités optionnelles | | Body | Conteneur hétérogène (solides + surfaces + fils + points) |

Modèle shape-tolerant

Chaque entité porte sa propre tolérance (≥ Precision.confusion = 1e-7 mm) qui peut croître lors des opérations booléennes. Solid.maxTolerance() retourne la tolérance maximale.

Constructeurs clés

new Vertex(point, tolerance?)
new Edge(startVertex, endVertex, curve?, interval?)
new CoEdge(edge, orientation?)
new Loop(coEdges?, kind?)
new Face(surface, sameSense?)
new Shell(faces?)
new Solid(shells?, genus?)
new Body()

Enums

Orientation.FORWARD  // 1  — la coedge va de edge.start à edge.end
Orientation.REVERSED // -1 — sens inverse
LoopKind.OUTER       // contour extérieur
LoopKind.INNER       // trou

Primitives

import { makeBox, makeCylinder, makeCone, makeSphere, makeTorus } from 'cadex-kernel';

| Fonction | Signature | |---|---| | makeBox(w, h, d) | (number, number, number) → Solid | | makeCylinder(r, h) | (number, number) → Solid | | makeCone(r1, r2, h) | (number, number, number) → Solid | | makeSphere(r) | (number) → Solid | | makeTorus(majorR, minorR) | (number, number) → Solid |

Couture (sewing)

import { sewSolid, sewSolidNurbs, isShellClosed, linkMates } from 'cadex-kernel';

// Couture polygonale (legacy) — tolérance de merge + octree O(n log n)
const solid = sewSolid(faceSpecs, { mergeTol: 1e-6, useOctree: true });

// Couture NURBS-native (v3) — identité de courbe par hash (knots+CP+weights)
const solid = sewSolidNurbs(faceSpecs, { mergeTol: 1e-6 });

// Vérification fermeture (gapTol pour mode tolerant)
const closed = isShellClosed(shell, gapTol);

| Export | Description | |---|---| | sewSolid(faces, opts?) | Couture polygonale (face specs → Solid) | | sewSolidNurbs(faces, opts?) | Couture NURBS-native : identité de courbe + octree | | isShellClosed(shell, gapTol?) | Vérifie la fermeture (gapTol pour arêtes tolerantes) | | linkMates(shell) | Apparie les coedges en mates radiales |

ToleranceContext

import { ToleranceContext } from 'cadex-kernel';

// 3 presets
ToleranceContext.strict()    // gapTol=0, exact B-Rep
ToleranceContext.tolerant()  // gapTol=1e-4, modélisation interactive (défaut)
ToleranceContext.import()    // gapTol=1e-3, import STEP/IGES

// Propriétés
ctx.gapTolerance             // gap max toléré
ctx.intersectionTolerance    // tolérance SSI
ctx.fittingTolerance         // tolérance fitting NURBS
ctx.mergeTolerance           // tolérance effective de merge = max(confusion, gapTol)
ctx.isTolerant               // true si gapTol > 0
ctx.clampTolerance(tol)      // clamp au range [confusion, confusion×maxGrowth]

Validation

import { checkSolid, checkBody } from 'cadex-kernel';

const report = checkSolid(solid, { context: ToleranceContext.tolerant() });
// { valid, errors, warnings, stats: { V, E, F, S, genus, euler, expected } }

Vérifie : Euler-Poincaré (relaxé en mode tolerant : 2 unités/arête tolerante), manifold edges, fermeture des loops, endpoints coïncidents, pas d'arêtes dégénérées.

Autres exports

| Export | Description | |---|---| | tessellate(solid, opts?) | Tessellation → { positions, normals, indices } | | BodyManager | Gestionnaire de corps multiples | | disassemble(solid) | Décompose en composantes connexes | | ModificationHistory | Historique des modifications (persistent naming) | | topoOperations | joinShells, sewSolids |


L4 — binding (Liaison géométrie/topologie)

import { Pcurve, Nurbs2, projectPointOnSurface, buildPcurves,
         checkCoherence, unwrapPeriodic } from 'cadex-kernel';

| Export | Description | |---|---| | Pcurve | Courbe 2D NURBS dans l'espace (u,v) d'une surface. .value(t), .point3d(t), .domain() | | Nurbs2 | Courbe NURBS 2D (x,y), base des pcurves | | Pcurve.liftTo3D(samples?) | Conversion pcurve → NurbsCurve 3D exacte | | projectPointOnSurface(point, surface) | Projection 3D → (u,v) | | buildPcurves(edge, face) | Construit les pcurves pour une arête sur une face | | checkCoherence(face) | Vérifie cohérence 3D ↔ pcurves | | unwrapPeriodic(values, period) | Dépliage de séquence périodique | | nearFarFilter(...) | Filtre de proximité pour accélérer les projections |


L5 — intersect (Intersections)

import {
  intersectCurveCurve, intersectCurveSurface, intersectSurfaceSurface,
  intersectFaces, IntersectionPoint, IntersectionCurve, CoincidentResult,
  fitMarchedCurve, fitMarchedCurveFromUV, fitAndVerifyPcurve,
  marchRobust3D, estimateMaxCurvaturePair,
  intersectNurbsNurbsBezier, implicitEquation,
  traceParametricBranch, guaranteedBranchSeeds
} from 'cadex-kernel';

Architecture de dispatch (4-tiers)

| Tier | Méthode | Cas couverts | |:----:|---------|-------------| | 1 | Analytique exact (formes closes) | 25 combos quadric×quadric : Plane, Sphere, Cylinder, Cone, Torus | | 2 | Bézier+BVH + 2D tracer | NURBS/NURBS : décomposition Bézier → BVH → F(u,v)=0 → traceur paramétrique | | 3 | RK4 3D marcher | Fallback pour κ > 10 (surfaces aéro) : Runge-Kutta ordre 4 + projection simultanée | | 4 | Legacy marcher | Dernier recours : prédicteur/correcteur tangent-plane |

Sections exactes (pas de NURBS fitting)

| Type | Méthode | Résultat | |------|---------|----------| | ruledQuadricSection | Cylindre/Cône × Quadrique | ExactSectionCurve genus-1, 2 loops | | ruledTorusSection | Cylindre/Cône × Tore | Ferrari quartique, k∈{2,4} loops exactes | | steinmetzSection | 2 cylindres radii≠, axes sécants | ExactSectionCurve + fold-aware partial pen. | | spiricSection | Plan oblique × Tore | Fast 2 loops + spiricTraceGeneral pour ovales | | quadricTorusSection | Sphère/Cylindre/Cône × Tore | Fold-aware, genus-1 exact |

Types de résultats

| Classe | Description | |---|---| | IntersectionPoint | Point 3D + paramètres (t, uv) sur chaque opérande | | IntersectionCurve | Courbe 3D (NURBS ou polyline) + pcurves exactes sur chaque surface | | CoincidentResult | Opérandes coïncidents (infinité d'intersections) |

Fonctions principales

| Fonction | Description | |---|---| | intersectPointPoint(a, b, opts?) | Coïncidence de points | | intersectCurveCurve(c1, c2, opts?) | Courbe/courbe → IntersectionPoint[] | | intersectCurveSurface(curve, surface, opts?) | Courbe/surface → IntersectionPoint[] | | intersectSurfaceSurface(s1, s2, opts?) | Surface/surface → dispatch 4-tiers | | intersectFaces(f1, f2, opts?) | Face/face (avec trimming) | | intersectNurbsNurbsBezier(s1, s2, opts?) | NURBS/NURBS via Bézier+BVH+2D tracer | | marchSurfaceSurface(s1, s2, opts?) | Marching numérique SSI | | marchRobust3D(s1, s2, opts?) | RK4 3D pour surfaces à forte courbure | | fitMarchedCurve(polyline, opts?) | Fit NURBS carrier + pcurves (auto-détecte UV) | | fitMarchedCurveFromUV(uvPts, s1, s2, opts?) | Fit pcurve direct depuis trace UV | | fitAndVerifyPcurve(uvPts, F, opts?) | Pcurve vérifiée |F(u,v)|<tol | | implicitEquation(sA, sB) | Équation implicite F(u,v)=0 + gradient + Hessien | | traceParametricBranch(F, u0, v0, opts?) | Tracé 2D sur F(u,v)=0, pas adaptatif courbure | | guaranteedBranchSeeds(s1, s2, opts?) | Seeds garantis via subdivision Bézier + 3×3 sign | | estimateMaxCurvaturePair(s1, s2) | Courbure max pour détection surfaces aéro |

Optimisations de performance (Juin 2026)

| Optimisation | Gain | |-------------|:----:| | Cache LRU (16) pour closestPoint | ×3 | | Grille adaptative 8×8→16×16 | ×2 | | Hint-aware traceur (setHint/getLastFootUV) | ×1.5 | | Warm-start fitting (projections consécutives) | ×1.3 | | Domaine restreint Bézier (setDomainHint) | ×1.2 | | Évaluation NURBS bulk (valueAndDerivs, valueAndDerivs2) | ×2 | | Newton iterations 8→4 | ×1.2 |

Suite L5 : 19.6s → 15.5s (-21%), ratio NURBS/NURBS vs C++ : 90× → ~18×


L6 — booleans (Opérations booléennes)

import { fuse, cut, common, CSG, booleanSolid, ToleranceContext } from 'cadex-kernel';

Pipeline (imprint → classify → select → sew → regularize → bind → heal)

fuse(A, B) / cut(A, B) / common(A, B) :

1. SSI          : intersectFaces entre toutes les faces de A et B → arêtes de section
2. Imprint      : découpage des faces le long des arêtes de section → fragments
3. Classify     : ray-casting + SoS → chaque fragment IN / OUT / ON
4. Select       : table de sélection selon l'opération (fuse/cut/common)
5. Sew          : couture NURBS-native (identité de courbe, registre géométrique partagé)
6. Regularize   : merge faces coplanaires, dissolve vertices colinéaires, Euler-Poincaré
7. Bind         : reconstruction des pcurves
8. Heal         : targeted-healing style diagnose → target → fix → track (8 defect classes)

Opérations de haut niveau

const result = fuse(solidA, solidB);   // A ∪ B  (union)
const result = cut(solidA, solidB);    // A − B  (différence)
const result = common(solidA, solidB); // A ∩ B  (intersection)

booleanSolid (entrée bas niveau)

const { solid, valid, closed, genus, check, healed, stats } = booleanSolid(a, b, op, {
  tolerant: true,                    // défaut: mode tolerant (gapTol=1e-4)
  context: ToleranceContext.strict(),// mode exact
  mergeTol: 1e-6,                   // tolérance de merge pour la couture
  bindOperands: true,               // lie les opérandes avant le booléen
});

ToleranceContext

| Preset | gapTol | Usage | |--------|:------:|-------| | ToleranceContext.strict() | 0 | B-Rep exact | | ToleranceContext.tolerant() | 1e-4 | Modélisation interactive (défaut) | | ToleranceContext.import() | 1e-3 | Import STEP/IGES |

Classification

| Fonction | Description | |---|---| | classifyPoint(solid, point) | IN / OUT / ON | | pointInSolid(solid, point) | boolean | | pointInFaceUV(face, u, v) | Test d'appartenance UV |

CSG (legacy, déprécié pour les booléens)

const csg = CSG.fromSolid(solid);
csg.union(otherCsg);  csg.subtract(otherCsg);  csg.intersect(otherCsg);
csg.toSolid();        // Reconstruction B-Rep (best-effort)
csg.toMesh();         // { positions, normals, indices }

Autres exports

| Export | Description | |---|---| | selectFragments(a, b, op, opts?) | Sélection des fragments | | sewFragments(selection, opts?) | Couture des fragments → solide | | regularizeSolid(solid, opts?) | Régularisation topologique | | checkSolid(solid, opts?) | Validation Euler-Poincaré + manifold | | checkSolidSelfIntersection(solid, opts?) | Détection auto-intersection post-booléen | | targetedHeal(solid, opts?) | Healing ciblé (targeted-healing style) | | incrementalHeal(solid, opts?) | Healing escalade tolérance (5 niveaux) | | Polygon, BspNode | Primitives CSG (legacy) |

Robustesse vs référence industrielle

| Axe | CADEX | Industrie | |-----|:-----:|:---------:| | Pipeline global | ✅ | ✅ ÉGAL | | Classification IN/OUT/ON | ✅ | ✅ ÉGAL | | Couture NURBS-native | ✅ | ✅ ÉGAL | | Régularisation | ✅ | ✅ ÉGAL | | Targeted Healing | ✅ | ✅ ÉGAL | | ToleranceContext | ✅ | ✅ ÉGAL | | Imprint arcs ouverts | 🔶 | ✅ GAP | | Imprint boucles imbriquées | 🔶 | ✅ GAP |


L7 — dressing (Habillage)

Pipeline NURBS-first : toutes les opérations produisent de la géométrie NURBS exacte, chaînable avec d'autres opérations, exportable en STEP.

import { chamferEdge, chamferEdges, filletEdge, filletEdges,
         filletEdgeVariable, filletEdgesVariable, shell, draftFace, draftFaces,
         removeFace, removeFaces, replaceFace, tritangentFillet, chordalFillet,
         filletEdgeStop, filletCorner, faceFaceFillet } from 'cadex-kernel';

Congés (Fillet)

| Fonction | Description | |---|---| | filletEdge(solid, edge, radius) | Congé rayon constant (blend cylindrique NURBS) | | filletEdges(solid, edges, radius) | Congé multi-arêtes | | filletEdgeVariable(solid, edge, radii) | Congé rayon variable (blend surface NURBS) | | filletEdgesVariable(solid, edges, radii) | Congé variable multi-arêtes | | filletEdgeStop(solid, edge, radius, stop) | Congé avec arrêt (stop/shoulder) | | filletCorner(solid, edges, radii) | Congé de coin (setback + blend sphérique → NURBS) | | faceFaceFillet(solid, faceA, faceB, radius) | Congé rolling-ball entre deux faces non-adjacentes | | tritangentFillet(solid, faces) | Congé tri-tangent (SSI + trim + sew) | | chordalFillet(solid, edge, chord) | Congé par corde |

Chanfreins (Chamfer)

| Fonction | Description | |---|---| | chamferEdge(solid, edge, dist) | Chanfrein (surface réglée NURBS entre springs) | | chamferEdges(solid, edges, dist) | Chanfrein multi-arêtes |

Dépouille (Draft)

| Fonction | Description | |---|---| | draftFace(solid, face, neutralLine, angle) | Dépouille d'une face (rotation de surface) | | draftFaces(solid, faces, neutralLine, angle) | Dépouille multi-faces |

Coque (Shell)

| Fonction | Description | |---|---| | shell(solid, thickness, faces?) | Évidage (plan → exact ; courbe → SSI mitre edges) |

Suppression de face (RemoveFace)

| Fonction | Description | |---|---| | removeFace(solid, face) | Suppression (extension surfaces adjacentes + SSI + sew) | | removeFaces(solid, faces) | Suppression multi-faces | | replaceFace(solid, oldFace, newFace) | Remplacement de face |

Architecture

Springs (courbes de contact) → Blend surface (cylindre/réglée/NURBS)
  → Trim faces originales → Sew → Solid validé

| Étape | Détail | |-------|--------| | Springs | Plan/plan → ligne exacte, coaxial → cercle, NURBS → SSI | | Blend | Plan → CylinderSurface, courbe → surface NURBS interpolée | | Trimming | trimFaceBySpring — toutes les faces sont trimées | | Validation | fixOrientation + checkSolid après sew |


L8 — construct (Construction)

import { prism, revolve, makeHole, splitSolid, rectangularPattern3D } from 'cadex-kernel';

Features de base

| Fonction | Description | |---|---| | prism(profile, direction, length) | Extrusion linéaire → Solid | | revolve(profile, axisPoint, axisDir, angle) | Révolution → Solid | | sweep(profile, spine) | Balayage le long d'une spine → Solid |

Features Part Design

| Fonction | Description | |---|---| | pad(profile, length) | Protrusion (alias sémantique de prism) | | pocket(profile, length) | Poche (différence booléenne) | | shaft(profile, axis, angle) | Révolution additive | | groove(profile, axis, angle) | Révolution soustractive | | rib(profile, length) | Nervure | | slot(profile, length) | Rainure | | makeHole(solid, face, point, spec) | Perçage | | makeHoles(solid, holes) | Multi-perçages | | makeStiffener(solid, profile) | Raidisseur |

Opérations de transformation

| Fonction | Description | |---|---| | translateShape(solid, vec) | Translation | | rotateShape(solid, axis, angle) | Rotation | | scaleShape(solid, factor) | Mise à l'échelle | | mirrorShape(solid, plane) | Symétrie | | transformShape(solid, transform) | Transformation générique |

Opérations avancées

| Fonction | Description | |---|---| | splitSolid(solid, plane) | Découpe par plan | | splitByPlane(solid, plane) | Découpe par plan | | thickenSurface(surface, thickness) | Épaississement de surface → Solid | | rectangularPattern3D(solid, dirs, counts, spacing) | Répétition rectangulaire | | circularPattern3D(solid, axis, count, angle) | Répétition circulaire | | closeSurface(surface) | Fermeture de surface → Solid | | multiSectionsSolid(sections) | Solide multi-sections | | multiSectionsCut(solid, sections) | Découpe multi-sections | | offsetSurface(surface, dist) | Surface décalée | | blendSurface(s1, s2, opts) | Surface de raccordement | | extendSurface(surface, edge, dist) | Extension de surface |

Threading

| Fonction | Description | |---|---| | cosmeticThread(solid, face, spec) | Filetage cosmétique | | createThreadSpec(...) | Spécification de filetage | | isoMetricPitch(diameter) | Pas métrique ISO |


L9 — features (Persistent naming & feature tree)

import { FeatureHistory, FeatureTreeEditor, PowerCopy } from 'cadex-kernel';

| Export | Description | |---|---| | ModificationHistory | Historique des modifications | | nameEntity(entity, name) | Nomme une entité topologique | | resolveName(solid, name) | Résout un nom → entité | | FeatureHistory | Historique de features | | replayBranch(history, id) | Rejoue une branche | | FeatureTreeEditor | Éditeur d'arbre de features | | ReferencePoint, ReferenceLine, ReferencePlane | Références géométriques | | ReferenceRegistry | Registre de références | | PowerCopy, PowerCopyInstance, UserFeature | PowerCopy / UDF | | FeatureCatalog | Catalogue de features | | DesignTable, FormulaEngine | Tables de design, formules | | KnowledgeRule, KnowledgeCheck, KnowledgeEngine | Règles métier | | validateSolid, validateProfile | Wrappers qualité |


L10 — tessellation

import { tessellateSolid, tessellateAdaptive } from 'cadex-kernel';

| Fonction | Description | |---|---| | tessellateSolid(solid, opts?) | Tessellation complète → { positions, normals, indices } | | tessellateAdaptive(surface, opts?) | Tessellation adaptative par courbure |


L11 — healing

import { fixOrientation, fixTolerance, fixGaps } from 'cadex-kernel';

| Fonction | Description | |---|---| | fixOrientation(solid) | Corrige l'orientation des faces | | fixTolerance(solid) | Ajuste les tolérances | | removeSmallEdges(solid) | Supprime les micro-arêtes | | fixGaps(solid) | Referme les gaps entre faces | | fixDegenerated(solid) | Répare les arêtes dégénérées | | fixSelfIntersection(solid) | Détecte et corrige les auto-intersections | | sewWithTolerance(faces, tol) | Couture avec tolérance élargie | | rebuildDegenerateFace(face) | Reconstruction de face dégénérée |


L12 — serialization (Format natif .CADEX)

import { serializeSolid, deserializeSolid } from 'cadex-kernel';

| Fonction | Description | |---|---| | serializeSolid(solid) | Solidstring (JSON) | | serializeSolidToObject(solid) | Solidobject (sérialisable) | | deserializeSolid(json) | string ou objectSolid |

Format lossless : toutes les entités topologiques, les données NURBS, et les porteurs géométriques sont préservés. Round-trip : deserialize(serialize(s)) ≡ s.