Revision 6377eed5
Added by Leszek Koltunski 8 months ago
src/main/java/org/distorted/objectlib/bandaged/BandagedObjectCuboid.java | ||
---|---|---|
69 | 69 |
|
70 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
71 | 71 |
|
72 |
boolean isAdjacent(float dx, float dy, float dz)
|
|
72 |
boolean isAdjacent(float x1, float y1, float z1, float x2, float y2, float z2 )
|
|
73 | 73 |
{ |
74 |
float dx = x1-x2; |
|
75 |
float dy = y1-y2; |
|
76 |
float dz = z1-z2; |
|
77 |
|
|
74 | 78 |
return dx*dx + dy*dy + dz*dz <= 1; |
75 | 79 |
} |
76 | 80 |
|
... | ... | |
93 | 97 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
94 | 98 |
// PUBLIC API |
95 | 99 |
|
96 |
public BandagedObjectCuboid(DistortedScreen screen) |
|
100 |
public BandagedObjectCuboid(DistortedScreen screen, int minSize, int maxSize)
|
|
97 | 101 |
{ |
98 |
super(screen); |
|
102 |
super(screen,minSize, maxSize);
|
|
99 | 103 |
} |
100 | 104 |
|
101 | 105 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
164 | 168 |
|
165 | 169 |
public boolean tryChangeObject(int x, int y, int z) |
166 | 170 |
{ |
167 |
if( mSize[0]!=x || mSize[1]!=y || mSize[2]!=z ) |
|
171 |
if( (mSize[0]!=x || mSize[1]!=y || mSize[2]!=z) && |
|
172 |
x>=mMinSize && x<=mMaxSize && y>= mMinSize && |
|
173 |
y<=mMaxSize && z>=mMinSize && z<=mMaxSize ) |
|
168 | 174 |
{ |
169 | 175 |
mSize[0] = x; |
170 | 176 |
mSize[1] = y; |
171 | 177 |
mSize[2] = z; |
178 |
|
|
172 | 179 |
mMax = x>y ? Math.max(x,z) : Math.max(y,z); |
173 | 180 |
mNumCubits = ( x<=1 || y<=1 || z<=1 ) ? x*y*z : x*y*z-(x-2)*(y-2)*(z-2); |
174 | 181 |
mCuts = getCuts(mSize); |
175 | 182 |
return true; |
176 | 183 |
} |
177 |
|
|
184 |
else if( mCuts==null ) |
|
185 |
{ |
|
186 |
mMax = 1; |
|
187 |
mNumCubits = 1; |
|
188 |
mCuts = getCuts(mSize); |
|
189 |
} |
|
178 | 190 |
return false; |
179 | 191 |
} |
180 | 192 |
|
Also available in: Unified diff
Introduce Creator of Bandaged Skewbs.