mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 13:48:12 +08:00
* added arcs impl Co-authored-by: Hannah Li <hannahli2010@gmail.com> Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com> * fixed arc drawing, todo - fix linear check Co-authored-by: Hannah Li <hannahli2010@gmail.com> * fixed linear bug + added comments and tests Co-authored-by: Hannah Li <hannahli2010@gmail.com> * added max iteration guard + made params optional + added impl todo * Add functionality to get arcs between extrema * Add ArcsOptions to manage optional parameters of the arcs function * added slider to toggle between arcs impl Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com> * Remove unused types * address some comments * added rustdoc for CircularArc struct * Extract duplicate code into helper, remove loop labels, use window function * Make JsValue handling consistent in WasmBezier and add comments for the underlying type * Add enum for MaximizeArcs Auto/On/Off functionality * Change Auto to Automatic * fix errors from resolving merge conflict * fixed error from resolving merge conflicts * fixed formatting * address comments * Small fix * Add some missing comments * address comments * rename variable * Use unit to show maximize_arcs values * Change i32 to usize and other minor adjustments * Change computation for middle t values * Remove tsconfig * Fix more usize number handling Co-authored-by: Hannah Li <hannahli2010@gmail.com> Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
29 lines
1.2 KiB
Rust
29 lines
1.2 KiB
Rust
// Implementation constants
|
|
|
|
/// Constant used to determine if `f64`s are equivalent.
|
|
pub const MAX_ABSOLUTE_DIFFERENCE: f64 = 1e-3;
|
|
/// A stricter constant used to determine if `f64`s are equivalent.
|
|
pub const STRICT_MAX_ABSOLUTE_DIFFERENCE: f64 = 1e-6;
|
|
/// Number of distances used in search algorithm for `project`.
|
|
pub const NUM_DISTANCES: usize = 5;
|
|
/// Maximum allowed angle that the normal of the `start` or `end` point can make with the normal of the corresponding handle for a curve to be considered scalable/simple.
|
|
pub const SCALABLE_CURVE_MAX_ENDPOINT_NORMAL_ANGLE: f64 = std::f64::consts::PI / 3.;
|
|
|
|
// Method argument defaults
|
|
|
|
/// Default `t` value used for the `curve_through_points` functions.
|
|
pub const DEFAULT_T_VALUE: f64 = 0.5;
|
|
/// Default LUT step size in `compute_lookup_table` function.
|
|
pub const DEFAULT_LUT_STEP_SIZE: usize = 10;
|
|
/// Default number of subdivisions used in `length` calculation.
|
|
pub const DEFAULT_LENGTH_SUBDIVISIONS: usize = 1000;
|
|
/// Default step size for `reduce` function.
|
|
pub const DEFAULT_REDUCE_STEP_SIZE: f64 = 0.01;
|
|
|
|
// SVG constants
|
|
pub const SVG_ARG_CUBIC: &str = "C";
|
|
pub const SVG_ARG_LINEAR: &str = "L";
|
|
pub const SVG_ARG_MOVE: &str = "M";
|
|
pub const SVG_ARG_QUADRATIC: &str = "Q";
|
|
pub const SVG_ARG_CLOSED: &str = "Z";
|