scichart
Version:
Fast WebGL JavaScript Charting Library and Framework
28 lines (27 loc) • 948 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.geometryHelpers = void 0;
function calcArrowHeadParameters(tipX, tipY, angleRadian, headLength, headWidth, headDepth) {
var halfWidth = headWidth / 2;
var cosine = Math.cos(angleRadian);
var sine = Math.sin(angleRadian);
var baseX = tipX - headLength * cosine;
var baseY = tipY - headLength * sine;
var leftX = baseX + halfWidth * sine;
var leftY = baseY - halfWidth * cosine;
var rightX = baseX - halfWidth * sine;
var rightY = baseY + halfWidth * cosine;
var baseMidX = tipX - headDepth * cosine;
var baseMidY = tipY - headDepth * sine;
return {
baseMidX: baseMidX,
baseMidY: baseMidY,
leftX: leftX,
leftY: leftY,
rightX: rightX,
rightY: rightY
};
}
exports.geometryHelpers = {
calcArrowHeadParameters: calcArrowHeadParameters
};