<div dir="ltr">+1<br><div><br></div><div>It's quite hard to get a grasp over how to draw stuff so this sound like a step in the right direction.</div><div><br></div><div>Best,</div><div>Karl</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 22, 2019 at 6:32 PM <<a href="mailto:patrick.rein@hpi.uni-potsdam.de">patrick.rein@hpi.uni-potsdam.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi everyone,<br>
<br>
during some recent clean-up an issue with geometry objects came up. As a result the following idea came up which I thereby would like to put out for an initial discussion. <br>
<br>
In case we find that this might be useful, I would continue by implementing a first prototype of the package as a foundation of a more in-depth discussion later on.<br>
<br>
Bests<br>
Patrick<br>
<br>
# Squeak Change Proposal - Geometry Package <br>
<br>
## Why? <br>
Squeak implements basic geometry logic in too many different places. For example intersection of different kinds of geometric objects is implemented all over Morphic, ST80, Balloon, Graphics, and Etoys. Such extensive scattering across packages and classes impedes modularity, that is, readability and extensibility. An example for this recently came up when we discovered an issue with testing for graphical intersections between PolygonMorph and RectangleMorph. It was not possible to compute that overlapping area because the class Rectangle omits to provide an important method. A quick fix would entail unnecessary dependencies (here: Morphic -> Balloon) or duplicated code (see also <a href="http://bugs.squeak.org/view.php?id=7872" rel="noreferrer" target="_blank">http://bugs.squeak.org/view.php?id=7872</a>). Consequently, we might want to modularize the geometry objects and operations. As a side effect, dependent packages such as Morphic can be simplified a little bit (more).<br>
<br>
## Scope <br>
The proposed package should cover basic 2D geometric objects and their operations represented by the following classes:<br>
- Point <br>
- Line <br>
- LineSegment <br>
- Polygon <br>
- Rectangle (as an optimization as it could be represented as a special Polygon already) <br>
<br>
Most classes could simply be moved from their previous packages. Afterwards the interfaces would need to be made consistent with each other to allow interoperability of all geometry classes within the new package. <br>
<br>
### Affected classes:<br>
- All classes in ST80-Paths<br>
- LineSegement, Bezier2Segment, Bezier3Segment (Balloon-Geometry)<br>
- Rectangle, Quadrangle, Point (Graphics-Primitives)<br>
- LineIntersections, LineIntersectionSegment, LineIntersectionEvent (Etoys-Squeakland-Graphics-Tools-Intersection)<br>
<br>
## Open questions <br>
- Should this become a single new package or a subcategory in the Graphics package? <br>
- Should the package contain an Ellipses class? <br>
- Should we model curved line segments as BezierLineSegments, CurvedLineSegment, or Arc?<br>
<br>
## Risks <br>
- This would potentially deprecate the existing ST80 geometry classes (ST80-Paths)<br>
- Some of the new classes will cause name clashes with existing classes. For example Line is currently in ST-80 and represents a line segment, and the class LineSegment is a line segment but not in the geometric sense as it also incorporates arcs. Both names might then be used by new classes with different meanings. This might be mitigated by introducing a pre-/postfix for the names of the new classes.<br>
<br>
</blockquote></div>