2
\$\begingroup\$

I need to face an object from a central point directly through any one of many triangles which are faces on an icosphere whose position is centered on that point. Is there a way to get the center position of the triangle itself, even though its position is the position of the larger object of which it is a part?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Remember that a triangle has at least four different "centers", so we need to be more specific. Do you want the centroid? Presumably you tried simply averaging the vertex positions? Where did you run into trouble expressing this in your code? \$\endgroup\$
    – DMGregory
    Dec 31, 2020 at 4:22
  • \$\begingroup\$ Yes, I do in fact want the centroid. You'll have to forgive my public education; we never covered that. But then, when you say I could just average the vertices, it seems obvious enough that I probably should have thought of it. I was more looking for a property of a mesh, but I wasn't finding it in the docs. \$\endgroup\$
    – Truth
    Jan 7, 2021 at 15:47

1 Answer 1

1
\$\begingroup\$

There are actually tens of thousands of well defined triangle centers.

The centroid is always a safe and fast center, which is simply the sum of the 3 points which define the triangle, divided by 3 (or multiplied by 1/3rd, which is the faster operation)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .