-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2 API - 2D Primitive Shapes #96
Comments
There is also...
Is this another shape? |
The SVG 2 basic shapes.... Mathematically, these shape elements are equivalent to a ‘path’ element that would construct the same shape. The basic shapes may be stroked, filled and used as clip paths. 10.2. The ‘rect’ element SVG parameters...
|
Nice list !
|
I’m not even sure quadrangle is necessary. It’s just a more general form of a 4 sided polygon that allows angles other than 90 degrees. We really have to decide what basic shapes to provide. Comparing the current API to other standards/applications should help. @danmarshall may have a few suggestions about this, but I think maker.js is SVG based. |
Rounding of corners is really important but we might want to generalize the API. Instead of rounded* functions, we have a operation... would be a challenging function. roundCorners
|
it would be nice, but generic operations to round corners is near impossible to do (or at least very very hard : ie topology): how do you decide WHICH corner to round etc ? |
Great discussion guys! BTW Maker.js isn't SVG based, it is completely abstract from any format other than its own JSON schema :) I would omit triangle and quadrangle and just go with polygon, with a series of points. Are you still considering having the "point to point" API? Functions such as "lineTo", and "bezierTo" which you can use to create a shape. To get rounded corners on any polygon, we can do some computation on a polyline, and apply fillets, similar to what Maker.js does: https://maker.js.org/docs/working-with-chains/#Chain%20fillet |
@danmarshall Thanks for joining... should be fun. I adjusted the list, separating the ‘geometry’ objects out. FYI, segment is new, as that class does not exist today (the current lines are really unbounded never ending lines) Path is one of the discussion points. I like this class as it has a set of arc functions to produce points. But it needs to be integrated better with line and polygon. |
DXF 2D Entities
|
I am a great fan of the 100% declarative way Maker.js uses for creating paths, bezier etc , I REALLY dislike the imperative "lineTo", and "bezierTo" :) |
I will take a look. Wondering if polyline should be part of the API for storage. It seems to me that the new caching could use another API to make things more efficient. We want a superior 2D API as well as 3D. |
I think there are some additional requirements for paths. (a) Directed traversal, noting circularity Paths need to have direction, and it should be easy to find the next step in the path without transforming it into a graph. So combination of { ordered sequence of points, circular } seems reasonable. (b) Inside and outside edges. Paths need to have a notional inside and outside edge (e.g., following the CCW convention, the right side of the path is outside, and the left side is inside). This property needs to be kept for open paths as well as closed paths, so that things like toolpath routing can be accommodated. (e.g., running a milling bit alongside a path so as to produce an edge on the path, likewise for laser cutting). (c) Conversion to and from shape2 while preserving holes. (d) Conversion of shape3 to shape2s to paths to shape2s to the original shape3 should also be supported. Note that (c) is supported already by (a) and (b), but may require some additional care in shape2 to avoid the current vertex collision issue in getOutlinePaths(). Note that (d) precludes the use of arcs in paths, since they won't survive the round-trip. This requires arc approximation by short path segments. This results in three primitive forms -- path, shape2, shape3 -- from which all other shapes can be produced. |
These concerns have been addressed as part of V2, so closing this issue. |
Discussion about V2 API for 2D shapes.
Geometries (point / polygon based)
Geometry Generation
Shapes
API Declarations
API Aliases
The text was updated successfully, but these errors were encountered: