Checking points inside a shape

Hello,
I’ve a set of points that constitute a polygon (flat shape, no z dimension), I need to animate the points that are inside the shape leaving the edges untouched, there is a node, or a way, to check and access which points of the polygon are inside the shape?
I’m using polygon(Ex9 2d) to build the geometry.
If the answer is bounds or something like that please explain me how, because I’ve already tried it with no success.
Thank you

hi ectrome,

there is a hittest polygon version , maybe handy at least to know which points are inside of your shape.

HitTest (2d Polygon).v4p (14.8 KB)

Thank you colorsound! I’ll give this a try as soon as I can

hello again,
HitTest polygon seems a good solution and the test patch is working almost as I need, problem is that in my actual patch I’m not using any transform node and it seems that HitTest rely a lot on this.
I’ve tried leaving the first pin empty but it doesn’t work, I’ve tried to feed it an empty transform node but it mess up my geometry. Then I gave it some of the vectors I’m working with but again, the geometry gets completely messed up.
There are other solutions without using transform nodes?

hi can you send example patch with your shapes so to see what is the problem ?

Hi, I created an example patch that works in the same way of mine.
The idea is to maintain the edges of the shape still, while moving the points inside of it

example_hittest.v4p (14.0 KB)

Hi,

not sure if i understood but i would try representing your shape with a polygon node as this is the one using the hittest example as the deluany seems more complex. Or forget about the hittest and try other solution. not sure.

I did the delaunay example because it works exactly how my shape is gonna work in the end, same kind of complexity.
I guess HitTest isn’t working for what I need.
Thank you anyway

Any other ideas from anyone else?

it doesn’t at all actually. in the example by colorsound if you disconnect the Transform from HitTest and Constant you’ll see the patch still to work.

please demonstrate this in a patch. if this is as you say it has to be fixed.

in your patch you’re using the HitTest node wrong. you cannot simply feed it a random point cloud. it relies on you feeding it points that make a polygon! also you connected the Delaunays Indices output to the HitTests Vertices Count input which does not make any sense.

in your initial post you say you have a “set of points that constitute a polygon” but then in your demo patch you’re using a RandomSpread which does not constitute a polygon. so i’m afraid there is still some information missing for us to be able to help you.

Ok, I see what I did wrong, it was the wrong example I’m sorry.
I re-made the previous patch by colorsound, with a polygon, there’s a single point in the middle of the geometry that should be detected, but is not.
I hope this is correct, if not I’m not really understanding what am I doing wrong

HitTest_ex_2.v4p (15.4 KB)

ok, it seems you’re confused about what a Polygon is. from wikipedia: a polygon is a plane figure that is bounded by a finite chain of straight line segments closing in a loop to form a closed polygonal chain or circuit.

in your example you take the mesh that draws the filled polygon, deconstruct it and take that spread of vertices and put it into the HitTest node. this won’t work, because that spread is now no longer a valid polygon, as it contains the point in the middle! so instead you have to give it the original spread of points you generate from the CircularSpread.

also you connect the spread of vertices to both the PointsXY and VerticesXY inputs. what is your thinking behind that?

see, the idea of the node is that VerticesXY and Vertices Count together describe the polygon and on the PointsXY input you give it those points that you wanna check, if they hit the polygon.

hope this helps you adapt your patch. let me know if you need more hints.

You can do texture based hit test with complex shapes, for that you can use pipet dx11

@joreg Oh I see, I’m confusing the fucking therms, I’m sorry.
I got confused by the names of the nodes I’m using.
I have a set of points that constitutes a set of polygonS created with polygon node into a mesh. I though I had A polygon, but what I have is a series of polygons into a mesh. Is it more clear now?
What I needed was checking which points of these polygons were inside the mesh and which constitutes the edge of the mesh, so here’s generated my confusion and not understanding how to use HitTest.
I was trying to use the same points to somehow self-check if they were in the shape, which didn’t makes any sense even when I first tried to use it. Now is clear.

Again, I’m sorry for the total misunderstanding.

Do I need to start another topic with a proper name or we continue on this one? I’ll try to strip down the original project to provide a proper example patch of my problem.

phew ok, this is what i now understand you’re looking for:

in words: you got a pointcloud and want to find its outermost points (ie, its convex hull). and then you want to split the points of the cloud into those that are part of the surrounding polygon and those that are inside it. right?

InnerPointsOfPointcloud.v4p (12.9 KB)

@joreg
Yes!
This is what I was looking for, totally forgot about convexhull node, next days I will test it out if it actually works with my setup
Thank you for the patience!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.