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
The static ClippingPolygon.equals() method is typed wrong.
The parameters left and right should be typed as ClippingPolygon not Plane.
Reproduction steps
Create two ClippingPolygon
Try comparing them using ClippingPolygon.equals(left, right)
TypeScript will throw an error:
Argument of type 'ClippingPolygon' is not assignable to parameter of type 'Plane'.
Type 'ClippingPolygon' is missing the following properties from type 'Plane': normal, distance
The typing error looks uncontroversial for me, and I opened a PR at #12394 to fix this.
Broader questions:
Usually, classes that have a ClassName.equals function also have a ClassName.prototype.equals function that delegates to the first one. Should this be added here as well? (I'd be in favor of "yes")
Usually, for these ClassName.equals functions, both parameters are optional. There are very few exceptions to that, and Plane (which this equals function was copied-and-pasted from) is one of these few. For some others (like Spherical or OrientedBoundingBox), the parameters are optional, but not declared to be optional via the [brackets]. This should be made more consistent...
What is "equality"? 🙂
The last one refers to the fact that one could very reasonably expect the following to print true:
But it prints false, because it is comparing arrays via ===. I'd consider to 1. fix this, and 2. add an equalsEpsilon function, like it is done in similar classes...
What happened?
The
static ClippingPolygon.equals()
method is typed wrong.The parameters
left
andright
should be typed asClippingPolygon
notPlane
.Reproduction steps
Argument of type 'ClippingPolygon' is not assignable to parameter of type 'Plane'.
Type 'ClippingPolygon' is missing the following properties from type 'Plane': normal, distance
Sandcastle example
No response
Environment
Browser: -
CesiumJS Version: 1.124.0
Operating System: -
The text was updated successfully, but these errors were encountered: