Project

General

Profile

« Previous | Next » 

Revision a40adec7

Added by Leszek Koltunski over 2 years ago

Convert the Ivy corner cubit to the new, 'universal' cubit creation method.

This forces deep changes to 'createRoundSolid' and the underlying 'MeshPolygon' class to make them support arbitrary Polygon 'centers of face convexity'.

Reason: the faces of this cubit are concave and such default 'center of face convexity' (which by default used to be (0,0)) turned to lie outside the face - which produces strange visual artifacts.

View differences:

src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
254 254

  
255 255
    private void createMesh()
256 256
      {
257
      int mode = 14;
258
      int numComponents = 0;
257
      int mode            = 5;
258
      int numComponents   = 0;
259 259
      double[][] vertices = null;
260 260
      int[][] vertIndexes = null;
261 261
      float[][] bands     = null;
......
264 264
      int[] cornerIndexes = null;
265 265
      float[][] centers   = null;
266 266
      int[] centerIndexes = null;
267
      float[] convexCenter= null;
267 268

  
268 269
      ///// CUBE ////////////////////////////////////////////////////////////////////////////////
269 270

  
......
519 520

  
520 521
      else if( mode==5 )
521 522
        {
522
        int IVY_N = 3;
523
        int IVY_N = 8;
523 524
        final float IVY_D = 0.003f;
524 525
        final double angle = Math.PI/(2*IVY_N);
525 526
        final double CORR  = 1.0 - 2*IVY_D;
......
625 626
          centerIndexes[i] = -1;
626 627
          }
627 628

  
629
        float C = 0.5f - SQ2/4;
630
        convexCenter = new float[] {-C,-C,-C};
631

  
628 632
        numComponents = 6;
629 633
        }
630 634

  
......
1246 1250
                                         bands, bandIndexes,
1247 1251
                                         corners, cornerIndexes,
1248 1252
                                         centers, centerIndexes,
1249
                                         numComponents );
1253
                                         numComponents, convexCenter );
1250 1254

  
1251 1255
      int numEff = mMesh.getNumEffComponents();
1252 1256

  

Also available in: Unified diff