// Converts an angle to an equivalent angle within the range with the given center. // The range will always be 360 degrees in size. public Angle MoveIntoInterval(Angle centerOfTheInterval) { IntervalFloat interval = IntervalFloat.FromCenterRadius( centerOfTheInterval.GetDegrees(), 180.0f); degrees = UtilPeriodic.MoveIntoInterval(degrees, interval); return(this); }
// Makes the oscillator progress through time by a given amount // and then returns its amplitude at the new time. public float SampleAmplitude(float deltaTime) { progress += deltaTime * speed; /* * while (progress > Angle.TWO_PI) * { * progress -= UtilCircle.TWO_PI; * } * while (progress < 0.0f) * { * progress += UtilCircle.TWO_PI; * } */ progress = UtilPeriodic.MoveIntoInterval(progress, Angle.INTERVAL_UNSIGNED_RADIANS); return(magnitude * waveform(progress)); }
// Converts an angle to an equivalent angle within the [0, 360) range. public Angle MoveIntoUnsignedInterval() { degrees = UtilPeriodic.MoveIntoInterval(degrees, INTERVAL_UNSIGNED_DEGREES); return(this); }
// Returns the signed degree measure of the angle. public float GetDegreesSigned() { return(UtilPeriodic.MoveIntoInterval(degrees, INTERVAL_SIGNED_DEGREES)); }