# Minkowski distance

Anyone got an idea how to implement this into grasshopper ?

Itâ€™s already available in expressions. If you have two points x and y, you can compute the p-order Minkowski distance using the expression

``````MinkowskiDistance(x, y, p)
``````

If you want to do it for coordinates with a dimension other than 3, then youâ€™ll need some custom logic.

1 Like

Clipper has minkowski difference and sum for 2d polylines. Check food4rhino clipper.

What is the reason for you to use minkowski?

I donâ€™t think Minkowski distance has much to do with Minkowski difference, apart from being named after the same guy.
Incidentally, do you know if Clipper can also find no-fit polygons? (which is related to Minkowski sum, and could be useful for nesting)

Dear @DanielPiker,

Do you know very first steps how nesting works? (not including any further information about genetic algorithms)

I was playing around minkowski difference. But I simply do not understand what is the next step after you have more than 2 shapes nested.

In the image below I clearly understand that Minkowski difference (nfp - no fit polygon) (clipper library) helps to position a shape without collision. But once you do that, how you would position a 3rd element? How you would compute the next nfp to nest 3rd element? (I know that there many papers, but could you describe what is the simplest case to nest 3rd element?)

Hi Petras,

I havenâ€™t researched it a lot, but the nicest explanation of nesting Iâ€™ve seen was this one:

I just saw heâ€™s got a new project too:
https://deepnest.io/

3 Likes

I saw those threads and it is really nice that this algorithm is open to public.
However since it is based on javascript, I am trying to get the logic behind.

In the documentation for nesting multiple shapes it says that you need find valid positions between multiple no-fit-polygons. Is it always the case of cutting the nfps with rectangle boundary sheet and does the shape must always stay outside the nfp? If someone has any experience in this would be nice to hear explanation what are the first steps of nesting.

I think it means the lower left corner of the triangle B here has to lie outside the union of the 2 green polygons, and inside the red polygon.

do a voronoi variable diagram based on â€śpâ€ť value

Well â€¦ if you are interested I have some C# Minkowski freaky stuff: like this Minkowski sum on pairs of polylines (Google that):

2 Likes

Just tried Minkowski Difference to generate No-Fit-Polygon for packing:

13 Likes

This is awesome work Petras

1 Like

I wonder how many threads have this phrase posted by you. And how many of them actually got something shared from you. Youâ€™re acting like some of the Assoc. Professors in my University. All talk and brag, no share and teach. The ones I decided not to attend their lectures. At the end it didnâ€™t really matter, I got the same grades my colleagues that attended got.

No one denies your knowledge and skills, but itâ€™s all worthless, useless, bordering annoying, if you donâ€™t contribute to the improvement of the community. â€śLordâ€ť

I donâ€™t know, just a thought.

2 Likes

Some have: if they are interested AND if the content of the script is not internal.

But you got it wrongly (again): I have absolute no interest to expose any tour de force to anyone, But I do have some interest to implicitly â€śadviseâ€ť people who can read behind lines no matter if they start the walk or they are in the middle of it. By that I mean to state to them the obvious: the only way to survive in the contemporary practice of the future is coding. If some understand that â€¦ this is my contribution in this Forum. Because helping by solving some case with some way is one thing but outlining a secure way not to get fired (or be in high demand) â€¦ well â€¦ thatâ€™s another animal.

Have in mind that someone who starts walking the walk is far more prone to get the wrong orientation (and the easier it appears the easier to choose it). As usual when later one realises the mistake â€¦ itâ€™s always too late. In fact in real-life is always too late for anything â€¦ but thatâ€™s another story.

And contrary to what happens in the Academic world â€¦ time flies and NEVER goes back.

What lines? Between your text bragging about that what you have and videos bragging what YOU (your scripts) can do there are only pictures like the one above.

How are your non-educational videos, showing off what is possible with unknown scripts, helping the the ones that start to walk to find the right direction, exactly?

Most of your posts are with meaning - HAHA I CAN DO IT YOU CANâ€™T, YOUâ€™RE DUMB. Hence my comparison above with the professors. Iâ€™m not wrong at all.

1 Like