OpenJSCAD.org icon indicating copy to clipboard operation
OpenJSCAD.org copied to clipboard

Call to polyhedron() with inward change input content

Open gilboonet opened this issue 4 years ago • 1 comments

Expected Behavior

call to polyhedron with orientation: 'inward' doesn't change data (faces)

Actual Behavior

call to polyhedron with orientation: 'inward' changes data (faces)

Steps to Reproduce the Problem

run this

const { polyhedron } = require('@jscad/modeling').primitives
 
const main = () => {
const points = [ [10, 10, 0], [10, -10, 0], [-10, -10, 0], [-10, 10, 0], [0, 0, 10] ]
const faces = [ [0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4], [1, 0, 3], [2, 1, 3] ]

console.log(faces[0])
const myshape = polyhedron({points, faces, orientation: 'inward'})
console.log(faces[0])

return myshape
}

module.exports = { main }

Specifications

  • Version: web 2.5.0
  • Platform: Ubuntu 21.10 64 bits
  • Environment: firefox 95b12

gilboonet avatar Dec 08 '21 13:12 gilboonet

@gilboonet hmm... if orientation is changed to 'outward' then the faces of the polyhedron are inverted, and the display of the polygons change as well.

The orientation parameter was added because SCAD wants 'inward' facing polygons. Do not ask me why... it seems broken. The 'inward' orientation allows designs from SCAD to be imported into JSCAD without a lot of change. Changing the order of 500 faces would be very painful.

z3dev avatar May 03 '22 07:05 z3dev