feat(entities): give an entity its geometry as a curve
The same shape was being read out of an entity's fields in three places and the three had drifted. An arc's tessellation cut it at 20 segments per radian, TRIM's sampling at 16, and its snap points came from a fourth expression again; a spline was sampled at a fixed 96 points however long it was; TRIM read an arc's centre as world coordinates when the entity stores it in its OCS, so an arc carrying the (0, 0, −1) normal a MIRROR leaves behind acted as a boundary on the wrong side of the drawing. entity_curve returns a PlanarCurve: the shape, plus the plane its coordinates are read in. The plane comes from the entity's OCS — its extrusion normal through the DXF arbitrary-axis algorithm — not from the UCS. A UCS is the working plane a user drew in and an entity does not remember it: draw a circle in a UCS turned 30° about Z and the stored normal is still +Z, which is why the header keeps the UCS separately. The algorithm itself stays in transform.rs, where the format is understood and where #142's degenerate case was fixed once. Entities that store world coordinates and may not be planar at all — LINE, SPLINE — are checked rather than assumed. A spline whose points wander in space returns None instead of being flattened onto XY, which would move it. entity_curve_xy folds the plane away for the editing commands, which work in plan view and need every boundary in one frame before two of them can be intersected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
8847724127
commit
57661c5754
4 changed files with 745 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -935,7 +935,7 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
|||
[[package]]
|
||||
name = "cadkernel"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/HakanSeven12/cadkernel.git#dee251f190a82f66d548e10d36f112815d9a901f"
|
||||
source = "git+https://github.com/HakanSeven12/cadkernel.git#39083307452ba14b3968bdb0738e2665d3d18e62"
|
||||
dependencies = [
|
||||
"cavalier_contours",
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue