forked from 1b-agent/opencadstudio-upstream
feat(render): GPU analytical rendering for circles, arcs, and ellipses
- Render planar circles, circular arcs, ellipses, and elliptical arcs analytically via GPU-instanced screen-space quads and WGSL shaders. - Implement exact arc sweep clamping with round end caps matching the CAD wire shader. - Implement robust Newton-Raphson closest-point solver for ellipses with isotropic screen-space derivative anti-aliasing. - Integrate into wire pipeline and PersistentWireArena upload paths. - Remove unused mesh_volume_centroid function in doc_api.
This commit is contained in:
1 parent
143703d809
commit
0425f979f9
17 files changed
+1860
-40
No files matched your search
Vendored
+27
-1
@@ -1268,7 +1268,8 @@ fn translated_prototype_wire(
|
||||
}
|
||||
}
|
||||
TangentGeom::PlanarCircle { center, .. }
|
||||
| TangentGeom::Arc { center, .. } => {
|
||||
| TangentGeom::Arc { center, .. }
|
||||
| TangentGeom::PlanarEllipse { center, .. } => {
|
||||
for axis in 0..3 {
|
||||
center[axis] += delta[axis];
|
||||
}
|
||||
@@ -2727,6 +2728,31 @@ fn transform_tangent(
|
||||
radius: radius * ((sx + sy) * 0.5),
|
||||
})
|
||||
}
|
||||
TangentGeom::PlanarEllipse {
|
||||
center,
|
||||
major_axis,
|
||||
normal,
|
||||
minor_axis_ratio,
|
||||
start_param,
|
||||
end_param,
|
||||
} => {
|
||||
let c = t.apply(Vector3::new(center[0], center[1], center[2]));
|
||||
let m = t.apply_rotation(Vector3::new(major_axis[0], major_axis[1], major_axis[2]));
|
||||
let n = t.apply_rotation(Vector3::new(normal[0], normal[1], normal[2]));
|
||||
let n_len = n.length();
|
||||
if n_len <= 1.0e-12 {
|
||||
return None;
|
||||
}
|
||||
let n = n / n_len;
|
||||
Some(TangentGeom::PlanarEllipse {
|
||||
center: [c.x, c.y, c.z],
|
||||
major_axis: [m.x, m.y, m.z],
|
||||
normal: [n.x, n.y, n.z],
|
||||
minor_axis_ratio: *minor_axis_ratio,
|
||||
start_param: *start_param,
|
||||
end_param: *end_param,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user