Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@mapbox/martini
Advanced tools
@mapbox/martini is a JavaScript library for generating adaptive meshes for terrain rendering. It is designed to work with digital elevation models (DEMs) and can create efficient, level-of-detail (LOD) meshes that are suitable for real-time rendering in 3D applications.
Generating a Terrain Mesh
This feature allows you to generate a terrain mesh from a digital elevation model (DEM). The code sample demonstrates how to create a Martini instance, initialize a terrain tile with elevation data, and generate a mesh with a specified error threshold.
const Martini = require('@mapbox/martini');
const DEM = new Float32Array([/* elevation data */]);
const tileSize = 256;
const martini = new Martini(tileSize + 1);
const terrain = martini.createTile(DEM);
const mesh = terrain.getMesh(10); // 10 is the error threshold
console.log(mesh);
Getting Terrain Errors
This feature allows you to retrieve the error values for each vertex in the terrain mesh. The code sample shows how to create a Martini instance, initialize a terrain tile with elevation data, and get the error values.
const Martini = require('@mapbox/martini');
const DEM = new Float32Array([/* elevation data */]);
const tileSize = 256;
const martini = new Martini(tileSize + 1);
const terrain = martini.createTile(DEM);
const errors = terrain.getErrors();
console.log(errors);
Simplifying a Mesh
This feature allows you to simplify an existing terrain mesh by increasing the error threshold. The code sample demonstrates how to generate an initial mesh and then create a simplified version of it by using a higher error threshold.
const Martini = require('@mapbox/martini');
const DEM = new Float32Array([/* elevation data */]);
const tileSize = 256;
const martini = new Martini(tileSize + 1);
const terrain = martini.createTile(DEM);
const mesh = terrain.getMesh(10); // initial mesh
const simplifiedMesh = terrain.getMesh(20); // simplified mesh with higher error threshold
console.log(simplifiedMesh);
three-geo is a library for generating 3D terrain meshes using Three.js and Mapbox. It provides higher-level abstractions for working with terrain data and integrates directly with Three.js for rendering. Compared to @mapbox/martini, three-geo offers more built-in functionality for rendering and visualization but may be less flexible for custom mesh generation.
MARTINI stands for Mapbox's Awesome Right-Triangulated Irregular Networks, Improved.
It's an experimental JavaScript library for real-time terrain mesh generation from height data. Given a (2k+1) × (2k+1) terrain grid, it generates a hierarchy of triangular meshes of varying level of detail in milliseconds. A work in progress.
See the algorithm in action and read more about how it works in this interactive Observable notebook.
Based on the paper "Right-Triangulated Irregular Networks" by Will Evans et. al. (1997).
// set up mesh generator for a certain 2^k+1 grid size
const martini = new Martini(257);
// generate RTIN hierarchy from terrain data (an array of size^2 length)
const tile = martini.createTile(terrain);
// get a mesh (vertices and triangles indices) for a 10m error
const mesh = tile.getMesh(10);
npm install @mapbox/martini
FAQs
A JavaScript library for real-time terrain mesh generation
The npm package @mapbox/martini receives a total of 187,616 weekly downloads. As such, @mapbox/martini popularity was classified as popular.
We found that @mapbox/martini demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.