Revision 462b983d
Added by Leszek Koltunski 12 months ago
src/main/java/org/distorted/bandaged/BandagedObjectCuboid.java | ||
---|---|---|
12 | 12 |
import org.distorted.library.main.DistortedScreen; |
13 | 13 |
import org.distorted.library.mesh.MeshBase; |
14 | 14 |
import org.distorted.library.type.Static3D; |
15 |
import org.distorted.objectlib.helpers.FactoryBandagedCubit;
|
|
15 |
import org.distorted.objectlib.helpers.FactoryBandagedCuboid;
|
|
16 | 16 |
import org.distorted.objectlib.main.InitData; |
17 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
18 | 18 |
import org.distorted.objectlib.objects.TwistyBandagedCuboid; |
... | ... | |
69 | 69 |
return dx*dx + dy*dy + dz*dz == 1; |
70 | 70 |
} |
71 | 71 |
|
72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
73 |
|
|
74 |
boolean tryChangeObject(int x, int y, int z) |
|
75 |
{ |
|
76 |
if( mSize[0]!=x || mSize[1]!=y || mSize[2]!=z ) |
|
77 |
{ |
|
78 |
mSize[0] = x; |
|
79 |
mSize[1] = y; |
|
80 |
mSize[2] = z; |
|
81 |
mMax = x>y ? Math.max(x,z) : Math.max(y,z); |
|
82 |
mNumCubits = ( x<=1 || y<=1 || z<=1 ) ? x*y*z : x*y*z-(x-2)*(y-2)*(z-2); |
|
83 |
return true; |
|
84 |
} |
|
85 |
|
|
86 |
return false; |
|
87 |
} |
|
88 |
|
|
89 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
90 |
|
|
91 |
int computeProjectionAngle() |
|
92 |
{ |
|
93 |
float quot1 = mSize[2]/ (float)mSize[0]; |
|
94 |
float quot2 = mSize[2]/ (float)mSize[1]; |
|
95 |
float quot3 = mSize[0]/ (float)mSize[2]; |
|
96 |
float quot4 = mSize[0]/ (float)mSize[1]; |
|
97 |
|
|
98 |
float quot5 = Math.max(quot1,quot2); |
|
99 |
float quot6 = Math.max(quot3,quot4); |
|
100 |
float quot7 = Math.max(quot5,quot6); |
|
101 |
|
|
102 |
if( quot7<=1.0f ) return 120; |
|
103 |
else if( quot7<=1.5f ) return 90; |
|
104 |
else if( quot7<=2.0f ) return 60; |
|
105 |
else return 30; |
|
106 |
} |
|
107 |
|
|
108 | 72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
109 | 73 |
|
110 | 74 |
float[][] getPositions() |
... | ... | |
167 | 131 |
} |
168 | 132 |
} |
169 | 133 |
|
134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
135 |
|
|
136 |
boolean tryChangeObject(int x, int y, int z) |
|
137 |
{ |
|
138 |
if( mSize[0]!=x || mSize[1]!=y || mSize[2]!=z ) |
|
139 |
{ |
|
140 |
mSize[0] = x; |
|
141 |
mSize[1] = y; |
|
142 |
mSize[2] = z; |
|
143 |
mMax = x>y ? Math.max(x,z) : Math.max(y,z); |
|
144 |
mNumCubits = ( x<=1 || y<=1 || z<=1 ) ? x*y*z : x*y*z-(x-2)*(y-2)*(z-2); |
|
145 |
return true; |
|
146 |
} |
|
147 |
|
|
148 |
return false; |
|
149 |
} |
|
150 |
|
|
151 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
152 |
|
|
153 |
int computeProjectionAngle() |
|
154 |
{ |
|
155 |
float quot1 = mSize[2]/ (float)mSize[0]; |
|
156 |
float quot2 = mSize[2]/ (float)mSize[1]; |
|
157 |
float quot3 = mSize[0]/ (float)mSize[2]; |
|
158 |
float quot4 = mSize[0]/ (float)mSize[1]; |
|
159 |
|
|
160 |
float quot5 = Math.max(quot1,quot2); |
|
161 |
float quot6 = Math.max(quot3,quot4); |
|
162 |
float quot7 = Math.max(quot5,quot6); |
|
163 |
|
|
164 |
if( quot7<=1.0f ) return 120; |
|
165 |
else if( quot7<=1.5f ) return 90; |
|
166 |
else if( quot7<=2.0f ) return 60; |
|
167 |
else return 30; |
|
168 |
} |
|
169 |
|
|
170 | 170 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
171 | 171 |
|
172 | 172 |
boolean isInsideFace(int face, float[] p) |
... | ... | |
187 | 187 |
|
188 | 188 |
MeshBase createMesh(float[] pos, boolean round) |
189 | 189 |
{ |
190 |
FactoryBandagedCubit factory = FactoryBandagedCubit.getInstance(); |
|
191 |
int[] size = getSize(); |
|
192 |
return factory.createMesh(pos,size[0],size[1],size[2],false,round); |
|
190 |
FactoryBandagedCuboid factory = FactoryBandagedCuboid.getInstance(); |
|
191 |
return factory.createMesh(pos,mSize[0],mSize[1],mSize[2],false,round); |
|
193 | 192 |
} |
194 | 193 |
|
195 | 194 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Introduce BandagedObjectPyraminx.