Open
Description
Expected Behavior
With five convex 3D points, geom3.fromPointsConvex() calling quickhull() should return pentagon.
Actual Behavior
Only 4 of the 5 points are part of response (right, with eps=0).
With eps=1e-10 moving one point out of plane a bit (left) all 5 vertices are in response.
With eps=1e-15 moving one point out of plane a bit (middle) only 4 of 5 points are part of response.
Steps to Reproduce the Problem
- open below code in jscad.app
const jscad = require('@jscad/modeling')
const { geom3 } = jscad.geometries
const { hull } = jscad.hulls
const { sphere } = jscad.primitives
const { translate } = jscad.transforms
function fromPointsConvex(listofpoints) {
return hull([geom3.create(),
geom3.fromPoints(listofpoints.map((p) => [p,p,p]))])
}
const eps = [1e-10, 1e-15, 0]
function e(ep,i) {
pts = [[-8,1,0],[-7+ep,4,0],[-6,5,-2],[-7,0,-4],[-8,0,-1]]
g = /*geom3.*/fromPointsConvex(pts)
console.log(JSON.stringify(g))
return translate([0,-6*i,0],
[g,
pts.map((p)=>translate(p,sphere({radius: 0.1})))])
}
function main() {
return eps.map((ep,i)=>e(ep,i))
}
module.exports={main}
This is not a problem specific to geom3.fromPointsConvex().
Above implementation based on hull() shows same behavior.
So it is quickhull() problem for all 3D points in same plane.
Specifications
- Version: latest modelling with new geom.fromPointsConvex()
- Platform: ubuntu 22.04
- Environment: firefox
Metadata
Metadata
Assignees
Labels
No labels