Ask Your Question

How to separate the point2f to other variable?

asked 2015-09-30 03:03:54 -0500

zms gravatar image

Hello, I had obtained the centroid coordinate in terms of float and array, Point2f a = mc[0]; Point2f b = mc[1];

the next step for me is to get the angle between these two points. By looking at the example throughout the net, the point2f must be separated to x1,y1 and x2,y2 so I can calculate the atan for the angle.

THe problem here I could not manage to get the values inside mc[0] and mc[1] for x1,y1 and x2,y2.

what I had tried and failed is using this statement

float x1,x2,y1,y2; [x1,y1] = mc[0];

Anyone would help on this? Or is there any faster way to find the atan - angle for the two centroids coordinate I have obtained?

edit retag flag offensive close merge delete


@thdrksdfthmn sorry to make you surprise for the question :) . I'm quite a beginner person on this. Anyway, the solution above is correct. TQSM!! :)

zms gravatar imagezms ( 2015-10-01 02:14:16 -0500 )edit

No problem, so good luck learning!

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-10-01 05:12:02 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-09-30 03:46:14 -0500

thdrksdfthmn gravatar image

updated 2015-10-01 05:11:25 -0500

Point2f has 2 members: x and y, so you can just call them: a.x and a.y

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-09-30 03:03:54 -0500

Seen: 61 times

Last updated: Oct 01 '15