Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created July 13, 2011 14:47
Show Gist options
  • Save assertchris/1080435 to your computer and use it in GitHub Desktop.
Save assertchris/1080435 to your computer and use it in GitHub Desktop.
Objective-c flipclock shape geometry
/*
* x1
* a-----------------------b
* r1/ \
* p c
* | |
* | l g |
* | / \ r2/ \ |y1
* | m k h f |
* | | | y3| | |
* o__n j_____________i e__d
* x2
* y2
* _____________________________
*/
float x1 = 100.0 * 2;
float x2 = 10.0 * 2;
float y1 = 50.0 * 2;
float y2 = 5.0 * 2;
float y3 = 5.0 * 2;
float r1 = 5.0 * 2;
float r2 = 3.0 * 2;
CGPoint a = CGPointMake(r1 * 2, 0.0);
CGPoint b = CGPointMake(x1 - (r1 * 2), 0);
CGPoint c = CGPointMake(x1, r1 * 2);
CGPoint d = CGPointMake(x1, y1 - (y2 / 2));
CGPoint e = CGPointMake(x1 - x2, y1 - (y2 / 2));
CGPoint f = CGPointMake(x1 - x2, y1 - (y2 / 2) - y3);
CGPoint g = CGPointMake(x1 - x2 - r2, y1 - (y2 / 2) - y3 - r2);
CGPoint h = CGPointMake(x1 - x2 - (r2 * 2), y1 - (y2 / 2) - y3);
CGPoint i = CGPointMake(x1 - x2 - (r2 * 2), y1 - (y2 / 2));
CGPoint j = CGPointMake(x2 + (r2 * 2), y1 - (y2 / 2));
CGPoint k = CGPointMake(x2 + (r2 * 2), y1 - (y2 / 2) - y3);
CGPoint l = CGPointMake(x2 + r2, y1 - (y2 / 2) - y3 - r2);
CGPoint m = CGPointMake(x2, y1 - (y2 / 2) - y3);
CGPoint n = CGPointMake(x2, y1 - (y2 / 2));
CGPoint o = CGPointMake(0, y1 - (y2 / 2));
CGPoint p = CGPointMake(0, r1 * 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment