public IEnumerable <PointRadius> GetPathBetweenIndex(int i0, int i1) { var points = new List <PointRadius>(); points.Add(new PointRadius() { Point = new Vector3(Center.X, Center.Y, 0), Color = StartColor }); for (int i = i0 + 1; i < i1; i++) { var prev = (SLOTS + i - 1) % SLOTS; Vector3 p0; Vector3 p1; { var ray = s_rays[i]; var slot = m_slots[prev]; var x = ray.X * slot.Radius + Center.X; var y = ray.Y * slot.Radius + Center.Y; p0 = new Vector3(x, y, 0); } { var ray = s_rays[i]; var slot = m_slots[i]; var x = ray.X * slot.Radius + Center.X; var y = ray.Y * slot.Radius + Center.Y; p1 = new Vector3(x, y, 0); } if (p0 != p1) { points.Add(new PointRadius() { Point = p0, Color = Color4ub.Mix(StartColor, EndColor, (m_slots[prev].Radius / Radius)) }); points.Add(new PointRadius() { Point = p1, Color = Color4ub.Mix(StartColor, EndColor, (m_slots[i].Radius / Radius)) }); } else { points.Add(new PointRadius() { Point = p0, Color = Color4ub.Mix(StartColor, EndColor, (m_slots[prev].Radius / Radius)) }); } } return(points); }
public IEnumerable <PointRadius> GetPath() { var points = new List <PointRadius>(); points.Add(new PointRadius() { Point = new Vector3(Center.X, Center.Y, 0), Color = StartColor }); var i0 = 0; var i1 = SLOTS; if (Angle < PI_2) { i0 = (int)(Math.Floor(((StartAngle + PI_2) % PI_2) / SLOT_ANGLE)); i1 = (int)(Math.Ceiling(((StartAngle + Angle + PI_2) % PI_2) / SLOT_ANGLE)); } for (int i = i0; i < i1; i++) { var prev = (SLOTS + i - 1) % SLOTS; if (m_slots[i].Segment != m_slots[prev].Segment) { Vector3 p0; Vector3 p1; { var ray = s_rays[i]; var slot = m_slots[prev]; var x = ray.X * slot.Radius + Center.X; var y = ray.Y * slot.Radius + Center.Y; p0 = new Vector3(x, y, 0); } { var ray = s_rays[i]; var slot = m_slots[i]; var x = ray.X * slot.Radius + Center.X; var y = ray.Y * slot.Radius + Center.Y; p1 = new Vector3(x, y, 0); } if (p0 != p1) { points.Add(new PointRadius() { Point = p0, Color = Color4ub.Mix(StartColor, EndColor, (m_slots[prev].Radius / Radius)) }); points.Add(new PointRadius() { Point = p1, Color = Color4ub.Mix(StartColor, EndColor, (m_slots[i].Radius / Radius)) }); } else { points.Add(new PointRadius() { Point = p0, Color = Color4ub.Mix(StartColor, EndColor, (m_slots[prev].Radius / Radius)) }); } } } if (Angle >= PI_2) { points.Add(points[1]); } return(points); }