Open hrj opened 11 months ago
@hrj thanks for the nice example. hopefully, we can sort out the issues, and get you moving again.
i tried the example, and the results definitely change when setting diameter to 50 and 51. i then added a short circuit, returning the 2D objects, and found out that the cbc() function may have some issues with the calculations. Can you double check?
Thanks for looking @z3dev
I can't notice any error in the cdc function. Those thin rectangles which are getting truncated abnormally are just a simple array of rectangles. The union of those with the other set of polygons (lfChopped) is somehow converting them into unclosed polygons.
Since all polygons are being created through primitives or through boolean operations, I don't think there can be any error in the supplied code, unless I am misusing the API in some way. For example, if I am using union
in an unexpected way. But since the code works for a different diameter, I don't think that would be a suspect.
@hrj strange things are happening with the intersect(), so i changed the code a little to...
cut = subtract(square({size: 10 * radius}), rectangle({ size: chopSize, center: [rb2 + pb4, -rb2-pb4] }))
const lfChopped = subtract(
union(lf), cut
)
return [verticals, lfChopped]
@z3dev Thanks, that workaround works :) I am unblocked for now.
Expected Behavior
The rectangular slits should retain their shape.
Actual Behavior
The vertices in some of the slits merge, creating triangles instead of rectangular slits.
Steps to Reproduce the Problem
Open the attached file in online editor V 2.6.5. jsCadError2.txt
Changing the diameter to 51 will remove the bug.
Specifications