4
$\begingroup$

Suppose I have a mesh or a simple curve consisting of four (or some more) points.

Now I want to scale them inward with constant distance to the edges.

This works fine (with a little effort) under some circumstances.

But when the scaling reaches a certain level, the points start to protrude into each other. This is especially noticeable with curves that consist of several points, or that do not contain straight lines, as well as points that are close together.

My goal would be the following (simplified sketched):

enter image description here

On the left is the starting point, in the middle a scaling with constant strength, and on the right the result I would like to have as soon as the distance is a little higher.

Clearly, the inner curve in this example would then have to consist of only three points instead of four, which is absolutely OK.

Only how do I get to this result in the first place?


The solution here helped me, but causes the points to protrude into each other from a certain curvature or thickness:
Solving Uneven Profile Curve Thickness with Mesh Extrusions?

This solution is also not uninteresting, but much too computational in this case:
How to displace a curve without introducing artifacts at tight turns?

I am looking for a simple mathematical solution for a relatively simple shape on the X/Y plane (Geometry Nodes only!)

$\endgroup$
6
  • $\begingroup$ ...And no, I really don't have any idea about it this time and I don't answer my question myself this time ;-) $\endgroup$
    – quellenform
    Jun 8, 2022 at 18:05
  • $\begingroup$ I could imagin mathematical solutions - but I have no clue, how you could create a mathematical solution in geometry nodes for this task without beeing less computational, than the solution, that you linked ;-) $\endgroup$ Jun 8, 2022 at 18:38
  • $\begingroup$ @AndréZmuda I would be already happy if the solution does not include Geometry Proximity or similar, but works ;-) $\endgroup$
    – quellenform
    Jun 8, 2022 at 18:55
  • $\begingroup$ i just wonder who wrote that answer WITH proximity node.... :D $\endgroup$
    – Chris
    Jun 8, 2022 at 19:04
  • 1
    $\begingroup$ @quellenform , I will think about it. Just realized, that it starts getting complicated, when three ore more neighbouring displacement vectors intersect each other. - Could be difficult to realize without while-loops. $\endgroup$ Jun 8, 2022 at 19:15

2 Answers 2

4
$\begingroup$

You could try breaking this one.. it Mitres a 2D Mesh-Line to a given width:

enter image description here

It:

  • Converts one branch to curve, so radius can be set
  • Extrudes 2D mesh vertically, to get edge angle
  • Wrangles indices, and tranfers edge-angle from extrusion edge to curve point
  • Does trig on the edge angle to get mitre-joint length (curve radius)
  • Converts the curve back to a mesh

enter image description here

$\endgroup$
4
  • $\begingroup$ Thanks @RobinBetts, this is fantastic and an extremely good solution! I would say that this currently solves the task in the best and most performant way and this is exactly the kind of thing I wanted to achieve! However, unfortunately it doesn't work in all cases (I know, I'm nitpicking). For example, if the inward scaling exceeds a certain value, the overlapping of the edges again creates rather strange shapes. Actually exactly what I wanted to avoid somehow... $\endgroup$
    – quellenform
    Jun 12, 2022 at 10:47
  • 1
    $\begingroup$ @quellenform Yup .. I didn't read you up carefully enough before jumping in with something I'd been using anyway. I could delete this answer but I thought it might be a decent start to a solution. Maybe you or I can amend it. I'll get to it when I can. $\endgroup$
    – Robin Betts
    Jun 12, 2022 at 10:51
  • 1
    $\begingroup$ No, please leave the answer here! I find it solves a large part of the task extremely well and is certainly very helpful (for me and for others)! $\endgroup$
    – quellenform
    Jun 12, 2022 at 10:55
  • 1
    $\begingroup$ @quellenform Haven't forgotten this one... or thought of a clean method, yet.. $\endgroup$
    – Robin Betts
    Jun 13, 2022 at 14:53
4
$\begingroup$

result

As already mentioned in the comments, I don't consider this solution to be less computational and probably even not less compuationally intensive. But hopefully it makes you happy, as it does not include any Geometry Proximity ;-)

The general idea is, to build up the inset of quads, create the union, triangulate it and then remove all inner vertices.

Depending on the shape of the polygon, the inset may result in geometry outside of the polygon. Thus I implemented the Point-in-Polygon algorithm according to Weiler, Kevin (1994), "An Incremental Angle Point in Polygon Test", in Heckbert, Paul S. (ed.), Graphics Gems IV, San Diego, CA, USA: Academic Press Professional, Inc., pp. 16–23, ISBN 0-12-336155-9. Applying this to all points leads to a complexity of O(n²) where n is the number of points of the polygon. I use this for removing the original polygon from the inset as well.

In some cases I got some artifacts inside the polygon near the outline of the polygon. This is, why I remove points with less than 2 neighbouring vertices at the end. I did not test the solution with many different shapes. So I don't know, if it will work in every case.

$\endgroup$
2
  • $\begingroup$ Kudos, This is a brilliant approach to the subject! I'm working on it myself, and would not be able to come up with something like that. I'm very excited to see how you develop this further! It does contain a Mesh Boolean (which should make things slow) but at least no Geometry Proximity ;-) $\endgroup$
    – quellenform
    Jun 10, 2022 at 16:46
  • 1
    $\begingroup$ @quellenform , it's the same vice versa: I saw many of your solutions, that would never have come to my mind. Different backgrounds/experiences just lead to different ideas. This is, what makes life interesting ;-) -- I updated the solution. Unfortunately I only found a computationally intensive solution for removing those artifacts. And it is not as robust, as I would have liked it to be. $\endgroup$ Jun 12, 2022 at 8:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .