Project

General

Profile

« Previous | Next » 

Revision 9a7e8b98

Added by Leszek Koltunski about 1 year ago

new SPLIT type: type EDGE_COIN (will be used in Coin Tetrahedron).
Only supported in Tetrahedrons for now.

View differences:

src/main/java/org/distorted/objectlib/touchcontrol/TouchControlOctahedron.java
24 24

  
25 25
  public static final Static3D[] FACE_AXIS = new Static3D[]
26 26
         {
27
           new Static3D(+SQ6/3,+SQ3/3,     0), new Static3D(-SQ6/3,-SQ3/3,     0),
28
           new Static3D(-SQ6/3,+SQ3/3,     0), new Static3D(+SQ6/3,-SQ3/3,     0),
29
           new Static3D(     0,+SQ3/3,+SQ6/3), new Static3D(     0,-SQ3/3,-SQ6/3),
30
           new Static3D(     0,+SQ3/3,-SQ6/3), new Static3D(     0,-SQ3/3,+SQ6/3)
27
           new Static3D( SQ6/3, SQ3/3,     0), new Static3D(-SQ6/3,-SQ3/3,     0),
28
           new Static3D(-SQ6/3, SQ3/3,     0), new Static3D( SQ6/3,-SQ3/3,     0),
29
           new Static3D(     0, SQ3/3, SQ6/3), new Static3D(     0,-SQ3/3,-SQ6/3),
30
           new Static3D(     0, SQ3/3,-SQ6/3), new Static3D(     0,-SQ3/3, SQ6/3)
31 31
         };
32 32

  
33 33
///////////////////////////////////////////////////////////////////////////////////////////////////
......
54 54
                              float x1 = touchPoint[0];
55 55

  
56 56
                              boolean e0 = x1>0;
57
                              boolean e1 = y1>(+SQ3/3)*x1;
57
                              boolean e1 = y1>( SQ3/3)*x1;
58 58
                              boolean e2 = y1>(-SQ3/3)*x1;
59 59

  
60 60
                              if(  e1 && e2 ) return 0;
61 61
                              if( !e1 && e0 ) return 1;
62 62
                              if( !e0 &&!e2 ) return 2;
63
                              return 0;
63 64

  
64 65
      case TYPE_SPLIT_CORNER: float y2 = (face%2 == 0 ? touchPoint[1] : -touchPoint[1]);
65 66
                              float x2 = touchPoint[0];
66 67

  
67 68
                              boolean c0 = x2>0;
68
                              boolean c1 = y2>(+SQ3/3)*x2;
69
                              boolean c1 = y2>( SQ3/3)*x2;
69 70
                              boolean c2 = y2>(-SQ3/3)*x2;
70 71

  
71 72
                              if(  c0 && c2 ) return 0;
72 73
                              if( !c1 &&!c2 ) return 1;
73 74
                              if( !c0 && c1 ) return 2;
75
                              return 0;
76

  
77
      case TYPE_SPLIT_EDGE_COIN: //  not supported
74 78
      }
75 79

  
76 80
    return 0;

Also available in: Unified diff