Plotting Mutually-Occluding (Knit) Curves in 2D
Afficher commentaires plus anciens
I was browsing and doing cleanup earlier, and I came across this misplaced question-as-answer on a question about basic plotting of a sine function.

As it's misplaced, I didn't want to answer it in-place, but the more I thought about it, it really did seem like a pretty good question. Considering the upvotes, I'm not the only one. I decided I would repost it as a proper question so that I could take a stab at answering it. It's normally slow on the weekend, so I figured I'd leave this as a bit of a challenge to anyone who wants to play along with what is otherwise a frivolous endeavor.
The requirements are loose.
- There is no strict definition of the interlocking curves. Any method which strikes at a similar shape is fine.
- The individual curves should have significant width -- that prevents some minor simplifications.
- The curves should have different colors for sake of clarity.
- Result can be done in-figure or as an image.
- Number of curves and loops should be adjustable.
The way I see it, there are a few inroads to an answer.
- Using plot3() to actually knit the curves together and then view in 2D
- Using nonflat patch objects in 3D to do similar
- Using polyshape or other 2D geometry tools that I'm unfamiliar with
- Directly compositing an image using masks like some kind of maniac
Using plot3() seems like the simple approach, but linewidth scaling is relative. Using patch() objects is appealing. That would allow the linewidth to be fixed, and it would also allow for the lines to have an additional border color. Off the top of my head, idk a neat way to calculate the vertex coordinates from the coordinates of a centerline curve (minkowski sum?). The idea of strictly operating with plane geometry sounds like the supreme challenge.
I'll add a couple of answers, but I know well enough that if anyone cares to contribute that someone else probably has a better way of approaching the problem.
Réponses (2)
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






