- Timestamp:
- Jan 23, 2007, 11:37:13 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mount_points/src/lib/graphics/importer/static_model.cc
r10309 r10310 138 138 } 139 139 140 141 Vector center; 142 Vector xAxis; 143 Vector yAxis; 144 Vector zAxis; 140 145 // now process all points 141 146 for( int i = 0; i < 3; i++) … … 145 150 this->data->getVertices()[triangle[i]._elements[0].vertexNumber * 3 + 1], 146 151 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]);152 Vector b( this->data->getVertices()[triangle[i]._elements[1].vertexNumber * 3], 153 this->data->getVertices()[triangle[i]._elements[1].vertexNumber * 3 + 1], 154 this->data->getVertices()[triangle[i]._elements[1].vertexNumber * 3 + 2]); 155 Vector c( this->data->getVertices()[triangle[i]._elements[2].vertexNumber * 3], 156 this->data->getVertices()[triangle[i]._elements[2].vertexNumber * 3 + 1], 157 this->data->getVertices()[triangle[i]._elements[2].vertexNumber * 3 + 2]); 153 158 154 159 Vector ab = a - b; … … 156 161 Vector bc = b - c; 157 162 158 Vector* center = NULL; 163 Vector axis1; 164 Vector axis2; 159 165 // now find the center point (the one with the 90degree angle) 160 if( fabs(ab.dot( ac)) < 0.01) 161 center = &a; 162 else if( fabs(ab.dot(bc)) < 0.01) 163 center = &b; 164 else if( fabs(bc.dot(ac)) < 0.01) 165 center = &c; 166 167 center->debug(); 166 if( fabs(ab.dot( ac)) < 0.0001) 167 { 168 center = a; 169 axis1 = b - a; 170 axis2 = c - a; 171 } 172 else if( fabs(ab.dot(bc)) < 0.0001) 173 { 174 center = b; 175 axis1 = a - b; 176 axis2 = c - b; 177 } 178 else if( fabs(bc.dot(ac)) < 0.0001) 179 { 180 center = c; 181 axis1 = b - c; 182 axis2 = a - c; 183 } 184 185 186 // get the longest axis (without defining a max() funciton :D 187 if( xAxis.len() < axis1.len() ) 188 xAxis = axis1; 189 if( xAxis.len() < axis2.len()) 190 xAxis = axis2; 191 192 xAxis.debug(); 193 194 195 if( xAxis.len() > axis1.len() && yAxis.len() < axis1.len()) 196 yAxis = axis1; 197 if( xAxis.len() > axis2.len() && yAxis.len() < axis2.len()) 198 yAxis = axis2; 199 200 yAxis.debug(); 201 202 // needed... no explanation here.. 203 if( zAxis.len() == 0.) 204 zAxis = yAxis; 205 206 if( yAxis.len() > axis1.len() ) 207 zAxis = axis1; 208 if( yAxis.len() > axis2.len() ) 209 zAxis = axis2; 210 211 zAxis.debug(); 168 212 169 213 }
Note: See TracChangeset
for help on using the changeset viewer.