public void AddReferenceStar(SystemClass sys) { ReferenceSystem refSys = new ReferenceSystem(sys, EstimatedPosition); if (NrOfRefenreceSystems == 0 || refSys.Distance > 0.0) // Exlude own position { int aznr = (int)Math.Floor((refSys.Azimuth * 180 / Math.PI + 180) / (360.0 / sections)); int altnr = (int)Math.Floor((refSys.Altitude * 180 / Math.PI) / (360.0 / sections)); sectors[aznr % sections, altnr % (sections / 2)].AddReference(refSys); } }
private void AddStarToSector(SystemClass sys) // call back from AddSystemToSectors { if (sys.HasCoordinate) { ReferenceSystem refSys = new ReferenceSystem(sys, EstimatedPosition); if (refSys.Distance > 0.0) // Exlude own position { int aznr = (int)Math.Floor((refSys.Azimuth * 180 / Math.PI + 180) / (360.0 / sections)); int altnr = (int)Math.Floor((refSys.Altitude * 180 / Math.PI) / (360.0 / sections)); if (sectors[aznr % sections, altnr % (sections / 2)].CandidatesCount < MaxPerSection) { sectors[aznr % sections, altnr % (sections / 2)].AddCandidate(refSys); } } } }
public void AddCandidate(ReferenceSystem refSys) { candidateReferences.Add(refSys); double weight = refSys.Weight; if (weight < minWeight) { minWeight = weight; optcandidateReferences.Add(refSys); } else if (optcandidateReferences.Count < 10) { optcandidateReferences.Add(refSys); } else if (optcandidateReferences.Count < 100 && refSys.Distance < 1000 && refSys.Distance > 100) { optcandidateReferences.Add(refSys); } }
private void AddSystemsToSectors() { int aznr, altnr; foreach (SystemClass sys in SQLiteDBClass.globalSystems) { if (sys.HasCoordinate) { ReferenceSystem refSys = new ReferenceSystem(sys, EstimatedPosition); if (refSys.Distance > 0.0) // Exlude own position { aznr = (int)Math.Floor((refSys.Azimuth * 180 / Math.PI + 180) / (360.0 / sections)); altnr = (int)Math.Floor((refSys.Altitude * 180 / Math.PI) / (360.0 / sections)); sectors[aznr % sections, altnr % (sections / 2)].AddCandidate(refSys); } } } }
private void AddSystemsToSectors() { int aznr, altnr; foreach (SystemClass sys in SQLiteDBClass.globalSystems) { if (sys.HasCoordinate) { ReferenceSystem refSys = new ReferenceSystem(sys, EstimatedPosition); if (refSys.Distance > 0.0) // Exlude own position { aznr = (int)Math.Floor((refSys.Azimuth * 180 / Math.PI + 180) / (360.0 / sections)); altnr = (int)Math.Floor((refSys.Altitude * 180 / Math.PI) / (360.0 / sections)); sectors[aznr%sections, altnr%(sections/2)].AddCandidate(refSys); } } } }
public ReferenceSystem GetCandidate() { double maxdistance = 0; ReferencesSector sectorcandidate = null; // Get Sector with maximum distance for all others... for (int i = 0; i < sections; i++) { for (int j = 0; j < sections / 2; j++) { if (sectors[i, j].ReferencesCount == 0 && sectors[i, j].CandidatesCount > 0) // An unused sector with candidates left? { double dist; double mindist = 10; for (int ii = 0; ii < sections; ii++) { for (int jj = 0; jj < sections / 2; jj++) { if (sectors[ii, jj].CandidatesCount > 0) { dist = CalculateAngularDistance(sectors[i, j].AzimuthCenterRad, sectors[i, j].LatitudeCenterRad, sectors[ii, jj].AzimuthCenterRad, sectors[ii, jj].LatitudeCenterRad); if (dist > 0.001) { if (dist < mindist) { mindist = dist; } } } } } if (mindist > maxdistance) // New candidate { maxdistance = mindist; sectorcandidate = sectors[i, j]; } } } } if (sectorcandidate == null) { if (NrOfRefenreceSystems == 0) { SystemClass sys = SystemClass.GetSystem("Sol"); if (EstimatedPosition.x == 0 && EstimatedPosition.y == 0 && EstimatedPosition.z == 0) { sys = SystemClass.GetSystem("Sirius"); } if (sys == null) { return(null); // Should not happend } ReferenceSystem refSys = new ReferenceSystem(sys, EstimatedPosition); return(refSys); } return(null); } return(sectorcandidate.GetBestCandidate()); }
public void AddReference(ReferenceSystem refSys) { usedReferences.Add(refSys); }
public ReferenceSystem GetCandidate() { double maxdistance = 0; ReferencesSector sectorcandidate = null; // Get Sector with maximum distance for all others... for (int i = 0; i < sections; i++) for (int j = 0; j < sections / 2; j++) { if (sectors[i, j].ReferencesCount == 0 && sectors[i, j].CandidatesCount > 0) // An unused sector with candidates left? { double dist; double mindist = 10; for (int ii = 0; ii < sections; ii++) for (int jj = 0; jj < sections / 2; jj++) { if (sectors[ii, jj].CandidatesCount > 0) { dist = CalculateAngularDistance(sectors[i, j].AzimuthCenterRad, sectors[i, j].LatitudeCenterRad, sectors[ii, jj].AzimuthCenterRad, sectors[ii, jj].LatitudeCenterRad); if (dist > 0.001) { if (dist < mindist) mindist = dist; } } } if (mindist > maxdistance) // New candidate { maxdistance = mindist; sectorcandidate = sectors[i, j]; } } } if (sectorcandidate == null) { if (NrOfRefenreceSystems == 0) { SystemClass sys = SystemData.GetSystem("Sol"); if (EstimatedPosition.x == 0 && EstimatedPosition.y == 0 && EstimatedPosition.z == 0) sys = SystemData.GetSystem("Sirius"); if (sys == null) return null; // Should not happend ReferenceSystem refSys = new ReferenceSystem(sys, EstimatedPosition); return refSys; } return null; } return sectorcandidate.GetBestCandidate(); }
public void AddReferenceStar(SystemClass sys) { ReferenceSystem refSys = new ReferenceSystem(sys, EstimatedPosition); if (NrOfRefenreceSystems== 0 || refSys.Distance > 0.0) // Exlude own position { int aznr = (int)Math.Floor((refSys.Azimuth * 180 / Math.PI + 180) / (360.0 / sections)); int altnr = (int)Math.Floor((refSys.Altitude * 180 / Math.PI) / (360.0 / sections)); sectors[aznr % sections, altnr % (sections / 2)].AddReference(refSys); } }
public void AddCandidate(ReferenceSystem refSys) { candidateReferences.Add(refSys); if (optcandidateReferences.Count < 5) optcandidateReferences.Add(refSys); else if (optcandidateReferences.Count < 100 && refSys.Distance < 1000 && refSys.Distance > 100) optcandidateReferences.Add(refSys); }
public void AddCandidate(ReferenceSystem refSys) { candidateReferences.Add(refSys); double weight = refSys.Weight; if (weight < minWeight) { minWeight = weight; optcandidateReferences.Add(refSys); } else if (optcandidateReferences.Count < 10) optcandidateReferences.Add(refSys); else if (optcandidateReferences.Count < 100 && refSys.Distance < 1000 && refSys.Distance > 100) optcandidateReferences.Add(refSys); }