Download node-graph/gcore/src/vector/misc.rs from openfree/graphite2: direct link, hf CLI and curl.
- Browser
- Download file 2.27 kB
-
https://huggingface.co/spaces/openfree/graphite2/resolve/main/node-graph/gcore/src/vector/misc.rs
- Command line
-
hf download hf://spaces/openfree/graphite2/node-graph/gcore/src/vector/misc.rs
-
curl -L -o misc.rs https://huggingface.co/spaces/openfree/graphite2/resolve/main/node-graph/gcore/src/vector/misc.rs
2.27 kB
| use dyn_any::DynAny; | |
| use glam::DVec2; | |
| use kurbo::Point; | |
| /// Represents different ways of calculating the centroid. | |
| pub enum CentroidType { | |
| /// The center of mass for the area of a solid shape's interior, as if made out of an infinitely flat material. | |
| Area, | |
| /// The center of mass for the arc length of a curved shape's perimeter, as if made out of an infinitely thin wire. | |
| Length, | |
| } | |
| pub trait AsU64 { | |
| fn as_u64(&self) -> u64; | |
| } | |
| impl AsU64 for u32 { | |
| fn as_u64(&self) -> u64 { | |
| *self as u64 | |
| } | |
| } | |
| impl AsU64 for u64 { | |
| fn as_u64(&self) -> u64 { | |
| *self | |
| } | |
| } | |
| impl AsU64 for f64 { | |
| fn as_u64(&self) -> u64 { | |
| *self as u64 | |
| } | |
| } | |
| pub trait AsI64 { | |
| fn as_i64(&self) -> i64; | |
| } | |
| impl AsI64 for u32 { | |
| fn as_i64(&self) -> i64 { | |
| *self as i64 | |
| } | |
| } | |
| impl AsI64 for u64 { | |
| fn as_i64(&self) -> i64 { | |
| *self as i64 | |
| } | |
| } | |
| impl AsI64 for f64 { | |
| fn as_i64(&self) -> i64 { | |
| *self as i64 | |
| } | |
| } | |
| pub enum GridType { | |
| Rectangular, | |
| Isometric, | |
| } | |
| pub enum ArcType { | |
| Open, | |
| Closed, | |
| PieSlice, | |
| } | |
| pub enum MergeByDistanceAlgorithm { | |
| Spatial, | |
| Topological, | |
| } | |
| pub enum PointSpacingType { | |
| /// The desired spacing distance between points. | |
| Separation, | |
| /// The exact number of points to span the path. | |
| Quantity, | |
| } | |
| pub fn point_to_dvec2(point: Point) -> DVec2 { | |
| DVec2 { x: point.x, y: point.y } | |
| } | |
| pub fn dvec2_to_point(value: DVec2) -> Point { | |
| Point { x: value.x, y: value.y } | |
| } | |