Revision c7c72305
Added by Leszek Koltunski 12 months ago
src/main/java/org/distorted/objectlib/helpers/BandagedElement.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
public class BandagedElement |
15 | 15 |
{ |
16 |
private final float mX, mY, mZ; |
|
17 | 16 |
private final float[][] mCuts; |
18 | 17 |
private final int[] mNumCuts; |
19 | 18 |
private final float[][] mRotAxis; |
20 | 19 |
private final int[] mRotationRow; |
20 |
private final float[] mPos; |
|
21 | 21 |
|
22 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
23 | 23 |
|
24 | 24 |
BandagedElement(float[] pos, int index, float[][] rotAxis, float[][] cuts) |
25 | 25 |
{ |
26 |
mX = pos[index ]; |
|
27 |
mY = pos[index+1]; |
|
28 |
mZ = pos[index+2]; |
|
26 |
mPos = new float[] { pos[index], pos[index+1], pos[index+2] }; |
|
29 | 27 |
|
30 | 28 |
int numAxis = rotAxis.length; |
31 | 29 |
mRotAxis = rotAxis; |
... | ... | |
45 | 43 |
private int computeRow(int rotAx) |
46 | 44 |
{ |
47 | 45 |
float[] ax = mRotAxis[rotAx]; |
48 |
float casted = mX*ax[0] + mY*ax[1] + mZ*ax[2];
|
|
46 |
float casted = mPos[0]*ax[0] + mPos[1]*ax[1] + mPos[2]*ax[2];
|
|
49 | 47 |
int num = mNumCuts[rotAx]; |
50 | 48 |
float[] cuts = mCuts[rotAx]; |
51 | 49 |
|
... | ... | |
61 | 59 |
{ |
62 | 60 |
return mRotationRow; |
63 | 61 |
} |
62 |
|
|
63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
64 |
|
|
65 |
float[] getPos() |
|
66 |
{ |
|
67 |
return mPos; |
|
68 |
} |
|
64 | 69 |
} |
Also available in: Unified diff
move almost all methods to the generic 'FactoryBandaged'