- switch (aType) {
- case SMDSEntity_Edge:
- if (len == 2)
- aVal = getDistance( P( 1 ), P( 2 ) );
- break;
- case SMDSEntity_Quad_Edge:
- if (len == 3) // quadratic edge
- aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
- break;
- case SMDSEntity_Triangle:
- if (len == 3){ // triangles
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- aVal = Min(L1,Min(L2,L3));
- }
- break;
- case SMDSEntity_Quadrangle:
- if (len == 4){ // quadrangles
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- aVal = Min(Min(L1,L2),Min(L3,L4));
- }
- break;
- case SMDSEntity_Quad_Triangle:
- case SMDSEntity_BiQuad_Triangle:
- if (len >= 6){ // quadratic triangles
- double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
- double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
- double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
- aVal = Min(L1,Min(L2,L3));
- }
- break;
- case SMDSEntity_Quad_Quadrangle:
- case SMDSEntity_BiQuad_Quadrangle:
- if (len >= 8){ // quadratic quadrangles
- double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
- double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
- double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
- double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
- aVal = Min(Min(L1,L2),Min(L3,L4));
- }
- break;
- case SMDSEntity_Tetra:
- if (len == 4){ // tetrahedra
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 1 ),P( 4 ));
- double L5 = getDistance(P( 2 ),P( 4 ));
- double L6 = getDistance(P( 3 ),P( 4 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- }
- break;
- case SMDSEntity_Pyramid:
- if (len == 5){ // piramids
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- double L5 = getDistance(P( 1 ),P( 5 ));
- double L6 = getDistance(P( 2 ),P( 5 ));
- double L7 = getDistance(P( 3 ),P( 5 ));
- double L8 = getDistance(P( 4 ),P( 5 ));
-
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(L7,L8));
- }
- break;
- case SMDSEntity_Penta:
- if (len == 6) { // pentaidres
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 4 ));
- double L7 = getDistance(P( 1 ),P( 4 ));
- double L8 = getDistance(P( 2 ),P( 5 ));
- double L9 = getDistance(P( 3 ),P( 6 ));
-
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(Min(L7,L8),L9));
- }
- break;
- case SMDSEntity_Hexa:
- if (len == 8){ // hexahedron
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 7 ));
- double L7 = getDistance(P( 7 ),P( 8 ));
- double L8 = getDistance(P( 8 ),P( 5 ));
- double L9 = getDistance(P( 1 ),P( 5 ));
- double L10= getDistance(P( 2 ),P( 6 ));
- double L11= getDistance(P( 3 ),P( 7 ));
- double L12= getDistance(P( 4 ),P( 8 ));
-
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
- aVal = Min(aVal,Min(L11,L12));
- }
- break;
- case SMDSEntity_Quad_Tetra:
- if (len == 10){ // quadratic tetraidrs
- double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
- double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
- double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
- double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- }
- break;
- case SMDSEntity_Quad_Pyramid:
- if (len == 13){ // quadratic piramids
- double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
- double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
- double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
- double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
- double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(L7,L8));
- }
- break;
- case SMDSEntity_Quad_Penta:
- if (len == 15){ // quadratic pentaidres
- double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
- double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
- double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
- double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(Min(L7,L8),L9));
- }
- break;
- case SMDSEntity_Quad_Hexa:
- case SMDSEntity_TriQuad_Hexa:
- if (len >= 20) { // quadratic hexaider
- double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
- double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
- double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
- double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
- double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
- double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
- double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
- double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
- aVal = Min(aVal,Min(L11,L12));
- }
- break;
- case SMDSEntity_Polygon:
- if ( len > 1 ) {
- aVal = getDistance( P(1), P( P.size() ));
- for ( size_t i = 1; i < P.size(); ++i )
- aVal = Min( aVal, getDistance( P( i ), P( i+1 )));
- }
- break;
- case SMDSEntity_Quad_Polygon:
- if ( len > 2 ) {
- aVal = getDistance( P(1), P( P.size() )) + getDistance( P(P.size()), P( P.size()-1 ));
- for ( size_t i = 1; i < P.size()-1; i += 2 )
- aVal = Min( aVal, getDistance( P( i ), P( i+1 )) + getDistance( P( i+1 ), P( i+2 )));
- }
- break;
- case SMDSEntity_Hexagonal_Prism:
- if (len == 12) { // hexagonal prism
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 1 ));
-
- double L7 = getDistance(P( 7 ), P( 8 ));
- double L8 = getDistance(P( 8 ), P( 9 ));
- double L9 = getDistance(P( 9 ), P( 10 ));
- double L10= getDistance(P( 10 ),P( 11 ));
- double L11= getDistance(P( 11 ),P( 12 ));
- double L12= getDistance(P( 12 ),P( 7 ));
-
- double L13 = getDistance(P( 1 ),P( 7 ));
- double L14 = getDistance(P( 2 ),P( 8 ));
- double L15 = getDistance(P( 3 ),P( 9 ));
- double L16 = getDistance(P( 4 ),P( 10 ));
- double L17 = getDistance(P( 5 ),P( 11 ));
- double L18 = getDistance(P( 6 ),P( 12 ));
- aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
- aVal = Min(aVal, Min(Min(Min(L7,L8),Min(L9,L10)),Min(L11,L12)));
- aVal = Min(aVal, Min(Min(Min(L13,L14),Min(L15,L16)),Min(L17,L18)));
- }
- break;
- case SMDSEntity_Polyhedra:
- {