Skip to content

Commit

Permalink
added midpoint for triangle class
Browse files Browse the repository at this point in the history
  • Loading branch information
orange-cpp committed Jan 6, 2025
1 parent 9a4fb67 commit 42c84f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/omath/Triangle3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ namespace omath

[[nodiscard]]
Vector3 SideBVector() const;

[[nodiscard]]
Vector3 MidPoint() const;
};
}
6 changes: 5 additions & 1 deletion source/Triangle3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ namespace omath
{
return m_vertex3 - m_vertex2;
}
}
Vector3 Triangle3d::MidPoint() const
{
return (m_vertex1 + m_vertex2 + m_vertex3) / 3;
}
} // namespace omath

0 comments on commit 42c84f2

Please sign in to comment.