xtorcga
Version:
Xtor Compute Geometry Algorithm Libary 计算几何算法库
53 lines (52 loc) • 2.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cartographic = exports.wgs84OneOverRadiiSquared = exports.wgs84OneOverRadii = void 0;
var Math_1 = require("../../src/math/Math");
var Vec3_1 = require("../../src/math/Vec3");
exports.wgs84OneOverRadii = new Vec3_1.Vec3(1.0 / 6378137.0, 1.0 / 6378137.0, 1.0 / 6356752.3142451793);
exports.wgs84OneOverRadiiSquared = new Vec3_1.Vec3(1.0 / (6378137.0 * 6378137.0), 1.0 / (6378137.0 * 6378137.0), 1.0 / (6356752.3142451793 * 6356752.3142451793));
/**
* 地理坐标
*/
var Cartographic = /** @class */ (function () {
/**
* 单位都是弧度
* @param longitude 经度
* @param latitude 纬度
* @param height 海拔
*/
function Cartographic(longitude, latitude, height) {
if (longitude === void 0) { longitude = 0.0; }
if (latitude === void 0) { latitude = 0.0; }
if (height === void 0) { height = 0.0; }
this.longitude = longitude;
this.latitude = latitude;
this.height = height;
}
Cartographic.fromRadians = function (longitude, latitude, height, result) {
if (longitude === void 0) { longitude = 0.0; }
if (latitude === void 0) { latitude = 0.0; }
if (height === void 0) { height = 0.0; }
if (!result) {
return new Cartographic(longitude, latitude, height);
}
result.longitude = longitude;
result.latitude = latitude;
result.height = height;
return result;
};
Cartographic.fromDegrees = function (longitude, latitude, height, result) {
if (longitude === void 0) { longitude = 0.0; }
if (latitude === void 0) { latitude = 0.0; }
if (height === void 0) { height = 0.0; }
if (!result) {
return new Cartographic(longitude, latitude, height);
}
result.longitude = Math_1.toRadians(longitude);
result.latitude = Math_1.toRadians(latitude);
result.height = height;
return result;
};
return Cartographic;
}());
exports.Cartographic = Cartographic;