smooth-frame 0.2.0

Generate Sketch-like smooth corner and smooth frame cubic Bezier paths.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::types::{Point, Vector};

// 根据局部圆坐标系和角度计算圆弧上的点。
pub(super) fn circle_point(
    center: Point,
    radius: f64,
    e0: Vector,
    e1: Vector,
    angle: f64,
) -> Point {
    center + e0 * (radius * angle.cos()) + e1 * (radius * angle.sin())
}

// 根据局部圆坐标系和角度计算圆弧切线方向。
pub(super) fn circle_tangent(e0: Vector, e1: Vector, angle: f64) -> Vector {
    -e0 * angle.sin() + e1 * angle.cos()
}