mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpiutil] Add angle normalization method
This commit is contained in:
committed by
Peter Johnson
parent
399684a58f
commit
af588adce5
@@ -0,0 +1,22 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package edu.wpi.first.wpiutil.math;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class MathUtilTest {
|
||||
@Test
|
||||
void testAngleNormalize() {
|
||||
assertEquals(MathUtil.normalizeAngle(5 * Math.PI), Math.PI);
|
||||
assertEquals(MathUtil.normalizeAngle(-5 * Math.PI), Math.PI);
|
||||
assertEquals(MathUtil.normalizeAngle(Math.PI / 2), Math.PI / 2);
|
||||
assertEquals(MathUtil.normalizeAngle(-Math.PI / 2), -Math.PI / 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user