deriveRange method
Derive a AngleRange from this one by applying one or more transforms.
Rotation: move the range by rotate
degrees
Scale: grow or shrink the range about its center by a scale
factor
Reverse: flip the direction by exchanging the start and end angles
Implementation
AngleRange deriveRange({double? rotate, double? scale, bool? reverse}) {
var start = q1;
var end = q2;
if (reverse != null && reverse) {
final temp = q1;
start = end;
end = temp;
}
if (scale != null) {
final delta = (end - start) * (scale / 2.0) as Angle;
start = centerValue - delta as Angle;
end = centerValue + delta as Angle;
}
if (rotate != null) {
final newCenter = centerValue + rotate as Angle;
final delta = (end - start) / 2.0 as Angle;
start = newCenter - delta as Angle;
end = newCenter + delta as Angle;
}
return AngleRange(start, end);
}