3 using System.Collections.Generic;
     7 using System.Runtime.InteropServices;
    23     public float[] 
points = 
new float[3];
    29     public List<GraphVertex> 
molAsGraph = 
new List<GraphVertex>(); 
    30     public List<List<int>> 
cycles = 
new List<List<int>>(); 
    40         for (
int i=0; i<atomsLocationlist.Count; i++){
    42             tempVertex.
coordinate=(
new Vector3(atomsLocationlist[i][0] ,
    43                                                atomsLocationlist[i][1],
    44                                                atomsLocationlist[i][2]));
    48             molAsGraph.Add(tempVertex);
    71         for (
int i=0; i<molAsGraph.Count; i++){
    72             List<int> indexCycle = 
new List<int>();
    73             molAsGraph[i].SearchCycle(indexCycle, i);
    77             for (
int j=0; j<molAsGraph.Count; j++)
    78                 molAsGraph[j].flag=
false;
    80             if (indexCycle.Count>0){
    82                 if(!cycles.Any (x => x.OrderBy(y => y).SequenceEqual(indexCycle.OrderBy(z=>z)))){
    83                     cycles.Add(indexCycle);
    84                     residueslist.Add(molAsGraph[i].resname);
   112         List<GameObject> result = 
new List<GameObject>();
   114         for (
int i=0; i< cycles.Count; i++) {
   115             for (
int j=0; j<cycles[i].Count; j++) {
   116                     x = atomsLocationlist [cycles [i] [j]] [0];
   117                     y = atomsLocationlist [cycles [i] [j]] [1];
   118                     z = atomsLocationlist [cycles [i] [j]] [2];
   120                 coordinates.Add (
new float[3]{x,y,z});
   122             string res = residueslist[i];
   126             Mesh mesh = twomesh[0];
   127             Mesh backMesh = twomesh[1];
   131             coordinates.Clear ();
   147         List<Color32> ColorList = 
new List<Color32>();
   148         List<Vector3> atomPositionList = 
new List<Vector3>(); 
   149         List<Vector3> vertices = 
new List<Vector3>();
   150         List<int> triangles = 
new List<int>();
   151         List<int> trianglesback = 
new List<int>();
   153         Mesh mymesh = 
new Mesh();
   154         Mesh backmesh = 
new Mesh();
   155         float xTot=0, yTot=0, zTot=0;
   157         Vector3 barycenter = 
new Vector3();
   159         for (
int i=0; i<cxLocation.Count; i++){
   161             atomPositionList.Add(
new Vector3(cxLocation[i][0],cxLocation[i][1],cxLocation[i][2]));
   162             xTot=xTot+cxLocation[i][0];
   163             yTot=yTot+cxLocation[i][1];
   164             zTot=zTot+cxLocation[i][2];
   167         barycenter.x=xTot/cxLocation.Count;
   168         barycenter.y=yTot/cxLocation.Count;
   169         barycenter.z=zTot/cxLocation.Count;
   174         for (
int i=0; i < atomPositionList.Count; i++){
   175             vertices.Add(atomPositionList[i]);
   177             if(i==atomPositionList.Count-1){ 
   178                 vertices.Add(barycenter); 
   181                 triangles.Add(atomPositionList.Count); 
   182                 trianglesback.Add (atomPositionList.Count);
   183                 trianglesback.Add(0);
   184                 trianglesback.Add (i);
   188                 triangles.Add(atomPositionList.Count); 
   189                 trianglesback.Add (atomPositionList.Count);
   190                 trianglesback.Add(i+1);
   191                 trianglesback.Add(i);
   195         index=index+atomPositionList.Count; 
   197         mymesh.vertices=vertices.ToArray();
   198         mymesh.triangles=triangles.ToArray();
   199         mymesh.RecalculateNormals();
   200         mymesh.colors32=ColorList.ToArray();
   201         backmesh.vertices=vertices.ToArray();
   202         backmesh.triangles=trianglesback.ToArray();
   203         backmesh.RecalculateNormals();
   204         backmesh.colors32=ColorList.ToArray();
   206         Mesh[] TWOMESH= 
new Mesh[2]{mymesh, backmesh};
   220         GameObject papobj = 
new GameObject(
"RingBlending");
   221         papobj.tag = 
"RingBlending";
   222         papobj.AddComponent<MeshFilter>();
   223         papobj.AddComponent<MeshRenderer>();
   224         papobj.GetComponent<MeshFilter>().mesh = mesh;
   225         papobj.GetComponent<Renderer>().material = 
new Material(Shader.Find(
"Transparent/Diffuse"));
   229             papobj.GetComponent<Renderer>().material.color=
new Color(0.7f,0.7f,0.7f,0.5f);
   236         GameObject oxysphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
   237         oxysphere.tag = 
"OxySphere";
   238         Vector3 point = 
new Vector3(atomsLocationlist [pos] [0],atomsLocationlist [pos] [1],atomsLocationlist [pos] [2]);
   240         oxysphere.transform.position = point;
   241         oxysphere.GetComponent<Renderer>().material.color = Color.red;
   242         oxysphere.transform.localScale = 
new Vector3(1, 1, 1);
   248         List<GameObject> result = 
new List<GameObject>();
   249         for (
int i=0; i<this.cycles.Count; i++) {
   250             for (
int j=0; j<this.cycles[i].Count; j++) {
 
List< GameObject > createAllMesh()
this fonction will call the other functions to create all mesh and also create gameobject. 
 
GameObject CreateOxygenSphere(int pos)
 
List< float[]> atomsLocationlist
 
this class is made to fill cycle inside a molecule with a semi-transparent polygon to have a effect o...
 
List< string > residueslist
 
static List< string > atomsNamelist
The name of each atom. 
 
List< GameObject > CreateRingBlending()
This function will convert the molecule to a "graph" (an object "GraphVertex" is made from each atoms...
 
List< GameObject > ShowOxySphere()
 
GameObject createPCObj(Mesh mesh, string res)
Create an object "RingBlending" (polygon which fill a cycle). 
 
List< GraphVertex > molAsGraph
 
!WiP manage GUI, and provide static strings for the GUI. 
 
List< float[]> coordinates
 
static List< int[]> bondEPList
The bonds between atoms. 
 
List< List< int > > cycles
 
This class is made to convert an atom (postion X,Y,Z) to a object with a list of neighbor. 
 
static List< string > atomsResnamelist
The name of the residue to which each atom belongs. 
 
static Dictionary< string, Color > colorByResiduesDict
 
static Mesh[] createAMeshPC(List< float[]> cxLocation)
This function will create two mesh. 
 
static List< float[]> atomsLocationlist
The coordinates of each atom.