Example #1
0
void cytosineGuanine()
{
    float hex1[6][2], hex2[6][2];
    float rx=512;
    //radius and color declarations
    GLubyte red[] = {15, 231, 76, 60};          //oxygen
    GLubyte green[] = {20, 39, 174, 96};        //carbon
    GLubyte blue[] = {20, 52, 152, 219};         //nitrogen
    GLubyte yellow[] = {10, 241, 196, 15};    //hydrogen
    getHexagonPoints(hex1, -192, 350, 75);
    getHexagonPoints(hex2, 192, 350, 75);
    
    glPushMatrix();

    	glTranslatef(rx, 0, 0);
    	glRotatef(theta, 0.0, 1.0, 0.0);
   		
   		 //hexagon 1
	    drawAtom(hex1[0][0], hex1[0][1], 0, green);
	    drawAtom(hex1[1][0], hex1[1][1], 0, blue);
	    drawAtom(hex1[2][0], hex1[2][1], 0, green);
	    drawAtom(hex1[3][0], hex1[3][1], 0, green);
	    drawAtom(hex1[4][0], hex1[4][1], 0, green);
	    drawAtom(hex1[5][0], hex1[5][1], 0, blue);
	    drawBondLine(hex1[0][0],hex1[0][1],0, hex1[1][0],hex1[1][1],0);
	    drawBondLine(hex1[1][0],hex1[1][1],0, hex1[2][0],hex1[2][1],0);
	    drawBondLine(hex1[2][0],hex1[2][1],0, hex1[3][0],hex1[3][1],0);
	    drawBondLine(hex1[3][0],hex1[3][1],0, hex1[4][0],hex1[4][1],0);
	    drawBondLine(hex1[4][0],hex1[4][1],0, hex1[5][0],hex1[5][1],0);
	    drawBondLine(hex1[5][0],hex1[5][1],0, hex1[0][0],hex1[0][1],0);

	    drawAtom(hex1[0][0], hex1[0][1]-50, 0, red);
	    drawBondLine(hex1[0][0],hex1[0][1],0, hex1[0][0],hex1[0][1]-50,0);

	    drawAtom(hex1[2][0]+50, hex1[2][1]+25, -50, blue);
	    drawBondLine(hex1[2][0],hex1[2][1],0, hex1[2][0]+50,hex1[2][1]+25,-50);
		    drawAtom(hex1[2][0]+50,hex1[2][1]+67.5, -50, yellow);
		    drawBondLine(hex1[2][0]+50,hex1[2][1]+25,-50, hex1[2][0]+50,hex1[2][1]+67.5,-50);
		    drawAtom(hex1[2][0]+85,hex1[2][1],-50, yellow);
		    drawBondLine(hex1[2][0]+50,hex1[2][1]+25,-50, hex1[2][0]+85,hex1[2][1],-50);
		    
	    drawAtom(hex1[3][0],hex1[3][1]+25, -50, yellow);   
	    drawBondLine(hex1[3][0],hex1[3][1],0, hex1[3][0],hex1[3][1]+25,-50);

		drawAtom(hex1[4][0]-15,hex1[4][1]+15, 50, yellow);   
	    drawBondLine(hex1[4][0],hex1[4][1],0, hex1[4][0]-15,hex1[4][1]+15,50);


	    //hexagon 2
	    drawAtom(hex2[0][0], hex2[0][1], 0, blue);
	    drawAtom(hex2[1][0], hex2[1][1], 0, green);
	    drawAtom(hex2[2][0], hex2[2][1], 0, green);
	    drawAtom(hex2[3][0], hex2[3][1], 0, green);
	    drawAtom(hex2[4][0], hex2[4][1], 0, blue);
	    drawAtom(hex2[5][0], hex2[5][1], 0, green);
	    drawBondLine(hex2[0][0],hex2[0][1],0, hex2[1][0],hex2[1][1],0);
	    drawBondLine(hex2[1][0],hex2[1][1],0, hex2[2][0],hex2[2][1],0);
	    drawBondLine(hex2[2][0],hex2[2][1],0, hex2[3][0],hex2[3][1],0);
	    drawBondLine(hex2[3][0],hex2[3][1],0, hex2[4][0],hex2[4][1],0);
	    drawBondLine(hex2[4][0],hex2[4][1],0, hex2[5][0],hex2[5][1],0);
	    drawBondLine(hex2[5][0],hex2[5][1],0, hex2[0][0],hex2[0][1],0);

	    drawAtom(hex2[1][0]+50, hex2[0][1]+25, 50, blue);
	    drawBondLine(hex2[1][0],hex2[1][1],0, hex2[1][0]+50,hex2[0][1]+25,50);
	    drawAtom(hex2[2][0]+50, hex2[3][1]-25, 50, blue);
	    drawBondLine(hex2[2][0],hex2[2][1],0, hex2[2][0]+50,hex2[3][1]-25,50);
		    drawAtom(hex2[2][0]+100,hex2[2][1]-37.5,75, green);
		    drawBondLine(hex2[1][0]+50, hex2[0][1]+25, 50, hex2[2][0]+100,hex2[2][1]-37.5,75); 
		    drawBondLine(hex2[2][0]+50, hex2[3][1]-25, 50, hex2[2][0]+100,hex2[2][1]-37.5,75);
			    drawAtom(hex2[2][0]+142.5,hex2[2][1]-37.5,75, yellow);
			    drawBondLine(hex2[2][0]+100,hex2[2][1]-37.5,75, hex2[2][0]+142.5,hex2[2][1]-37.5,75);

	    drawAtom(hex2[3][0], hex2[3][1]+50, 0, red);
	    drawBondLine(hex2[3][0],hex2[3][1],0, hex2[3][0],hex2[3][1]+50,0);

	    drawAtom(hex2[4][0]-25, hex2[4][1]+25, 0, yellow);
	    drawBondLine(hex2[4][0],hex2[4][1],0, hex2[4][0]-25,hex2[4][1]+25,0);
		
		drawAtom(hex2[5][0]-50, hex2[0][1]+25, 50, blue);   
	    drawBondLine(hex2[5][0],hex2[5][1],0, hex2[5][0]-50,hex2[0][1]+25,50);
		    drawAtom(hex2[5][0]-50, hex2[0][1]-15, 50, yellow);
		    drawBondLine(hex2[5][0]-50,hex2[0][1]+25,50, hex2[5][0]-50,hex2[0][1]-15,50);
		    drawAtom(hex2[5][0]-85, hex2[0][1]+60, 50, yellow);
		    drawBondLine(hex2[5][0]-50,hex2[0][1]+25,50, hex2[5][0]-85,hex2[0][1]+60,50);
	    

	    //H-bonds
	    glLineWidth(1.5);
	    glBegin(GL_LINES);
		    glVertex3f(hex1[0][0],hex1[0][1]-50,0);
		    glVertex3f(hex2[5][0]-85,hex2[0][1]+60,50);

		    glVertex3f(hex1[1][0],hex1[1][1],0);
		    glVertex3f(hex2[4][0]-25,hex2[4][1]+25,0);

		    glVertex3f(hex1[2][0]+85,hex1[2][1],-50);
		    glVertex3f(hex2[3][0],hex2[3][1]+50,0);
		glEnd();

	    glTranslatef(-rx, 0, 0);

	glPopMatrix();
	theta+=0.25;

    drawLegend();
    glColor3ub(52, 73, 94);
    output(300, 190, "Cytosine recognizes specific DNA sequences and catalyzes", fonts[2]);
    output(300, 170, "the transfer of a methyl group.", fonts[2]);
    output(300, 130, "Guanine can carry energy and if bound to special receptors,", fonts[2]);
    output(300, 110, "can help carry signals from one part of the cell to another.", fonts[2]);
}
PointCloudPtr ContourGenerator::M30_H()
{
    return getContour(getHexagonPoints(0.02875));
}
Example #3
0
void adenineThymine()
{
	float hex1[6][2], hex2[6][2];
	float rx=512;
    //radius and colors declarations
    GLubyte red[] = {15, 231, 76, 60};          //oxygen
    GLubyte green[] = {20, 39, 174, 96};        //carbon
    GLubyte blue[] = {20, 52, 152, 219};         //nitrogen
    GLubyte yellow[] = {10, 241, 196, 15};    //hydrogen
    getHexagonPoints(hex1, -128, 350, 75);
    getHexagonPoints(hex2, 128, 350, 75);
    
    glPushMatrix();

    	glTranslatef(rx, 0, 0);
    	glRotatef(theta, 0.0, 1.0, 0.0);

	    //hexagon 1
	    drawAtom(hex1[0][0], hex1[0][1], 0, green);
	    drawAtom(hex1[1][0], hex1[1][1], 0, blue);
	    drawAtom(hex1[2][0], hex1[2][1], 0, green);
	    drawAtom(hex1[3][0], hex1[3][1], 0, green);
	    drawAtom(hex1[4][0], hex1[4][1], 0, green);
	    drawAtom(hex1[5][0], hex1[5][1], 0, blue);
	    drawBondLine(hex1[0][0],hex1[0][1],0, hex1[1][0],hex1[1][1],0);
	    drawBondLine(hex1[1][0],hex1[1][1],0, hex1[2][0],hex1[2][1],0);
	    drawBondLine(hex1[2][0],hex1[2][1],0, hex1[3][0],hex1[3][1],0);
	    drawBondLine(hex1[3][0],hex1[3][1],0, hex1[4][0],hex1[4][1],0);
	    drawBondLine(hex1[4][0],hex1[4][1],0, hex1[5][0],hex1[5][1],0);
	    drawBondLine(hex1[5][0],hex1[5][1],0, hex1[0][0],hex1[0][1],0);

	    drawAtom(hex1[0][0], hex1[0][1]-50, 0, red);
	    drawBondLine(hex1[0][0],hex1[0][1],0, hex1[0][0],hex1[0][1]-50,0);

	    drawAtom(hex1[1][0]+15, hex1[1][1]-15, -50, yellow);
	    drawBondLine(hex1[1][0],hex1[1][1],0, hex1[1][0]+15,hex1[1][1]-15,-50);

	    drawAtom(hex1[2][0]+40, hex1[2][1]+40, 0, red);
	    drawBondLine(hex1[2][0],hex1[2][1],0, hex1[2][0]+40,hex1[2][1]+40,0);
	    
	    drawAtom(hex1[3][0], hex1[3][1]+50, 0, green);
	    drawBondLine(hex1[3][0],hex1[3][1],0, hex1[3][0],hex1[3][1]+50,0);
		    drawAtom(hex1[3][0], hex1[3][1]+75, 50, yellow);
		    drawBondLine(hex1[3][0],hex1[3][1]+50,0, hex1[3][0],hex1[3][1]+75,50);
		    drawAtom(hex1[3][0]+35, hex1[3][1]+75, -35, yellow);
		    drawBondLine(hex1[3][0],hex1[3][1]+50,0, hex1[3][0]+35,hex1[3][1]+75,-35);
		    drawAtom(hex1[3][0]-35, hex1[3][1]+75, -35, yellow);
		    drawBondLine(hex1[3][0],hex1[3][1]+50,0, hex1[3][0]-35,hex1[3][1]+75,-35);

		drawAtom(hex1[4][0]-15,hex1[4][1]+15, 50, yellow);   
	    drawBondLine(hex1[4][0],hex1[4][1],0, hex1[4][0]-15,hex1[4][1]+15,50);


	    //hexagon 2
	    drawAtom(hex2[0][0], hex2[0][1], 0, blue);
	    drawAtom(hex2[1][0], hex2[1][1], 0, green);
	    drawAtom(hex2[2][0], hex2[2][1], 0, green);
	    drawAtom(hex2[3][0], hex2[3][1], 0, green);
	    drawAtom(hex2[4][0], hex2[4][1], 0, blue);
	    drawAtom(hex2[5][0], hex2[5][1], 0, green);
	    drawBondLine(hex2[0][0],hex2[0][1],0, hex2[1][0],hex2[1][1],0);
	    drawBondLine(hex2[1][0],hex2[1][1],0, hex2[2][0],hex2[2][1],0);
	    drawBondLine(hex2[2][0],hex2[2][1],0, hex2[3][0],hex2[3][1],0);
	    drawBondLine(hex2[3][0],hex2[3][1],0, hex2[4][0],hex2[4][1],0);
	    drawBondLine(hex2[4][0],hex2[4][1],0, hex2[5][0],hex2[5][1],0);
	    drawBondLine(hex2[5][0],hex2[5][1],0, hex2[0][0],hex2[0][1],0);

	    drawAtom(hex2[1][0]+50, hex2[0][1]+25, 50, blue);
	    drawBondLine(hex2[1][0],hex2[1][1],0, hex2[1][0]+50,hex2[0][1]+25,50);
	    drawAtom(hex2[2][0]+50, hex2[3][1]-25, 50, blue);
	    drawBondLine(hex2[2][0],hex2[2][1],0, hex2[2][0]+50,hex2[3][1]-25,50);
		    drawAtom(hex2[2][0]+100,hex2[2][1]-37.5,75, green);
		    drawBondLine(hex2[1][0]+50, hex2[0][1]+25, 50, hex2[2][0]+100,hex2[2][1]-37.5,75); 
		    drawBondLine(hex2[2][0]+50, hex2[3][1]-25, 50, hex2[2][0]+100,hex2[2][1]-37.5,75);
			    drawAtom(hex2[2][0]+142.5,hex2[2][1]-37.5,75, yellow);
			    drawBondLine(hex2[2][0]+100,hex2[2][1]-37.5,75, hex2[2][0]+142.5,hex2[2][1]-37.5,75);

	    drawAtom(hex2[3][0], hex2[3][1]+50, 0, blue);
	    drawBondLine(hex2[3][0],hex2[3][1],0, hex2[3][0],hex2[3][1]+50,0);
		    drawAtom(hex2[3][0], hex2[3][1]+75, 50, yellow);
		    drawBondLine(hex2[3][0], hex2[3][1]+50,0, hex2[3][0],hex2[3][1]+75,50);
		    drawAtom(hex2[3][0], hex2[3][1]+75, -50, yellow);
		    drawBondLine(hex2[3][0],hex2[3][1]+50,0, hex2[3][0],hex2[3][1]+75,-50);
	    
		drawAtom(hex2[5][0]-30,hex2[5][1]-30, 0, yellow);   
	    drawBondLine(hex2[5][0],hex2[5][1],0, hex2[5][0]-30,hex2[5][1]-30,0);


	    //H-bonds
	    glLineWidth(1.5);
	    glBegin(GL_LINES);
	    	glVertex3f(hex1[2][0]+40,hex1[2][1]+40,0);
	    	glVertex3f(hex2[3][0], hex2[3][1]+75, 50);

	    	glVertex3f(hex1[1][0]+15, hex1[1][1]-15, -50);
	    	glVertex3f(hex2[4][0],hex2[4][1],0);
	    glEnd();

	    glTranslatef(-rx, 0, 0);

	glPopMatrix();
	theta+=0.25;

    drawLegend();
    glColor3ub(52, 73, 94);
    output(300, 190, "Adenine is a nucleobase which plays a major role in", fonts[2]);
    output(300, 170, "cellular respiration and is rich in adenosine.", fonts[2]);
    output(300, 130, "Thymine is a pyrimidine nucleobase and it", fonts[2]);
    output(300, 110, "assists in stabalizing the nucleic acid structures.", fonts[2]);

}