Download node-graph/gcore/src/extract_xy.rs from openfree/graphite2: direct link, hf CLI and curl.
- Browser
- Download file 747 Bytes
-
https://huggingface.co/spaces/openfree/graphite2/resolve/main/node-graph/gcore/src/extract_xy.rs
- Command line
-
hf download hf://spaces/openfree/graphite2/node-graph/gcore/src/extract_xy.rs
-
curl -L -o extract_xy.rs https://huggingface.co/spaces/openfree/graphite2/resolve/main/node-graph/gcore/src/extract_xy.rs
747 Bytes
| use crate::Ctx; | |
| use dyn_any::DynAny; | |
| use glam::{DVec2, IVec2, UVec2}; | |
| /// Obtains the X or Y component of a coordinate point. | |
| /// | |
| /// The inverse of this node is "Coordinate Value", which can have either or both its X and Y exposed as graph inputs. | |
| fn extract_xy<T: Into<DVec2>>(_: impl Ctx, vector: T, axis: XY) -> f64 { | |
| match axis { | |
| XY::X => vector.into().x, | |
| XY::Y => vector.into().y, | |
| } | |
| } | |
| /// The X or Y component of a coordinate. | |
| pub enum XY { | |
| X, | |
| Y, | |
| } | |