added midpoint for triangle class

This commit is contained in:
2025-01-06 04:30:03 +03:00
parent 9a4fb67289
commit 42c84f2523
2 changed files with 8 additions and 1 deletions

View File

@@ -29,5 +29,8 @@ namespace omath
[[nodiscard]] [[nodiscard]]
Vector3 SideBVector() const; Vector3 SideBVector() const;
[[nodiscard]]
Vector3 MidPoint() const;
}; };
} }

View File

@@ -33,4 +33,8 @@ namespace omath
{ {
return m_vertex3 - m_vertex2; return m_vertex3 - m_vertex2;
} }
} Vector3 Triangle3d::MidPoint() const
{
return (m_vertex1 + m_vertex2 + m_vertex3) / 3;
}
} // namespace omath