Skip to main content

XJunctionValidator

Struct XJunctionValidator 

Source
pub struct XJunctionValidator<F: Float = f32> {
    pub min_spacing: F,
    pub max_spacing: F,
    pub tolerance_rad: F,
}
Expand description

Validator for square grids of X-junction corners with known orientation.

Designed for ChESS-like features where each corner has an orientation angle (mod π) and adjacent corners on a chessboard pattern have orthogonal orientations. The edge between two neighbors is at ~45° to both orientations.

§PointData

F — the corner’s orientation angle in radians (mod π, undirected axis).

§Example

use projective_grid::{GridGraph, GridGraphParams, NeighborCandidate};
use projective_grid::square::validators::XJunctionValidator;
use nalgebra::Point2;
use std::f32::consts::FRAC_PI_4;

let positions = vec![
    Point2::new(0.0f32, 0.0), Point2::new(10.0, 0.0),
    Point2::new(0.0, 10.0),   Point2::new(10.0, 10.0),
];
// Alternating orientations (π/4 and 3π/4) like a chessboard
let orientations = vec![FRAC_PI_4, 3.0 * FRAC_PI_4, 3.0 * FRAC_PI_4, FRAC_PI_4];

let validator = XJunctionValidator {
    min_spacing: 5.0,
    max_spacing: 15.0,
    tolerance_rad: 15.0f32.to_radians(),
};
let graph = GridGraph::build(
    &positions, &orientations, &validator, &GridGraphParams::default(),
);

Fields§

§min_spacing: F

Minimum acceptable neighbor distance (pixels).

§max_spacing: F

Maximum acceptable neighbor distance (pixels).

§tolerance_rad: F

Angular tolerance (radians) for orthogonality and 45° edge alignment checks.

Trait Implementations§

Source§

impl<F: Float> NeighborValidator<F> for XJunctionValidator<F>

Source§

type PointData = F

Per-point data beyond position (e.g., orientation, cluster label). Use () if no extra data is needed.
Source§

fn validate( &self, _source_index: usize, source_data: &F, candidate: &NeighborCandidate<F>, candidate_data: &F, ) -> Option<(NeighborDirection, F)>

Validate whether candidate is a valid grid neighbor of the point at source_index. Returns (direction, score) where lower score is better, or None to reject.

Auto Trait Implementations§

§

impl<F> Freeze for XJunctionValidator<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for XJunctionValidator<F>
where F: RefUnwindSafe,

§

impl<F> Send for XJunctionValidator<F>

§

impl<F> Sync for XJunctionValidator<F>

§

impl<F> Unpin for XJunctionValidator<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for XJunctionValidator<F>
where F: UnsafeUnpin,

§

impl<F> UnwindSafe for XJunctionValidator<F>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.