diff --git a/src/main/java/swervelib/math/SwerveMath.java b/src/main/java/swervelib/math/SwerveMath.java index 8506b5b7..eb7de873 100644 --- a/src/main/java/swervelib/math/SwerveMath.java +++ b/src/main/java/swervelib/math/SwerveMath.java @@ -421,4 +421,16 @@ public static Translation2d cubeTranslation(Translation2d translation) { return new Translation2d(Math.pow(translation.getNorm(), 3), translation.getAngle()); } + + /** + * Scale the {@link Translation2d} Polar coordinate magnitude. + * + * @param translation {@link Translation2d} to use. + * @param scalar Multiplier for the Polar coordinate magnitude to use. + * @return {@link Translation2d} scaled by given magnitude scalar. + */ + public static Translation2d scaleTranslation(Translation2d translation, double scalar) + { + return new Translation2d(translation.getNorm() * scalar, translation.getAngle()); + } }