public SurfaceMatch(SurfaceBasicInfo _sbi_1, SurfaceBasicInfo _sbi_2, float _matching_tolerance = 0.001f) { this.Match01 = _sbi_1; this.Match02 = _sbi_2; this.tolerance = _matching_tolerance; this.IsAlignment = false; }
private static void ClusterAccToAlignmentAlgorithm(ref Dictionary <SurfaceBasicInfo, int> _processed, ref int _cluster_counter) { for (int i = 0; i < _processed.Count; i++) { SurfaceBasicInfo s = _processed.ElementAt(i).Key; int s_cluster = _processed.ElementAt(i).Value; if (s_cluster > -1) { continue; } // debug if (s.VolumeID == 39 && s.IsWall && s.LevelOrLabel == 2 && s.Wall_LowerPoly == 16 && s.Wall_UpperPoly == 17) { } // try to add to cluster List <int> tested_clusters = new List <int>(); for (int c = 0; c < _processed.Count; c++) { SurfaceBasicInfo clusterCenter = _processed.ElementAt(c).Key; int clusterIndex = _processed.ElementAt(c).Value; // debug if (clusterCenter.VolumeID == 25 && clusterCenter.IsWall && clusterCenter.LevelOrLabel == 0) { } if (tested_clusters.Contains(clusterIndex)) { continue; } tested_clusters.Add(clusterIndex); SurfaceMatch match_test = new SurfaceMatch(s, clusterCenter, 0.1f); // tolerance for the cos match_test.PerformAlignmentTest(); if (match_test.IsAlignment) { _processed[s] = clusterIndex; break; } } // if unsuccessful, initiate another cluster if (_processed[s] < 0) { _processed[s] = _cluster_counter; _cluster_counter++; } } }
public override bool Equals(object obj) { if (!(obj is SurfaceBasicInfo)) { return(base.Equals(obj)); } else { SurfaceBasicInfo obj_as_sbi = obj as SurfaceBasicInfo; return(this.VolumeID == obj_as_sbi.VolumeID && this.IsWall == obj_as_sbi.IsWall && this.LevelOrLabel == obj_as_sbi.LevelOrLabel && this.LabelForOpenings == obj_as_sbi.LabelForOpenings && this.Wall_LowerPoly == obj_as_sbi.Wall_LowerPoly && this.Wall_UpperPoly == obj_as_sbi.Wall_UpperPoly); } }
private static Dictionary <SurfaceBasicInfo, int> ClusterAccToAlignment(List <SurfaceBasicInfo> _surfaces) { Dictionary <SurfaceBasicInfo, int> processed = new Dictionary <SurfaceBasicInfo, int>(); if (_surfaces == null || _surfaces.Count == 0) { return(processed); } foreach (SurfaceBasicInfo s in _surfaces) { processed.Add(s, -1); } SurfaceBasicInfo s1 = processed.ElementAt(0).Key; processed[s1] = 0; int cluster_counter = 1; NeighborhoodGraph.ClusterAccToAlignmentAlgorithm(ref processed, ref cluster_counter); return(processed); }