@nestbotics/nct_frontend_common_components
Version:
A collection of reusable React components with theme management and styling utilities
31 lines (29 loc) • 858 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.worldToImage = exports.scaleCoordinates = exports.imageToCanvas = void 0;
// src/coordinateUtils.js
var worldToImage = exports.worldToImage = function worldToImage(x_w, y_w, x_origin, y_origin, resolution) {
var x_i = (x_w - x_origin) / resolution;
var y_i = (y_w - y_origin) / resolution;
return {
x_i: x_i,
y_i: y_i
};
};
var scaleCoordinates = exports.scaleCoordinates = function scaleCoordinates(x_i, y_i, scale) {
var x_i_scaled = x_i * scale;
var y_i_scaled = y_i * scale;
return {
x_i_scaled: x_i_scaled,
y_i_scaled: y_i_scaled
};
};
var imageToCanvas = exports.imageToCanvas = function imageToCanvas(x_i_scaled, y_i_scaled, imageHeight) {
var y_c = imageHeight - y_i_scaled;
return {
x_c: x_i_scaled,
y_c: y_c
};
};