mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 03:18:06 +08:00
made spiral node
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::f64::consts::{FRAC_PI_4, FRAC_PI_8, TAU};
|
||||
|
||||
use super::misc::{ArcType, AsU64, GridType};
|
||||
use super::{PointId, SegmentId, StrokeId};
|
||||
use crate::Ctx;
|
||||
@@ -65,6 +67,28 @@ fn arc(
|
||||
)))
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Vector: Shape"))]
|
||||
fn spiral(
|
||||
_: impl Ctx,
|
||||
_primary: (),
|
||||
#[default(1.)] inner_radius: f64,
|
||||
#[default(1.)] tightness: f64,
|
||||
#[default(6)]
|
||||
#[hard_min(1.)]
|
||||
turns: u32,
|
||||
#[default(0.)]
|
||||
#[range((0., 360.))]
|
||||
angle_offset: f64,
|
||||
) -> VectorDataTable {
|
||||
VectorDataTable::new(VectorData::from_subpath(Subpath::generate_equal_arc_bezier_spiral2(
|
||||
inner_radius,
|
||||
tightness,
|
||||
turns,
|
||||
FRAC_PI_4,
|
||||
angle_offset.to_radians(),
|
||||
)))
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Vector: Shape"))]
|
||||
fn ellipse(_: impl Ctx, _primary: (), #[default(50)] radius_x: f64, #[default(25)] radius_y: f64) -> VectorDataTable {
|
||||
let radius = DVec2::new(radius_x, radius_y);
|
||||
|
||||
Reference in New Issue
Block a user