Rename handle mirroring to colinear

This commit is contained in:
Keavon Chambers
2024-03-14 04:02:16 -07:00
parent ea4f3d8bba
commit 5bca931813
20 changed files with 326 additions and 305 deletions

View File

@@ -98,14 +98,14 @@ fn spline_generator(_input: (), positions: Vec<DVec2>) -> VectorData {
// TODO(TrueDoctor): I removed the Arc requirement we should think about when it makes sense to use it vs making a generic value node
#[derive(Debug, Clone)]
pub struct PathGenerator<Mirror> {
mirror: Mirror,
pub struct PathGenerator<ColinearManipulators> {
colinear_manipulators: ColinearManipulators,
}
#[node_macro::node_fn(PathGenerator)]
fn generate_path(path_data: Vec<Subpath<ManipulatorGroupId>>, mirror: Vec<ManipulatorGroupId>) -> super::VectorData {
fn generate_path(path_data: Vec<Subpath<ManipulatorGroupId>>, colinear_manipulators: Vec<ManipulatorGroupId>) -> super::VectorData {
let mut vector_data = super::VectorData::from_subpaths(path_data);
vector_data.mirror_angle = mirror;
vector_data.colinear_manipulators = colinear_manipulators;
vector_data
}

View File

@@ -18,9 +18,9 @@ pub struct VectorData {
pub transform: DAffine2,
pub style: PathStyle,
pub alpha_blending: AlphaBlending,
/// A list of all manipulator groups (referenced in `subpaths`) that have smooth handles (where their handles are colinear, or locked to 180° angles from one another)
/// This gets read in `graph_operation_message_handler.rs` by calling `inputs.as_mut_slice()` (search for the string `"Shape does not have subpath and mirror angle inputs"` to find it).
pub mirror_angle: Vec<ManipulatorGroupId>,
/// A list of all manipulator groups (referenced in `subpaths`) that have colinear handles (where they're locked at 180° angles from one another).
/// This gets read in `graph_operation_message_handler.rs` by calling `inputs.as_mut_slice()` (search for the string `"Shape does not have both `subpath` and `colinear_manipulators` inputs"` to find it).
pub colinear_manipulators: Vec<ManipulatorGroupId>,
pub point_domain: PointDomain,
pub segment_domain: SegmentDomain,
@@ -35,7 +35,7 @@ impl core::hash::Hash for VectorData {
self.transform.to_cols_array().iter().for_each(|x| x.to_bits().hash(state));
self.style.hash(state);
self.alpha_blending.hash(state);
self.mirror_angle.hash(state);
self.colinear_manipulators.hash(state);
}
}
@@ -46,7 +46,7 @@ impl VectorData {
transform: DAffine2::IDENTITY,
style: PathStyle::new(Some(Stroke::new(Some(Color::BLACK), 0.)), super::style::Fill::None),
alpha_blending: AlphaBlending::new(),
mirror_angle: Vec::new(),
colinear_manipulators: Vec::new(),
point_domain: PointDomain::new(),
segment_domain: SegmentDomain::new(),
region_domain: RegionDomain::new(),

View File

@@ -364,7 +364,7 @@ impl crate::vector::ConcatElement for super::VectorData {
self.region_domain.concat(&other.region_domain, transform * other.transform, &id_map);
// TODO: properly deal with fills such as gradients
self.style = other.style.clone();
self.mirror_angle.extend(other.mirror_angle.iter().copied());
self.colinear_manipulators.extend(other.colinear_manipulators.iter().copied());
self.alpha_blending = other.alpha_blending;
}
}