mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 11:28:30 +08:00
New nodes: shape/curve primitives (#1389)
* Add new Primitive Shape/Curve Nodes * Elipse Node and Debug * N-input Spline node * Debuging * Debug * fmt * remov debug * Changes from code review * Debug: Empty Spline Input * Changes from code review * Fix spelling of ellipse * Rename polygon to regular polygon --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
9d27bf49cf
commit
226b96260c
@@ -235,8 +235,8 @@ impl<ManipulatorGroupId: crate::Identifier> Subpath<ManipulatorGroupId> {
|
||||
Self::from_anchors(anchor_positions, true)
|
||||
}
|
||||
|
||||
/// Constructs a regular star polygon (n-star). See [new_regular_polygon], but with interspersed vertices at an `inner_radius`.
|
||||
pub fn new_regular_star_polygon(center: DVec2, sides: u64, radius: f64, inner_radius: f64) -> Self {
|
||||
/// Constructs a star polygon (n-star). See [new_regular_polygon], but with interspersed vertices at an `inner_radius`.
|
||||
pub fn new_star_polygon(center: DVec2, sides: u64, radius: f64, inner_radius: f64) -> Self {
|
||||
let anchor_positions = (0..sides * 2).map(|i| {
|
||||
let angle = (i as f64) * 0.5 * std::f64::consts::TAU / (sides as f64);
|
||||
let center = center + DVec2::ONE * radius;
|
||||
@@ -254,6 +254,10 @@ impl<ManipulatorGroupId: crate::Identifier> Subpath<ManipulatorGroupId> {
|
||||
/// Construct a cubic spline from a list of points.
|
||||
/// Based on <https://mathworld.wolfram.com/CubicSpline.html>.
|
||||
pub fn new_cubic_spline(points: Vec<DVec2>) -> Self {
|
||||
if points.is_empty() {
|
||||
return Self::new(Vec::new(), false);
|
||||
}
|
||||
|
||||
// Number of points = number of points to find handles for
|
||||
let len_points = points.len();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user