Skip to content

Instantly share code, notes, and snippets.

@jamesktan
Created December 21, 2014 09:25
Show Gist options
  • Save jamesktan/820a6ee0f05cfda9a09c to your computer and use it in GitHub Desktop.
Save jamesktan/820a6ee0f05cfda9a09c to your computer and use it in GitHub Desktop.
Calculate Surface Area of Shape
CGPoint points[N];
CGFloat area = 0;
for (int i = 0; i < N; i++) {
area += (points[i].x * points[(i+1) % N].y - points[(i+1) % N].x * points[i].y)/2.0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment