37 |
37 |
{
|
38 |
38 |
private static final float SQ2 = (float)Math.sqrt(2);
|
39 |
39 |
private static final float SQ3 = (float)Math.sqrt(3);
|
|
40 |
private static final float SQ5 = (float)Math.sqrt(5);
|
40 |
41 |
private static final float SQ6 = (float)Math.sqrt(6);
|
41 |
42 |
|
42 |
43 |
private static final float IVY_D = 0.003f;
|
... | ... | |
46 |
47 |
private static final float REX_D = 0.2f;
|
47 |
48 |
private static final int REX_N = 5;
|
48 |
49 |
|
|
50 |
static final float MINX_C0 = (SQ5-1)/4;
|
|
51 |
static final float MINX_C1 = (SQ5+1)/4; // sin(54 deg)
|
|
52 |
static final float MINX_C3 = (float)(Math.sqrt(10-2*SQ5)/4); // cos(54 deg)
|
|
53 |
static final float MINX_C4 = (float)(Math.sqrt(0.5f-0.1f*SQ5)); // cos(half the dihedral angle)
|
|
54 |
static final float MINX_C5 = (float)(Math.sqrt(0.5f+0.1f*SQ5)); // sin(half the dihedral angle)
|
|
55 |
|
49 |
56 |
private static final Static1D RADIUS = new Static1D(1);
|
50 |
57 |
|
51 |
58 |
private static FactoryCubit mThis;
|
... | ... | |
725 |
732 |
return new MeshJoined(meshes);
|
726 |
733 |
}
|
727 |
734 |
|
|
735 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
736 |
|
|
737 |
MeshBase createFacesMinxCorner()
|
|
738 |
{
|
|
739 |
MeshBase[] meshes = new MeshPolygon[6];
|
|
740 |
|
|
741 |
float X1= (SQ5+1)/8;
|
|
742 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4);
|
|
743 |
float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8);
|
|
744 |
float H = 0.5f*MINX_C1/MINX_C3;
|
|
745 |
float X2= H*MINX_C5;
|
|
746 |
float Y3= H/(2*MINX_C4);
|
|
747 |
float Y4= H*(1/(2*MINX_C4) - MINX_C4);
|
|
748 |
|
|
749 |
float[] vertices0 = { -X1, Y2, 0, -Y1, X1, Y2, 0, Y1 };
|
|
750 |
float[] bands0 = computeBands(0.03f,39,0.3f,0.2f,5);
|
|
751 |
float[] vertices1 = { -X2, Y4, 0, -Y3, X2, Y4, 0, Y3 };
|
|
752 |
float[] bands1 = computeBands(0.00f,27,0.25f,0.5f,2);
|
|
753 |
|
|
754 |
meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1);
|
|
755 |
meshes[0].setEffectAssociation(0, 1,0);
|
|
756 |
meshes[1] = meshes[0].copy(true);
|
|
757 |
meshes[1].setEffectAssociation(0, 2,0);
|
|
758 |
meshes[2] = meshes[0].copy(true);
|
|
759 |
meshes[2].setEffectAssociation(0, 4,0);
|
|
760 |
meshes[3] = new MeshPolygon(vertices1, bands1, 0, 0);
|
|
761 |
meshes[3].setEffectAssociation(0, 8,0);
|
|
762 |
meshes[4] = meshes[3].copy(true);
|
|
763 |
meshes[4].setEffectAssociation(0,16,0);
|
|
764 |
meshes[5] = meshes[3].copy(true);
|
|
765 |
meshes[5].setEffectAssociation(0,32,0);
|
|
766 |
|
|
767 |
return new MeshJoined(meshes);
|
|
768 |
}
|
|
769 |
|
728 |
770 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
729 |
771 |
// EFFECTS
|
730 |
772 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
1222 |
1264 |
return effect;
|
1223 |
1265 |
}
|
1224 |
1266 |
|
|
1267 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
1268 |
|
|
1269 |
VertexEffect[] createVertexEffectsMinxCorner()
|
|
1270 |
{
|
|
1271 |
VertexEffect[] effect = new VertexEffect[9];
|
|
1272 |
|
|
1273 |
float H = 0.5f*(MINX_C1/MINX_C3);
|
|
1274 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4);
|
|
1275 |
float Y2= H/(2*MINX_C4);
|
|
1276 |
float A = (float)(Math.acos(-SQ5/5)*180/Math.PI); // dihedral angle of a dedecahedron in degrees
|
|
1277 |
float sin18 = MINX_C0;
|
|
1278 |
float cos18 = (float)(Math.sqrt(1-MINX_C0*MINX_C0));
|
|
1279 |
float LEN = (float)Math.sqrt(H*H/(MINX_C4*MINX_C4) + 0.25f);
|
|
1280 |
|
|
1281 |
Static3D axisZ = new Static3D(0.0f , 0.0f , 1.0f);
|
|
1282 |
Static3D axisY = new Static3D(0.0f , 1.0f , 0.0f);
|
|
1283 |
Static3D axisA = new Static3D(-sin18, cos18, 0.0f);
|
|
1284 |
Static3D axisC = new Static3D( H/LEN, -0.5f/LEN,-H*MINX_C5/(MINX_C4*LEN));
|
|
1285 |
|
|
1286 |
Static3D move1 = new Static3D(0,-Y1,0);
|
|
1287 |
Static3D move2 = new Static3D(0,-Y2,0);
|
|
1288 |
Static3D move3 = new Static3D(0.5f*cos18,0.5f*sin18,0);
|
|
1289 |
Static3D center= new Static3D(0.0f, 0.0f, 0.0f);
|
|
1290 |
|
|
1291 |
Static1D angle1 = new Static1D(54);
|
|
1292 |
Static1D angle2 = new Static1D(A/2+18);
|
|
1293 |
Static1D angle3 = new Static1D(90);
|
|
1294 |
Static1D angle4 = new Static1D(120);
|
|
1295 |
Static1D angle5 = new Static1D(240);
|
|
1296 |
Static1D angle6 = new Static1D(90-A/2);
|
|
1297 |
|
|
1298 |
effect[0] = new VertexEffectMove(move1);
|
|
1299 |
effect[1] = new VertexEffectMove(move2);
|
|
1300 |
effect[2] = new VertexEffectRotate(angle1, axisZ, center);
|
|
1301 |
effect[3] = new VertexEffectRotate(angle2, axisZ, center);
|
|
1302 |
effect[4] = new VertexEffectRotate(angle3, axisA, center);
|
|
1303 |
effect[5] = new VertexEffectMove(move3);
|
|
1304 |
effect[6] = new VertexEffectRotate(angle4, axisC, center);
|
|
1305 |
effect[7] = new VertexEffectRotate(angle5, axisC, center);
|
|
1306 |
effect[8] = new VertexEffectRotate(angle6, axisY, center);
|
|
1307 |
|
|
1308 |
effect[0].setMeshAssociation( 7,-1); // meshes 0,1,2
|
|
1309 |
effect[1].setMeshAssociation(56,-1); // meshes 3,4,5
|
|
1310 |
effect[2].setMeshAssociation( 7,-1); // meshes 0,1,2
|
|
1311 |
effect[3].setMeshAssociation(56,-1); // meshes 3,4,5
|
|
1312 |
effect[4].setMeshAssociation(56,-1); // meshes 3,4,5
|
|
1313 |
effect[5].setMeshAssociation(56,-1); // meshes 3,4,5
|
|
1314 |
effect[6].setMeshAssociation(18,-1); // meshes 1,4
|
|
1315 |
effect[7].setMeshAssociation(36,-1); // meshes 2,5
|
|
1316 |
|
|
1317 |
return effect;
|
|
1318 |
}
|
|
1319 |
|
1225 |
1320 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1226 |
1321 |
// OBJECTS
|
1227 |
1322 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
1558 |
1653 |
MeshBase mesh = createFacesRexEdge();
|
1559 |
1654 |
VertexEffect[] effects = createVertexEffectsRexEdge();
|
1560 |
1655 |
for( VertexEffect effect : effects ) mesh.apply(effect);
|
1561 |
|
/*
|
|
1656 |
|
1562 |
1657 |
Static3D center = new Static3D(0.0f,-0.5f,-0.5f);
|
1563 |
1658 |
Static3D[] vertices = new Static3D[2];
|
1564 |
1659 |
vertices[0] = new Static3D(+0.5f,+0.0f,+0.0f);
|
1565 |
1660 |
vertices[1] = new Static3D(-0.5f,+0.0f,+0.0f);
|
1566 |
|
roundCorners(mesh,center,vertices,0.03f,0.10f);
|
|
1661 |
roundCorners(mesh,center,vertices,0.06f,0.10f);
|
1567 |
1662 |
|
1568 |
1663 |
mesh.mergeEffComponents();
|
|
1664 |
|
|
1665 |
return mesh;
|
|
1666 |
}
|
|
1667 |
|
|
1668 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
1669 |
|
|
1670 |
MeshBase createMinxCornerMesh()
|
|
1671 |
{
|
|
1672 |
MeshBase mesh = createFacesMinxCorner();
|
|
1673 |
VertexEffect[] effects = createVertexEffectsMinxCorner();
|
|
1674 |
for( VertexEffect effect : effects ) mesh.apply(effect);
|
|
1675 |
/*
|
|
1676 |
Static3D center = new Static3D(0.0f,-0.5f,-0.5f);
|
|
1677 |
Static3D[] vertices = new Static3D[2];
|
|
1678 |
vertices[0] = new Static3D(+0.5f,+0.0f,+0.0f);
|
|
1679 |
vertices[1] = new Static3D(-0.5f,+0.0f,+0.0f);
|
|
1680 |
roundCorners(mesh,center,vertices,0.06f,0.10f);
|
1569 |
1681 |
*/
|
|
1682 |
//mesh.mergeEffComponents();
|
|
1683 |
|
1570 |
1684 |
return mesh;
|
1571 |
1685 |
}
|
1572 |
1686 |
}
|
New shape: Kilominx corner.