예제 #1
0
    public static dvektor Inverse(dvektor aa)
    {
        int     total = aa.x + aa.y + aa.z;
        dvektor retv  = aa + (-total);

        return(retv * -1);
    }
예제 #2
0
    public Block blockAdjacentToNeighboringChunkCoord(ChunkIndex neighborCI, dvektor dir)       // OR maybe - after all this.
    {
        ChunkIndex adjIndex;
        ChunkIndex unitCI      = new ChunkIndex(dvektor.Abs(dir));
        dvektor    inverseDvek = dvektor.Inverse(dvektor.Abs(dir));

        ChunkIndex inverseCI = new ChunkIndex(inverseDvek);

        adjIndex = inverseCI * neighborCI;                   // zero out direction that we want

        int dir_coord = dir.total() == -1 ? CHUNKLENGTH : 0; // if dir pos, this chunk is pointing to us from negative and vis-versa

        ChunkIndex adjSide = new ChunkIndex(dir_coord, dir_coord, dir_coord) * unitCI;

        adjIndex = adjIndex + adjSide;

        return(blockAt(adjIndex));
    }
예제 #3
0
 public ChunkIndex(dvektor d)
 {
     x = (int)d.x;
     y = (int)d.y;
     z = (int)d.z;
 }
예제 #4
0
 public static dvektor Abs(dvektor aa)
 {
     return(aa * aa);
 }
예제 #5
0
 public static dvektor OppositeDirection(dvektor d)
 {
     return(d * -1.0f);
 }
예제 #6
0
 public dvektor(ChunkIndex ci)
 {
     this = new dvektor(ci.x, ci.y, ci.z);
 }