Skip to content

Commit

Permalink
fix aspect orb calculation -- for good
Browse files Browse the repository at this point in the history
  • Loading branch information
0xStarcat committed Aug 26, 2020
1 parent 42b8b33 commit e0e45dc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/main.bundle.js

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions src/utilities/aspects.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ export const getAspectData = (horoscope) => {

export const calculateOrb = (aspectAngle, maxOrb, point1, point2) => {

// const centerPoint = modulo(point1 + aspectAngle, 360)
const comparisonAngle = aspectAngle > 0 ? modulo(Math.abs(point2 - aspectAngle), aspectAngle) : point2
// Calculates how close point2 is to the aspect angle from point1.
// Ex: Point1 = 100 deg, Point2 = 161 deg,
// Sextile Aspect = 60 deg
// => orb = 1 deg

let orb = getModuloDifference(point1, comparisonAngle)
if (aspectAngle > 0) orb = modulo(orb, aspectAngle)
const difference = getModuloDifference(point1, point2)
const orb = Math.abs(difference - aspectAngle)

// let orb = getModuloDifference(point1, comparisonAngle)
// if (aspectAngle > 0) orb = modulo(orb, aspectAngle)
return parseFloat(orb.toFixed(4))
}

Expand Down
4 changes: 4 additions & 0 deletions src/utilities/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export const decimalDegreesToDMS = (decimalDegrees) => {
}

export const isDegreeWithinCircleArc = (arcLow, arcHigh, degree, edges = '[)') => {
// Calculates if a point ("degree") is within an arc between "arcLow" and "arcHigh" within a circle.
// With parameters for low/high inclusive or exclusive.
// [] = low/high inclusive
// () = low/high exclusive
const operators = {
'[': (a, b) => a >= b,
'(': (a, b) => a > b,
Expand Down

0 comments on commit e0e45dc

Please sign in to comment.