Attribute-based vector format refactor (#1624)

* Initial vector format structure

* Click targets

* Code review pass

* Remove subpaths from vector data

* Morph node & vector node tests

* Insignificant change

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2024-03-09 18:27:30 +00:00
committed by GitHub
parent c8ea9e05a6
commit 218e9675fd
30 changed files with 991 additions and 436 deletions

View File

@@ -164,7 +164,7 @@ impl WasmBezier {
"Euclidean" => TValueType::Euclidean,
_ => panic!("Unexpected TValue string: '{t_variant}'"),
};
let table_values: Vec<DVec2> = self.0.compute_lookup_table(Some(steps), Some(tvalue_type));
let table_values: Vec<DVec2> = self.0.compute_lookup_table(Some(steps), Some(tvalue_type)).collect();
let circles: String = table_values
.iter()
.map(|point| draw_circle(*point, 3., RED, 1.5, WHITE))
@@ -293,7 +293,7 @@ impl WasmBezier {
}
pub fn project(&self, x: f64, y: f64) -> String {
let projected_t_value = self.0.project(DVec2::new(x, y), None);
let projected_t_value = self.0.project(DVec2::new(x, y));
let projected_point = self.0.evaluate(TValue::Parametric(projected_t_value));
let bezier = self.get_bezier_path();

View File

@@ -236,7 +236,7 @@ impl WasmSubpath {
}
pub fn project(&self, x: f64, y: f64) -> String {
let (segment_index, projected_t) = self.0.project(DVec2::new(x, y), None).unwrap();
let (segment_index, projected_t) = self.0.project(DVec2::new(x, y)).unwrap();
let projected_point = self.0.evaluate(SubpathTValue::Parametric { segment_index, t: projected_t });
let subpath_svg = self.to_default_svg();