Example #1
0
// We are going to override (is that the right word?) the draw()
// method of ModelerView to draw out RobotArm
void RobotArm::draw()
{
	/* pick up the slider values */

	float theta = VAL( BASE_ROTATION );
	float phi = VAL( LOWER_TILT );
	float psi = VAL( UPPER_TILT );
	float cr = VAL( CLAW_ROTATION );
	float h1 = VAL( BASE_LENGTH );
	float h2 = VAL( LOWER_LENGTH );
	float h3 = VAL( UPPER_LENGTH );
	float pc = VAL( PARTICLE_COUNT );


    // This call takes care of a lot of the nasty projection 
    // matrix stuff
	ModelerView::draw();
	static GLfloat lmodel_ambient[] = { 0.4, 0.4, 0.4, 1.0 };
	Mat4f temp = getModelViewMatrix();

	// define the model

	ground(-0.2);
	
	if (true) {
		Ariou();
	} else {
		base(0.8);

	    glTranslatef( 0.0, 0.8, 0.0 );			// move to the top of the base
	    glRotatef( theta, 0.0, 1.0, 0.0 );		// turn the whole assembly around the y-axis. 
		rotation_base(h1);						// draw the rotation base

	    glTranslatef( 0.0, h1, 0.0 );			// move to the top of the base
	    glRotatef( phi, 0.0, 0.0, 1.0 );		// rotate around the z-axis for the lower arm
		glTranslatef( -0.1, 0.0, 0.4 );
		lower_arm(h2);							// draw the lower arm

	    glTranslatef( 0.0, h2, 0.0 );			// move to the top of the lower arm
	    glRotatef( psi, 0.0, 0.0, 1.0 );		// rotate  around z-axis for the upper arm
		upper_arm(h3);							// draw the upper arm

		glTranslatef( 0.0, h3, 0.0 );
		glRotatef(cr, 0.0, 0.0, 1.0);
		claw(1.0);
		SpawnParticles(temp);
	}

	//*** DON'T FORGET TO PUT THIS IN YOUR OWN CODE **/
	endDraw();
}
Example #2
0
// N tamaƱo del nodo de mayor grado (estrella)
vector<nodo> ninja(int n) {
    vector<nodo> estrella = claw(n);
    vector<nodo> clique = k((n+1)/2);
    int nodosFronteraPorVertice = n-((n+1)/2);
    for (unsigned i = 0; i < (unsigned) (n+1)/2; ++i) {
        for (int j = 0; j < nodosFronteraPorVertice; ++j) {
            nodo nuevo;
            clique.push_back(nuevo);
            clique[clique.size() - 1].indice = clique.size() - 1;
            clique[clique.size() - 1].adyacentes.insert(i);
            clique[i].adyacentes.insert((indice_nodo) clique.size() - 1);
        }
    }
    vector<nodo> Gunion = graph_union(estrella, clique);
    // Tomo el clique un nodo de la "frontera" y lo uno con un nodo "frontera" de la estrella
    Gunion[1].adyacentes.insert((indice_nodo) Gunion.size() - 1);
    Gunion[Gunion.size() - 1].adyacentes.insert(1);
    return Gunion;
}
Example #3
0
// We are going to override (is that the right word?) the draw()
// method of ModelerView to draw out RobotArm
void RobotArm::draw()
{
    /* pick up the slider values */
    float theta = baseRotation.getValue();
    float phi = lowerTilt.getValue();
    float psi = upperTilt.getValue();
    float cr = clawRotation.getValue();
    float h1 = baseLength.getValue();
    float h2 = lowerLength.getValue();
    float h3 = upperLength.getValue();




    static GLfloat lmodel_ambient[] = {0.4,0.4,0.4,1.0};

    // define the model

    ground(-0.2);

    base(0.8);

    glTranslatef( 0.0, 0.8, 0.0 );			// move to the top of the base
    glRotatef( theta, 0.0, 1.0, 0.0 );		// turn the whole assembly around the y-axis.
    rotation_base(h1);						// draw the rotation base

    glTranslatef( 0.0, h1, 0.0 );			// move to the top of the base
    glRotatef( phi, 0.0, 0.0, 1.0 );		// rotate around the z-axis for the lower arm
    glTranslatef( -0.1, 0.0, 0.4 );
    lower_arm(h2);							// draw the lower arm

    glTranslatef( 0.0, h2, 0.0 );			// move to the top of the lower arm
    glRotatef( psi, 0.0, 0.0, 1.0 );		// rotate  around z-axis for the upper arm
    upper_arm(h3);							// draw the upper arm

    glTranslatef( 0.0, h3, 0.0 );
    glRotatef( cr, 0.0, 0.0, 1.0 );
    claw(1.0);

}
Example #4
0
// Ver http://www.graphclasses.org/smallgraphs.html#K2Uclaw
vector<nodo> kn_union_claw_m_complemento(int n, int m) {
    vector<nodo> kn = k(n);
    vector<nodo> k1_n = claw(m);
    vector<nodo> Gunion = graph_union(kn, k1_n);
    return complemento(Gunion);
}