Open pixelzoom opened 11 years ago
See details in https://github.com/phetsims/kite/issues/20
Also necessary for more advanced BAM 3D edge cases, and for WebGL work.
Another request for this feature. In ph-scale, I have all kinds of odd shapes that I need to draw. They would be trivial with CAG. They are going to take more time without CAG, and will require copying more code from kite (eg, rounded corners).
Another need for this feature today, in sun.ComboBox. Request to add a rectangle behind the arrow button, which would have square corners on left end, round corners on right end.
Another need for this feature today in pH Scale, yet another rounded rectangle combined with another shape. I'm getting good at using Shape.arc.
Removing the "high priority" label, because it's not.
This would be very helpful in Capacitor Lab, shapes in that sim were mostly put together using CAG. It is not critical though, I can still redraw shapes using arcs and z layer ordering.
I've implemented the large bulk of cases for CAG (referenced some commits towards https://github.com/phetsims/kite/issues/20). shapeUnion
, shapeDifference
, shapeIntersection
and shapeXor
(methods on Shape
) are implemented. getArea
and similar functions came for free.
Some outlines of the general CAG process exist in https://github.com/phetsims/kite/issues/20, but this issue is more suited towards the subset that is actually completed and should be reviewed.
For review, I'd recommend:
getOverlaps
method on the type (including any associated helper methods) and getSignedAreaFragment
segment method.Definitely let me know where documentation can be improved (anything that's confusing). Thanks!
Assigned to @jessegreenberg for review.
I will need to implement the curvature-based discrimination of half-edges when sorting incident edges to vertices. CLB has a case with a line and arc with the same tangent.
Implemented the curvature-based method described above.
Additional things added (which could benefit from review):
shape.serialize()
to JSON, then Shape.deserialize( json )
to create an equivalent shape with exact numerical precision).Shape.union
, Shape.intersection
and Shape.xor
that apply to an array of shapes.segment.intersection( ray )
.Extra credit: Try creating two shapes whose union either isn't correct, or asserts out!
This could be used immediately in graphing-lines.