123456789101112131415161718192021222324252627 |
-
-
-
- public class NormalizeAngle {
- private Integer newAngle;
- public Integer normalizeValueUsingModulo(Integer angle){
- // reduce the angle
- newAngle = angle % 360;
-
- // force into the minimum absolute value residue class, so that -180 < angle <= 180
- if (newAngle > 360) {
- newAngle -= 360; }
- else if(newAngle < 0) {newAngle += 360;}
-
- return newAngle;
- }
-
- public Integer normalizeValueUsingFloorMod(Integer integer){
- newAngle = Math.floorMod(integer, 360);
- return newAngle;
- }
-
- public static void main(String[] args){
-
- }
- }
|