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;
}
coordEach(feature, function (coord) {
var originalDistance = rhumbDistance(origin, coord);
var bearing = rhumbBearing(origin, coord);
var newDistance = originalDistance * factor;
var newCoord = getCoords(rhumbDestination(origin, newDistance, bearing));
coord[0] = newCoord[0];
coord[1] = newCoord[1];
if (coord.length === 3) coord[2] *= factor;
});
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;
}
coordEach(geojson, function (pointCoords) {
var initialAngle = rhumbBearing(pivot, pointCoords);
var finalAngle = initialAngle + angle;
var distance = rhumbDistance(pivot, pointCoords);
var newCoords = getCoords(rhumbDestination(pivot, distance, finalAngle));
pointCoords[0] = newCoords[0];
pointCoords[1] = newCoords[1];
});
return geojson;