UnityMol  0.9.6-875
UnityMol viewer / In developement
EdgeGrid.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 
4 public class EdgeGrid {
5 
6  private EdgeArray[,,] _grid;
7 
8  public EdgeGrid(int x, int y, int z) {
9  Debug.Log("Creating the EdgeGrid: " + Time.realtimeSinceStartup.ToString());
10 
11  _grid = new EdgeArray[x,y,z];
12 
13  for(int i=0; i<x; i++) {
14  for (int j=0; j<y; j++) {
15  for (int k=0; k<z; k++) {
16  _grid[i,j,k] = new EdgeArray();
17  }
18  }
19  }
20 
21  Debug.Log("EdgeGrid created: " + Time.realtimeSinceStartup.ToString());
22  } // End of constructor
23 
43  public int AddVertex(int x, int y, int z, int t, int index) {
44  if(_grid[x,y,z].GetEdge(t) == -1)
45  _grid[x,y,z].SetEdge(t, index);
46  return _grid[x,y,z].GetEdge(t);
47  }
48 
49 }
int GetEdge(int index)
Definition: EdgeArray.cs:12
EdgeGrid(int x, int y, int z)
Definition: EdgeGrid.cs:8
void SetEdge(int index, int vertexIndex)
Definition: EdgeArray.cs:16
EdgeArray[,,] _grid
Definition: EdgeGrid.cs:6
int AddVertex(int x, int y, int z, int t, int index)
Adds the index of the vertex to the edge grid.
Definition: EdgeGrid.cs:43