New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@eturnity/eturnity_maths

Package Overview
Dependencies
Maintainers
5
Versions
429
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eturnity/eturnity_maths - npm Package Compare versions

Comparing version 6.32.0 to 6.33.0-qa.0

2

package.json
{
"name": "@eturnity/eturnity_maths",
"version": "6.32.0",
"version": "6.33.0-qa.0",
"author": "Eturnity Team",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -5,4 +5,62 @@ import {

export function lon2tile(lon,zoom) { return (Math.floor((lon+180)/360*Math.pow(2,zoom))); }
export function lat2tile(lat,zoom) { return (Math.floor((1-Math.log(Math.tan(lat*Math.PI/180) + 1/Math.cos(lat*Math.PI/180))/Math.PI)/2 *Math.pow(2,zoom))); }
export function tile2long(x,z) {
return (x/Math.pow(2,z)*360-180);
}
export function tile2lat(y,z) {
var n=Math.PI-2*Math.PI*y/Math.pow(2,z);
return (180/Math.PI*Math.atan(0.5*(Math.exp(n)-Math.exp(-n))));
}
export function latLngToTileXY(lat,lng,zoom){
const xTile = lon2tile(lng,zoom)
const yTile = lat2tile(lat,zoom)
return {
x:xTile,
y:yTile
}
}
export function tileXYZToLatLng(x,y,zoom){
const longitude=tile2long(x,zoom)
const latitude=tile2lat(y,zoom)
return {lat: latitude,lng: longitude};
}
export function distanceToDeltaLatLng(x, y, latitude) {
export function tileToCorners(x,y,zoom,lat,lng){
const tileAltitude=0
const tileLatLng=tileXYZToLatLng(x,y,zoom)
const deltaLat=tileLatLng.lat-lat
const deltaLng=tileLatLng.lng-lng
let { x:x_mm, y:y_mm }=deltaLatLngToDistance(deltaLat, deltaLng, lat)
let size=(earthRadius * 2000 * Math.PI / Math.pow(2.0, zoom))*Math.cos(lat*Math.PI/180)
let corner0={
x:x_mm,
y:y_mm,
z:tileAltitude
}
let corner1={
x:x_mm+size,
y:y_mm,
z:tileAltitude
}
let corner2={
x:x_mm+size,
y:y_mm-size,
z:tileAltitude
}
let corner3={
x:x_mm,
y:y_mm-size,
z:tileAltitude
}
return [
corner3,
corner0,
corner1,
corner2,
]
}
export function distanceToDeltaLatLng(x, y, latitude) {
//x,y,z in ENU coords

@@ -9,0 +67,0 @@ let lat = (180 / Math.PI) * (y / 1000) / earthRadius

@@ -24,3 +24,3 @@ import {

}
export function updateOutlineFromInclineDirection(incline, direction, outline,initialAverageHeight) {
export function updateOutlineFromInclineDirection(incline, direction, outline,initialAverageHeight,isRoofOnRoof = false) {
const newNormalVector = {}

@@ -33,3 +33,2 @@ newNormalVector.x =

let meanPoint = meanVector(outline)
let minAltitude=Math.min(...outline.map(p=>p.z))
meanPoint.z=initialAverageHeight

@@ -40,4 +39,12 @@ let newOutline = outline.map((p) => {

//if some points are with negative altitude, we offset the whole roof
const newMinAltitude = Math.min(...newOutline.map((p) => p.z))
let altitudeOffset=newMinAltitude-minAltitude
let altitudeOffset
let minAltitude=Math.min(...outline.map(p=>p.z))
let maxAltitude=Math.max(...outline.map(p=>p.z))
let newMinAltitude = Math.min(...newOutline.map((p) => p.z))
let newMaxAltitude = Math.max(...newOutline.map((p) => p.z))
if(isRoofOnRoof && maxAltitude!=0){
altitudeOffset=newMaxAltitude-maxAltitude
}else{
altitudeOffset=newMinAltitude-minAltitude
}
newOutline.forEach((p) => (p.z -= altitudeOffset))

@@ -44,0 +51,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc