# Center-Coordinates and Rotation of a Triangle

Hello,

i´m using the Contour Node to track fixed 3 IR-LEDs.
Together they build a triangle. Can someone help
me to get X- & Y-Coordinates as well as the rotation?

We need it for our bachelor project: www.chemieraum.com

First we tried to use fiducials but now we try this
way. Tracking an Input Device with 3 IR-LEDs on the
bottom.

regards
Thomas

Contour Check vvvv.v4p (26.9 kB)

uuuhm… trigonometry?

the patch uses a regular triangle, with it you can only get an incremental rotation, because you cant find out which corner is which one. but even this is non trivial…
some hints: to get the center of some points add the coordinates component wise together and divide by the amount of points, e.g.:

(x1 + x2 + x3)/3 = xCenter
(y1 + y2 + y3)/3 = yCenter

the Mean (Spectral) node can do this easily.
then for the rotation i would sebtract the corners from each other to get the vectors that describe the edges. but this can get very complex, because you have to find the right order of the edges, which means you have to compare results with results from the last frames.
Points2Vector (2d) will give you rotation angles of vectors.

Hello tonfilm,

getting coordinates sounds easy… but the thing with the rotation could be complex.

What do you think about having another shape or using just two dots or more? But then I have the same problem again. I have to find out which point is on top.

Maybe I try another isosceles triangle instead of an equilateral triangle. What do you think?

Thomas

how many devices will be there? and is it important to get the absolute rotation of an input device?

Fortunately we have only one device on a table. First we tried Fiducials but it´s hard to get the right IR-light for table. Putting IR-LEDS directly in our input device is a much more easier and cheaper solution. We need the same output data like we would get from the FreeFrameFiducialTracker . X & Y Coordinates + Rotation…

After having the coordinates of the center point I just need one of the dots which is rotating around the middle while the whole input device could be moving. If i had isocles triangle I could define the highest point as the “rotation” point. Could I?

I attached a new version of my node…

I just need a solution where it will be recognized where is the middle and which one of these 3 blobs is on top so that vvvv can build up a link via Points2Vector(2) and gives me the rotation of the 3 LEDs.

I think i have to check all 3 distances between the points. After that i compared the values with each other to find out which point is the most distant. This will by my point which will be compared to the center point so i can get the angle.

But how will i get this done?

Contour Check vvvv_3.v4p (31.9 kB)
Contour Check vvvv_5_.v4p (44.1 kB)

yes, now with that setup you can just get the angle of the short edge of the triangle, it is a good as any other angle of a fixed line in the triangle.
due to the one sharp edge in the triangle the center is displaced, you can either compensate this by mounting the LEDs displaced on the input device, or you find a formula to calc the circumcenter of the triangle…

Contour Check vvvv_5_1.v4p (46.2 kB)

Finally i get the result that i wanted with some help from mr benefit. Just check the vvvv file… To tonfilm: Thanks for your help.