forked from 1b-agent/opencadstudio-upstream
fix(polyline): keep wide-polyline fills precise at UTM coordinates
The solid fill band of a wide LwPolyline / Polyline2D was built from absolute WCS vertex coordinates cast straight to f32, then handed to a HatchModel with world_origin = [0, 0]. At UTM-scale coordinates (~1e6) f32 resolves to ~0.06, so the half-width offset collapsed and the relative-to-eye fill shader cancelled `boundary - eye` to noise — the band rendered as a string of squares. (Exploding the polyline drops the width, hence no band and a clean line, which is why that "fixed" it.) Build the band relative to a world_origin (the first vertex) in f64 and store the small f32 offsets, mirroring how baked hatch fills keep precision. Same class of bug as the on-create hatch-fill fix. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
0317dad14e
commit
2672807c13
3 files changed
+42
-14
No files matched your search
+10
-4
@@ -4763,9 +4763,15 @@ impl Scene {
|
||||
|
||||
// Wide LWPolyline and Polyline2D fills
|
||||
for entity in self.document.entities() {
|
||||
let (common, fills) = match entity {
|
||||
EntityType::LwPolyline(pl) => (&pl.common, crate::entities::lwpolyline::wide_fills(pl)),
|
||||
EntityType::Polyline2D(pl) => (&pl.common, crate::entities::polyline::wide_fills(pl)),
|
||||
let (common, fill_origin, fills) = match entity {
|
||||
EntityType::LwPolyline(pl) => {
|
||||
let (o, f) = crate::entities::lwpolyline::wide_fills(pl);
|
||||
(&pl.common, o, f)
|
||||
}
|
||||
EntityType::Polyline2D(pl) => {
|
||||
let (o, f) = crate::entities::polyline::wide_fills(pl);
|
||||
(&pl.common, o, f)
|
||||
}
|
||||
_ => continue,
|
||||
};
|
||||
if fills.is_empty() {
|
||||
@@ -4792,7 +4798,7 @@ impl Scene {
|
||||
color,
|
||||
angle_offset: 0.0,
|
||||
scale: 1.0,
|
||||
world_origin: [0.0; 2],
|
||||
world_origin: fill_origin,
|
||||
vp_scissor: None,
|
||||
draw_depth: depth_map.get(&common.handle.value()).copied().unwrap_or(0.0),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user