public Aspects PreviousAspectOf(Angle angle) { return(Aspects.PreviousAspectOf(Outstandings, angle)); }
public Aspects NextAspectOf(Angle angle) { return(Aspects.NextAspectOf(Outstandings, angle)); }
public Aspects AspectBetween(Angle start, Angle end) { return(Aspects.AspectBetween(Outstandings, start, end)); }
public bool HasAspectBetween(Angle start, Angle end) { return(CurrentAspectOf(end - start) != null); }
public Aspects CurrentAspectOf(Angle angle) { return(Aspects.CurrentAspectOf(Outstandings, angle)); }
public Double IndexOnLine(int round, Angle angle) { if (round == 0) { return(1); } else if (round < 0) { throw new ArgumentOutOfRangeException("Round Number shall be bigger than 1."); } int last = LastOfRound(round); int sideLength = LengthOfRound(round) / Edges; int first = last - sideLength * Edges + 1; double sectorAngle = 360.0 / Edges; if ((angle.Degrees - FirstVertexDegree) % sectorAngle == 0) { return((FirstVertexDegree == sectorAngle) ? last - (angle.Degrees == 0 ? 0 : (Edges - angle.Degrees / sectorAngle)) * sideLength : last - (Edges - 1 - (angle.Degrees - FirstVertexDegree) / sectorAngle) * sideLength); } double offset; try { if (FirstVertexDegree == sectorAngle) { int nextCorner = (int)Math.Ceiling((angle.Degrees - FirstVertexDegree) / sectorAngle); if (nextCorner == 0) { Double degreeOfFirst = AngleOf(first).Degrees; if (angle.Degrees == degreeOfFirst) { return(first); } else if (angle.Degrees > degreeOfFirst) { offset = Sector.OffsetFromDegree((FirstVertexDegree - angle.Degrees)); return(last - (Edges - 1 + offset) * sideLength); } else { double degreeOfLast = AngleOf(last + 1).Degrees; if (angle.Degrees >= degreeOfLast) { return(last); } else { offset = Sector.OffsetFromDegree((angle.Degrees - Vertices[Edges - 2].Degrees).Normalize()); return(last - (1 - offset) * sideLength); } } } else { offset = Sector.OffsetFromDegree((Vertices[nextCorner].Degrees - angle.Degrees).Normalize()); return(last - (Edges - 1 - nextCorner + offset) * sideLength); } } else { int lowerCorner = (int)Math.Floor((angle.Degrees - FirstVertexDegree) / sectorAngle); if (lowerCorner == -1) { double delta = FirstVertexDegree - angle.Degrees; //offset = Sector.OffsetFromDegree((FirstVertexDegree - angle.Degrees).Normalize()); //return last + offset * sideLength; offset = Sector.OffsetFromDegree(delta); return(last - (Edges - 1 + offset) * sideLength); } else if (lowerCorner >= Edges - 1) { Double degreeOfFirst = AngleOf(first).Degrees; if (angle.Degrees == degreeOfFirst) { return(first); } else if (degreeOfFirst > Vertices[Edges - 1].Degrees && angle.Degrees > degreeOfFirst) { offset = Sector.OffsetFromDegree((FirstVertexDegree - angle.Degrees).Normalize()); return(last - (Edges - 1 + offset) * sideLength); } else { double degreeOfLast = AngleOf(last + 1).Degrees; if (angle.Degrees >= (degreeOfLast == 0 ? 360.0 : degreeOfLast)) { return(last); } else { offset = Sector.OffsetFromDegree((angle.Degrees - Vertices[Edges - 2].Degrees)); return(last - (1 - offset) * sideLength); } } } else { offset = Sector.OffsetFromDegree((angle.Degrees - Vertices[lowerCorner].Degrees).Normalize()); return(last - (Edges - 1 - lowerCorner - offset) * sideLength); } } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); return(0); } }