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
I am interested in having a Path class in cartocrow that captures SVG's <path>, Qt's QPainterPath, and ipe's Path.
Here I would like to discuss ways of implementing this.
The approach currently in my mind is the following.
We need a notion of a segment, say GSegment that is an abstract class or a typedef to std::variant (Segment is already used by CGAL for line segments). Line segments, Bézier curves, and circular arcs are in some sense an instance of a GSegment.
Then we would need a notion of a curve that consists of segments, say a Curve class. A Curve is simply a sequence of GSegments that is continuous (end and start point of consecutive segments coincide), and can be open or closed (may be implicit / detected automatically).
Lastly, we have a notion of a path, say a Path class, that consists of curves. A Path is a set of Curves.
Besides the above, other things that need to be done for this:
Add type alias for CGAL's Circular_arc_2.
Implement toCurve() method for polygons, polylines, circles, Bézier spline.
Implement toPath() method polygon with holes, and polygon set.
Implement Qt and ipe rendering of segments, curves, and paths.
The rendering could be refactored such that e.g. the renderer.draw(Polygon...) function implementation converts the polygon into a curve and draws the curve as these functions would need to be implemented anyway and this reduces redundancy.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am interested in having a Path class in cartocrow that captures SVG's <path>, Qt's QPainterPath, and ipe's Path.
Here I would like to discuss ways of implementing this.
The approach currently in my mind is the following.
We need a notion of a segment, say
GSegment
that is an abstract class or a typedef tostd::variant
(Segment
is already used by CGAL for line segments). Line segments, Bézier curves, and circular arcs are in some sense an instance of aGSegment
.Then we would need a notion of a curve that consists of segments, say a
Curve
class. ACurve
is simply a sequence ofGSegment
s that is continuous (end and start point of consecutive segments coincide), and can be open or closed (may be implicit / detected automatically).Lastly, we have a notion of a path, say a
Path
class, that consists of curves. APath
is a set ofCurve
s.Code skeleton sketch
Besides the above, other things that need to be done for this:
toCurve()
method for polygons, polylines, circles, Bézier spline.toPath()
method polygon with holes, and polygon set.renderer.draw(Polygon...)
function implementation converts the polygon into a curve and draws the curve as these functions would need to be implemented anyway and this reduces redundancy.Beta Was this translation helpful? Give feedback.
All reactions