Revision 4e627d8b
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/objects/FactoryCubit.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
private static final float SQ2 = (float)Math.sqrt(2); |
44 | 44 |
private static final float SQ3 = (float)Math.sqrt(3); |
45 |
private static final float SQ5 = (float)Math.sqrt(5); |
|
45 | 46 |
private static final float SQ6 = (float)Math.sqrt(6); |
46 | 47 |
|
48 |
static final float MINX_C0 = (SQ5-1)/4; |
|
49 |
static final float MINX_C1 = (SQ5+1)/4; // sin(54 deg) |
|
50 |
static final float MINX_C3 = (float)(Math.sqrt(10-2*SQ5)/4); // cos(54 deg) |
|
51 |
static final float MINX_C4 = (float)(Math.sqrt(0.5f-0.1f*SQ5)); // cos(half the dihedral angle) |
|
52 |
static final float MINX_C5 = (float)(Math.sqrt(0.5f+0.1f*SQ5)); // sin(half the dihedral angle) |
|
53 |
|
|
47 | 54 |
private static final int IVY_N = 8; |
55 |
|
|
48 | 56 |
private static final Static1D RADIUS = new Static1D(1); |
49 | 57 |
private static FactoryCubit mThis; |
50 | 58 |
|
... | ... | |
674 | 682 |
return new MeshJoined(meshes); |
675 | 683 |
} |
676 | 684 |
|
677 |
|
|
678 | 685 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
679 | 686 |
|
680 | 687 |
MeshBase createFacesMinxCorner() |
681 | 688 |
{ |
682 | 689 |
MeshBase[] meshes = new MeshPolygon[6]; |
683 | 690 |
|
684 |
float[] vertices0 = { }; // TODO |
|
685 |
float[] bands0 = computeBands(0.03f,27,0.25f,0.5f,5); |
|
686 |
float[] vertices1 = { }; // TODO |
|
691 |
float X1= (SQ5+1)/8; |
|
692 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4); |
|
693 |
float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8); |
|
694 |
float H = 0.5f*MINX_C1/MINX_C3; |
|
695 |
float X2= H*MINX_C5; |
|
696 |
float Y3= H/(2*MINX_C4); |
|
697 |
float Y4= H*(1/(2*MINX_C4) - MINX_C4); |
|
698 |
|
|
699 |
float[] vertices0 = { -X1, Y2, 0, -Y1, X1, Y2, 0, Y1 }; |
|
700 |
float[] bands0 = computeBands(0.03f,39,0.3f,0.2f,5); |
|
701 |
float[] vertices1 = { -X2, Y4, 0, -Y3, X2, Y4, 0, Y3 }; |
|
687 | 702 |
float[] bands1 = computeBands(0.00f,27,0.25f,0.5f,2); |
688 | 703 |
|
689 | 704 |
meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1); |
... | ... | |
1203 | 1218 |
|
1204 | 1219 |
VertexEffect[] createVertexEffectsMinxCorner() |
1205 | 1220 |
{ |
1206 |
// TODO |
|
1221 |
VertexEffect[] effect = new VertexEffect[9]; |
|
1222 |
|
|
1223 |
float H = 0.5f*(MINX_C1/MINX_C3); |
|
1224 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4); |
|
1225 |
float Y2= H/(2*MINX_C4); |
|
1226 |
float A = (float)(Math.acos(-SQ5/5)*180/Math.PI); // dihedral angle of a dedecahedron in degrees |
|
1227 |
float sin18 = MINX_C0; |
|
1228 |
float cos18 = (float)(Math.sqrt(1-MINX_C0*MINX_C0)); |
|
1229 |
float LEN = (float)Math.sqrt(H*H/(MINX_C4*MINX_C4) + 0.25f); |
|
1230 |
|
|
1231 |
Static3D axisZ = new Static3D(0.0f , 0.0f , 1.0f); |
|
1232 |
Static3D axisY = new Static3D(0.0f , 1.0f , 0.0f); |
|
1233 |
Static3D axisA = new Static3D(-sin18, cos18, 0.0f); |
|
1234 |
Static3D axisC = new Static3D( H/LEN, -0.5f/LEN,-H*MINX_C5/(MINX_C4*LEN)); |
|
1235 |
|
|
1236 |
Static3D move1 = new Static3D(0,-Y1,0); |
|
1237 |
Static3D move2 = new Static3D(0,-Y2,0); |
|
1238 |
Static3D move3 = new Static3D(0.5f*cos18,0.5f*sin18,0); |
|
1239 |
Static3D center= new Static3D(0.0f, 0.0f, 0.0f); |
|
1240 |
|
|
1241 |
Static1D angle1 = new Static1D(54); |
|
1242 |
Static1D angle2 = new Static1D(A/2+18); |
|
1243 |
Static1D angle3 = new Static1D(90); |
|
1244 |
Static1D angle4 = new Static1D(120); |
|
1245 |
Static1D angle5 = new Static1D(240); |
|
1246 |
Static1D angle6 = new Static1D(90-A/2); |
|
1247 |
|
|
1248 |
effect[0] = new VertexEffectMove(move1); |
|
1249 |
effect[1] = new VertexEffectMove(move2); |
|
1250 |
effect[2] = new VertexEffectRotate(angle1, axisZ, center); |
|
1251 |
effect[3] = new VertexEffectRotate(angle2, axisZ, center); |
|
1252 |
effect[4] = new VertexEffectRotate(angle3, axisA, center); |
|
1253 |
effect[5] = new VertexEffectMove(move3); |
|
1254 |
effect[6] = new VertexEffectRotate(angle4, axisC, center); |
|
1255 |
effect[7] = new VertexEffectRotate(angle5, axisC, center); |
|
1256 |
effect[8] = new VertexEffectRotate(angle6, axisY, center); |
|
1207 | 1257 |
|
1208 |
return null; |
|
1258 |
effect[0].setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
1259 |
effect[1].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
1260 |
effect[2].setMeshAssociation( 7,-1); // meshes 0,1,2 |
|
1261 |
effect[3].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
1262 |
effect[4].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
1263 |
effect[5].setMeshAssociation(56,-1); // meshes 3,4,5 |
|
1264 |
effect[6].setMeshAssociation(18,-1); // meshes 1,4 |
|
1265 |
effect[7].setMeshAssociation(36,-1); // meshes 2,5 |
|
1266 |
|
|
1267 |
return effect; |
|
1209 | 1268 |
} |
1210 | 1269 |
|
1211 | 1270 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with the Kilominx.