On Mon, Apr 20, 2020 at 09:43:58AM +0100, nop head wrote:
> The STL has to be perfect for OpenSCAD to accept it. No degenerate > triangles and no self intersections. > > I think the CGAL errors are 100% right about the mesh passed to it. I.e. no > false positives but because OpenSCAD snaps everything to a grid it can't > have very close vertices or snapping them will cause degenerate triangles > and self intersections. I would think that a pass through the list-of-triangles looking for the zero-area triangles is easy... There is this cross-product-vector that would normally give you a normal. If that becomes zero, you have a zero-area triangle: The points are on one line. To repair: If two points are the same, remove this triangle. Done. Otherwise they are on a single line. call the points p1, p2, p3. Find alpha such that p3 = p1 + alpha (p2-p1); If 0 < alpha < 1, p3 is the middle point. If alpha < 0, p1 is the middle point. If alpha > 1, p2 is the middle point . Now... look for triangles that include p1, p2, and p3. You should find two that include the middle point. Delete one and adjust the other to use both outer points. There is also a triangle that includes just the outer two points. That one can be left alone. If the source file to an STL import is invalid, I find it excusable not to "fix" broken input files. But once openscad snaps-to-grid and CAUSES these problems it would be very much appropriate to attempt to fix such issues. Just my humble opinion..... Roger. > On Mon, 20 Apr 2020 at 05:34, guaranteed_interwoven <[hidden email]> > wrote: > > > Thank you! I installed angelcad and it worked perfectly. > > > > I am 100% happy with an STL repair tool. > > > > Thank you everyone for your help here! > > > > > > > > -- > > Sent from: http://forum.openscad.org/ > > > > _______________________________________________ > > OpenSCAD mailing list > > [hidden email] > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- ** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** The plan was simple, like my brother-in-law Phil. But unlike Phil, this plan just might work. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I created a PR that fixed the degenerate triangles. OpenSCAD already removes the single point ones but I added removing the needles and darts with the edge flipping. Problem is the snapping also creates self intersection just as often I don't know an easy way of fixing those. On Mon, 20 Apr 2020 at 11:36, Rogier Wolff <[hidden email]> wrote: On Mon, Apr 20, 2020 at 09:43:58AM +0100, nop head wrote: _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
On Mon, Apr 20, 2020 at 11:39:51AM +0100, nop head wrote:
> I created a PR that fixed the degenerate triangles. OpenSCAD > already removes the single point ones but I added removing the needles and > darts with the edge flipping. Problem is the snapping also creates self > intersection just as often I don't know an easy way of fixing those. I've been thinking about it a bit between hitting send on the below email and now... You'd have to find the vector representation of the intersection line between the two planes of the two triangles. Then, for the each three edges of one of the triangles again find the alpha like below, and if you find any alpha 0<alpha<1, then the intersection between the planes happens inside the triangle: the intersection line crosses one edge (it'll intersect with precisely two edges). Now you've FOUND the self-intersection.... I haven't figured out yet what to do next.... This "check for self-intersection" however is much more expensive than the degenerate triangles check: The natural way to do it will be quadratic: check every triangle against every other. A heuristic would be to create "bins" for voxels and then put each triangle in those bins that it could touch. If your voxels are fine enough so that you don't get too many triangles in each voxel, that would significantly reduce the number of checks when there are lots and lots of triangles. (similarly you don't want the voxels too small: Then you get lots of triangles that touch many voxels.) Roger. > On Mon, 20 Apr 2020 at 11:36, Rogier Wolff <[hidden email]> wrote: > > Otherwise they are on a single line. > > call the points p1, p2, p3. > > > > Find alpha such that p3 = p1 + alpha (p2-p1); > > If 0 < alpha < 1, p3 is the middle point. > > If alpha < 0, p1 is the middle point. > > If alpha > 1, p2 is the middle point . -- ** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** The plan was simple, like my brother-in-law Phil. But unlike Phil, this plan just might work. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |