Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3079 in orxonox.OLD for orxonox/trunk/importer/object.cc


Ignore:
Timestamp:
Dec 4, 2004, 10:13:45 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk/importer: added Commnt, made the delete []normArray work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/importer/object.cc

    r3078 r3079  
    767767}
    768768
    769 
     769/**
     770   \brief A routine that is able to create normals.
     771   The algorithm does the following:
     772   1. It calculates creates Vectors for each normale, and sets them to zero.
     773   2. It then Walks through a) all the Groups b) all the Faces c) all the FaceElements
     774   3. It searches for a points two neighbours per Face, takes Vecotrs to them calculates FaceNormals and adds it to the Points Normal.
     775   4. It goes through all the normale-Points and calculates the VertexNormale and includes it in the normals-Array.
     776*/
    770777bool Object::buildVertexNormals ()
    771778{
     779  if (verbose >=2)
     780    printf("Normals are being calculated.\n");
    772781
    773782  Vector* normArray = new Vector [vertices->getCount()/3];
    774   for (int i=0; i<=vertices->getCount()/3;i++)
     783  for (int i=0; i<vertices->getCount()/3;i++)
    775784    normArray[i] = Vector(.0,.0,.0);
    776785
     
    823832    {
    824833      normArray[i].normalize();
    825       //      printf("%f, %f, %f.\n",normArray[i].x, normArray[i].y, normArray[i].z );
     834      if (verbose >=3)
     835        printf ("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);
     836
    826837      normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z);
    827838
    828839    }
    829   delete [] normArray;
     840  delete []normArray;
    830841}
    831842
Note: See TracChangeset for help on using the changeset viewer.