Class RegularIndexer
java.lang.Object
org.hipparchus.analysis.interpolation.RegularIndexer
Helper for sampled data along a regular grid.
- Since:
- 4.1
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecoordinate(int index) Get coordinates corresponding to index.doublegetMax()Get the maximum coordinate.doublegetMin()Get the minimum coordinate.intgetN()Get the number of different coordinates.doublegetStep()Get the step size between two successive coordinates.intindex(double coordinate) Get index corresponding to coordinate.
-
Constructor Details
-
RegularIndexer
public RegularIndexer(double min, double max, int n) Simple constructor.- Parameters:
min- minimum valuemax- maximum valuen- number of points (including min and max)
-
-
Method Details
-
getMin
public double getMin()Get the minimum coordinate.- Returns:
- minimum coordinate
-
getMax
public double getMax()Get the maximum coordinate.- Returns:
- maximum coordinate
-
getN
public int getN()Get the number of different coordinates. -
getStep
public double getStep()Get the step size between two successive coordinates.- Returns:
- step size between two successive coordinates
-
index
public int index(double coordinate) Get index corresponding to coordinate.The method rounds to the closest index, so it may be called with
coordinateslightly overshooting nominal range. If called withcoordinatebetweengetMin()-getStep()/2 andgetMin()+getStep()/2, it will return 0. If called withcoordinatebetweengetMax()-getStep()/2 andgetMax()+getStep()/2, it will returngetN()- 1. If called outside of this extended range, it will throw an exception.- Parameters:
coordinate- coordinate- Returns:
- index corresponding to coordinate (i.e.
0formin,n-1formax)
-
coordinate
public double coordinate(int index) Get coordinates corresponding to index.- Parameters:
index- index- Returns:
- coordinate (i.e.
minfor0,maxforn-1)
-