projective_grid/
expert.rs1pub mod orientation {
10 pub use crate::cluster::{
11 angular_dist_pi, cluster_axes, wrap_pi, AxisAssignment, AxisClusterCenters,
12 AxisClusterDebug, AxisFeature, AxisObservation, ClusterParams,
13 };
14 pub use crate::orient::{
15 synthesize_oriented2, synthesize_oriented2_from_oriented1, synthesize_oriented3,
16 };
17}
18
19pub mod geometry {
21 pub use crate::geometry::*;
22}
23
24pub mod lattice {
26 use crate::GridEntry;
27
28 pub use crate::lattice::{
29 predict_grid_position, GridTransform, Hex, Lattice, PredictedPosition, Square,
30 D4_TRANSFORMS, D6_TRANSFORMS, HEX_AXIAL_OFFSETS, SQUARE_CARDINAL_OFFSETS,
31 };
32
33 pub fn normalize_square_entries(entries: Vec<GridEntry>) -> Vec<GridEntry> {
39 crate::result::LabelledGrid::normalized_square_entries(entries)
40 }
41}
42
43pub mod square {
45 use crate::{Coord, GridError, OrientedFeature};
46
47 use super::TopologicalParams;
48
49 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
51 #[non_exhaustive]
52 pub struct ComponentEntry {
53 coord: Coord,
54 source_index: usize,
55 }
56
57 impl ComponentEntry {
58 pub fn coord(&self) -> Coord {
60 self.coord
61 }
62
63 pub fn source_index(&self) -> usize {
65 self.source_index
66 }
67 }
68
69 #[derive(Clone, Debug, PartialEq, Eq)]
72 #[non_exhaustive]
73 pub struct Component {
74 entries: Vec<ComponentEntry>,
75 }
76
77 impl Component {
78 pub fn entries(&self) -> &[ComponentEntry] {
81 &self.entries
82 }
83 }
84
85 pub fn assemble_oriented2_components(
93 features: &[OrientedFeature<2>],
94 params: &TopologicalParams,
95 ) -> Result<Vec<Component>, GridError> {
96 crate::topological::assemble_square_oriented2_components(features, params).map(
97 |components| {
98 components
99 .into_iter()
100 .map(|component| {
101 let mut entries: Vec<ComponentEntry> = component
102 .into_iter()
103 .map(|(coord, feature_index)| ComponentEntry {
104 coord,
105 source_index: features[feature_index].point.source_index,
106 })
107 .collect();
108 entries.sort_by_key(|entry| {
109 (entry.coord.v, entry.coord.u, entry.source_index)
110 });
111 Component { entries }
112 })
113 .collect()
114 },
115 )
116 }
117}
118
119pub mod component {
121 pub use crate::shared::merge::{merge_components_local, LocalMergeParams};
122}
123
124pub mod attachment {
126 pub use crate::shared::grow::{
127 Admit, FillEdgeCtx, GrowResult, LabelledNeighbour, SquareAttachPolicy,
128 };
129}
130
131pub mod fill {
133 pub use crate::shared::fill::{fill_grid_holes, FillParams, FillStats};
134}
135
136pub mod validation {
138 pub use crate::shared::validate::{
139 validate, LabelledEntry, ValidationParams, ValidationResult,
140 };
141
142 pub mod wrong_label_filters {
144 pub use crate::shared::validate::wrong_label_filters::{drop_set, DropSet};
145 }
146}
147
148pub use crate::detect::DetectionTuning;
149pub use crate::shared::recovery_schedule::{RecoveryParams, RecoverySchedule};
150pub use crate::topological::TopologicalParams;