1 |
462b983d
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2023 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
|
|
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
7 |
|
|
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
8 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9 |
|
|
|
10 |
|
|
package org.distorted.bandaged;
|
11 |
|
|
|
12 |
|
|
import static org.distorted.objectlib.main.TwistyObject.SQ3;
|
13 |
|
|
import static org.distorted.objectlib.main.TwistyObject.SQ6;
|
14 |
|
|
|
15 |
|
|
import org.distorted.library.main.DistortedScreen;
|
16 |
|
|
import org.distorted.library.mesh.MeshBase;
|
17 |
|
|
import org.distorted.library.type.Static3D;
|
18 |
|
|
import org.distorted.objectlib.helpers.FactoryBandagedPyraminx;
|
19 |
|
|
import org.distorted.objectlib.main.InitData;
|
20 |
|
|
import org.distorted.objectlib.main.TwistyObject;
|
21 |
|
|
import org.distorted.objectlib.objects.TwistyBandagedPyraminx;
|
22 |
|
|
import org.distorted.objectlib.shape.ShapeTetrahedron;
|
23 |
|
|
import org.distorted.objectlib.touchcontrol.TouchControlTetrahedron;
|
24 |
|
|
|
25 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
26 |
|
|
|
27 |
|
|
public class BandagedObjectPyraminx extends BandagedObject
|
28 |
|
|
{
|
29 |
|
|
BandagedObjectPyraminx(DistortedScreen screen)
|
30 |
|
|
{
|
31 |
|
|
super(screen);
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
35 |
|
|
|
36 |
|
|
float[] getDist3D()
|
37 |
|
|
{
|
38 |
|
|
float d = mSize[0]*SQ6/12;
|
39 |
|
|
return new float[] {d,d,d,d};
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
43 |
|
|
|
44 |
|
|
float getDist2D()
|
45 |
|
|
{
|
46 |
|
|
return SQ3/6;
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
50 |
|
|
|
51 |
|
|
int[] getColors()
|
52 |
|
|
{
|
53 |
|
|
return ShapeTetrahedron.FACE_COLORS;
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
57 |
|
|
|
58 |
|
|
Static3D[] getFaceAxis()
|
59 |
|
|
{
|
60 |
|
|
return TouchControlTetrahedron.FACE_AXIS;
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
64 |
|
|
|
65 |
|
|
boolean tryChangeObject(int x, int y, int z)
|
66 |
|
|
{
|
67 |
|
|
if( mSize[0]!=x )
|
68 |
|
|
{
|
69 |
|
|
mSize[0] = x;
|
70 |
|
|
mMax = mSize[0];
|
71 |
|
|
int numOcta = (x-1)*x*(x+1)/6;
|
72 |
|
|
int numTetra= x*(x+1)*(x+2)/6;
|
73 |
|
|
mNumCubits = numOcta + numTetra;
|
74 |
|
|
return true;
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
return false;
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
81 |
|
|
|
82 |
|
|
int computeProjectionAngle()
|
83 |
|
|
{
|
84 |
|
|
return 120;
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
88 |
|
|
// TODO
|
89 |
|
|
|
90 |
|
|
boolean isAdjacent(float dx, float dy, float dz)
|
91 |
|
|
{
|
92 |
|
|
return false;
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
96 |
|
|
// TODO
|
97 |
|
|
|
98 |
|
|
float[][] getPositions()
|
99 |
|
|
{
|
100 |
|
|
return null;
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
104 |
|
|
// TODO
|
105 |
|
|
|
106 |
|
|
void getTouchedPosition(float[] output, int face, float pointX, float pointY)
|
107 |
|
|
{
|
108 |
|
|
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
112 |
|
|
// TODO
|
113 |
|
|
|
114 |
|
|
boolean isInsideFace(int face, float[] p)
|
115 |
|
|
{
|
116 |
|
|
return false;
|
117 |
|
|
}
|
118 |
|
|
|
119 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
120 |
|
|
|
121 |
|
|
MeshBase createMesh(float[] pos, boolean round)
|
122 |
|
|
{
|
123 |
|
|
FactoryBandagedPyraminx factory = FactoryBandagedPyraminx.getInstance();
|
124 |
|
|
return factory.createMesh(pos,mSize[0],false,round);
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
128 |
|
|
|
129 |
|
|
TwistyObject createObject(int mode, float size)
|
130 |
|
|
{
|
131 |
|
|
float[][] pos = getCubitPositions();
|
132 |
|
|
InitData data = new InitData( mSize,pos);
|
133 |
|
|
return new TwistyBandagedPyraminx( TwistyObject.MESH_NICE, mode, ShapeTetrahedron.DEFAULT_ROT, new Static3D(0,0,0), size, data, null );
|
134 |
|
|
}
|
135 |
|
|
}
|