Revision 7764a67a
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/FactoryCubit.java | ||
---|---|---|
672 | 672 |
|
673 | 673 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
674 | 674 |
|
675 |
MeshBase createFacesKilominxCorner()
|
|
675 |
MeshBase createFacesKilominxCenter()
|
|
676 | 676 |
{ |
677 | 677 |
MeshBase[] meshes = new MeshPolygon[6]; |
678 | 678 |
|
679 |
float X1= (SQ5+1)/8;
|
|
680 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4);
|
|
681 |
float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8);
|
|
679 |
float X1= 0.5f*SIN54;
|
|
680 |
float Y1= 0.5f*SIN_HALFD;
|
|
681 |
float Y2= Y1 - 0.5f*COS54;
|
|
682 | 682 |
float H = 0.5f* SIN54 /COS54 ; |
683 | 683 |
float X2= MINX_SC*H* SIN_HALFD; |
684 | 684 |
float Y3= MINX_SC*H/(2*COS_HALFD); |
... | ... | |
1354 | 1354 |
|
1355 | 1355 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1356 | 1356 |
|
1357 |
VertexEffect[] createVertexEffectsKilominxCorner()
|
|
1357 |
VertexEffect[] createVertexEffectsKilominxCenter(float width)
|
|
1358 | 1358 |
{ |
1359 | 1359 |
VertexEffect[] effect = new VertexEffect[10]; |
1360 | 1360 |
|
1361 |
float H = 0.5f*(SIN54 /COS54 );
|
|
1362 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4);
|
|
1361 |
float H = 0.5f*(SIN54/COS54);
|
|
1362 |
float Y1= 0.5f*SIN_HALFD;
|
|
1363 | 1363 |
float Y2= H/(2*COS_HALFD); |
1364 |
float A = (float)(Math.acos(-SQ5/5)*180/Math.PI); // dihedral angle of a dedecahedron in degrees |
|
1365 |
float sin18 = SIN18; |
|
1366 | 1364 |
float cos18 = (float)(Math.sqrt(1- SIN18 * SIN18)); |
1367 | 1365 |
float LEN = (float)Math.sqrt(H*H/(COS_HALFD*COS_HALFD) + 0.25f); |
1368 | 1366 |
|
1369 | 1367 |
Static3D axisZ = new Static3D(0.0f , 0.0f , 1.0f); |
1370 | 1368 |
Static3D axisY = new Static3D(0.0f , 1.0f , 0.0f); |
1371 |
Static3D axisA = new Static3D(-sin18, cos18, 0.0f);
|
|
1369 |
Static3D axisA = new Static3D(-SIN18, cos18, 0.0f);
|
|
1372 | 1370 |
Static3D axisC = new Static3D( H/LEN, -0.5f/LEN,-H* SIN_HALFD /(COS_HALFD*LEN)); |
1373 | 1371 |
|
1374 | 1372 |
Static3D move1 = new Static3D(0,-Y1,0); |
1375 | 1373 |
Static3D move2 = new Static3D(0,-Y2,0); |
1376 |
Static3D move3 = new Static3D(0.5f*cos18,0.5f*sin18,0);
|
|
1374 |
Static3D move3 = new Static3D(0.5f*cos18,0.5f*SIN18,0);
|
|
1377 | 1375 |
Static3D center= new Static3D(0.0f, 0.0f, 0.0f); |
1378 | 1376 |
|
1379 | 1377 |
Static1D angle1 = new Static1D(54); |
1380 |
Static1D angle2 = new Static1D(A/2+18);
|
|
1378 |
Static1D angle2 = new Static1D(DIHEDRAL1/2+18);
|
|
1381 | 1379 |
Static1D angle3 = new Static1D(90); |
1382 | 1380 |
Static1D angle4 = new Static1D(120); |
1383 | 1381 |
Static1D angle5 = new Static1D(240); |
1384 |
Static1D angle6 = new Static1D(90-A/2);
|
|
1382 |
Static1D angle6 = new Static1D(90-DIHEDRAL1/2);
|
|
1385 | 1383 |
|
1386 | 1384 |
effect[0] = new VertexEffectMove(move1); |
1387 | 1385 |
effect[1] = new VertexEffectScale(1/MINX_SC); |
... | ... | |
1934 | 1932 |
|
1935 | 1933 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1936 | 1934 |
|
1937 |
MeshBase createKilominxCornerMesh()
|
|
1935 |
MeshBase createKilominxCenterMesh(float width)
|
|
1938 | 1936 |
{ |
1939 |
MeshBase mesh = createFacesKilominxCorner();
|
|
1940 |
VertexEffect[] effects = createVertexEffectsKilominxCorner();
|
|
1937 |
MeshBase mesh = createFacesKilominxCenter();
|
|
1938 |
VertexEffect[] effects = createVertexEffectsKilominxCenter(width);
|
|
1941 | 1939 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
1942 | 1940 |
|
1943 | 1941 |
float A = (2*SQ3/3)* SIN54; |
... | ... | |
1961 | 1959 |
return mesh; |
1962 | 1960 |
} |
1963 | 1961 |
|
1962 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1963 |
// numLayers==3 --> index=0; numLayers=5 --> index=1 ... |
|
1964 |
// type: 0,1,... 0 --> edge, 1 --> 1 layer deeper, etc |
|
1965 |
// TODO |
|
1966 |
|
|
1967 |
MeshBase createKilominxEdgeMesh(int numLayers, float width, float height) |
|
1968 |
{ |
|
1969 |
MeshBase mesh = createFacesMegaminxEdge(numLayers,width,height); |
|
1970 |
VertexEffect[] effects = createVertexEffectsMegaminxEdge(width,height); |
|
1971 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
1972 |
|
|
1973 |
mesh.mergeEffComponents(); |
|
1974 |
|
|
1975 |
return mesh; |
|
1976 |
} |
|
1977 |
|
|
1964 | 1978 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1965 | 1979 |
|
1966 |
MeshBase createMegaminxCornerMesh(int numLayers)
|
|
1980 |
MeshBase createMinxCornerMesh(ObjectList object, int numLayers)
|
|
1967 | 1981 |
{ |
1968 | 1982 |
MeshBase mesh = createFacesMegaminxCorner(numLayers); |
1969 | 1983 |
VertexEffect[] effects = createVertexEffectsMegaminxCorner(numLayers); |
Also available in: Unified diff
Progress with any size Kilominx.