MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / SphRatio

Function SphRatio

general.cpp:582–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580// proportion (0.0-1.0) along the great circle path between them.
581
582void SphRatio(real lon1, real lat1, real lon2, real lat2, real rRatio,
583 real *lon, real *lat)
584{
585 real x1, y1, z1, x2, y2, z2, x, y, z, len, ang, adj, ang2;
586
587 SphToRec(1.0, lon1, lat1, &x1, &y1, &z1);
588 SphToRec(1.0, lon2, lat2, &x2, &y2, &z2);
589 if (rRatio != 0.5) {
590 // Bisecting an arc is easy, however other proportions require extra math.
591 len = RLength3(x2 - x1, y2 - y1, z2 - z1) / 2.0;
592 ang = RAsinD(len);
593 adj = 1.0 / RTanD(ang);
594 rRatio = (rRatio - 0.5) / 0.5;
595 ang2 = rRatio * ang;
596 rRatio = adj * RTanD(ang2);
597 rRatio = (rRatio / 2.0) + 0.5;
598 }
599 x = x1 + (x2 - x1) * rRatio;
600 y = y1 + (y2 - y1) * rRatio;
601 z = z1 + (z2 - z1) * rRatio;
602 RecToSph3(x, y, z, lon, lat);
603}
604
605
606// Given a planet and sign, determine whether: The planet rules the sign or

Callers 10

ChartMidpointRelationFunction · 0.85
CastRelationFunction · 0.85
DrawMapLineFunction · 0.85
DrawMapTriangleFunction · 0.85
DrawMapSquareFunction · 0.85
XChartTelescopeFunction · 0.85
XChartLocalFunction · 0.85
FCreateGridFunction · 0.85
FCreateGridRelationFunction · 0.85
ChartMidpointFunction · 0.85

Calls 2

SphToRecFunction · 0.85
RecToSph3Function · 0.85

Tested by

no test coverage detected