MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / circle

Class circle

utilities/olcUTIL_Geometry2D.h:717–743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715
716 template<typename T>
717 struct circle
718 {
719 olc::v_2d<T> pos;
720 T radius = T(0);
721
722 inline circle(const olc::v_2d<T>& p = { T(0), T(0) }, const T r = T(0))
723 : pos(p), radius(r)
724 { }
725
726 // Get area of circle
727 inline constexpr T area() const
728 {
729 return T(pi) * radius * radius;
730 }
731
732 // Get circumference of circle
733 inline constexpr T perimeter() const
734 {
735 return T(2.0 * pi) * radius;
736 }
737
738 // Get circumference of circle
739 inline constexpr T circumference() const
740 {
741 return perimeter();
742 }
743 };
744
745
746 template<typename T>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected