A Computational Geometry Approach to Procedural Cable & Harness Generation
Harnex is more than a standard sweep modifier or a basic spline extrusion tool. It is a unified, non-destructive procedural geometry engine built natively for Autodesk 3ds Max (with Blender integration in development), designed to solve the mathematical and topological bottlenecks of complex cable routing, CAD ingestion, and harness rigging.
Standard 3D pipelines rely on Frenet-Serret frames and uniform spline parameterization, which inevitably result in axis flipping, pinching, and twisting artifacts on tight bends. Harnex replaces these legacy approximations with rigorous computational geometry and analytical mathematics.
Below is a technical breakdown of the architecture and algorithms powering the Harnex pipeline.
1. The Core Mathematical Engine
Rotation-Minimizing Bishop Frames (Parallel Transport)
Instead of relying on the native Frenet frame—which becomes undefined at inflection points (where curvature is zero) and causes sudden 180-degree axis flips—Harnex constructs a Rotation-Minimizing Frame (RMF). By utilizing parallel transport, the normal and binormal vectors are rotated along the tangent vector using a quaternion derived from the cross-product of consecutive tangents. This guarantees a continuous, twist-free reference frame with exact G1 continuity, regardless of how sharp the underlying spline bends.
Arc-Length Parameterization (LUT)
3ds Max splines are parameterized by knot distribution, not physical distance. This causes uneven twisting and noise distribution on splines with clustered knots. Harnex solves this by generating an Arc-Length Look-Up Table (LUT) via 120-sample numerical integration. When calculating strand offsets, twist angles, or noise, the engine performs a binary search on the LUT to map physical distance to the correct spline parameter, ensuring perfectly uniform procedural distribution along the entire cable length.
Analytical 3D Helical Space Curves
Strand geometry is not approximated; it is mathematically exact. The tangent vector for every bezier knot handle is derived analytically by combining the spine’s translational velocity with the rotational velocity of the helix:
V_helical = V_spine + (R * ω * (-sin(θ)N + cos(θ)B))
This ensures exact C1 continuity across all strand segments, completely eliminating the “lumpy” or “pinched” artifacts common in standard sweep generators.
2. Topological CAD Ingestion & Centerline Extraction
The Topological Ring-Walker
Extracting clean centerlines from messy, tessellated CAD tube meshes (STEP/IGES) requires topological analysis, not just bounding box math. Harnex implements a custom Ring-Walker algorithm:
- Pole Detection: Uses a Dijkstra/BFS geodesic distance sweep across the mesh’s adjacency graph to identify the two most distant vertices (the true geometric poles/caps).
- Orthogonal Slicing: Marches cross-sectional rings from Cap A to Cap B.
- Kasa Circle Fitting: For each ring, it applies the Kasa formulation for 2D algebraic least-squares circle fitting. This robustly calculates the true algebraic centroid and radius of the cross-section, ignoring tessellation noise and returning a mathematically perfect centerline.
Direction-Continuity Gate (DXF Re-Chaining)
When importing fragmented DXF files (where a single 10-meter cable is exported as 8,000 individual 2-knot line segments), Harnex utilizes a Direction-Continuity Gate. It evaluates the dot product of the incoming and outgoing segment vectors. If the angle exceeds a strict threshold (e.g., 60°), the join is rejected. This prevents distinct cables touching at a connector from being falsely merged, while allowing sharp internal corners of a single cable to remain intact.
3. Procedural Pinouts & Smoothstep Blending
Routing a bundled braid into a flat connector socket usually results in intersecting geometry. Harnex solves this using Hermite Smoothstep Transitions.
The engine calculates two distinct offset vectors for every strand knot:
- The Helical Offset: The standard round braid.
- The Terminal Offset: Calculated via Matrix Grid, Circular, Horizontal, or Vertical cross-sectional algorithms.
Using a smoothstep function, the engine interpolates between the helical and terminal offsets over a user-defined transition percentage. This creates a flawless, intersection-free morphological blend from a round cable into a flat, pinned connector layout.
4. Non-Destructive Rigging & Dynamics
Automated Geodesic Skinning
For game-ready exports (FBX/Unreal/Unity), Harnex generates a non-destructive Bone Chain and HI-IK solver. Instead of relying on Max’s default “Rigid” or “Envelope” skinning, it performs an automated geodesic weight painting pass. It projects every vertex of the generated braid mesh onto the closest segment of the bone chain and assigns dual-bone weights based on the exact parametric distance, ensuring smooth, realistic deformation during animation.
Dynamic 2-Point Catenary Cables
For live physics, Harnex implements a parametric catenary solver driven by MaxScript’s
when transform changes callbacks. As the anchor objects move, the engine recalculates the parabolic sag and applies seeded Perlin-like organic jitter to the spline knots in real-time, maintaining a 60fps interactive viewport without relying on heavy external physics engines.5. Pipeline Architecture & Data Integrity
- Type-Safe User Properties: All procedural states are stored natively on the spline nodes using strictly typed string serialization, ensuring data survives scene saves, merges, and XRefs without corruption.
- Automotive DIN 47100 Compliance: The material pipeline natively supports industrial multi-material PBR assignment, mapping individual strand Material IDs to standardized automotive wire colors (Red, Black, Brown, Blue, etc.).
- Pure Algorithmic Purity: The core mathematical engines (Bishop frames, Kasa fitting, RDP simplification) are written as pure, optimized algorithms, designed for high performance and future migration to compiled C++/DLL architectures for massive batch processing.
🔗 Download the Harnex Lite for 3Ds max

