public RadialController(MeshFilter meshFilter, RadialType type, bool isFolding) : base(meshFilter) { IsFolding = isFolding; _type = type; FillModels(); ProcessDirection(); _unfoldRadius = _type == RadialType.Inward? _unfoldDirection.Min:_unfoldDirection.Max; }
public static Point GetCenterPosition(RadialType type, Size finalSize, double minAngle, double maxAngle, SweepDirection sweepDir) { //get the quadrants of the limits int q1 = GetQuadrant(minAngle); int q2 = GetQuadrant(maxAngle); if (sweepDir == SweepDirection.Counterclockwise) { q1++; q2++; if (q1 > 4) q1 = 1; if (q2 > 4) q2 = 1; } else { //q2->q4 and q4->q2 if (q1 % 2 == 0) q1 = 6 - q1; if (q2 % 2 == 0) q2 = 6 - q2; } //calculate the difference int diff = q2 - q1; if (Math.Abs(diff) == 0) {//quarter possibility if (type == RadialType.Quadrant) { return GetCenterForQuadrant(q2, finalSize); } else if (type == RadialType.Semicircle) { if (q1 == 1 || q1 == 2) return new Point(finalSize.Width / 2, finalSize.Height); else return new Point(finalSize.Width / 2, 0); } else { //full circle return new Point(finalSize.Width / 2, finalSize.Height / 2); } } else if (Math.Abs(diff) == 1 || (Math.Abs(diff)==3 && (maxAngle-minAngle)<=180)) {//semicircle possibility if (type == RadialType.Quadrant || type == RadialType.Semicircle) { return GetCenterForSemicircle(q1, q2, finalSize); } else { //full circle return new Point(finalSize.Width / 2, finalSize.Height / 2); } } else { //full circle return new Point(finalSize.Width / 2, finalSize.Height / 2); } }
public static double GetRadius(RadialType type, Size finalSize, double minAngle, double maxAngle, SweepDirection sweepDir) { //get the quadrants of the limits int q1 = GetQuadrant(minAngle); int q2 = GetQuadrant(maxAngle); if (sweepDir == SweepDirection.Counterclockwise) { q1++; q2++; if (q1 > 4) { q1 = 1; } if (q2 > 4) { q2 = 1; } } else { //q2->q4 and q4->q2 if (q1 % 2 == 0) { q1 = 6 - q1; } if (q2 % 2 == 0) { q2 = 6 - q2; } } //calculate the difference int diff = q2 - q1; if (Math.Abs(diff) == 0) {//quarter possibility if (type == RadialType.Quadrant) { return(Math.Min(finalSize.Width, finalSize.Height)); } else if (type == RadialType.Semicircle) { return(finalSize.Height); } else {//full circle return(Math.Min(finalSize.Width / 2, finalSize.Height / 2)); } } else if (Math.Abs(diff) == 1 || (Math.Abs(diff) == 3 && (maxAngle - minAngle) <= 180)) {//semicircle possibility if (type == RadialType.Quadrant || type == RadialType.Semicircle) { return(GetRadiusForSemicircle(q1, q2, finalSize)); } else {//full circle return(Math.Min(finalSize.Width / 2, finalSize.Height / 2)); } } else {//full circle return(Math.Min(finalSize.Width / 2, finalSize.Height / 2)); } }