Commit Graph
9 Commits
Author SHA1 Message Date
Hakan SevenandClaude Opus 4.7 5e36e85e07 refactor(common): unify bulge → arc math into BulgeArc
The same DXF/DWG bulge → (center, radius, sweep) formula was inlined
in six places (hatch outline, polyline tess + truck path, lwpolyline
×4, scene hatch fill, explode bulge_to_arc) — each with subtly
different sweep-direction handling for the bulge sign.

Add `entities::common::BulgeArc { center, radius, start_angle,
end_angle, sweep }` with one `from_bulge(p0, p1, bulge)` constructor
and a `sample(t)` helper. Callsites collapse to a few lines.

Net: -121 lines, one canonical sweep-direction convention shared by
all consumers.

array.rs (the path-along-curve f32 helper) keeps its inline math —
its sign convention is inverted relative to the others and changing
it without exercising the array-path command risks regressing the
output.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 23:42:26 +03:00
Hakan Seven 200f10fd25 fix(explode): correct arc/ellipse direction in mirrored INSERT blocks
Mirrored INSERTs reverse OCS handedness, but acadrust's explode used to
keep the original normal — making CCW-around-normal arcs and ellipses
sweep the wrong way. The fix lives in acadrust 7c711e9, which flips the
new normal when det < 0 and reprojects center/major_axis/angles into the
new OCS. H7CAD's fix_mirrored_arc workaround is no longer needed.
2026-05-12 22:04:12 +03:00
Hakan ca07268c7c cargo fmt 2026-05-12 10:36:15 +03:00
Hakan Seven 603d07412e refactor: replace angle calculations with radians for consistency 2026-05-03 21:58:38 +03:00
Hakan SevenandClaude Sonnet 4.6 e2f5715de8 fix: correct arc sweep direction for reversed normals and mirrored blocks
- Arc rendering now respects the normal vector: when normal.z < 0 the
  midpoint is placed on the clockwise side so the curve sweeps the right way
- Removed spurious .to_radians() / .to_degrees() round-trips in arc.rs
  (angles are already stored in the unit the trig functions expect)
- apply_grip and apply_transform use consistent angle units
- normalize_insert_entity no longer converts arc angles; the old conversion
  was only needed by the now-removed .to_radians() call in to_truck
- Added fix_mirrored_arc: swaps arc start/end angles when the INSERT has a
  mirrored scale (x_scale * y_scale < 0) so exploded arcs curve correctly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 21:48:21 +03:00
Hakan SevenandClaude Sonnet 4.6 7a07ef8710 feat: EXPLODE now supports Dimension entities
Decomposes Dimension (Linear, Aligned, Radius, Diameter, Angular2Ln,
Angular3Pt, Ordinate) into constituent Lines (extension lines, dimension
line) plus a Text entity for the dimension label value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 11:29:39 +03:00
Hakan SevenandClaude Sonnet 4.6 44af4278f2 feat: EXPLODE MLine support and accurate header documentation
- Add explode_mline() that decomposes each MLine segment into its
  spine Line plus two ±scale/2 offset Lines using per-vertex miter
  directions, matching the visual representation of MLine entities
- Update file header to document all actually-supported entity types
  (LwPolyline, Polyline2D/3D, Polyline, Insert, MLine)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 10:52:05 +03:00
Hakan SevenandClaude Sonnet 4.6 fa4fcf3c10 Feat: EXPLODE for Polyline, Polyline2D (bulge→Arc), Polyline3D → Lines
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 23:03:49 +03:00
Hakan Seven d2fdac7f1e first commit 2026-03-22 14:56:27 +03:00