
Research
lightning PyPI Package Compromised in Supply Chain Attack
Socket detected a malicious supply chain attack on PyPI package lightning versions 2.6.2 and 2.6.3, which execute credential-stealing malware on import.
polytope-closest-point
Advanced tools
Computes the closest point to a polytope in arbitrary dimensions
Computes the closest point in a convex polytope to a given point.
Using npm, type the following command into your shell:
npm install polytope-closest-point
Here is an example of how to find the closest point to a triangle in a mesh:
var mesh = require("bunny");
var result = new Array(3);
var sqr_distance = require("polytope-closest-point")(
mesh.cells[0],
mesh.positions,
[0,0,0],
result);
Which computes the closest point in the first facet of the mesh to the point [0,0,0], storing the resulting point in result and the squared distance in sqr_distance.
For more examples, see test/simple.js.
require("polytope-closest-point")(cell, positions, x[, result])Computes the closest point in a polytope to x, storing the result in result.
cell is a list of indices into a positions representing the vertices of the polytope.positions is an array of tuples representing the vertices of the polytopex is the point we are querying againstresult (optional) is the array to store the closest point in.Returns a float representing the squared Euclidean distance from x to the polytope. If no such point can be found, it returns Number.NaN
Notes: For polytopes with fewer than 4 vertices, the code uses hand optimized routines derived from WildMagick. For higher dimensions, it falls back to a general purpose quadratic programming solver that is ported from somewhat slower R/FORTRAN codes. If you are planning on using this code to do distance queries on meshed surfaces, it is recommend you triangulate all your polygons first.
Triangle/tetrahedra closest point code derived from WildMagick (c) David Eberly 1998-2012.
Other dimensions, (c) 2013 Mikola Lysenko
BOOST License.
FAQs
Computes the closest point to a polytope in arbitrary dimensions
The npm package polytope-closest-point receives a total of 14,792 weekly downloads. As such, polytope-closest-point popularity was classified as popular.
We found that polytope-closest-point demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket detected a malicious supply chain attack on PyPI package lightning versions 2.6.2 and 2.6.3, which execute credential-stealing malware on import.

Research
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.

Research
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.