title: how to draw Hexagon Using CGMutablePathRef in ios?
body: <p>I want to draw a Hexagon, and this is my code</p>
  
  <pre><code>int mgX = penThickness * 6;
  int mgY = penThickness * 2;
  
  CGPoint st = CGPointMake(MIN(startingPt.x, endingPt.x), 
                          MIN(startingPt.y, endingPt.y));
  CGPoint et = CGPointMake(MAX(startingPt.x, endingPt.x), 
                          MAX(startingPt.y, endingPt.y));
  
  CGRect outsideRect = CGRectMake(st.x,st.y, MAX(mgX, et.x-st.x), 
                          MAX(mgY, et.y-st.y));
  CGRect insideRect  = CGRectInset(outsideRect, outsideRect.size.width * 0.40f, 
                          outsideRect.size.height * 0.30f);
  
  
  CGPathMoveToPoint(pathRef, nil, CGRectGetMinX(outsideRect), 
                          CGRectGetMinY(outsideRect));
  //0
  CGPathAddLineToPoint(pathRef, nil, CGRectGetMaxX(insideRect), 
                          CGRectGetMinY(outsideRect));
  //1
  CGPathAddLineToPoint(pathRef, nil, CGRectGetMaxX(outsideRect), 
                          CGRectGetMidY(insideRect));
  //2
  CGPathAddLineToPoint(pathRef, nil, CGRectGetMaxX(insideRect), 
                          CGRectGetMaxY(outsideRect));
  //3
  CGPathAddLineToPoint(pathRef, nil, CGRectGetMinX(outsideRect), 
                          CGRectGetMaxY(outsideRect));
  //las line
   CGPathAddLineToPoint(pathRef, nil, CGRectGetMidX(outsideRect), 
                          CGRectGetMidY(outsideRect));
  </code></pre>
  
  <p>Anybody please help me.</p>