The center of any triangle is 2^-1/2 down a ray centered in any angle from that angle, where the length will be the mean of the two adjacent sides. From any angle, half the area will be on one side of it, as you can consider the opposite side the base and the fraction of the ray will be the fraction of the height. A similar triangle of 2^-1/2 height and base will have half the area. Once you have the centroid, translate the origin there and the radial positions of the points will have constant distances and rotated angles. This feels more like geometry than computer . . . .
Finding center of 2D triangle?
I've been given a struct for a 2D triangle with x and y coordinates, a rotation variable, and so on. From the point created by those x and y coordinates, I am supposed to draw a triangle around the point and rotate it appropriately using the rotation variable.
I'm familiar with drawing triangles in OpenGl with GL_TRIANGLES. My problem is somehow extracting the middle of a triangle and drawing the vertices around it.
edit: Yes, what I am looking for is the centroid.
Follow
1
Add comment
More
Report
1 Expert Answer
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.