Project

General

Profile

« Previous | Next » 

Revision 40223bbb

Added by Leszek Koltunski about 4 years ago

The Pyraminx itself finished - now its movements!

View differences:

src/main/java/org/distorted/examples/meshjoin/MeshJoinRenderer.java
183 183

  
184 184
    private MeshBase createJoinedTetrahedron()
185 185
      {
186
      final float SQ2 = (float)Math.sqrt(2);
186 187
      final float SQ3 = (float)Math.sqrt(3);
187 188
      final float angleFaces = (float)((180/Math.PI)*(2*Math.asin(SQ3/3))); // angle between two faces of a tetrahedron
188 189
      final int MESHES=4;
......
193 194
      MatrixEffect[] effects0 = new MatrixEffect[3];
194 195
      effects0[0] = new MatrixEffectScale( new Static3D(1,SQ3/2,1) );
195 196
      effects0[1] = new MatrixEffectRotate( new Static1D(90), new Static3D(1,0,0), new Static3D(0,0,0) );
196
      effects0[2] = new MatrixEffectMove( new Static3D(0,-SQ3/6,SQ3/12) );
197
      effects0[2] = new MatrixEffectMove( new Static3D(0,-SQ3*SQ2/12,SQ3/12) );
197 198

  
198 199
      meshes[0].apply(effects0);
199 200

  
200 201
      Static1D angle = new Static1D(angleFaces);
201 202
      Static3D axis  = new Static3D(-1,0,0);
202
      Static3D center= new Static3D(0,-SQ3/6,-SQ3/6);
203
      Static3D center= new Static3D(0,-SQ3*SQ2/12,-SQ3/6);
203 204

  
204 205
      MatrixEffect[] effects1 = new MatrixEffect[5];
205 206
      effects1[0] = effects0[0];

Also available in: Unified diff