You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is correct, but I think it deserves a comment, because, say, it matters if one wants to implement a proper isEmpty routine (which I didn't, and costed me several hours of debugging :-)
new Rectangle(10,10,20,20).intersect(new Rectangle(15,25,19,25))
gives a rectangle with the corner above the origin:
origin: Point
x: 15
y: 25
corner: Point
x: 19
y: 20
(the proper "is empty" test indeed is already in morphic.js !dirty.extent().gt(new Point(0, 0))
, just not in a dedicated routine)
Also note how a negative rectangle can be expanded to be positive (which again is correct but worth a comment, as the intuition might otherwise suggest that many operations including expansion should be "void" on an empty rectangle):
new Rectangle(10,10,20,20).intersect(new Rectangle(15,25,19,25)).expandBy(3).area() -> 10
The text was updated successfully, but these errors were encountered:
This is correct, but I think it deserves a comment, because, say, it matters if one wants to implement a proper isEmpty routine (which I didn't, and costed me several hours of debugging :-)
new Rectangle(10,10,20,20).intersect(new Rectangle(15,25,19,25))
gives a rectangle with the corner above the origin:
(the proper "is empty" test indeed is already in morphic.js
!dirty.extent().gt(new Point(0, 0))
, just not in a dedicated routine)
Also note how a negative rectangle can be expanded to be positive (which again is correct but worth a comment, as the intuition might otherwise suggest that many operations including expansion should be "void" on an empty rectangle):
new Rectangle(10,10,20,20).intersect(new Rectangle(15,25,19,25)).expandBy(3).area() -> 10
The text was updated successfully, but these errors were encountered: