Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Optional Parameters
if (!isObject(options)) { throw new Error("options is invalid"); }
// Validation
if (!startPoint) { throw new Error("startPoint is required"); }
if (!midPoint) { throw new Error("midPoint is required"); }
if (!endPoint) { throw new Error("endPoint is required"); }
// Rename to shorter variables
const A = startPoint;
const O = midPoint;
const B = endPoint;
// Main
const azimuthAO = bearingToAzimuth((options.mercator !== true) ? bearing(A, O) : rhumbBearing(A, O));
const azimuthBO = bearingToAzimuth((options.mercator !== true) ? bearing(B, O) : rhumbBearing(B, O));
const angleAO = Math.abs(azimuthAO - azimuthBO);
// Explementary angle
if (options.explementary === true) { return 360 - angleAO; }
return angleAO;
}
} = {}): number {
// Optional Parameters
if (!isObject(options)) { throw new Error("options is invalid"); }
// Validation
if (!startPoint) { throw new Error("startPoint is required"); }
if (!midPoint) { throw new Error("midPoint is required"); }
if (!endPoint) { throw new Error("endPoint is required"); }
// Rename to shorter variables
const A = startPoint;
const O = midPoint;
const B = endPoint;
// Main
const azimuthAO = bearingToAzimuth((options.mercator !== true) ? bearing(A, O) : rhumbBearing(A, O));
const azimuthBO = bearingToAzimuth((options.mercator !== true) ? bearing(B, O) : rhumbBearing(B, O));
const angleAO = Math.abs(azimuthAO - azimuthBO);
// Explementary angle
if (options.explementary === true) { return 360 - angleAO; }
return angleAO;
}
function isParallel(segment1, segment2) {
var slope1 = bearingToAzimuth(rhumbBearing(segment1[0], segment1[1]));
var slope2 = bearingToAzimuth(rhumbBearing(segment2[0], segment2[1]));
return slope1 === slope2;
}
function isParallel(segment1, segment2) {
var slope1 = bearingToAzimuth(rhumbBearing(segment1[0], segment1[1]));
var slope2 = bearingToAzimuth(rhumbBearing(segment2[0], segment2[1]));
return slope1 === slope2;
}