mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-06 01:48:12 +08:00
Bezier-rs: Add iframes to rustdoc (#1036)
* Add iframes examples * Move TValue selection to bottom * Remove spaces * Add background, adjust heights * Minor lint fix
This commit is contained in:
committed by
Keavon Chambers
parent
9a52cae9b9
commit
98f172414a
@@ -8,6 +8,7 @@ use glam::DVec2;
|
||||
impl Subpath {
|
||||
/// Return the sum of the approximation of the length of each `Bezier` curve along the `Subpath`.
|
||||
/// - `num_subdivisions` - Number of subdivisions used to approximate the curve. The default value is `1000`.
|
||||
/// <iframe frameBorder="0" width="100%" height="325px" src="https://graphite.rs/bezier-rs-demos#subpath/length/solo" title="Length Demo"></iframe>
|
||||
pub fn length(&self, num_subdivisions: Option<usize>) -> f64 {
|
||||
self.iter().fold(0., |accumulator, bezier| accumulator + bezier.length(num_subdivisions))
|
||||
}
|
||||
@@ -78,6 +79,7 @@ impl Subpath {
|
||||
|
||||
/// Returns the segment index and `t` value that corresponds to the closest point on the curve to the provided point.
|
||||
/// Uses a searching algorithm akin to binary search that can be customized using the [ProjectionOptions] structure.
|
||||
/// <iframe frameBorder="0" width="100%" height="325px" src="https://graphite.rs/bezier-rs-demos#subpath/project/solo" title="Project Demo"></iframe>
|
||||
pub fn project(&self, point: DVec2, options: ProjectionOptions) -> Option<(usize, f64)> {
|
||||
if self.is_empty() {
|
||||
return None;
|
||||
|
||||
Reference in New Issue
Block a user