-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added mythical math class for custom math functions
- Loading branch information
1 parent
6b30a62
commit a02bec3
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
|
||
} |