public class

MathCalc

extends Object
java.lang.Object
   ↳ com.mapsted.positioning.MathCalc

Summary

Public Constructors
MathCalc()
Public Methods
static int argMax(ArrayList<Double> arrayList)
static int argMin(ArrayList<Double> arrayList)
static double average(List<Double> array)
Calcalate the average of a list of numbers.
static float averageF(List<Float> array)
static Mercator centroid(MercatorVector boundary)
static double distFromPointToLineSegment(Mercator pt0, Mercator l1, Mercator l2)
static double distance(IMercator A, IMercator B)
Calculate the distance between two points.
static Double distanceToCurrentUserPosition(IMercator point, CoreApi coreApi)
Calculate the distance between the current user's position to the point.
static float distanceWithFloorPenalty(CoreApi coreApi, IMercatorZone locA, IMercatorZone locB)
Returns approximate distance between two locations, roughly taking into account floor changes
static Float distanceWithFloorPenaltyFromUser(CoreApi coreApi, IMercatorZone loc)
static MinMax getMinMax(ArrayList<Double> arrayList)
Gets the minimum and maximum value from an array list.
static List<Mercator> lineIntersectCircle(LineEqn lineEqn, IMercator circlePt, float r)
Finds the point(s) of intersection between a circle and a line
static List<Mercator> lineIntersectCircle(IMercator pt1, IMercator pt2, IMercator circlePt, float r)
Finds the point(s) of intersection between a circle and a line
static Mercator lineIntersectCircleFarthestFromPt1(IMercator pt1, IMercator pt2, IMercator circlePt, float r)
Finds the point of intersection between a circle and a line.
static Mercator lineIntersection(LineEqn line1, LineEqn line2)
static LineEqn linearFit(IMercator p0, IMercator p1)
static double[] matrixTimesVector(double[][] M, double[] X)
static float[] matrixTimesVector(float[][] M, float[] X)
static double max(ArrayList<Double> arrayList)
Finds the maximum value from a list.
static double min(ArrayList<Double> arrayList)
Finds the minimum value from an array of numbers.
static IdxVal minIdxVal(ArrayList<Double> arrayList)
static double mod(double x, double y)
static Mercator projPointOntoLine(Mercator pt0, LineEqn lineEqn)
static double rotationAngle(Mercator loc1, Mercator loc2)
Returns angle between two locations in radians clockwise from North
static List<Double> solveQuadraticEquation(double a, double b, double c)
static double sum(List<Double> array)
Calculate the sum of a list of numbers.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public MathCalc ()

Public Methods

public static int argMax (ArrayList<Double> arrayList)

public static int argMin (ArrayList<Double> arrayList)

public static double average (List<Double> array)

Calcalate the average of a list of numbers.

Parameters
array a list of numbers.
Returns
  • return the average value.

public static float averageF (List<Float> array)

public static Mercator centroid (MercatorVector boundary)

public static double distFromPointToLineSegment (Mercator pt0, Mercator l1, Mercator l2)

public static double distance (IMercator A, IMercator B)

Calculate the distance between two points.

Parameters
A one point in the map.
B another point in the map.
Returns
  • return the distance between two points.

public static Double distanceToCurrentUserPosition (IMercator point, CoreApi coreApi)

Calculate the distance between the current user's position to the point. It will return null if the current position is not yet set

Parameters
point a point in the map.
Returns
  • return the distance between the current user's position to the point in meters.

public static float distanceWithFloorPenalty (CoreApi coreApi, IMercatorZone locA, IMercatorZone locB)

Returns approximate distance between two locations, roughly taking into account floor changes

public static Float distanceWithFloorPenaltyFromUser (CoreApi coreApi, IMercatorZone loc)

public static MinMax getMinMax (ArrayList<Double> arrayList)

Gets the minimum and maximum value from an array list.

Parameters
arrayList The list where to do the search.
Returns
  • Returns the min an max within a MinMax object. See MinMax

public static List<Mercator> lineIntersectCircle (LineEqn lineEqn, IMercator circlePt, float r)

Finds the point(s) of intersection between a circle and a line

Parameters
lineEqn equation of the line
circlePt circle center point
r circle radius
Returns
  • returns point(s) of intersection

public static List<Mercator> lineIntersectCircle (IMercator pt1, IMercator pt2, IMercator circlePt, float r)

Finds the point(s) of intersection between a circle and a line

Parameters
pt1 line point 1
pt2 line point 2
circlePt circle center point
r circle radius
Returns
  • returns point(s) of intersection

public static Mercator lineIntersectCircleFarthestFromPt1 (IMercator pt1, IMercator pt2, IMercator circlePt, float r)

Finds the point of intersection between a circle and a line. Only returns one point, uses pt1 to disambiguate, if necessary

Parameters
pt1 line point 1 (will return point farthest from this one)
pt2 line point 2
circlePt circle center point
r circle radius
Returns
  • returns point of intersection furthest from pt1

public static Mercator lineIntersection (LineEqn line1, LineEqn line2)

public static LineEqn linearFit (IMercator p0, IMercator p1)

public static double[] matrixTimesVector (double[][] M, double[] X)

public static float[] matrixTimesVector (float[][] M, float[] X)

public static double max (ArrayList<Double> arrayList)

Finds the maximum value from a list.

Parameters
arrayList The list where to do the search.
Returns
  • Return the maximum value from the list.

public static double min (ArrayList<Double> arrayList)

Finds the minimum value from an array of numbers.

Parameters
arrayList The list where to do the search.
Returns
  • Return the minimum value from the list.

public static IdxVal minIdxVal (ArrayList<Double> arrayList)

public static double mod (double x, double y)

public static Mercator projPointOntoLine (Mercator pt0, LineEqn lineEqn)

public static double rotationAngle (Mercator loc1, Mercator loc2)

Returns angle between two locations in radians clockwise from North

Parameters
loc1 one point in the map
loc2 another point in the map

public static List<Double> solveQuadraticEquation (double a, double b, double c)

public static double sum (List<Double> array)

Calculate the sum of a list of numbers.

Parameters
array a list of numbers.
Returns
  • return total number added up.