Files
OneCAD-Draft/src/entities/mod.rs
T
Hakan SevenandClaude Opus 5 57661c5754 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>
2026-08-09 00:43:35 +03:00

41 lines
675 B
Rust

pub mod arc;
pub mod attribute;
pub mod circle;
pub mod common;
pub mod curve;
pub mod dim_override;
pub mod dimension;
pub mod ellipse;
pub mod extended;
pub mod field;
pub mod hatch;
pub mod helix;
pub mod insert;
pub mod leader;
pub mod light;
pub mod line;
pub mod lwpolyline;
pub mod mesh;
pub mod mline;
pub mod mtext;
pub mod multileader;
pub mod names;
pub mod object_data;
pub mod ole2frame;
pub mod point;
pub mod polyline;
pub mod raster_image;
pub mod ray;
pub mod shape;
pub mod solid;
pub mod solid3d;
pub mod spline;
pub mod table;
pub mod text;
pub mod text_support;
pub mod tolerance;
pub mod traits;
pub mod underlay;
pub mod viewport;
pub mod view_symbol;