Skip to content

Commit

Permalink
added mythical math class for custom math functions
Browse files Browse the repository at this point in the history
  • Loading branch information
2491NoMythic committed Nov 6, 2024
1 parent 6b30a62 commit a02bec3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/java/frc/robot/helpers/MythicalMath.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.helpers;

import edu.wpi.first.math.geometry.Pose3d;

/** Add your docs here. */
public class MythicalMath {
/**
* finds the absolute distance from the origin of any point on a 3d plane
* @param XfromOrigin x-coordinate of point
* @param YfromOrigin y-coordinate of point
* @param ZfromOrigin z-coordinate of point
* @return distance from origin of point
*/
public static double DistanceFromOrigin3d(double XfromOrigin, double YfromOrigin, double ZfromOrigin) {
double Distance2d = Math.sqrt(Math.pow(YfromOrigin, 2)+Math.pow(XfromOrigin, 2));
return Math.sqrt(Math.pow(Distance2d, 2)+Math.pow(ZfromOrigin, 2));
}

}

0 comments on commit a02bec3

Please sign in to comment.