Open seylerius opened 3 years ago
Further investigation reveals that the BasicMesh may be generating wrong. I get the following results when I inspect the generation of the mesh in CIDER:
Class: thi.ng.geom.types.BasicMesh
Contents:
:vertices = #{ 0.0 -1.5668 -8.6965 2.7351 -12.0802 ... }
:faces = #{ [[-8.6965 3.1084 6.294]] [[6.2429 -12.0802 0.0]] [[-19.2099 -1.0464 2.7351]] [[6.2429 -12.0802 2.7351]] [[2.0882 -1.5668 6.294]] }
:fnormals = {}
The mesh is being generated by having the following sequence of faces passed in, using the form (g/into (bm/basic-mesh) faces)
, where faces
is defined as follows:
( ( [ 2.0882 -1.5668 6.294 ] [ -8.6965 3.1084 6.294 ] [ -19.2099 -1.0464 2.7351 ] [ 6.2429 -12.0802 2.7351 ] )
[ [ 2.0882 -1.5668 6.294 ] [ 2.0882 -1.5668 0.0 ] [ -8.6965 3.1084 0.0 ] [ -8.6965 3.1084 6.294 ] ]
[ [ -8.6965 3.1084 6.294 ] [ -8.6965 3.1084 0.0 ] [ -19.2099 -1.0464 0.0 ] [ -19.2099 -1.0464 2.7351 ] ]
[ [ -19.2099 -1.0464 2.7351 ] [ -19.2099 -1.0464 0.0 ] [ 6.2429 -12.0802 0.0 ] [ 6.2429 -12.0802 2.7351 ] ]
[ [ 6.2429 -12.0802 2.7351 ] [ 6.2429 -12.0802 0.0 ] [ 2.0882 -1.5668 0.0 ] [ 2.0882 -1.5668 6.294 ] ]
( [ 6.2429 -12.0802 0.0 ] [ -19.2099 -1.0464 0.0 ] [ -8.6965 3.1084 0.0 ] [ 2.0882 -1.5668 0.0 ] ) )
Okay, finally tested and found where the problem is. On line 18 of basicmesh.cljc
, where you define the parameters for add-face*
, you're excessively deconstructing the passed face.
After removing the extra sequence deconstruction around fverts
, the problem disappeared.
And of course after fixing that I get a stack overflow.
Hi @seylerius - I'm in the middle of a relocation and will take a while until I can look into this. In the meanwhile, please post a minimal example to reproduce your issue, thanks! 👍
When trying to convert a mesh (tested with either basic-mesh or gmesh) to a CSG node (using
csg/mesh->csg
) to compute the union of several nodes, I receive the following error.No implementation of method: :- of protocol: #'thi.ng.math.core/IMathOps found for class: java.lang.Double
. Further investigation shows that it's happening in theortho-normal
function, which is being used when computing the plane for each polygon. At first glance, this seems to be a reoccurrence of #40, which featured the same error with:+
instead. I've reproduced the stack trace below.