Skip to main content
eScholarship
Open Access Publications from the University of California

Unit 33 - Simple Algorithms II - Polygons

Abstract

This unit introduces a simple algorithm and extensions for performing several operations on polygons including area calculation, determining whether a point lies inside a polygon, and determining a polygon’s centroid location. For each operation the generalized case is described, strategy for solving the task explained, sample code given, and special cases noted.