|
RCube
Rcube Rest Server calculates sail routes based on Grib files and sailing boat polar files
|
#include <math.h>#include <time.h>

Go to the source code of this file.
Functions | |
| static bool | isSea (char *isSeaArray, double lat, double lon) |
| this file contains small inlines functions to be included in source files | |
| static bool | isSeaTolerant (char *isSeaArray, double lat, double lon) |
| say if point is in sea | |
| static double | lonCanonize (double lon) |
| return lon on ]-180, 180 ] interval | |
| static double | lonNormalize (double lon, bool anteMeridian) |
| if antemeridian -180 < lon < 360. | |
| static bool | isInZone (double lat, double lon, Zone *zone) |
| true if P (lat, lon) is within the zone | |
| static double | fTwd (double u, double v) |
| true wind direction | |
| static double | fTws (double u, double v) |
| true wind speed. | |
| static double | fTwa (double heading, double twd) |
| return TWA between -180 and 180 note : tribord amure if twa < 0 | |
| static void | fAwaAws (double twa, double tws, double sog, double *awa, double *aws) |
| return AWA and AWS Apparent Wind Angle and Speed | |
| static double | interpolate (double x, double x0, double x1, double fx0, double fx1) |
| return fx : linear interpolation | |
| static double | givry (double lat1, double lon1, double lat2, double lon2) |
| return givry correction to apply to direct or loxodromic cap to get orthodromic cap | |
| static double | directCap (double lat1, double lon1, double lat2, double lon2) |
| return loxodromic cap from origin to destination | |
| static double | orthoCap (double lat1, double lon1, double lat2, double lon2) |
| return initial orthodromic cap from origin to destination equivalent to : return directCap (lat1, lon1, lat2, lon2) + givry (lat1, lon1, lat2, lon2); | |
| static double | orthoCap2 (double lat1, double lon1, double lat2, double lon2) |
| return initial orthodromic cap from origin to destination, no givry correction | |
| static double | loxoDist (double lat1, double lon1, double lat2, double lon2) |
| return loxodromic distance in nautical miles from origin to destination | |
| static double | orthoDist (double lat1, double lon1, double lat2, double lon2) |
| return orthodromic distance in nautical miles from origin to destination | |
| static double | orthoDist2 (double lat1, double lon1, double lat2, double lon2) |
| return orthodomic distance in nautical miles from origin to destinationi, Haversine formula time consuming | |
| static double | findPolar (double twa, double w, const PolMat *mat, const PolMat *sailMat, int *sail) |
| find in polar boat speed or wave coeff | |
| static int | binarySearchTwa (const PolMat *mat, double val) |
| dichotomic search on column 0 (TWA), using rows [1 . | |
| static int | binarySearchW (const double *row0, int nCol, double val) |
| dichotomic search on row 0 (wind speed), using columns [1 . | |
| static double | findPolar1 (double twa, double w, const PolMat *mat, const PolMat *sailMat, int *sail) |
| find in polar boat speed or wave coeff and sail number if sailMat != NULL | |
| static double | findPolar2 (double twa, double w, const PolMat *mat, const PolMat *sailMat, int *sail) |
| find in polar boat speed or wave coeff and sail number if sailMat != NULL | |
| static double | maxSpeedInPolarAt (double tws, const PolMat *mat) |
| return max speed of boat at tws for all twa | |
| static void | orthoFindInterPoint (double lat1, double lon1, double lat2, double lon2, double d_nm, double *latR, double *lonR) |
| Compute the intermediate point on the great circle from P1 to P2. | |
| static bool | isDay (double t, long dataDate, long dataTime, double lat, double lon) |
| true if day light, false if night | |
|
inlinestatic |
dichotomic search on column 0 (TWA), using rows [1 .
. nLine-1]
Definition at line 211 of file inline.h.
References PolMat::nLine, and PolMat::t.
Referenced by findPolar2().

|
inlinestatic |
dichotomic search on row 0 (wind speed), using columns [1 .
. nCol-1]
Definition at line 226 of file inline.h.
Referenced by findPolar1(), findPolar2(), and maxSpeedInPolarAt().

|
inlinestatic |
return loxodromic cap from origin to destination
Definition at line 89 of file inline.h.
References DEG_TO_RAD, and RAD_TO_DEG.
Referenced by routing(), and statRoute().

|
inlinestatic |
return AWA and AWS Apparent Wind Angle and Speed
Definition at line 70 of file inline.h.
References DEG_TO_RAD, and RAD_TO_DEG.
Referenced by routeToStr().

|
inlinestatic |
find in polar boat speed or wave coeff
Definition at line 174 of file inline.h.
References interpolate(), PolMat::nCol, PolMat::nLine, and PolMat::t.
Referenced by bestVmg(), bestVmgBack(), buildNextIsochrone(), goalP(), optionManage(), and simpleGoalP().


|
inlinestatic |
find in polar boat speed or wave coeff and sail number if sailMat != NULL
Definition at line 241 of file inline.h.
References binarySearchW(), interpolate(), PolMat::nCol, PolMat::nLine, and PolMat::t.
Referenced by optionManage().


|
inlinestatic |
find in polar boat speed or wave coeff and sail number if sailMat != NULL
Definition at line 277 of file inline.h.
References binarySearchTwa(), binarySearchW(), interpolate(), PolMat::nCol, PolMat::nLine, and PolMat::t.
Referenced by optionManage().


|
inlinestatic |
return TWA between -180 and 180 note : tribord amure if twa < 0
Definition at line 64 of file inline.h.
Referenced by buildNextIsochrone(), goalP(), optionManage(), routeToJson(), routeToStr(), and simpleGoalP().

|
inlinestatic |
true wind direction
Definition at line 52 of file inline.h.
References RAD_TO_DEG.
Referenced by findCurrentGrib(), and findWindGrib().

|
inlinestatic |
true wind speed.
cf Pythagore
Definition at line 58 of file inline.h.
References MS_TO_KN.
Referenced by findCurrentGrib(), findWindGrib(), fPenalty(), fPointLoss(), and fTimeToRecupOnePoint().

|
inlinestatic |
return givry correction to apply to direct or loxodromic cap to get orthodromic cap
Definition at line 84 of file inline.h.
References DEG_TO_RAD.
|
inlinestatic |
return fx : linear interpolation
Definition at line 78 of file inline.h.
Referenced by findFlow(), findPolar(), findPolar1(), and findPolar2().

|
inlinestatic |
true if day light, false if night
Definition at line 421 of file inline.h.
References lonCanonize().
Referenced by buildNextIsochrone(), goalP(), optionManage(), and simpleGoalP().


|
inlinestatic |
true if P (lat, lon) is within the zone
Definition at line 47 of file inline.h.
References Zone::latMax, Zone::latMin, Zone::lonLeft, Zone::lonRight, and zone.
Referenced by buildNextIsochrone(), checkParamAndUpdate(), findFlow(), and infoCoordToJson().

|
inlinestatic |
this file contains small inlines functions to be included in source files
say if point is in sea
Definition at line 8 of file inline.h.
Referenced by infoCoordToJson(), optionManage(), segmentOverSea(), and simpleGoal().

|
inlinestatic |
say if point is in sea
Definition at line 16 of file inline.h.
Referenced by buildNextIsochrone(), checkParamAndUpdate(), goal(), and infoCoordToJson().

|
inlinestatic |
return lon on ]-180, 180 ] interval
Definition at line 29 of file inline.h.
Referenced by consistentGrib(), isDay(), lonNormalize(), orthoFindInterPoint(), readGribAll(), readGribParameters(), and storeRoute().

|
inlinestatic |
if antemeridian -180 < lon < 360.
Normal case : -180 < lon <= 180
Definition at line 40 of file inline.h.
References lonCanonize().

|
inlinestatic |
return loxodromic distance in nautical miles from origin to destination
Definition at line 119 of file inline.h.
References DEG_TO_RAD, EARTH_RADIUS, and G_PI.
Referenced by optionManage(), and statRoute().

|
inlinestatic |
return max speed of boat at tws for all twa
Definition at line 308 of file inline.h.
References binarySearchW(), PolMat::nCol, PolMat::nLine, and PolMat::t.
Referenced by buildNextIsochrone(), goalP(), optionManage(), and simpleGoalP().


|
inlinestatic |
return initial orthodromic cap from origin to destination equivalent to : return directCap (lat1, lon1, lat2, lon2) + givry (lat1, lon1, lat2, lon2);
Definition at line 96 of file inline.h.
References DEG_TO_RAD, and RAD_TO_DEG.
Referenced by buildNextIsochrone(), forwardSectorOptimize(), optionManage(), and statRoute().

|
inlinestatic |
return initial orthodromic cap from origin to destination, no givry correction
Definition at line 108 of file inline.h.
References DEG_TO_RAD, and RAD_TO_DEG.
Referenced by optionManage().

|
inlinestatic |
return orthodromic distance in nautical miles from origin to destination
Definition at line 147 of file inline.h.
References CLAMP, DEG_TO_RAD, and RAD_TO_DEG.
Referenced by allCompetitors(), buildNextIsochrone(), checkArrival(), fClosest(), goalP(), logReport(), nearestPort(), optionManage(), orthoFindInterPoint(), routing(), simpleGoalP(), and statRoute().

|
inlinestatic |
return orthodomic distance in nautical miles from origin to destinationi, Haversine formula time consuming
Definition at line 161 of file inline.h.
References DEG_TO_RAD, and RAD_TO_DEG.
Referenced by optionManage().

|
inlinestatic |
Compute the intermediate point on the great circle from P1 to P2.
This function returns the point Pr (latR, lonR) lying on the orthodromic (great-circle) route from P1 (lat1, lon1) to P2 (lat2, lon2), at a distance d_nm (nautical miles) from P1.
Latitudes and longitudes are in degrees. Distance d_nm is in nautical miles.
The result (latR, lonR) is given in degrees.
Edge cases:
Definition at line 343 of file inline.h.
References DEG_TO_RAD, lonCanonize(), orthoDist(), and RAD_TO_DEG.
