compas-dev / compas_occ

COMPAS wrapper for the Python bindings of OCC
http://compas.dev/compas_occ/
MIT License
15 stars 7 forks source link

Unexpected Brep trimming behavior #25

Open chenkasirer opened 4 months ago

chenkasirer commented 4 months ago

When trimming Brep using brep.trimmed() getting an unexpected result compared to Rhino. Specifically, the portion of the brep that is cut away is the one at the opposite direction of the plane's normal. In Rhino, the portion at the direction of the normal is cut.

To Reproduce

  from compas.geometry import Box, Line, Plane, Brep, Point, Vector
  brep = Brep.from_box(Box(xsize=2, ysize=0.1, zsize=0.2))
  plane = Plane(point=Point(x=0.5, y=0.0, z=0.0), normal=Vector(x=0.923, y=-0.382, z=0.0) * -1.0)
  result = brep.trimmed(plane)

  viewer = Viewer(rendermode="ghosted")
  # viewer.add(brep)
  viewer.add(result)
  viewer.add(plane)
  viewer.add(Line(plane.point, plane.point + plane.normal))
  viewer.show()

Expected behavior

I would expect the the portion trimmed away is always where the plane's normal is pointing and documented it accordingly in the RhinoBrep implementation.

However, if this is not the desired maybe we can discuss and agree on a consistent convention?

Screenshots

image

Desktop (please complete the following information):

chenkasirer commented 3 months ago

I think this should be the opposite: https://github.com/compas-dev/compas_occ/blob/d310651376849bb3615d78cef81c8a965ffd4514/src/compas_occ/brep/brep.py#L1451-L1453

as it was before: https://github.com/compas-dev/compas_occ/commit/e3ee66c9ea957ff270e27375394071da50d286a9

tomvanmele commented 3 months ago

should be solved now. will release new version soon...