MCPcopy Index your code
hub / github.com/OmkarPathak/pygorithm / test_area

Method test_area

tests/test_geometry.py:716–731  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

714
715
716 def test_area(self):
717 # https://www.calculatorsoup.com/calculators/geometry-plane/polygon.php helpful for checking
718 poly = polygon2.Polygon2.from_regular(4, 1)
719 self.assertAlmostEqual(1, poly.area)
720
721 poly2 = polygon2.Polygon2.from_regular(4, 2)
722 self.assertAlmostEqual(4, poly2.area)
723
724 poly3 = polygon2.Polygon2.from_regular(8, 3.7)
725 self.assertAlmostEqual(66.1011673, poly3.area, msg=str(poly3))
726
727 poly4 = polygon2.Polygon2([ (0, 0), (1, 1), (2, 1) ])
728 self.assertAlmostEqual(0.5, poly4.area)
729
730 poly5 = polygon2.Polygon2([ (0, 0), (1, 1), (2, 1), (1, -0.25) ])
731 self.assertAlmostEqual(1.25, poly5.area)
732
733 def _proj_onto_axis_fuzzer(self, points, axis, expected):
734 for i in range(3):

Callers

nothing calls this directly

Calls 1

from_regularMethod · 0.80

Tested by

no test coverage detected