compas icon indicating copy to clipboard operation
compas copied to clipboard

Plane.is_parallel wrong result as given in the documentation

Open petrasvestartas opened this issue 1 year ago • 2 comments
trafficstars

Describe the bug In the documentation of the example code. The result after running the method is False (latest compas2 from github.)

image image

This method: https://github.com/compas-dev/compas/blob/main/src/compas/geometry/plane.py#L354

I think, instead of this: return abs(self.normal.dot(other.normal)) == 1 - tol it has to be: return abs(self.frame.zaxis.dot(frame.zaxis)) >= 1 - tol

To Reproduce

    plane1 = Plane.worldXY()
    plane2 = Plane([1.0, 1.0, 1.0], [0.0, 0.0, 1.0])
    result = plane1.is_parallel(plane2)
    print(result)

prints False

Expected behavior prints True

Screenshots None

Desktop (please complete the following information):

  • OS: [e.g. iOS] - Win
  • Python version [e.g. 2.7] - 3.11.6
  • Python package manager - conda

petrasvestartas avatar Dec 18 '23 08:12 petrasvestartas

yes, the implementation is indeed wrong. will fix... thanks!

tomvanmele avatar Dec 18 '23 10:12 tomvanmele

will change to abs(self.normal.dot(other.normal)) - 1 < tol

tomvanmele avatar Dec 18 '23 10:12 tomvanmele

@tomvanmele I think you've addressed this in the compas.tolerance refactor?

jf--- avatar Apr 08 '24 19:04 jf---

yes indeed

tomvanmele avatar Apr 08 '24 19:04 tomvanmele