GPU RoundedBox Geometry - barocss/barocss GitHub Wiki
Authored indexed RoundedBox geometry
Status: prototype-integrated for CPU geometry, source/files, Scene and ray use. Native #1414 parent 74333e3d79781183224389676836941c7ef96c3f â 8becc7e3bb91fb4a3fdcc117edbc43551e53aa58; exact local adoption d48d97282092c38b02724c2f6fd563651747e3f0. Actual rendered RoundedBox/Render document support and full validation are separate, not proved by this function.
Public API and example
import { prepareRoundedBoxGeometry } from '@barocss/gpu';
const rounded = prepareRoundedBoxGeometry({
format: 'barocss-gpu-rounded-box-geometry',
version: 0,
id: 'rounded_part',
coordinateSystem: 'right-handed-y-up',
positionUnit: 'scene',
sizeXYZ: [2, 4, 6],
cornerRadius: 0.25,
segments: 8,
});
// Original parameters remain separate from sampled triangle authority.
const authored = rounded.source;
const triangles = rounded.prepared.geometry;
const displayPositions = rounded.prepared.positions;
This usage example follows the actual public source signature; this documentation audit did not run it. RoundedBoxGeometrySourceV0 has exactly these eight required fields. PreparedRoundedBoxGeometry returns frozen {source, prepared}. prepared is the actual existing PreparedTriangleGeometry with frozen original Number attributes plus independently owned mutable Float32 positions/normals/UV and Uint16 indices. Mutating execution buffers does not change retained parameters or frozen geometry. Use existing EngineScene admission on the real TriangleGeometry data; do not retag the RoundedBox parameter record as a TriangleGeometry.
Coordinates are right-handed Y-up and use generic scene units. No implicit millimetre conversion, native CAD frame or Physical mass/collision follows. Chart UVs are dimensionless display coordinates: faces have their chart layout, edges use station/axial row and corners use normalized lattice indices. These UVs are not original CAD parameters.
Actual profile and failure behavior
- ID: ASCII1..64 using the existing identifier grammar.
- Each dimension: finite
0 < size <= 2000; represented half extents must be positive. - Radius: finite
0 < cornerRadius < min(sizeXYZ/2). Each represented corehalf-radiusmust remain positive and distinct from its half extent. - Segments: finite integer2..64. No default, zero-radius substitution, Sphere/Box fallback, clamping or geometric repair.
- Build six plane charts, twelve quarter-cylinder charts and eight triangular spherical octants. Canonical seam position/normal values are copied, while UV seams retain separate vertices. Outward CCW uses actual generated triangle cross products.
- One existing TriangleGeometry admission applies its actual original/Float32/collapse/budget guards. Preserve the original construction error or inherited representation cause. Failure returns no accepted replacement; hosts retain their prior result/state according to their own transaction.
| Segments | Vertices | Triangles | Execution-buffer bytes |
|---|---|---|---|
| 2 | 144 | 92 | 5,160 |
| 64 | 18,744 | 34,316 | 805,704 |
General counts are 4N²+36N+56 vertices and 8N²+24N+12 triangles. Bounds come from sampled vertices. Sampled charts and copied seams are not welded B-Rep topology, analytic enclosure, manufacturing geometry or CAD Fillet.
Actual evidence and consumer readiness
Native receipt records FIRST affected build and one genuine source/API/Scene/ray/file/cold flow,14 admissions/46 refusals, getter0, two fresh cold children/four provider rows and119 public exports. Scoped adoption audit confirms exactly five owned paths and unchanged Triangle/Scene/ray providers. Precommit operational HEAD differs from the final native child; tested file blobs were preserved in that child. Original failure/refusal records remain.
The executable authored flow is examples/gpu-scene/rounded-box-geometry-flow.mjs --output <fresh-directory>. Its previous native successful run is evidence; do not replay it for this manual edit. Ordinary workspace exports resolve source; declared publishConfig entries resolve compiled JS/types for the explicit compiled checkpoint. This does not authorize npm publication.
Render #1236 tracks a future explicit Capsule/RoundedBox parameter profile. Its existing V2 six-kind document is unchanged. GPU #593 Source1/SDF RoundedBox is a different function. Actual GL/lifetime/device parity, native CAD Fillet/Solid, Physics/collision, global numerical error and current composed #1254/#674/release remain separately unproved/deferred. Preserve the original #1375 first-mount denial; this CPU manual is not a graphics workaround.