Revision 68ce0d53
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/TwistyBandagedAbstract.java | ||
---|---|---|
138 | 138 |
|
139 | 139 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
140 | 140 |
|
141 |
abstract int getCubitVariant(int cubit); |
|
142 |
abstract int getNumCubits(); |
|
143 |
abstract int getQuatIndex(int cubit); |
|
144 |
abstract float[] getCubitPosition(int cubit); |
|
141 |
abstract float[][] getPositions(); |
|
142 |
abstract int[] getQuatIndices(); |
|
143 |
|
|
144 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
145 |
|
|
146 |
int getCubitVariant(int cubit) |
|
147 |
{ |
|
148 |
float[][] pos = getPositions(); |
|
149 |
|
|
150 |
if( cubit>=0 && cubit< pos.length ) |
|
151 |
{ |
|
152 |
int numPoints = pos[cubit].length/3; |
|
153 |
return numPoints==8 ? 4:numPoints; |
|
154 |
} |
|
155 |
|
|
156 |
return 1; |
|
157 |
} |
|
158 |
|
|
159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
160 |
|
|
161 |
int getNumCubits() |
|
162 |
{ |
|
163 |
return getPositions().length; |
|
164 |
} |
|
165 |
|
|
166 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
167 |
|
|
168 |
float[] getCubitPosition(int cubit) |
|
169 |
{ |
|
170 |
float[][] pos = getPositions(); |
|
171 |
|
|
172 |
return ( cubit>=0 && cubit< pos.length ) ? pos[cubit] : null; |
|
173 |
} |
|
174 |
|
|
175 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
176 |
|
|
177 |
int getQuatIndex(int cubit) |
|
178 |
{ |
|
179 |
int[] indices = getQuatIndices(); |
|
180 |
|
|
181 |
return ( cubit>=0 && cubit< indices.length ) ? indices[cubit] : 0; |
|
182 |
} |
|
145 | 183 |
|
146 | 184 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
147 | 185 |
|
Also available in: Unified diff
Simplify the 'bandaged' class API.