How to use quickhull3d - 1 common examples

To help you get started, we’ve selected a few quickhull3d examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cruise-automation / webviz / packages / webviz-core / src / panels / ThreeDimensionalViz / commands / LinedConvexHulls.js View on Github external
.map((line) => {
      // Make sure all points are in vec3 format and unique.
      const points = uniqBy(
        line.points.map((point) => (shouldConvert(point) ? pointToVec3(point) : point)),
        ([x, y, z]) => `${x}:${y}:${z}`
      );
      // We need a minimum of 4 points to do the convex hull algorithm.
      if (points.length < 4) {
        return null;
      }
      // Try to run hulling on the face indices. If there is an error, discard the result.
      let faceIndices;
      try {
        faceIndices = qh(points);
      } catch (error) {
        console.error(error);
        return null;
      }

      // From the point indices of each face, find the points and flatmap to get the points of the triangles.
      const trianglePoints = flatMap(faceIndices, ([index1, index2, index3]) => {
        return [points[index1], points[index2], points[index3]];
      });
      const convertedColor = typeof line.color.r === "number" ? line.color : vec4ToRGBA(line.color);
      return {
        pose: line.pose,
        scale: line.scale,
        color: convertedColor,
        points: trianglePoints,
        originalMarker: line.originalMarker,

quickhull3d

A quickhull implementation for 3d points

MIT
Latest version published 2 years ago

Package Health Score

49 / 100
Full package analysis

Popular quickhull3d functions