|
static int[][] | interpolate (int fromX, int fromY, int toX, int toY, double space) |
|
Definition at line 3 of file LinearInt.java.
mhr.appcore.utils.LinearInt.LinearInt |
( |
| ) |
|
|
inlineprotected |
static int [][] mhr.appcore.utils.LinearInt.interpolate |
( |
int |
fromX, |
|
|
int |
fromY, |
|
|
int |
toX, |
|
|
int |
toY, |
|
|
double |
space |
|
) |
| |
|
inlinestatic |
Definition at line 7 of file LinearInt.java.
{
double dist = Math.sqrt((toX - fromX)*(toX - fromX) + (toY - fromY)*(toY - fromY));
double count = dist / space;
double dx = (toX - fromX) / (double) count;
double dy = (toY - fromY) / (double) count;
double dt = 1.0 / count;
int ptCount = (int) count + 1;
int[][] retVal = new int[2][ptCount];
double x = fromX;
double y = fromY;
for (int i = 0; i < ptCount; i++) {
retVal[0][i] = (int) Math.round(x);
x += dx;
retVal[1][i] = (int) Math.round(y);
y += dy;
}
return retVal;
}
The documentation for this class was generated from the following file:
- /home/xxx/eclipse_workspaces/app/appcore/src/mhr/appcore/utils/LinearInt.java