private void calculateMidpoints() { // build list to check PlanetaryPosition pp; MidpointType midpointType = new MidpointType(1, 1, midpointOrb); for (int i = 0; i < planetaryPositions.Count; i++) { pp = (PlanetaryPosition)planetaryPositions[i]; analysedItems.Add(new AnalysedItem(pp.planetId, pp.longitude)); } // add Ascendant and MC analysedItems.Add(new AnalysedItem(Constants.SE_ASC_AS_BODY, housePositionSet.getAsc())); analysedItems.Add(new AnalysedItem(Constants.SE_MC_AS_BODY, housePositionSet.getMC())); double normPosition; double actOrbis; double long1; double long2; double long3; AnalysedItem item1; AnalysedItem item2; AnalysedItem item3; for (int i = 0; i < analysedItems.Count; i++) { item1 = (AnalysedItem)analysedItems[i]; for (int j = i + 1; j < analysedItems.Count; j++) { item2 = (AnalysedItem)analysedItems[j]; long1 = item1.longitude; long2 = item2.longitude; normPosition = (long1 + long2) / 2; if (normPosition >= 180) { normPosition -= 180; } for (int k = 0; k < analysedItems.Count; k++) { item3 = (AnalysedItem)analysedItems[k]; long3 = item3.longitude; actOrbis = long3 - normPosition; if (actOrbis >= 90) { actOrbis -= 180; } actOrbis = Math.Abs(actOrbis); if (actOrbis < midpointType.orbis) { // midpoint found midpoints.Add(new Midpoint(item1.index, item2.index, item3.index, normPosition, actOrbis, midpointType)); } } } } }
/// <summary> /// Constructor, defines all variables /// </summary> /// <param name="pos1">One of the paired bodies that form the midpoint</param> /// <param name="pos2">The other paired body</param> /// <param name="pos3">The body on the midpoint axis</param> /// <param name="position">Position of the exact midpoint, calculated within the first 180 degrees</param> /// <param name="actOrbis">Orbis from conjunction or opposition between pos3 and position</param> /// <param name="midpointType">Type of midpoint</param> public Midpoint(int pos1, int pos2, int pos3, double position, double actOrbis, MidpointType midpointType) { this.pos1 = pos1; this.pos2 = pos2; this.pos3 = pos3; this.position = position; this.actOrbis = actOrbis; this.midpointType = midpointType; }