App
Static Public Member Functions | Protected Member Functions | List of all members
mhr.appcore.utils.LinearInt Class Reference

Static Public Member Functions

static int[][] interpolate (int fromX, int fromY, int toX, int toY, double space)
 

Protected Member Functions

 LinearInt ()
 

Detailed Description

Definition at line 3 of file LinearInt.java.

Constructor & Destructor Documentation

mhr.appcore.utils.LinearInt.LinearInt ( )
inlineprotected

Definition at line 5 of file LinearInt.java.

{}

Member Function Documentation

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; // tohle je pocet intervalu, ergo krajni bod, ve finale se ten prvni stejne asi nebude kreslit
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: