Changeset 1025 for GTP/trunk/Lib/Geom
- Timestamp:
- 06/20/06 13:28:51 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared
- Files:
-
- 1 added
- 1 deleted
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
r1018 r1025 418 418 419 419 // 2 min. 420 // Calcular los siguiente teniendo en cuenta el QSLIM.420 // Calcular los siguiente teniendo en cuenta el simplif. 421 421 for (i = 0; i < Ordenacion.size(); i++) 422 422 { -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/AdjModel.cxx
r774 r1025 7 7 mlab: (Id: polymodel.cc,v 1.21 1997/02/06 16:34:14 garland Exp) 8 8 via 9 QSlim: (Id: polymodel.cc,v 1.5 1997/02/25 20:36:36 garland Exp)9 simplif: (Id: polymodel.cc,v 1.5 1997/02/25 20:36:36 garland Exp) 10 10 11 11 ************************************************************************/ … … 13 13 #include "AdjModel.h" 14 14 15 using namespace qslim;15 using namespace simplif; 16 16 17 17 int Model::in_Vertex(const Vec3& p) … … 329 329 /* // SUS: recalcular la normal en los triangulos cambiados no degenerados 330 330 331 qslim::Vertex * auxv0 = F->vertex(0);332 qslim::Vertex * auxv1 = F->vertex(1);333 qslim::Vertex * auxv2 = F->vertex(2);334 qslim::Vec3 vd1(auxv1->operator[](qslim::X) - auxv0->operator[](qslim::X),335 auxv1->operator[]( qslim::Y) - auxv0->operator[](qslim::Y),336 auxv1->operator[]( qslim::Z) - auxv0->operator[](qslim::Z));337 qslim::Vec3 vd2(auxv2->operator[](qslim::X) - auxv0->operator[](qslim::X),338 auxv2->operator[]( qslim::Y) - auxv0->operator[](qslim::Y),339 auxv2->operator[]( qslim::Z) - auxv0->operator[](qslim::Z));340 341 qslim::unitize(vd1);342 qslim::unitize(vd2);343 344 qslim::Vec3 vn = vd1 ^ vd2;345 qslim::unitize(vn);331 simplif::Vertex * auxv0 = F->vertex(0); 332 simplif::Vertex * auxv1 = F->vertex(1); 333 simplif::Vertex * auxv2 = F->vertex(2); 334 simplif::Vec3 vd1(auxv1->operator[](simplif::X) - auxv0->operator[](simplif::X), 335 auxv1->operator[](simplif::Y) - auxv0->operator[](simplif::Y), 336 auxv1->operator[](simplif::Z) - auxv0->operator[](simplif::Z)); 337 simplif::Vec3 vd2(auxv2->operator[](simplif::X) - auxv0->operator[](simplif::X), 338 auxv2->operator[](simplif::Y) - auxv0->operator[](simplif::Y), 339 auxv2->operator[](simplif::Z) - auxv0->operator[](simplif::Z)); 340 341 simplif::unitize(vd1); 342 simplif::unitize(vd2); 343 344 simplif::Vec3 vn = vd1 ^ vd2; 345 simplif::unitize(vn); 346 346 347 347 //auxf->vertex_normals[0] = vn; 348 348 //auxf->vertex_normals[1] = vn; 349 349 //auxf->vertex_normals[2] = vn; 350 F->vertex_normals[0][ qslim::X] = vn[qslim::X];351 F->vertex_normals[0][ qslim::Y] = vn[qslim::Y];352 F->vertex_normals[0][ qslim::Z] = vn[qslim::Z];353 F->vertex_normals[1][ qslim::X] = vn[qslim::X];354 F->vertex_normals[1][ qslim::Y] = vn[qslim::Y];355 F->vertex_normals[1][ qslim::Z] = vn[qslim::Z];356 F->vertex_normals[2][ qslim::X] = vn[qslim::X];357 F->vertex_normals[2][ qslim::Y] = vn[qslim::Y];358 F->vertex_normals[2][ qslim::Z] = vn[qslim::Z];*/350 F->vertex_normals[0][simplif::X] = vn[simplif::X]; 351 F->vertex_normals[0][simplif::Y] = vn[simplif::Y]; 352 F->vertex_normals[0][simplif::Z] = vn[simplif::Z]; 353 F->vertex_normals[1][simplif::X] = vn[simplif::X]; 354 F->vertex_normals[1][simplif::Y] = vn[simplif::Y]; 355 F->vertex_normals[1][simplif::Z] = vn[simplif::Z]; 356 F->vertex_normals[2][simplif::X] = vn[simplif::X]; 357 F->vertex_normals[2][simplif::Y] = vn[simplif::Y]; 358 F->vertex_normals[2][simplif::Z] = vn[simplif::Z];*/ 359 359 360 360 } -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/AdjModel.h
r774 r1025 10 10 mlab: (Id: polymodel.h,v 1.13 1997/02/06 16:30:11 garland Exp) 11 11 via 12 QSlim: (Id: polymodel.h,v 1.1 1997/02/11 15:21:29 garland Exp)12 simplif: (Id: polymodel.h,v 1.1 1997/02/11 15:21:29 garland Exp) 13 13 14 14 ************************************************************************/ … … 18 18 #include <vector> 19 19 20 namespace qslim20 namespace simplif 21 21 { 22 22 class Model : public SMF_Model … … 58 58 // Basic model accessor functions 59 59 // 60 qslim::Vertex *vertex(int i) { return vertices(i); }61 qslim::Vec3 & normal(int i){ return normals(i); }62 qslim::Vec2 & texcoord(int i){ return texcoords(i); }63 qslim::Edge *edge(int i) { return edges(i); }64 qslim::Face *face(int i) { return faces(i); }60 simplif::Vertex *vertex(int i) { return vertices(i); } 61 simplif::Vec3 & normal(int i){ return normals(i); } 62 simplif::Vec2 & texcoord(int i){ return texcoords(i); } 63 simplif::Edge *edge(int i) { return edges(i); } 64 simplif::Face *face(int i) { return faces(i); } 65 65 66 66 int vertCount() { return vertices.length(); } -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/AdjPrims.cxx
r774 r1025 7 7 mlab: (Id: primitives.cc,v 1.7 1997/02/06 16:32:45 garland Exp) 8 8 via 9 QSlim: (Id: primitives.cc,v 1.2 1997/02/18 21:11:27 garland Exp)9 simplif: (Id: primitives.cc,v 1.2 1997/02/18 21:11:27 garland Exp) 10 10 11 11 ************************************************************************/ … … 13 13 #include "AdjPrims.h" 14 14 15 using namespace qslim;15 using namespace simplif; 16 16 17 17 void Vertex::kill() … … 215 215 216 216 217 void qslim::untagFaceLoop(Vertex *v)217 void simplif::untagFaceLoop(Vertex *v) 218 218 { 219 219 edge_buffer& edges = v->edgeUses(); … … 227 227 } 228 228 229 void qslim::collectFaceLoop(Vertex *v, face_buffer& loop)229 void simplif::collectFaceLoop(Vertex *v, face_buffer& loop) 230 230 { 231 231 edge_buffer& edges = v->edgeUses(); … … 243 243 } 244 244 245 int qslim::classifyEdge(Edge *e)245 int simplif::classifyEdge(Edge *e) 246 246 { 247 247 int cls = e->faceUses().length(); … … 252 252 } 253 253 254 int qslim::classifyVertex(Vertex *v)254 int simplif::classifyVertex(Vertex *v) 255 255 { 256 256 int border_count = 0; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/AdjPrims.h
r774 r1025 10 10 mlab: (Id: primitives.h,v 1.7 1997/02/06 16:30:14 garland Exp) 11 11 via 12 QSlim: (Id: primitives.h,v 1.3 1997/02/18 21:11:29 garland Exp)12 simplif: (Id: primitives.h,v 1.3 1997/02/18 21:11:29 garland Exp) 13 13 14 14 ************************************************************************/ … … 21 21 #include <gfx/geom/3D.h> 22 22 23 namespace qslim23 namespace simplif 24 24 { 25 25 class Vertex; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/SimplificationMethod.cpp
r1007 r1025 33 33 // Recalculate the cost of the vertices of an edge 34 34 //--------------------------------------------------------------------------- 35 void SimplificationMethod::compute_pair_info( qslim::pair_info *auxpair)36 { 37 qslim::Vertex *v0 = auxpair->v0;38 qslim::Vertex *v1 = auxpair->v1;39 40 qslim::vert_info& v0_info = vertex_info(v0);41 qslim::vert_info& v1_info = vertex_info(v1);42 43 qslim::Mat4 Q = v0_info.Q + v1_info.Q;44 qslim::real norm = v0_info.norm + v1_info.norm;45 46 auxpair->cost = qslim::quadrix_pair_target(Q, v0, v1, auxpair->candidate);47 48 if( qslim::will_weight_by_area )35 void SimplificationMethod::compute_pair_info(simplif::pair_info *auxpair) 36 { 37 simplif::Vertex *v0 = auxpair->v0; 38 simplif::Vertex *v1 = auxpair->v1; 39 40 simplif::vert_info& v0_info = vertex_info(v0); 41 simplif::vert_info& v1_info = vertex_info(v1); 42 43 simplif::Mat4 Q = v0_info.Q + v1_info.Q; 44 simplif::real norm = v0_info.norm + v1_info.norm; 45 46 auxpair->cost = simplif::quadrix_pair_target(Q, v0, v1, auxpair->candidate); 47 48 if( simplif::will_weight_by_area ) 49 49 auxpair->cost /= norm; 50 50 51 if( qslim::will_preserve_mesh_quality )51 if( simplif::will_preserve_mesh_quality ) 52 52 auxpair->cost += pair_mesh_penalty(M0, v0, v1, auxpair->candidate); 53 53 … … 70 70 // Reasign the new vertex to the adequate face 71 71 //--------------------------------------------------------------------------- 72 int SimplificationMethod::predict_face( qslim::Face& F, qslim::Vertex *v1, qslim::Vertex *v2, qslim::Vec3& vnew, qslim::Vec3& f1, qslim::Vec3& f2, qslim::Vec3& f3)72 int SimplificationMethod::predict_face(simplif::Face& F, simplif::Vertex *v1, simplif::Vertex *v2, simplif::Vec3& vnew, simplif::Vec3& f1, simplif::Vec3& f2, simplif::Vec3& f3) 73 73 { 74 74 int nmapped = 0; … … 93 93 //--------------------------------------------------------------------------- 94 94 //--------------------------------------------------------------------------- 95 qslim::real SimplificationMethod::pair_mesh_penalty(qslim::Model& M, qslim::Vertex *v1, qslim::Vertex *v2, qslim::Vec3& vnew)96 { 97 static qslim::face_buffer changed;95 simplif::real SimplificationMethod::pair_mesh_penalty(simplif::Model& M, simplif::Vertex *v1, simplif::Vertex *v2, simplif::Vec3& vnew) 96 { 97 static simplif::face_buffer changed; 98 98 changed.reset(); 99 99 … … 101 101 102 102 // real Nsum = 0; 103 qslim::real Nmin = 0;103 simplif::real Nmin = 0; 104 104 105 105 for(int i=0; i<changed.length(); i++) 106 106 { 107 qslim::Face& F = *changed(i);108 qslim::Vec3 f1, f2, f3;107 simplif::Face& F = *changed(i); 108 simplif::Vec3 f1, f2, f3; 109 109 110 110 int nmapped = predict_face(F, v1, v2, vnew, f1, f2, f3); … … 113 113 if( nmapped < 2 ) 114 114 { 115 qslim::Plane Pnew(f1, f2, f3);116 qslim::real delta = Pnew.normal() * F.plane().normal();115 simplif::Plane Pnew(f1, f2, f3); 116 simplif::real delta = Pnew.normal() * F.plane().normal(); 117 117 118 118 if( Nmin > delta ) Nmin = delta; … … 130 130 // Returns true if the givens vertices are a valid pair 131 131 //--------------------------------------------------------------------------- 132 bool SimplificationMethod::check_for_pair( qslim::Vertex *v0, qslim::Vertex *v1)133 { 134 const qslim::pair_buffer& pairs = vertex_info(v0).pairs;132 bool SimplificationMethod::check_for_pair(simplif::Vertex *v0, simplif::Vertex *v1) 133 { 134 const simplif::pair_buffer& pairs = vertex_info(v0).pairs; 135 135 136 136 for(int i=0; i<pairs.length(); i++) … … 146 146 // Create a new pair with two given vertices 147 147 //--------------------------------------------------------------------------- 148 qslim::pair_info *SimplificationMethod::new_pair(qslim::Vertex *v0, qslim::Vertex *v1)149 { 150 qslim::vert_info& v0_info = vertex_info(v0);151 qslim::vert_info& v1_info = vertex_info(v1);152 153 qslim::pair_info *pair = new qslim::pair_info(v0,v1);148 simplif::pair_info *SimplificationMethod::new_pair(simplif::Vertex *v0, simplif::Vertex *v1) 149 { 150 simplif::vert_info& v0_info = vertex_info(v0); 151 simplif::vert_info& v1_info = vertex_info(v1); 152 153 simplif::pair_info *pair = new simplif::pair_info(v0,v1); 154 154 v0_info.pairs.add(pair); 155 155 v1_info.pairs.add(pair); … … 161 161 // Remove a given pair 162 162 //--------------------------------------------------------------------------- 163 void SimplificationMethod::delete_pair( qslim::pair_info *auxpair)164 { 165 qslim::vert_info& v0_info = vertex_info(auxpair->v0);166 qslim::vert_info& v1_info = vertex_info(auxpair->v1);163 void SimplificationMethod::delete_pair(simplif::pair_info *auxpair) 164 { 165 simplif::vert_info& v0_info = vertex_info(auxpair->v0); 166 simplif::vert_info& v1_info = vertex_info(auxpair->v1); 167 167 168 168 v0_info.pairs.remove(v0_info.pairs.find(auxpair)); … … 178 178 // Contract a given pair 179 179 //--------------------------------------------------------------------------- 180 void SimplificationMethod::do_contract( qslim::Model& m, qslim::pair_info *auxpair)181 { 182 qslim::Vertex *v0 = auxpair->v0; qslim::Vertex *v1 = auxpair->v1;183 qslim::vert_info& v0_info = vertex_info(v0);184 qslim::vert_info& v1_info = vertex_info(v1);185 qslim::Vec3 vnew = auxpair->candidate;180 void SimplificationMethod::do_contract(simplif::Model& m, simplif::pair_info *auxpair) 181 { 182 simplif::Vertex *v0 = auxpair->v0; simplif::Vertex *v1 = auxpair->v1; 183 simplif::vert_info& v0_info = vertex_info(v0); 184 simplif::vert_info& v1_info = vertex_info(v1); 185 simplif::Vec3 vnew = auxpair->candidate; 186 186 int i; 187 187 … … 190 190 v0_info.norm += v1_info.norm; 191 191 192 qslim::Vec3 p(vnew);193 qslim::Vec3 v0antes(v0->operator[](qslim::X),v0->operator[](qslim::Y),v0->operator[](qslim::Z));192 simplif::Vec3 p(vnew); 193 simplif::Vec3 v0antes(v0->operator[](simplif::X),v0->operator[](simplif::Y),v0->operator[](simplif::Z)); 194 194 195 195 // Find the edge to remove (before remove it (contract())) 196 qslim::Edge *econ=NULL;196 simplif::Edge *econ=NULL; 197 197 bool finded = false; 198 198 for (i=0; i<v0->edgeUses().length(); i++) … … 210 210 211 211 // Perform the actual contraction 212 static qslim::face_buffer changed;212 static simplif::face_buffer changed; 213 213 changed.reset(); 214 214 m.contract(v0, v1, vnew, changed); … … 216 216 // Stores the simplification step 217 217 MeshSimplificationSequence::Step simplifstep; 218 qslim::Vec3 vdesp = p - v0antes;218 simplif::Vec3 vdesp = p - v0antes; 219 219 220 220 // Stores the displacement in the simplification step 221 simplifstep.x=(float)vdesp[ qslim::X];222 simplifstep.y = (float)vdesp[ qslim::Y];223 simplifstep.z = (float)vdesp[ qslim::Z];221 simplifstep.x=(float)vdesp[simplif::X]; 222 simplifstep.y = (float)vdesp[simplif::Y]; 223 simplifstep.z = (float)vdesp[simplif::Z]; 224 224 225 225 // Submeshes which pertains each vertex … … 245 245 for (i=0; i<changed.length(); i++) 246 246 { 247 qslim::Face *auxface = changed(i);247 simplif::Face *auxface = changed(i); 248 248 249 249 if (auxface->isValid()) … … 291 291 for(i=0; i<v0_info.pairs.length(); i++) 292 292 { 293 qslim::pair_info *p = v0_info.pairs(i);293 simplif::pair_info *p = v0_info.pairs(i); 294 294 compute_pair_info(p); 295 295 } 296 296 297 297 // Process pairs associated with now dead vertex 298 static qslim::pair_buffer condemned(6); // collect condemned pairs for execution298 static simplif::pair_buffer condemned(6); // collect condemned pairs for execution 299 299 condemned.reset(); 300 300 301 301 for(i=0; i<v1_info.pairs.length(); i++) 302 302 { 303 qslim::pair_info *p = v1_info.pairs(i);304 305 qslim::Vertex *u;303 simplif::pair_info *p = v1_info.pairs(i); 304 305 simplif::Vertex *u; 306 306 if( p->v0 == v1 ) 307 307 u = p->v1; … … 332 332 //--------------------------------------------------------------------------- 333 333 //--------------------------------------------------------------------------- 334 bool SimplificationMethod::decimate_quadric( qslim::Vertex *v, qslim::Mat4& Q)334 bool SimplificationMethod::decimate_quadric(simplif::Vertex *v, simplif::Mat4& Q) 335 335 { 336 336 if( vinfo.length() > 0 ) … … 346 346 // Extract a pair from the heap, concract it and remove it form the heap 347 347 //--------------------------------------------------------------------------- 348 void SimplificationMethod::decimate_contract( qslim::Model& m)349 { 350 qslim::heap_node *top;351 qslim::pair_info *pair;348 void SimplificationMethod::decimate_contract(simplif::Model& m) 349 { 350 simplif::heap_node *top; 351 simplif::pair_info *pair; 352 352 353 353 for(;;) … … 355 355 top = heap->extract(); 356 356 if( !top ) return; 357 pair = ( qslim::pair_info *)top->obj;357 pair = (simplif::pair_info *)top->obj; 358 358 359 359 //Remove all the vertices of the removed edges … … 361 361 for (int i=0; i<pair->v0->edgeUses().length(); i++) 362 362 { 363 qslim::Edge *econ = pair->v0->edgeUses()(i);363 simplif::Edge *econ = pair->v0->edgeUses()(i); 364 364 if (pair->v1->vID == econ->org()->vID || pair->v1->vID == econ->dest()->vID) 365 365 { … … 383 383 //--------------------------------------------------------------------------- 384 384 //--------------------------------------------------------------------------- 385 qslim::real SimplificationMethod::decimate_error(qslim::Vertex *v)386 { 387 qslim::vert_info& info = vertex_info(v);388 389 qslim::real err = qslim::quadrix_evaluate_vertex(*v, info.Q);390 391 if( qslim::will_weight_by_area )385 simplif::real SimplificationMethod::decimate_error(simplif::Vertex *v) 386 { 387 simplif::vert_info& info = vertex_info(v); 388 389 simplif::real err = simplif::quadrix_evaluate_vertex(*v, info.Q); 390 391 if( simplif::will_weight_by_area ) 392 392 err /= info.norm; 393 393 … … 398 398 // Extract the minimum cost of the the valid nodes (not simplified) 399 399 //--------------------------------------------------------------------------- 400 qslim::real SimplificationMethod::decimate_min_error()401 { 402 qslim::heap_node *top;403 qslim::pair_info *pair;400 simplif::real SimplificationMethod::decimate_min_error() 401 { 402 simplif::heap_node *top; 403 simplif::pair_info *pair; 404 404 405 405 for(;;) … … 407 407 top = heap->top(); 408 408 if( !top ) return -1.0; 409 pair = ( qslim::pair_info *)top->obj;409 pair = (simplif::pair_info *)top->obj; 410 410 411 411 if( pair->isValid() ) … … 422 422 // Returns the maximum error by vertex 423 423 //--------------------------------------------------------------------------- 424 qslim::real SimplificationMethod::decimate_max_error(qslim::Model& m)425 { 426 qslim::real max_err = 0;424 simplif::real SimplificationMethod::decimate_max_error(simplif::Model& m) 425 { 426 simplif::real max_err = 0; 427 427 428 428 for(int i=0; i<m.vertCount(); i++) … … 438 438 // Initializations 439 439 //--------------------------------------------------------------------------- 440 void SimplificationMethod::decimate_init( qslim::Model& m, qslim::real limit)440 void SimplificationMethod::decimate_init(simplif::Model& m, simplif::real limit) 441 441 { 442 442 int i,j; … … 444 444 vinfo.init(m.vertCount()); 445 445 446 if( qslim::will_use_vertex_constraint )446 if( simplif::will_use_vertex_constraint ) 447 447 for(i=0; i<m.vertCount(); i++) 448 448 { 449 qslim::Vertex *v = m.vertex(i);449 simplif::Vertex *v = m.vertex(i); 450 450 if( v->isValid() ) 451 vertex_info(v).Q = qslim::quadrix_vertex_constraint(*v);451 vertex_info(v).Q = simplif::quadrix_vertex_constraint(*v); 452 452 } 453 453 … … 455 455 if( m.face(i)->isValid() ) 456 456 { 457 if( qslim::will_use_plane_constraint )458 { 459 qslim::Mat4 Q = qslim::quadrix_plane_constraint(*m.face(i));460 qslim::real norm = 0.0;461 462 if( qslim::will_weight_by_area )457 if( simplif::will_use_plane_constraint ) 458 { 459 simplif::Mat4 Q = simplif::quadrix_plane_constraint(*m.face(i)); 460 simplif::real norm = 0.0; 461 462 if( simplif::will_weight_by_area ) 463 463 { 464 464 norm = m.face(i)->area(); … … 475 475 } 476 476 477 if( qslim::will_constrain_boundaries )477 if( simplif::will_constrain_boundaries ) 478 478 { 479 479 for(i=0; i<m.edgeCount(); i++) 480 if( m.edge(i)->isValid() && qslim::check_for_discontinuity(m.edge(i)) )481 { 482 qslim::Mat4 B = qslim::quadrix_discontinuity_constraint(m.edge(i));483 qslim::real norm = 0.0;484 485 if( qslim::will_weight_by_area )486 { 487 norm = qslim::norm2(*m.edge(i)->org() - *m.edge(i)->dest());480 if( m.edge(i)->isValid() && simplif::check_for_discontinuity(m.edge(i)) ) 481 { 482 simplif::Mat4 B = simplif::quadrix_discontinuity_constraint(m.edge(i)); 483 simplif::real norm = 0.0; 484 485 if( simplif::will_weight_by_area ) 486 { 487 norm = simplif::norm2(*m.edge(i)->org() - *m.edge(i)->dest()); 488 488 B *= norm; 489 489 } 490 490 491 B *= qslim::boundary_constraint_weight;491 B *= simplif::boundary_constraint_weight; 492 492 vertex_info(m.edge(i)->org()).Q += B; 493 493 vertex_info(m.edge(i)->org()).norm += norm; … … 497 497 } 498 498 499 heap = new qslim::Heap(m.validEdgeCount);499 heap = new simplif::Heap(m.validEdgeCount); 500 500 501 501 int pair_count = 0; … … 504 504 if( m.edge(i)->isValid() ) 505 505 { 506 qslim::pair_info *pair = new_pair(m.edge(i)->org(), m.edge(i)->dest());506 simplif::pair_info *pair = new_pair(m.edge(i)->org(), m.edge(i)->dest()); 507 507 //pointers_to_remove.push_back(pair); 508 508 compute_pair_info(pair); … … 517 517 if( proximity_limit > 0 ) 518 518 { 519 qslim::ProxGrid grid(m.bounds.min, m.bounds.max, limit);519 simplif::ProxGrid grid(m.bounds.min, m.bounds.max, limit); 520 520 for(i=0; i<m.vertCount(); i++) 521 521 grid.addPoint(m.vertex(i)); 522 522 523 qslim::buffer<qslim::Vec3 *> nearby(32);523 simplif::buffer<simplif::Vec3 *> nearby(32); 524 524 for(i=0; i<m.vertCount(); i++) 525 525 { … … 529 529 for(j=0; j<nearby.length(); j++) 530 530 { 531 qslim::Vertex *v1 = m.vertex(i);532 qslim::Vertex *v2 = (qslim::Vertex *)nearby(j);531 simplif::Vertex *v1 = m.vertex(i); 532 simplif::Vertex *v2 = (simplif::Vertex *)nearby(j); 533 533 534 534 if( v1->isValid() && v2->isValid() ) … … 539 539 if( !check_for_pair(v1,v2) ) 540 540 { 541 qslim::pair_info *pair = new_pair(v1,v2);541 simplif::pair_info *pair = new_pair(v1,v2); 542 542 compute_pair_info(pair); 543 543 pair_count++; … … 586 586 void SimplificationMethod::simplifmethod_run(int finalfaces,TIPOFUNC upb) 587 587 { 588 decimate_init(M0, qslim::pair_selection_tolerance);588 decimate_init(M0, simplif::pair_selection_tolerance); 589 589 unsigned int contador = 0; 590 590 float percent; // simplification percentage. … … 604 604 decim_data.clear(); 605 605 606 while( M0.validFaceCount > finalfaces/* qslim::face_target*/606 while( M0.validFaceCount > finalfaces/*simplif::face_target*/ 607 607 && M0.validFaceCount > 1 608 && decimate_min_error() < qslim::error_tolerance )608 && decimate_min_error() < simplif::error_tolerance ) 609 609 { 610 610 decimate_contract(M0); … … 629 629 void SimplificationMethod::simplifmethod_runv(int numvertices,TIPOFUNC upb) 630 630 { 631 decimate_init(M0, qslim::pair_selection_tolerance);631 decimate_init(M0, simplif::pair_selection_tolerance); 632 632 unsigned int contador = 0; 633 633 int previousValidVertCount; … … 650 650 decim_data.clear(); 651 651 652 while( M0.validVertCount > numvertices /* qslim::face_target*/652 while( M0.validVertCount > numvertices /*simplif::face_target*/ 653 653 && 654 decimate_min_error() < qslim::error_tolerance654 decimate_min_error() < simplif::error_tolerance 655 655 && 656 656 previousValidVertCount != M0.validVertCount) … … 730 730 { 731 731 //If the vertex is not in vertices_map, then is added 732 simplifindex=M0.in_Vertex( qslim::Vec3(objmesh->mSubMesh[i].mVertexBuffer->mPosition[j].x,732 simplifindex=M0.in_Vertex(simplif::Vec3(objmesh->mSubMesh[i].mVertexBuffer->mPosition[j].x, 733 733 objmesh->mSubMesh[i].mVertexBuffer->mPosition[j].y, 734 734 objmesh->mSubMesh[i].mVertexBuffer->mPosition[j].z)); 735 M0.in_Normal( qslim::Vec3(objmesh->mSubMesh[i].mVertexBuffer->mNormal[j].x,735 M0.in_Normal(simplif::Vec3(objmesh->mSubMesh[i].mVertexBuffer->mNormal[j].x, 736 736 objmesh->mSubMesh[i].mVertexBuffer->mNormal[j].y, 737 737 objmesh->mSubMesh[i].mVertexBuffer->mNormal[j].z)); 738 738 739 M0.in_TexCoord( qslim::Vec2(objmesh->mSubMesh[i].mVertexBuffer->mTexCoords[j].x,739 M0.in_TexCoord(simplif::Vec2(objmesh->mSubMesh[i].mVertexBuffer->mTexCoords[j].x, 740 740 objmesh->mSubMesh[i].mVertexBuffer->mTexCoords[j].y)); 741 741 vertices_map[auxvert] = num_final_verts; … … 777 777 { 778 778 //If the vertex is not in vertices_map, then is added 779 simplifindex=M0.in_Vertex( qslim::Vec3(objmesh->mSubMesh[i].mVertexBuffer->mPosition[j].x,779 simplifindex=M0.in_Vertex(simplif::Vec3(objmesh->mSubMesh[i].mVertexBuffer->mPosition[j].x, 780 780 objmesh->mSubMesh[i].mVertexBuffer->mPosition[j].y, 781 781 objmesh->mSubMesh[i].mVertexBuffer->mPosition[j].z)); 782 M0.in_Normal( qslim::Vec3(objmesh->mSubMesh[i].mVertexBuffer->mNormal[j].x,782 M0.in_Normal(simplif::Vec3(objmesh->mSubMesh[i].mVertexBuffer->mNormal[j].x, 783 783 objmesh->mSubMesh[i].mVertexBuffer->mNormal[j].y, 784 784 objmesh->mSubMesh[i].mVertexBuffer->mNormal[j].z)); 785 M0.in_TexCoord( qslim::Vec2(0.0,0.0));785 M0.in_TexCoord(simplif::Vec2(0.0,0.0)); 786 786 vertices_map[auxvert] = num_final_verts; 787 787 num_final_verts ++; … … 970 970 if (M0.face(i)->isValid()) 971 971 { 972 qslim::Face *auxface = M0.face(i);972 simplif::Face *auxface = M0.face(i); 973 973 974 974 // Determine to which submesh pertains the triangle. -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/SimplificationMethod.h
r1007 r1025 6 6 #include <list> 7 7 #include <iostream> 8 #include < qslim.h>8 #include <simplif.h> 9 9 #include <GeoMeshSimplifier.h> 10 10 … … 13 13 private: 14 14 Geometry::Mesh *mGeoMesh; 15 void compute_pair_info( qslim::pair_info*);16 qslim::Model M0;17 qslim::array<qslim::vert_info> vinfo;18 qslim::Heap *heap;19 qslim::real proximity_limit; // distance threshold squared15 void compute_pair_info(simplif::pair_info*); 16 simplif::Model M0; 17 simplif::array<simplif::vert_info> vinfo; 18 simplif::Heap *heap; 19 simplif::real proximity_limit; // distance threshold squared 20 20 int initialVertCount; 21 21 int initialEdgeCount; 22 22 int initialFaceCount; 23 23 24 inline qslim::vert_info& vertex_info(qslim::Vertex *v)24 inline simplif::vert_info& vertex_info(simplif::Vertex *v) 25 25 { 26 26 return vinfo(v->validID()); 27 27 } 28 28 29 qslim::real pair_mesh_penalty(qslim::Model& M,30 qslim::Vertex *v1,31 qslim::Vertex *v2,32 qslim::Vec3& vnew);29 simplif::real pair_mesh_penalty(simplif::Model& M, 30 simplif::Vertex *v1, 31 simplif::Vertex *v2, 32 simplif::Vec3& vnew); 33 33 34 int predict_face( qslim::Face& F,35 qslim::Vertex *v1,36 qslim::Vertex *v2,37 qslim::Vec3& vnew,38 qslim::Vec3& f1,39 qslim::Vec3& f2,40 qslim::Vec3& f3);34 int predict_face(simplif::Face& F, 35 simplif::Vertex *v1, 36 simplif::Vertex *v2, 37 simplif::Vec3& vnew, 38 simplif::Vec3& f1, 39 simplif::Vec3& f2, 40 simplif::Vec3& f3); 41 41 42 bool check_for_pair( qslim::Vertex *v0, qslim::Vertex *v1);42 bool check_for_pair(simplif::Vertex *v0, simplif::Vertex *v1); 43 43 44 qslim::pair_info *new_pair(qslim::Vertex *v0, qslim::Vertex *v1);44 simplif::pair_info *new_pair(simplif::Vertex *v0, simplif::Vertex *v1); 45 45 46 void delete_pair( qslim::pair_info *pair);46 void delete_pair(simplif::pair_info *pair); 47 47 48 void do_contract( qslim::Model& m, qslim::pair_info *pair);48 void do_contract(simplif::Model& m, simplif::pair_info *pair); 49 49 50 bool decimate_quadric( qslim::Vertex *v, qslim::Mat4& Q);50 bool decimate_quadric(simplif::Vertex *v, simplif::Mat4& Q); 51 51 52 void decimate_contract( qslim::Model& m);52 void decimate_contract(simplif::Model& m); 53 53 54 qslim::real decimate_error(qslim::Vertex *v);54 simplif::real decimate_error(simplif::Vertex *v); 55 55 56 qslim::real decimate_min_error();56 simplif::real decimate_min_error(); 57 57 58 qslim::real decimate_max_error(qslim::Model& m);58 simplif::real decimate_max_error(simplif::Model& m); 59 59 60 void decimate_init( qslim::Model& m, qslim::real limit);60 void decimate_init(simplif::Model& m, simplif::real limit); 61 61 62 bool pair_is_valid( qslim::Vertex *u, qslim::Vertex *v);62 bool pair_is_valid(simplif::Vertex *u, simplif::Vertex *v); 63 63 64 64 void simplifmethod_run(int, Geometry::TIPOFUNC upb=0); … … 85 85 unsigned int *first_index_submesh; 86 86 87 //std::vector< qslim::pair_info *> pointers_to_remove;87 //std::vector<simplif::pair_info *> pointers_to_remove; 88 88 89 89 int indexMeshLeaves; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/avars.cxx
r981 r1025 9 9 // GLOBAL SIMPLIFICATION OPTIONS 10 10 11 int qslim::face_target = 0;12 qslim::real qslim::error_tolerance = HUGE;11 int simplif::face_target = 0; 12 simplif::real simplif::error_tolerance = HUGE; 13 13 14 14 15 bool qslim::will_use_plane_constraint = true;16 bool qslim::will_use_vertex_constraint = true;15 bool simplif::will_use_plane_constraint = true; 16 bool simplif::will_use_vertex_constraint = true; 17 17 18 bool qslim::will_preserve_boundaries = true;19 bool qslim::will_preserve_mesh_quality = true;20 bool qslim::will_constrain_boundaries = true;21 qslim::real qslim::boundary_constraint_weight = 1.0;18 bool simplif::will_preserve_boundaries = true; 19 bool simplif::will_preserve_mesh_quality = true; 20 bool simplif::will_constrain_boundaries = true; 21 simplif::real simplif::boundary_constraint_weight = 1.0; 22 22 23 bool qslim::will_weight_by_area = false;23 bool simplif::will_weight_by_area = false; 24 24 25 int qslim::placement_policy = PLACE_ENDPOINTS;25 int simplif::placement_policy = PLACE_ENDPOINTS; 26 26 27 qslim::real qslim::pair_selection_tolerance = 0.0;27 simplif::real simplif::pair_selection_tolerance = 0.0; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/avars.h
r774 r1025 2 2 #include <gfx/SMF/smf.h> 3 3 4 namespace qslim4 namespace simplif 5 5 { 6 6 // extern ostream *outfile; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/SMF/smf.cxx
r774 r1025 9 9 #include <gfx/SMF/smfstate.h> 10 10 11 using namespace qslim;11 using namespace simplif; 12 12 13 13 inline int streq(const char *a,const char *b) { return strcmp(a,b)==0; } 14 14 15 float qslim::SMF_version = 1.0;16 char * qslim::SMF_version_string = "1.0";15 float simplif::SMF_version = 1.0; 16 char *simplif::SMF_version_string = "1.0"; 17 17 char *SMF_source_revision = "$Id: smf.cxx,v 1.1 1997/06/16 22:11:40 garland Exp $"; 18 18 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/SMF/smf.h
r774 r1025 17 17 18 18 19 namespace qslim19 namespace simplif 20 20 { 21 21 #define SMF_MAXLINE 4096 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/SMF/smfstate.cxx
r774 r1025 8 8 inline int streq(const char *a,const char *b) { return strcmp(a,b)==0; } 9 9 10 using namespace qslim;10 using namespace simplif; 11 11 12 12 SMF_State::SMF_State(const SMF_ivars& ivar, SMF_State *link) -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/SMF/smfstate.h
r774 r1025 2 2 #define GFXSMF_STATE_INCLUDED 3 3 4 namespace qslim4 namespace simplif 5 5 { 6 6 class SMF_State -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/geom/3D.cxx
r774 r1025 3 3 #include <gfx/geom/3D.h> 4 4 5 using namespace qslim;5 using namespace simplif; 6 6 7 7 Vec3 randomPoint(const Vec3& v1, const Vec3& v2) … … 21 21 } 22 22 23 real qslim::triangleArea(const Vec3& v1, const Vec3& v2, const Vec3& v3)23 real simplif::triangleArea(const Vec3& v1, const Vec3& v2, const Vec3& v3) 24 24 { 25 25 Vec3 a = v2 - v1; … … 38 38 real L3 = norm2(v1-v3); 39 39 40 return FOUR_ROOT3 * qslim::triangleArea(v1,v2,v3) / (L1+L2+L3);40 return FOUR_ROOT3 * simplif::triangleArea(v1,v2,v3) / (L1+L2+L3); 41 41 } 42 42 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/geom/3D.h
r774 r1025 10 10 // 11 11 12 namespace qslim12 namespace simplif 13 13 { 14 14 extern Vec3 randomPoint(const Vec3&, const Vec3&); // on segment -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/geom/ProjectH.cxx
r774 r1025 27 27 #define DOTP(a, b) (a[0] * b[0] + a[1] * b[1] + a[2] * b[2]) 28 28 29 using namespace qslim;29 using namespace simplif; 30 30 31 31 static real Distance2(real x[3], real *y) -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/geom/ProxGrid.cxx
r774 r1025 6 6 #include <gfx/geom/ProxGrid.h> 7 7 8 using namespace qslim;8 using namespace simplif; 9 9 10 10 ProxGrid::ProxGrid(const Vec3& lo, const Vec3& hi, real dist) -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/geom/ProxGrid.h
r774 r1025 7 7 8 8 9 namespace qslim9 namespace simplif 10 10 { 11 11 class ProxGrid_Cell : public buffer<Vec3 *> -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Mat2.cxx
r774 r1025 2 2 #include <gfx/math/Mat2.h> 3 3 4 using namespace qslim;4 using namespace simplif; 5 5 6 6 Mat2 Mat2::identity(Vec2(1,0), Vec2(0,1)); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Mat2.h
r774 r1025 4 4 #include <gfx/math/Vec2.h> 5 5 6 namespace qslim6 namespace simplif 7 7 { 8 8 class Mat2 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Mat3.cxx
r774 r1025 2 2 #include <gfx/math/Mat3.h> 3 3 4 using namespace qslim;4 using namespace simplif; 5 5 6 6 Mat3 Mat3::identity(Vec3(1,0,0), Vec3(0,1,0), Vec3(0,0,1)); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Mat3.h
r774 r1025 5 5 #include <ostream> 6 6 7 namespace qslim7 namespace simplif 8 8 { 9 9 class Mat3 … … 64 64 65 65 // // Input/Output methods 66 // friend std::ostream& operator<<(std::ostream&, const qslim::Mat3&);67 // friend std::istream& operator>>(std::istream&, qslim::Mat3&);66 // friend std::ostream& operator<<(std::ostream&, const simplif::Mat3&); 67 // friend std::istream& operator>>(std::istream&, simplif::Mat3&); 68 68 }; 69 69 … … 134 134 135 135 /* 136 inline std::ostream& operator<<(std::ostream& out, const qslim::Mat3& M)136 inline std::ostream& operator<<(std::ostream& out, const simplif::Mat3& M) 137 137 { 138 138 return out << M.row[0] << endl << M.row[1] << endl << M.row[2]; … … 144 144 } 145 145 */ 146 extern bool jacobi(const qslim::Mat3& m, qslim::Vec3& vals, qslim::Vec3 vecs[3]);146 extern bool jacobi(const simplif::Mat3& m, simplif::Vec3& vals, simplif::Vec3 vecs[3]); 147 147 148 148 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Mat4.cxx
r774 r1025 2 2 #include <gfx/math/Mat4.h> 3 3 4 using namespace qslim;4 using namespace simplif; 5 5 6 6 Mat4 Mat4::identity(Vec4(1,0,0,0),Vec4(0,1,0,0),Vec4(0,0,1,0),Vec4(0,0,0,1)); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Mat4.h
r774 r1025 13 13 #include <gfx/math/Vec4.h> 14 14 15 namespace qslim15 namespace simplif 16 16 { 17 17 class Mat4 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Vec2.h
r774 r1025 10 10 ************************************************************************/ 11 11 12 namespace qslim12 namespace simplif 13 13 { 14 14 class Vec2 { … … 78 78 // 79 79 80 inline void qslim::Vec2::copy(const qslim::Vec2& v)80 inline void simplif::Vec2::copy(const simplif::Vec2& v) 81 81 { 82 82 elt[0]=v.elt[0]; elt[1]=v.elt[1]; 83 83 } 84 84 85 inline bool qslim::Vec2::operator==(const qslim::Vec2& v) const85 inline bool simplif::Vec2::operator==(const simplif::Vec2& v) const 86 86 { 87 87 real dx=elt[X]-v[X], dy=elt[Y]-v[Y]; … … 89 89 } 90 90 91 inline bool qslim::Vec2::operator!=(const qslim::Vec2& v) const91 inline bool simplif::Vec2::operator!=(const simplif::Vec2& v) const 92 92 { 93 93 real dx=elt[X]-v[X], dy=elt[Y]-v[Y]; … … 95 95 } 96 96 97 inline qslim::Vec2& qslim::Vec2::operator=(const qslim::Vec2& v)97 inline simplif::Vec2& simplif::Vec2::operator=(const simplif::Vec2& v) 98 98 { 99 99 copy(v); … … 101 101 } 102 102 103 inline qslim::Vec2& qslim::Vec2::operator+=(const qslim::Vec2& v)103 inline simplif::Vec2& simplif::Vec2::operator+=(const simplif::Vec2& v) 104 104 { 105 105 elt[0] += v[0]; elt[1] += v[1]; … … 107 107 } 108 108 109 inline qslim::Vec2& qslim::Vec2::operator-=(const qslim::Vec2& v)109 inline simplif::Vec2& simplif::Vec2::operator-=(const simplif::Vec2& v) 110 110 { 111 111 elt[0] -= v[0]; elt[1] -= v[1]; … … 113 113 } 114 114 115 inline qslim::Vec2& qslim::Vec2::operator*=(qslim::real s)115 inline simplif::Vec2& simplif::Vec2::operator*=(simplif::real s) 116 116 { 117 117 elt[0] *= s; elt[1] *= s; … … 119 119 } 120 120 121 inline qslim::Vec2& qslim::Vec2::operator/=(qslim::real s)121 inline simplif::Vec2& simplif::Vec2::operator/=(simplif::real s) 122 122 { 123 123 elt[0] /= s; elt[1] /= s; … … 125 125 } 126 126 127 inline qslim::Vec2 qslim::Vec2::operator+(const qslim::Vec2& v) const127 inline simplif::Vec2 simplif::Vec2::operator+(const simplif::Vec2& v) const 128 128 { 129 129 return Vec2(elt[0]+v[0], elt[1]+v[1]); 130 130 } 131 131 132 inline qslim::Vec2 qslim::Vec2::operator-(const qslim::Vec2& v) const132 inline simplif::Vec2 simplif::Vec2::operator-(const simplif::Vec2& v) const 133 133 { 134 134 return Vec2(elt[0]-v[0], elt[1]-v[1]); 135 135 } 136 136 137 inline qslim::Vec2 qslim::Vec2::operator-() const138 { 139 return qslim::Vec2(-elt[0], -elt[1]);140 } 141 142 inline qslim::Vec2 qslim::Vec2::operator*(qslim::real s) const137 inline simplif::Vec2 simplif::Vec2::operator-() const 138 { 139 return simplif::Vec2(-elt[0], -elt[1]); 140 } 141 142 inline simplif::Vec2 simplif::Vec2::operator*(simplif::real s) const 143 143 { 144 144 return Vec2(elt[0]*s, elt[1]*s); 145 145 } 146 146 147 inline qslim::Vec2 qslim::Vec2::operator/(qslim::real s) const147 inline simplif::Vec2 simplif::Vec2::operator/(simplif::real s) const 148 148 { 149 149 return Vec2(elt[0]/s, elt[1]/s); 150 150 } 151 151 152 inline qslim::real qslim::Vec2::operator*(const qslim::Vec2& v) const152 inline simplif::real simplif::Vec2::operator*(const simplif::Vec2& v) const 153 153 { 154 154 return elt[0]*v[0] + elt[1]*v[1]; … … 156 156 157 157 // Make scalar multiplication commutative 158 inline qslim::Vec2 operator*(qslim::real s, const qslim::Vec2& v) { return v*s; }158 inline simplif::Vec2 operator*(simplif::real s, const simplif::Vec2& v) { return v*s; } 159 159 160 160 … … 164 164 // 165 165 166 namespace qslim166 namespace simplif 167 167 { 168 inline real norm(const qslim::Vec2& v) { return sqrt(v[0]*v[0] + v[1]*v[1]); }169 inline real norm2(const qslim::Vec2& v) { return v[0]*v[0] + v[1]*v[1]; }170 inline real length(const qslim::Vec2& v) { return norm(v); }171 172 inline real unitize( qslim::Vec2& v)173 { 174 qslim::real l=norm2(v);168 inline real norm(const simplif::Vec2& v) { return sqrt(v[0]*v[0] + v[1]*v[1]); } 169 inline real norm2(const simplif::Vec2& v) { return v[0]*v[0] + v[1]*v[1]; } 170 inline real length(const simplif::Vec2& v) { return norm(v); } 171 172 inline real unitize(simplif::Vec2& v) 173 { 174 simplif::real l=norm2(v); 175 175 if( l!=1.0 && l!=0.0 ) 176 176 { -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Vec3.h
r774 r1025 12 12 #include "../std.h" 13 13 14 namespace qslim14 namespace simplif 15 15 { 16 16 class Vec3 { -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/Vec4.h
r774 r1025 10 10 ************************************************************************/ 11 11 12 namespace qslim12 namespace simplif 13 13 { 14 14 class Vec4 { -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/cholesky.cxx
r774 r1025 12 12 // 13 13 14 using namespace qslim;14 using namespace simplif; 15 15 16 16 bool cholesky(Mat4& a, Vec4& p) -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/jacobi.cxx
r774 r1025 20 20 // 21 21 22 using namespace qslim;22 using namespace simplif; 23 23 24 24 static -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/math/random.h
r774 r1025 5 5 #include <limits.h> 6 6 7 namespace qslim7 namespace simplif 8 8 { 9 9 // -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/std.h
r774 r1025 18 18 19 19 20 namespace qslim20 namespace simplif 21 21 { 22 22 // -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Array.h
r774 r1025 5 5 #include "../std.h" 6 6 7 namespace qslim7 namespace simplif 8 8 { 9 9 template<class T> -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Buffer.h
r774 r1025 4 4 #include <gfx/tools/Array.h> 5 5 6 namespace qslim6 namespace simplif 7 7 { 8 8 template<class T> -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Heap.h
r774 r1025 12 12 // 13 13 14 namespace qslim14 namespace simplif 15 15 { 16 16 class Heapable -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/heap.cxx
r774 r1025 3 3 #include <gfx/tools/Heap.h> 4 4 5 using namespace qslim;5 using namespace simplif; 6 6 7 7 void Heap::swap(int i,int j) -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/quadrics.cxx
r774 r1025 1 1 // $Id: quadrics.cxx,v 1.5 1997/10/01 14:07:28 garland Exp $ 2 2 3 #include " qslim.h"3 #include "simplif.h" 4 4 #include "quadrics.h" 5 5 … … 16 16 // 17 17 18 using namespace qslim;19 20 Mat4 qslim::quadrix_vertex_constraint(const Vec3& v)18 using namespace simplif; 19 20 Mat4 simplif::quadrix_vertex_constraint(const Vec3& v) 21 21 { 22 22 Mat4 L(Mat4::identity); … … 39 39 // quadric" discussed in the paper. 40 40 // 41 Mat4 qslim::quadrix_plane_constraint(real a, real b, real c, real d)41 Mat4 simplif::quadrix_plane_constraint(real a, real b, real c, real d) 42 42 { 43 43 Mat4 K(Mat4::zero); … … 54 54 // Define some other convenient ways for constructing these plane quadrics. 55 55 // 56 Mat4 qslim::quadrix_plane_constraint(const Vec3& n, real d)57 { 58 return qslim::quadrix_plane_constraint(n[X], n[Y], n[Z], d);59 } 60 61 Mat4 qslim::quadrix_plane_constraint(Face& T)56 Mat4 simplif::quadrix_plane_constraint(const Vec3& n, real d) 57 { 58 return simplif::quadrix_plane_constraint(n[X], n[Y], n[Z], d); 59 } 60 61 Mat4 simplif::quadrix_plane_constraint(Face& T) 62 62 { 63 63 const Plane& p = T.plane(); … … 65 65 p.coeffs(&a, &b, &c, &d); 66 66 67 return qslim::quadrix_plane_constraint(a, b, c, d);68 } 69 70 qslim::Mat4 qslim::quadrix_plane_constraint(const qslim::Vec3& v1, const qslim::Vec3& v2, const qslim::Vec3& v3)67 return simplif::quadrix_plane_constraint(a, b, c, d); 68 } 69 70 simplif::Mat4 simplif::quadrix_plane_constraint(const simplif::Vec3& v1, const simplif::Vec3& v2, const simplif::Vec3& v3) 71 71 { 72 72 Plane P(v1,v2,v3); … … 74 74 P.coeffs(&a, &b, &c, &d); 75 75 76 return qslim::quadrix_plane_constraint(a, b, c, d);77 } 78 79 real qslim::quadrix_evaluate_vertex(const Vec3& v, const Mat4& K)76 return simplif::quadrix_plane_constraint(a, b, c, d); 77 } 78 79 real simplif::quadrix_evaluate_vertex(const Vec3& v, const Mat4& K) 80 80 { 81 81 real x=v[X], y=v[Y], z=v[Z]; … … 113 113 } 114 114 115 bool qslim::check_for_discontinuity(Edge *e)115 bool simplif::check_for_discontinuity(Edge *e) 116 116 { 117 117 return is_border(e); 118 118 } 119 119 120 Mat4 qslim::quadrix_discontinuity_constraint(Edge *edge, const Vec3& n)120 Mat4 simplif::quadrix_discontinuity_constraint(Edge *edge, const Vec3& n) 121 121 { 122 122 Vec3& org = *edge->org(); … … 128 128 129 129 real d = -n2 * org; 130 return qslim::quadrix_plane_constraint(n2, d);131 } 132 133 134 Mat4 qslim::quadrix_discontinuity_constraint(Edge *edge)130 return simplif::quadrix_plane_constraint(n2, d); 131 } 132 133 134 Mat4 simplif::quadrix_discontinuity_constraint(Edge *edge) 135 135 { 136 136 Mat4 D(Mat4::zero); … … 139 139 140 140 for(int i=0; i<faces.length(); i++) 141 D += qslim::quadrix_discontinuity_constraint(edge,faces(i)->plane().normal());141 D += simplif::quadrix_discontinuity_constraint(edge,faces(i)->plane().normal()); 142 142 143 143 return D; … … 150 150 // 151 151 152 bool qslim::quadrix_find_local_fit(const Mat4& K,152 bool simplif::quadrix_find_local_fit(const Mat4& K, 153 153 const Vec3& v1, const Vec3& v2, 154 154 Vec3& candidate) … … 159 159 bool try_midpoint = placement_policy > PLACE_ENDPOINTS; 160 160 161 real c1 = qslim::quadrix_evaluate_vertex(v1, K);162 real c2 = qslim::quadrix_evaluate_vertex(v2, K);161 real c1 = simplif::quadrix_evaluate_vertex(v1, K); 162 real c2 = simplif::quadrix_evaluate_vertex(v2, K); 163 163 real c3; 164 if( try_midpoint ) c3 = qslim::quadrix_evaluate_vertex(v3, K);164 if( try_midpoint ) c3 = simplif::quadrix_evaluate_vertex(v3, K); 165 165 166 166 if( c1<c2 ) … … 182 182 } 183 183 184 bool qslim::quadrix_find_line_fit(const Mat4& Q,184 bool simplif::quadrix_find_line_fit(const Mat4& Q, 185 185 const Vec3& v1, const Vec3& v2, 186 186 Vec3& candidate) … … 206 206 } 207 207 208 bool qslim::quadrix_find_best_fit(const Mat4& Q, Vec3& candidate)208 bool simplif::quadrix_find_best_fit(const Mat4& Q, Vec3& candidate) 209 209 { 210 210 Mat4 K = Q; … … 237 237 #include <assert.h> 238 238 239 real qslim::quadrix_pair_target(const Mat4& Q,239 real simplif::quadrix_pair_target(const Mat4& Q, 240 240 Vertex *v1, 241 241 Vertex *v2, … … 257 257 { 258 258 candidate = *v1; 259 return qslim::quadrix_evaluate_vertex(candidate, Q);259 return simplif::quadrix_evaluate_vertex(candidate, Q); 260 260 } 261 261 else if( c2 > c1 ) 262 262 { 263 263 candidate = *v2; 264 return qslim::quadrix_evaluate_vertex(candidate, Q);264 return simplif::quadrix_evaluate_vertex(candidate, Q); 265 265 } 266 266 else if( c1>0 && policy>PLACE_LINE ) … … 273 273 { 274 274 case PLACE_OPTIMAL: 275 if( qslim::quadrix_find_best_fit(Q, candidate) )275 if( simplif::quadrix_find_best_fit(Q, candidate) ) 276 276 break; 277 277 278 278 case PLACE_LINE: 279 if( qslim::quadrix_find_line_fit(Q, *v1, *v2, candidate) )279 if( simplif::quadrix_find_line_fit(Q, *v1, *v2, candidate) ) 280 280 break; 281 281 282 282 default: 283 qslim::quadrix_find_local_fit(Q, *v1, *v2, candidate);283 simplif::quadrix_find_local_fit(Q, *v1, *v2, candidate); 284 284 break; 285 285 } 286 286 287 return qslim::quadrix_evaluate_vertex(candidate, Q);288 } 287 return simplif::quadrix_evaluate_vertex(candidate, Q); 288 } -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/quadrics.h
r774 r1025 5 5 #include <gfx/math/Mat4.h> 6 6 7 namespace qslim7 namespace simplif 8 8 { 9 9 extern Mat4 quadrix_vertex_constraint(const Vec3&);
Note: See TracChangeset
for help on using the changeset viewer.