zalo / CascadeStudio

A Full Live-Scripted CAD Kernel in the Browser
https://zalo.github.io/CascadeStudio/
MIT License
1.03k stars 129 forks source link

Intersection() docs say keepObects can be a [boolean, boolean] but that doesn't appear to be the case #130

Open DanTup opened 2 years ago

DanTup commented 2 years ago

The text description here says keepObjects can be a [boolean, boolean], but the type signature says boolean?:

Screenshot 2022-01-15 at 18 27 00

Trying to pass a list fails:

Screenshot 2022-01-15 at 18 27 56

I'm not sure if the docs or implementation are wrong though.

raydeleu commented 1 year ago

If you look at the code, there is only the option to keep objects or not:

for (let i = 0; i < objectsToIntersect.length; i++) {
    if (!keepObjects) { sceneShapes = Remove(sceneShapes, objectsToIntersect[i]); }
  }

If keepObjects is not true, all objects used to intersect are removed from the scene. There is no option to keep some of the objects, it is all or nothing. So I guess it is a mistake in the documentation.