mirror of
https://github.com/storytold/cadcraft.git
synced 2026-11-10 12:30:16 -06:00
* feat(inquiry): AREA, PERIMETER and DISTANCE system variables, as AutoCAD sets them AREA, DIST and MEASUREGEOM now leave AREA, PERIMETER and DISTANCE for getvar, read-only and not saved: the area just measured (the running total in Add and Subtract mode) with the last area's perimeter, and the distance (the total of Multiple points). After DIST's two points LASTPOINT stays at the first point, as measured. AREA's Object option measures splines, closed by their chord like open polylines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Address review: spline area over narrow spans, finite distances, list order - AREA of a spline samples it span by span (Spline::tessellate_spans), so a narrow knot span no longer drops out of the area. The spread over the spans is one helper shared with Spline::bounds, whose boxes are unchanged. - DIST refuses a distance that isn't finite on all three paths and leaves DISTANCE as it was. - sysvars::list puts the session's values after the drawing's header, so it shows what get returns (AREA, ORTHOMODE, LWDISPLAY...). - LASTPOINT after DIST's Multiple points is pinned to AutoCAD 2024's measured behaviour: the last point entered, also after Length and Undo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Address review: measure every knot span of a spline in AREA A spline with more knot spans than half the sample cap fell back to an even grid over the domain, which can step over a narrow span and measure the wrong area: a 100 x 100 square as a degree-1 spline, its right and top edges two spans a millionth wide after 4,500 spans along the bottom, measured 4,998.75. Spread the samples over the spans at any span count: at least one segment per span, within the cap up to MAX_SAMPLES spans and one each past it, as Spline::length integrates every span. One evaluation per span costs 85-285 ms on a million spans in a release build, against 32-52 s for the length AREA already takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Address review: share AREA's spline samples by how much each span bends Past the sample cap, tessellate_spans gave each knot span one segment, so a bent span among many straight ones was measured by its chord. Example: a quadratic spline along the x-axis, one control point 1000 above it, past 4,500 spans. It measured 750; the area is 1750/3. Each span now keeps one segment. A span whose control points are collinear is straight, so its chord is exact. tessellate's count is shared among the spans that bend, by the cube root of a measure of their control points' convex hull, which holds the span and its chord. The shares are rounded on the running total, so they use the whole count however many spans share it. The example now measures 583.33343, below the cap and past it. The spreading by parameter width that this replaces goes, and span_params with it: bounds is main's code again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * DIST: a measurement refused as too large leaves LASTPOINT at the first point Session::feed sets LASTPOINT to the second point before DIST checks the distance, and the refusal returned before DIST put the first point back, as it does after a measurement. It now does so before refusing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * AREA: a spline too long to measure is too large, not a perimeter of 0 Spline::length reads a length past f64's range as 0, and AREA took that as the spline's perimeter. Spline::checked_length returns None there, and AREA reports the perimeter too large, as it does a polyline's. The overflow was hidden twice: in the sum, and before it in the derivative, which read as zero speed once past f64's range. The length integral now takes the derivative before that (Spline::velocity), so an overflowing speed counts too. param_at_length keeps the speed it had, and finite lengths are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
169 lines
3.3 KiB
Rust
169 lines
3.3 KiB
Rust
mod angle_prompts;
|
|
mod angle_settings;
|
|
mod annotate_options;
|
|
mod annotative;
|
|
mod arc_ctrl_direction;
|
|
mod array_commands;
|
|
mod assoc_array;
|
|
mod attdef_command;
|
|
mod attdisp_attsync;
|
|
mod attedit_prompts;
|
|
mod attrib_modes;
|
|
mod attrib_props;
|
|
mod attribute_tools;
|
|
mod attribute_value_baseline;
|
|
mod block_description;
|
|
mod block_keep;
|
|
mod block_redefine;
|
|
mod blockreplace;
|
|
mod break_closed_polyline;
|
|
mod break_join_locked_layers;
|
|
mod break_keeps_z;
|
|
mod burst;
|
|
mod change_command;
|
|
mod chprop_command;
|
|
mod classic_array;
|
|
mod compare_export;
|
|
mod constraint_geometry;
|
|
mod constraint_infer;
|
|
mod copy_count;
|
|
mod count;
|
|
mod dash_block;
|
|
mod dash_units;
|
|
mod data_extraction;
|
|
mod dim_baseline_spacing;
|
|
mod dim_chain;
|
|
mod dim_commands;
|
|
mod dim_explode_text;
|
|
mod dim_properties;
|
|
mod dim_radial_inside;
|
|
mod dim_radial_outside;
|
|
mod dim_vars;
|
|
mod dimtedit_prompts;
|
|
mod drafting_spacing;
|
|
mod draw_prompts;
|
|
mod draworder;
|
|
mod dyn_input;
|
|
mod dynamic_block_data;
|
|
mod dynamic_grips;
|
|
mod fillet_chamfer;
|
|
mod fix_holds_grips;
|
|
mod followups_626;
|
|
mod grip_dim_input;
|
|
mod grip_options;
|
|
mod grip_selection;
|
|
mod group_selection;
|
|
mod groups;
|
|
mod hatch_assoc;
|
|
mod hatch_dialog_helpers;
|
|
mod hatch_numeric_validation;
|
|
mod hatch_options;
|
|
mod helix;
|
|
mod inquiry_keywords;
|
|
mod inquiry_variables;
|
|
mod inquiry_z;
|
|
mod insert_attribute_prompts;
|
|
mod insert_prompts;
|
|
mod isometric;
|
|
mod join_close;
|
|
mod json_param_validation;
|
|
mod layer_cmdline;
|
|
mod layer_merge_delete;
|
|
mod layoff_repeat;
|
|
mod layout_prompts;
|
|
mod leader_command;
|
|
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
mod lisp_corpus;
|
|
mod lisp_undo_in_routine;
|
|
mod malformed_handles;
|
|
mod matchprop;
|
|
mod measure_distance_snapping;
|
|
mod metric_linetypes;
|
|
mod mirror_degenerate_line;
|
|
mod mleader_content;
|
|
mod mleader_remember;
|
|
mod mline;
|
|
mod mocoro;
|
|
mod modify_curves;
|
|
mod mtext_columns;
|
|
mod mtext_options;
|
|
mod multiline_attributes;
|
|
mod named_viewports;
|
|
mod named_views;
|
|
mod non_finite_edits;
|
|
mod offset_closed_spline;
|
|
mod offset_ellipse_side;
|
|
mod offset_move;
|
|
mod oops_command;
|
|
mod options_profile;
|
|
mod overkill;
|
|
mod parallel_display_list;
|
|
mod pedit_multiple;
|
|
mod pedit_splinedit;
|
|
mod pick_text;
|
|
mod pickdrag;
|
|
mod pline_arc_xline_options;
|
|
mod plot_styles;
|
|
mod point_modifiers;
|
|
mod polyface_explode;
|
|
mod post_command_passes;
|
|
mod prompt_keywords;
|
|
mod prompt_or_once;
|
|
mod props_bad_lineweight;
|
|
mod props_insert_scale_attribs;
|
|
mod purge_mlinestyles;
|
|
mod purge_prompts;
|
|
mod qdim;
|
|
mod qdim_modes;
|
|
mod query_entities;
|
|
mod quickcalc;
|
|
mod recent_commands;
|
|
mod rectang_ortho;
|
|
mod rectang_polygon_order;
|
|
mod refedit;
|
|
mod region;
|
|
mod rename_cmdline;
|
|
mod rotate_reference;
|
|
mod scale_offset_z;
|
|
mod select_keywords;
|
|
mod select_similar;
|
|
mod select_underscore_keywords;
|
|
mod selection_cycling;
|
|
mod selection_modes;
|
|
mod setvar_cecolor;
|
|
mod setvar_coverage;
|
|
mod shapes;
|
|
mod snap_annotations;
|
|
mod snap_blocks;
|
|
mod snap_curves;
|
|
mod snap_intersections_aperture;
|
|
mod snap_nearest;
|
|
mod snap_overrides;
|
|
mod snap_tracking;
|
|
mod snaps_more;
|
|
mod solid_command;
|
|
mod space_is_enter;
|
|
mod spline_degree;
|
|
mod spline_options;
|
|
mod stretch;
|
|
mod stretch_select;
|
|
mod table_formulas;
|
|
mod table_styles;
|
|
mod temp_tracking;
|
|
mod text_commands;
|
|
mod text_left_justify;
|
|
mod tolerance;
|
|
mod transparent;
|
|
mod trim_closed_polyline;
|
|
mod trim_extend_options;
|
|
mod undo_count;
|
|
mod undo_layout_tab;
|
|
mod viewport_clip;
|
|
mod vplayer_prompts;
|
|
mod vports;
|
|
mod wipeout_grips;
|
|
mod xdata_follows_entity;
|
|
mod zoom_keywords;
|
|
mod zoom_viewport;
|
|
mod zoom_window_ortho;
|