title: Quartz 2D Path rotation
body: <p>I'm fairly new to Quartz 2D.</p>
  
  <p>Imagine the following scenario:</p>
  
  <p>You have a circle-shaped mini map view.
  I'm drawing triangle (the arc isn't important right now) on top of the map. This shape represents the visible area.</p>
  
  <p>I need to have the triangle shape rotate along the mini map as the user changes orientation.</p>
  
  <p>Currently this how the path is being drawn:</p>
  
  <pre><code>CGAffineTransform transform = CGAffineTransformMakeRotation(angleInRadians);
  
  CGPath visibleAreaPath = CGPathCreateMutable();
  
  CGPathMoveToPoint(visibleAreaPath, &amp;transform, miniMapCenter.x, miniMapCenter.y);
  CGPathAddLineToPoint(visibleAreaPath, &amp;transform, 18.0, 8.0);
  CGPathAddLineToPoint(visibleAreaPath, &amp;transform, 66.0, 8.0);
  
  CGPathCloseSubpath(visibleAreaPath);
  </code></pre>
  
  <p>I then draw the path using a CAShapeLayer like so:</p>
  
  <pre><code>CALayer *rootLayer = [visibleAreaView layer];
  
  visibleAreaShape = [CAShapeLayer layer];
  [visibleAreaShape setFillColor:[UIColor colorWithHue:0.584 saturation:0.8 brightness:0.9 alpha:0.6].CGColor];
  [visibleAreaShape setFillRule:kCAFillRuleNonZero];
  [visibleAreaShape setAnchorPoint:CGPointMake(0.5, 0.5)];
  [rootLayer addSublayer:visibleAreaShape];
  [visibleAreaShape setPath:visibleAreaPath];
  </code></pre>
  
  <p>The path is being rotated, but not based on a given origin.
  Keep in mind that setting the layer's anchor point doesn't help me since what I want is to rotate the path (ultimately I wouldn't even need to display it, since I will be using it to determine which points are visible on the mini map).</p>
  
  <p>Any ideas on how to accomplish this?
  Thank you.</p>