Exemplo n.º 1
0
void __fastcall Tunnel::MakeCouloir( GLuint listNb, char *nom )
{
    short i;
    GLfloat prod[3];
    GLfloat T, dT;
    GLfloat dir[10][3];
    short nseg = strlen(nom)/2;

//    MakeDir(nom, nseg, dir);

    T = 0;
    dT = (GLfloat) (TREP / (LSEG + (1.0 - 1.0/nseg) * PI * RSEG ));

    ///////////////////////
    // Couloir's list
    ///////////////////////

    glNewList(listNb, GL_COMPILE);
      // Cylindre 1
      MakeCylinder(&T, dT);
      glTranslatef(0, 0, -LSEG);

      for(i=2 ; i<=nseg ; i++)
      {
        // Rotation initiale pour s'aligner avec la definition de la jonction
        Cross(prod, dir[i-2], dir[i]);
        if(Compare(prod, Vnul))
        {
          if(Compare(dir[i-2], dir[i])) glRotatef(180, 0, 0, 1);
        }
        else
        {
          if(Compare(prod, dir[i-1])) glRotatef(90, 0, 0, 1);
          else glRotatef(-90, 0, 0, 1);
        }

        // Jonction i
        MakeJunction(&T, dT);

        // Translation & rotation
        glTranslatef(0, RSEG, -RSEG);   // remise en position
        glRotatef(90, 1, 0, 0);         // rotation d'axe x

        // Cylindre i+1
        MakeCylinder(&T, dT);

        // Translation
        glTranslatef(0, 0, -LSEG);
      }
    glEndList();
}
Exemplo n.º 2
0
void CCylinder::MakeTransformedShape(const gp_Trsf &mat)
{
	m_pos.Transform(mat);
	double scale = gp_Vec(1, 0, 0).Transformed(mat).Magnitude();
	m_radius = fabs(m_radius * scale);
	m_height = fabs(m_height * scale);
	m_shape = MakeCylinder(m_pos, m_radius, m_height);
}
Exemplo n.º 3
0
	void Mesh::MakeMesh(MeshType type, uint steps)
	{
		switch (type)
		{
		case MeshType::MeshTypeCube:
			MakeCube();
			break;
		case MeshType::MeshTypeCylinder:
			MakeCylinder(steps);
			break;
		case MeshType::MeshTypeSphere:
			MakeSphere(steps);
			break;
		default:
			Trace::WriteLine(String::Format("Unknown mesh type:{0}", type));
			break;
		}
	}
Exemplo n.º 4
0
CCylinder::CCylinder(const gp_Ax2& pos, double radius, double height, const wxChar* title, const HeeksColor& col, float opacity):CSolid(MakeCylinder(pos, radius, height), title, col, opacity), m_pos(pos), m_radius(radius), m_height(height)
{
}