Forum

Area and rotation from random set of points

Hello ,

you know guys how could i get the area and rotation from a random set of points , ?

hi i made little example as probably the question should have been "how to get area and rotation from irregular polygon by just knowing the points and binsize .

i guess is similar to what contour does get the area and rotation from points .

i found a site with a posible aproach for the area :

it is in spanish but you can understand by the pictures and animation in the atteched file i put the code into a plug and translated .
basicly It calculates the irregular polygon by split it in triangles and get the area of each of tehm and sum them all .

http://latecladeescape.com/algoritmos/1118-area-de-un-poligono-irregular-producto-en-cruz

I,d liek to know there is something already in vvvv nodes to make it or if this aproach is fine to continue , i,ll have to think how to make spreadble with binsize and find out how to convert to vvvv coordinate system .

about gettting teh rotation i have no clue .

atached also simulation patch .

Area and Rotation of an irregular Polygon.zip (22.6 kB)

triangulation is no problem, but i don’t understand what you mean by roation? if you have a random shape, how would you know which is 0 rotation and what is the actual rotation?

there is an open cv function called MinimumAreaRect (2d) that vux did- it’s in the addon pack.

with minimumarearect its hard to get a continous rotation. the result is jumping probably cause there is more than one solution

hi thanks for your replies ,
minimum area rec looks nice but yes for rotation seem too tricky , @ tonfilm my idea of rotation is that you set a 0 rotation of the polygon when first is created , that is why a pointed out contour as i thought it might be behaves like that when blob it is found 0 , or may be it gets bounds and determine rotation from there , not too sure exactly .

what i,m trying is to get the area knowing the points (blobs) and rotations since the polygons were created .

for better understanding:
the shape of the polygon will not change after the creation?

hi hrovac

yes ideally the shape may change , amount of points will be the same .

colorsound youre going to use this for multitouch rotation gesture right?

so amount of points can change… tracking and poeples behaviour is not so predicatble…

i would just add up the rotation around the points center incrementally and divide the increment by number of touching points. thats how i do it at the moment.

hi elek thanks for your suggestion ,
yes the idea is to use it for tracking purposes like multitouch , so group of blobs makes a polygon and if blob count changes then next polygon is like new reseted one , then get the whole relative area and rotation from it .

any more ideas ?

hi , ok for now i,ll try to make binsize plug with the first triangulation formula and for rotation i,ll use elektromeier trick .