public IEnumerable<VertexData> GetVertexIter()
{
// go to the start
if (UseStartEndLimit)
{
//---------------------------------------------------------
VertexData vertexData = new VertexData();
vertexData.command = VertexCmd.MoveTo;
vertexData.x = startX;
vertexData.y = startY;
yield return vertexData;
//---------------------------------------------------------
double angle = startAngle;
vertexData.command = VertexCmd.LineTo;
//calculate nsteps
int n = 0;
while (n < calculateNSteps - 1)
{
angle += flatenDeltaAngle;
vertexData.x = originX + Math.Cos(angle) * radiusX;
vertexData.y = originY + Math.Sin(angle) * radiusY;
yield return vertexData;
n++;
}
//while ((angle < endAngle - flatenDeltaAngle / 4) == (((int)ArcDirection.CounterClockWise) == 1))
//{
// angle += flatenDeltaAngle;
// vertexData.x = originX + Math.Cos(angle) * radiusX;
// vertexData.y = originY + Math.Sin(angle) * radiusY;
// yield return vertexData;
//}
//---------------------------------------------------------
vertexData.x = endX;
vertexData.y = endY;
yield return vertexData;
vertexData.command = VertexCmd.Stop;
yield return vertexData;
}
else
{
VertexData vertexData = new VertexData();
vertexData.command = VertexCmd.MoveTo;
vertexData.x = originX + Math.Cos(startAngle) * radiusX;
vertexData.y = originY + Math.Sin(startAngle) * radiusY;
yield return vertexData;
//---------------------------------------------------------
double angle = startAngle;
vertexData.command = VertexCmd.LineTo;
while ((angle < endAngle - flatenDeltaAngle / 4) == (((int)ArcDirection.CounterClockWise) == 1))
{
angle += flatenDeltaAngle;
vertexData.x = originX + Math.Cos(angle) * radiusX;
vertexData.y = originY + Math.Sin(angle) * radiusY;
yield return vertexData;
}
//---------------------------------------------------------
vertexData.x = originX + Math.Cos(endAngle) * radiusX;
vertexData.y = originY + Math.Sin(endAngle) * radiusY;
yield return vertexData;
vertexData.command = VertexCmd.Stop;
yield return vertexData;
}
}
IEnumerable <VertexData> GetVertexIter() { currentProcessingArc.UseStartEndLimit = true; currentProcessingArc.Init(bounds.Left + leftBottomRadius.x, bounds.Bottom + leftBottomRadius.y, leftBottomRadius.x, leftBottomRadius.y, Math.PI, Math.PI + Math.PI * 0.5); currentProcessingArc.SetStartEndLimit(bounds.Left, bounds.Bottom + leftBottomRadius.y, bounds.Left + leftBottomRadius.x, bounds.Bottom); foreach (VertexData vertexData in currentProcessingArc.GetVertexIter()) { if (VertexHelper.IsEmpty(vertexData.command)) { break; } yield return(vertexData); } currentProcessingArc.Init(bounds.Right - rightBottomRadius.x, bounds.Bottom + rightBottomRadius.y, rightBottomRadius.x, rightBottomRadius.y, Math.PI + Math.PI * 0.5, 0.0); currentProcessingArc.SetStartEndLimit(bounds.Right - rightBottomRadius.x, bounds.Bottom, bounds.Right, bounds.Bottom + rightBottomRadius.y); foreach (VertexData vertexData in currentProcessingArc.GetVertexIter()) { if (VertexHelper.IsMoveTo(vertexData.command)) { // skip the initial moveto continue; } if (VertexHelper.IsEmpty(vertexData.command)) { break; } yield return(vertexData); } currentProcessingArc.Init(bounds.Right - rightTopRadius.x, bounds.Top - rightTopRadius.y, rightTopRadius.x, rightTopRadius.y, 0.0, Math.PI * 0.5); currentProcessingArc.SetStartEndLimit(bounds.Right, bounds.Top - rightTopRadius.y, bounds.Right - rightTopRadius.x, bounds.Top); foreach (VertexData vertexData in currentProcessingArc.GetVertexIter()) { if (VertexHelper.IsMoveTo(vertexData.command)) { // skip the initial moveto continue; } if (VertexHelper.IsEmpty(vertexData.command)) { break; } yield return(vertexData); } currentProcessingArc.Init(bounds.Left + leftTopRadius.x, bounds.Top - leftTopRadius.y, leftTopRadius.x, leftTopRadius.y, Math.PI * 0.5, Math.PI); currentProcessingArc.SetStartEndLimit(bounds.Left - leftTopRadius.x, bounds.Top, bounds.Left, bounds.Top - leftTopRadius.y); foreach (VertexData vertexData in currentProcessingArc.GetVertexIter()) { switch (vertexData.command) { case VertexCmd.MoveTo: continue; case VertexCmd.NoMore: break; default: yield return(vertexData); break; } } yield return(new VertexData(VertexCmd.Close, (int)EndVertexOrientation.CCW, 0)); yield return(new VertexData(VertexCmd.NoMore)); }