Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Given this definition I think you almost never really want the parallel curve though (at least in computer graphics). Its behavior on the inside of corners is degenerate and not what one is looking for in almost any scenario involving curves.

So while the authors work is certainly impressive, I would keep looking for a more useful definition and implementation of 'curve alongside another curve' than that of the 'parallel curve' (as mathematically defined in the linked Wikipedia article) before using this.



(Speaking as someone who likes model trains.) You need parallel curves to design railroad tracks. Its behavior inside corners is degenerate because in the degenerate case there's no possible way you could make a train turn a corner that tight! You need to take a larger radius for your turns if you don't want your train to end up all crashed in a mess. :-P

Here's a nice example of a model railroad track plan: https://www.scarm.info/layouts/track_plans.php?gallery=10;0

There's software to help with designing these plans, which I guess must use parallel curves under the hood.


> There's software to help with designing these plans, which I guess must use parallel curves under the hood.

Siemens PLM / D-Cubed PGM component is one example of such software.

It's used for the offset function in the sketcher in Siemens PLM own NX/SolidEdge and also in SolidWorks.

> PGM automatically generates valid 2D offset profiles on points, lines, circles, ellipses, splines, general parametric curves, and offset curves.

> Gaps that arise between adjacent edges in an offset loop are automatically capped using a choice of capping techniques. Offset edges that shrink to zero length/radius, and any intersecting geometry is automatically trimmed, including self-intersecting offsets, offsets ellipses, and splines.

https://www.plm.automation.siemens.com/global/en/products/pl...

Disclaimer worked on the predecessor of that code as D-Cubed from 1995-2000.

As a side note, historically, in the Cambridge (UK) school of 3D mechanical CAD, BRep modeling (Parasolid, Acis) the approach to offset (aka parallel) surfaces (and later offset curves with the PGM) has been procedural - thus an offset surface is a pointer to an underlying surface plus a signed offset value. Accordingly, there would be no conversion to Cubic Béziers - all the modelling operations would be made to work with the procedural offset directly. Pretty much all exotic geometry had to be procedural to meet accuracy requirements - that is before the introduction of "Tolerant modeling" in Parasolid around 1992. So, for example, a Rolling ball blend (ie. a constant radius fillet) surface was procedural and had pointers to offset surfaces, which were also procedural. The advantage was accuracy, but the disadvantage was poor performance.


I'm not sure "degeneracy" is the best way to think about this. If the curvature exceeds the inverse of the offset distance, you get a cusp, and in general you need to think about how to deal with those. In some cases, that will be boolean path operations (stay tuned for an update on those!). But I'm not convinced there's any shortcut where you can avoid dealing with these cases altogether.


Ralph, I presume you have seen this, but just in case… it seems like it would be something of interest to you: https://www.youtube.com/watch?v=bZbuKOxH71o


That makes sense, I have already edited my comment to say specifically computer graphics since posting since I realized it could have very useful applications in physical modeling, or other scenarios where you specifically care about the constant distance metric, like you mention.


Nice, makes sense. I don't know much about computer graphics. What are some examples where you'd use translated curves? Are you referring to stuff like modeling strands of hair, and you'd make them using translations of a template strand's curve? Or what kind of problems do you typically face?

Is there some kind of "compromise" option that uses parallel curves where possible but falls back to translated curve segments when there's a degeneracy? (If that would be useful at all - I have no idea)


> Given this definition I think you almost never really want the parallel curve though (at least in computer graphics).

Fonts want this a lot.

It helps more to think about this in terms of a closed curve. If you have an arbitrary closed cubic curve, what does it mean to make it "bigger", "smaller", "thicker", "thinner", etc. For example, a blob sticking out eventually needs to get "flattened" as you shrink the curve.

A lot of the problem with 2D graphics currently is simply that we don't have good underpinning theory and, especially, definitions like we do for 3D graphics. If you don't even agree on what things mean, you can't generate a theory for how to do them.


Actually, this seems rather important for computer graphics if you want to transform vector-defined strokes into vector-defined closed polygons (outlines). See: https://youtu.be/F2oSR0Oh25c?t=70

For "corners" on non-smooth curves usually there's some kind of way to resolve the degenerate (or rather, undefined) behavior. Usually this would be something like a stroke-cap property.


The venerable and ridculously full-featured QPainter has a QPen with both a line cap style and a pen join style, documention of the latter: https://doc.qt.io/qt-6/qt.html#PenJoinStyle-enum

The two have to be different: a cap is a fixed piece of geometry, a join style calculates geometry based on the segments it joins.


Yeah, the paper made me wonder how the typical modern graphics library even draws stroked béziers. Surely, when the line weight is greater than 1, you have essentially two parallel béziers you are filling in order to rasterize a fat stroke.


You don't need to represent them as curves, though. Yes, turning the parallel curve of a bezier into a smooth curve is difficult, but turning it into a sequence of line segments is pretty easy, and something you can do at whatever level of resolution you want.


I’d be interested to hear what you propose as useful alternatives, or why you say you almost never want the parallel curve…

Others pointed out stroking, and in graphics stroking isn’t just common, it’s ubiquitous and you’re using it right now, because fonts are stroked as are lots of your browser features (I can see stroked rounded edge on my comment edit box, in addition to strokes on vector based SVG icons sprinkled on my screen). Most/all paint and drawing apps have stroked paths, etc., like Photoshop & Illustrator. All the online “whiteboards” use stroked paths. These are all offset curves or parallel curves according to the above definition. 3d graphics uses offset curves too for hair rendering, rigging & simulation, just as one example.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: