Revision 6377eed5
Added by Leszek Koltunski 8 months ago
src/main/java/org/distorted/objectlib/bandaged/BandagedObjectOctahedron.java | ||
---|---|---|
81 | 81 |
|
82 | 82 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
83 | 83 |
|
84 |
boolean isAdjacent(float dx, float dy, float dz)
|
|
84 |
boolean isAdjacent(float x1, float y1, float z1, float x2, float y2, float z2 )
|
|
85 | 85 |
{ |
86 |
float dx = x1-x2; |
|
87 |
float dy = y1-y2; |
|
88 |
float dz = z1-z2; |
|
89 |
|
|
86 | 90 |
return dx*dx + dy*dy + dz*dz < (SQ3/4)*1.01f; |
87 | 91 |
} |
88 | 92 |
|
... | ... | |
105 | 109 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
106 | 110 |
// PUBLIC API |
107 | 111 |
|
108 |
public BandagedObjectOctahedron(DistortedScreen screen) |
|
112 |
public BandagedObjectOctahedron(DistortedScreen screen, int minSize, int maxSize)
|
|
109 | 113 |
{ |
110 |
super(screen); |
|
114 |
super(screen,minSize,maxSize);
|
|
111 | 115 |
} |
112 | 116 |
|
113 | 117 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
136 | 140 |
|
137 | 141 |
public boolean tryChangeObject(int x, int y, int z) |
138 | 142 |
{ |
139 |
if( mSize[0]!=x ) |
|
143 |
if( mSize[0]!=x && x>=mMinSize && x<=mMaxSize )
|
|
140 | 144 |
{ |
141 | 145 |
mSize[0] = x; |
142 | 146 |
mSize[1] = x; |
... | ... | |
150 | 154 |
mCuts = getCuts(mSize); |
151 | 155 |
return true; |
152 | 156 |
} |
153 |
|
|
157 |
else if( mCuts==null ) |
|
158 |
{ |
|
159 |
mMax = 2; |
|
160 |
int numOcta = FactoryBandagedOctahedron.getNumOctahedrons(mMax); |
|
161 |
int numTetra= FactoryBandagedOctahedron.getNumTetrahedrons(mMax); |
|
162 |
mNumCubits = numOcta + numTetra; |
|
163 |
mCuts = getCuts(mSize); |
|
164 |
} |
|
154 | 165 |
return false; |
155 | 166 |
} |
156 | 167 |
|
Also available in: Unified diff
Introduce Creator of Bandaged Skewbs.