Project

General

Profile

« Previous | Next » 

Revision f2b63463

Added by Leszek Koltunski about 3 years ago

Making the Diamond class support any size: finished.

View differences:

src/main/java/org/distorted/objects/MovementDiamond.java
51 51

  
52 52
  int computeRowFromOffset(int face, int size, float offset)
53 53
    {
54
    if( face==1 || face==3 || face==4 || face==6 )
55
      {
56
      return offset<SQ3/12 ? 0:1;
57
      }
58
    else
59
      {
60
      return offset<SQ3/4  ? 0:1;
61
      }
54
    float off = ( face==1 || face==3 || face==4 || face==6 ) ? offset/SQ3 + 1.0f/6 : offset/SQ3;
55
    return (int)(2*size*off);
62 56
    }
63 57

  
64 58
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff