Changeset 10308 in orxonox.OLD for branches/mount_points
- Timestamp:
- Jan 23, 2007, 10:57:30 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mount_points/src/lib/graphics/importer/static_model.cc
r10307 r10308 117 117 118 118 PRINTF(0)("Found a MountPoint: %s\n", groupName.c_str()); 119 120 StaticModelData::Face triangle[3]; 119 121 120 122 // now check if it is a mount point identifier … … 127 129 // now iterate through all faces 128 130 std::vector<StaticModelData::Face>::const_iterator faceIt = (*groupIt)._faces.begin(); 129 for( ; faceIt < (*groupIt)._faces.end(); faceIt++)131 for( int i = 0; faceIt < (*groupIt)._faces.end(); faceIt++) 130 132 { 131 133 if( (*faceIt)._elements.size() == 3) 132 134 { 135 triangle[i++] = (*faceIt); 133 136 printf("got triangle\n"); 134 137 } 138 } 139 140 // now process all points 141 for( int i = 0; i < 3; i++) 142 { 143 // convert the float vertices to vectors 144 Vector a( this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3], 145 this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 1], 146 this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 2]); 147 Vector b( this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3], 148 this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 1], 149 this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 2]); 150 Vector c( this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3], 151 this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 1], 152 this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 2]); 153 154 Vector ab = a - b; 155 Vector ac = a - c; 156 Vector bc = b - c; 157 158 Vector* center = NULL; 159 // now find the center point (the one with the 90degree angle) 160 if( ab.dot( ac) < 0.01) 161 center = &a; 162 else if( ab.dot(bc) < 0.01) 163 center = &b; 164 else if( bc.dot(ac) < 0.01) 165 center = &c; 166 167 if( center != NULL) 168 PRINTF(0)("found a center\n"); 135 169 } 136 170
Note: See TracChangeset
for help on using the changeset viewer.