pub enum GateGeometry {
Polygon {
nodes: Vec<GateNode>,
closed: bool,
},
Rectangle {
min: GateNode,
max: GateNode,
},
Ellipse {
center: GateNode,
radius_x: f32,
radius_y: f32,
angle: f32,
},
}Expand description
The geometry of a gate, defining its shape in 2D parameter space.
Gates can be one of three geometric types:
- Polygon: A closed or open polygonal region defined by vertices
- Rectangle: An axis-aligned rectangular region
- Ellipse: An elliptical region with optional rotation
All geometries operate in raw data coordinate space and are parameterized by two channel names (x and y parameters).
§Example
use flow_gates::{GateGeometry, GateNode};
// Create a rectangle gate
let min = GateNode::new("min")
.with_coordinate("FSC-A", 100.0)
.with_coordinate("SSC-A", 200.0);
let max = GateNode::new("max")
.with_coordinate("FSC-A", 500.0)
.with_coordinate("SSC-A", 600.0);
let geometry = GateGeometry::Rectangle { min, max };
// Check if a point is inside
let inside = geometry.contains_point(300.0, 400.0, "FSC-A", "SSC-A")?;Variants§
Implementations§
Source§impl GateGeometry
impl GateGeometry
Sourcepub fn bounding_box(
&self,
x_param: &str,
y_param: &str,
) -> Option<(f32, f32, f32, f32)>
pub fn bounding_box( &self, x_param: &str, y_param: &str, ) -> Option<(f32, f32, f32, f32)>
Calculate the bounding box for this geometry in the specified parameter space
Sourcepub fn calculate_center(
&self,
x_param: &str,
y_param: &str,
) -> Result<(f32, f32)>
pub fn calculate_center( &self, x_param: &str, y_param: &str, ) -> Result<(f32, f32)>
Calculate the center point in raw data coordinates
Sourcepub fn contains_point(
&self,
x: f32,
y: f32,
x_param: &str,
y_param: &str,
) -> Result<bool>
pub fn contains_point( &self, x: f32, y: f32, x_param: &str, y_param: &str, ) -> Result<bool>
Check if a point (in raw coordinates) is inside the gate
Sourcepub fn is_valid(&self, x_param: &str, y_param: &str) -> Result<bool>
pub fn is_valid(&self, x_param: &str, y_param: &str) -> Result<bool>
Check if the gate has valid geometry and coordinates
Sourcepub fn gate_type_name(&self) -> &'static str
pub fn gate_type_name(&self) -> &'static str
Get a descriptive name for this gate type
Trait Implementations§
Source§impl Clone for GateGeometry
impl Clone for GateGeometry
Source§fn clone(&self) -> GateGeometry
fn clone(&self) -> GateGeometry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GateGeometry
impl Debug for GateGeometry
Source§impl<'de> Deserialize<'de> for GateGeometry
impl<'de> Deserialize<'de> for GateGeometry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl GateBounds for GateGeometry
impl GateBounds for GateGeometry
Source§impl GateCenter for GateGeometry
impl GateCenter for GateGeometry
Source§impl GateContainment for GateGeometry
impl GateContainment for GateGeometry
Source§impl GateGeometryOps for GateGeometry
impl GateGeometryOps for GateGeometry
Source§fn gate_type_name(&self) -> &'static str
fn gate_type_name(&self) -> &'static str
Get a descriptive name for this gate type
Source§impl GateValidation for GateGeometry
impl GateValidation for GateGeometry
Auto Trait Implementations§
impl Freeze for GateGeometry
impl RefUnwindSafe for GateGeometry
impl Send for GateGeometry
impl Sync for GateGeometry
impl Unpin for GateGeometry
impl UnwindSafe for GateGeometry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more