10 #define GEOMETRY_RESABS 1.e-6
11 #define mbsqr( a ) ( ( a ) * ( a ) )
12 #define mbcube( a ) ( mbsqr( a ) * ( a ) )
13 #define mbquart( a ) ( mbsqr( a ) * mbsqr( a ) )
27 std::vector< EntityHandle > adjTri;
31 for(
size_t i = 0; i < adjTri.size(); i++ )
42 : _markTag( 0 ), _gradientTag( 0 ), _tangentsTag( 0 ), _edgeCtrlTag( 0 ), _facetCtrlTag( 0 ),
43 _facetEdgeCtrlTag( 0 ), _planeTag( 0 ), _mb(
mb ), _set( surface_set ), _my_geomTopoTool( gTool ), _obb_root( 0 ),
44 _evaluationsCounter( 0 )
82 totArea += normal.
length() / 2;
96 for(
int i = 0; i < 3; i++ )
159 unsigned char tagVal = 0;
161 if( tagVal )
continue;
175 if( NULL ==
_mb )
return 1;
194 double defNormal[] = { 0., 0., 0. };
199 char name[50] = { 0 };
200 snprintf( name, 50,
"GRADIENT%lu",
205 double defPlane[4] = { 0., 0., 1., 0. };
207 char namePlaneTag[50] = { 0 };
208 snprintf( namePlaneTag, 50,
"PLANE%lu", setId );
219 if( nnodes != 3 )
return 1;
232 a[1] =
angle( AB, -BC );
233 a[2] =
angle( BC, -CA );
234 a[0] =
angle( CA, -AB );
239 const double* coordNormal = normal.
array();
241 plane[0] = coordNormal[0];
242 plane[1] = coordNormal[1];
243 plane[2] = coordNormal[2];
244 plane[3] = -normal % p[0];
253 for(
int i = 0; i < 3; i++ )
256 values[3 * i + 0] += a[i] * coordNormal[0];
257 values[3 * i + 1] += a[i] * coordNormal[1];
258 values[3 * i + 2] += a[i] * coordNormal[2];
267 double* normalVal =
new double[3 * numNodes];
270 for(
int i = 0; i < numNodes; i++ )
274 p1.
get( &normalVal[3 * i] );
282 std::cout <<
" normals at " << numNodes <<
" nodes" << std::endl;
287 std::cout <<
" Node id " <<
_mb->
id_from_handle( node ) <<
" " << normalVal[3 * i] <<
" "
288 << normalVal[3 * i + 1] <<
" " << normalVal[3 * i + 2] << std::endl;
319 assert( 2 == nnodes );
354 std::cout <<
" points: " << P[0] <<
" " << P[1] << std::endl;
355 std::cout <<
" normals: " << N[0] <<
" " << N[1] << std::endl;
356 std::cout <<
" Control points " << ctrl_pts[0] <<
" " << ctrl_pts[1] <<
" " << ctrl_pts[2] << std::endl;
365 double defTangents[6] = { 0., 0., 0., 0., 0., 0. };
378 assert( nnodes == 2 );
413 double ai0 = N0 % T0;
414 double ai3 = N3 % T3;
415 double denom = 4 - ai * ai;
416 if( fabs( denom ) < 1e-20 )
420 double row = 6.0e0 * ( 2.0e0 * ai0 + ai * ai3 ) / denom;
421 double omega = 6.0e0 * ( 2.0e0 * ai3 + ai * ai0 ) / denom;
422 Vi[1] = Vi[0] + ( di * ( ( ( 6.0e0 * T0 ) - ( ( 2.0e0 * row ) * N0 ) + ( omega * N3 ) ) / 18.0e0 ) );
423 Vi[2] = Vi[3] - ( di * ( ( ( 6.0e0 * T3 ) + ( row * N0 ) - ( ( 2.0e0 * omega ) * N3 ) ) / 18.0e0 ) );
429 Pi[0] = 0.25 * Vi[0] + 0.75 * Vi[1];
430 Pi[1] = 0.50 * Vi[1] + 0.50 * Vi[2];
431 Pi[2] = 0.75 * Vi[2] + 0.25 * Vi[3];
441 for(
int i = 0; i < 3; i++ )
445 v[0] = conn3[( i + 1 ) % 3];
446 v[1] = conn3[( i + 2 ) % 3];
447 std::vector< EntityHandle > adjacencies;
453 assert( adjacencies.size() == 1 );
458 assert( 2 == nnodes );
459 edges[i] = adjacencies[0];
461 if( conn2[0] == v[0] && conn2[1] == v[1] )
463 else if( conn2[0] == v[1] && conn2[1] == v[0] )
488 assert( 3 == nnodes );
515 for(
int i = 0; i < 3; i++ )
518 int i1 = ( i + 1 ) % 3;
519 int i2 = ( i + 2 ) % 3;
521 N[2 * i + 1] = NN[i2];
525 if( orient[i] == -1 )
533 for(
int j = 1; j < 4; j++ )
534 CP[index++] = P[i][j];
554 for( j = 0; j < 3; j++ )
557 for( j = 0; j < 9; j++ )
560 for( j = 0; j < 6; j++ )
568 for(
int j = 0; j < 3; j++ )
584 CartVect Di[4], Ai[3], N0, N3, Vi[4], Wi[3];
586 double lambda[2], mu[2];
590 for(
int i = 0; i < 3; i++ )
595 Vi[1] = ( P[i][1] - 0.25 * P[i][0] ) / 0.75;
596 Vi[2] = ( P[i][3] - 0.25 * P[i][4] ) / 0.75;
598 Wi[0] = Vi[1] - Vi[0];
599 Wi[1] = Vi[2] - Vi[1];
600 Wi[2] = Vi[3] - Vi[2];
601 Di[0] = P[( i + 2 ) % 3][3] - 0.5 * ( P[i][1] + P[i][0] );
602 Di[3] = P[( i + 1 ) % 3][1] - 0.5 * ( P[i][4] + P[i][3] );
603 Ai[0] = ( N0 * Wi[0] ) / Wi[0].
length();
604 Ai[2] = ( N3 * Wi[2] ) / Wi[2].
length();
605 Ai[1] = Ai[0] + Ai[2];
608 lambda[0] = ( Di[0] % Wi[0] ) / ( Wi[0] % Wi[0] );
609 lambda[1] = ( Di[3] % Wi[2] ) / ( Wi[2] % Wi[2] );
610 mu[0] = ( Di[0] % Ai[0] );
611 mu[1] = ( Di[3] % Ai[2] );
612 G[i * 2] = 0.5 * ( P[i][1] + P[i][2] ) + 0.66666666666666 * lambda[0] * Wi[1] +
613 0.33333333333333 * lambda[1] * Wi[0] + 0.66666666666666 * mu[0] * Ai[1] +
614 0.33333333333333 * mu[1] * Ai[0];
615 G[i * 2 + 1] = 0.5 * ( P[i][2] + P[i][3] ) + 0.33333333333333 * lambda[0] * Wi[2] +
616 0.66666666666666 * lambda[1] * Wi[1] + 0.33333333333333 * mu[0] * Ai[2] +
617 0.66666666666666 * mu[1] * Ai[1];
629 char name[50] = { 0 };
630 snprintf( name, 50,
"%lucontrol.Point3D", setId );
631 std::ofstream point3DFile;
632 point3DFile.open( name );
633 point3DFile <<
"# x y z \n";
634 std::ofstream point3DEdgeFile;
635 snprintf( name, 50,
"%lucontrolEdge.Point3D", setId );
636 point3DEdgeFile.open( name );
637 point3DEdgeFile <<
"# x y z \n";
638 std::ofstream smoothPoints;
639 snprintf( name, 50,
"%lusmooth.Point3D", setId );
640 smoothPoints.open( name );
641 smoothPoints <<
"# x y z \n";
648 for(
int i = 0; i < 3; i++ )
651 point3DEdgeFile << std::setprecision( 11 ) << c[0] <<
" " << c[1] <<
" " << c[2] <<
" \n";
664 for(
int n = 0; n < numPoints; n++ )
666 double a = 1. * n / ( numPoints - 1 );
669 P_facet[0] = a * controlTriPoints[3] + b * controlTriPoints[4];
671 P_facet[1] = a * controlTriPoints[0] + b * controlTriPoints[5];
673 P_facet[2] = a * controlTriPoints[1] + b * controlTriPoints[2];
674 for(
int i = 0; i < 3; i++ )
677 point3DFile << std::setprecision( 11 ) << c[0] <<
" " << c[1] <<
" " << c[2] <<
" \n";
683 for(
int k = 0; k <= N; k++ )
685 for(
int m = 0; m <= N - k; m++ )
688 CartVect areacoord( 1. * k / N, 1. * m / N, 1. * n / N );
691 smoothPoints << std::setprecision( 11 ) << pt[0] <<
" " << pt[1] <<
" " << pt[2] <<
" \n";
696 smoothPoints.close();
697 point3DEdgeFile.close();
712 double t4, t3, t2, one_minus_t, one_minus_t2, one_minus_t3, one_minus_t4;
717 if( tt <= 0.0 ) tt = 0.0;
718 if( tt >= 1.0 ) tt = 1.0;
737 one_minus_t = 1. - tt;
738 one_minus_t2 = one_minus_t * one_minus_t;
739 one_minus_t3 = one_minus_t2 * one_minus_t;
740 one_minus_t4 = one_minus_t3 * one_minus_t;
742 outv = one_minus_t4 * P[0] + 4. * one_minus_t3 * tt * controlPoints[0] + 6. * one_minus_t2 * t2 * controlPoints[1] +
743 4. * one_minus_t * t3 * controlPoints[2] + t4 * P[1];
768 if( fabs( areacoord[1] + areacoord[2] ) < 1.0e-6 )
773 if( fabs( areacoord[0] + areacoord[2] ) < 1.0e-6 )
778 if( fabs( areacoord[0] + areacoord[1] ) < 1.0e-6 )
787 ( 1.0e0 / ( areacoord[1] + areacoord[2] ) ) * ( areacoord[1] * gctrl_pts[3] + areacoord[2] * gctrl_pts[4] );
790 ( 1.0e0 / ( areacoord[0] + areacoord[2] ) ) * ( areacoord[0] * gctrl_pts[0] + areacoord[2] * gctrl_pts[5] );
793 ( 1.0e0 / ( areacoord[0] + areacoord[1] ) ) * ( areacoord[0] * gctrl_pts[1] + areacoord[1] * gctrl_pts[2] );
813 for( k = 1; k < 4; k++ )
814 ctrl_pts[k] = CP[k + 5];
818 double B =
mbquart( areacoord[0] );
819 pt += B * ctrl_pts[0];
822 B = 4.0 *
mbcube( areacoord[0] ) * areacoord[1];
823 pt += B * ctrl_pts[1];
826 B = 6.0 *
mbsqr( areacoord[0] ) *
mbsqr( areacoord[1] );
827 pt += B * ctrl_pts[2];
830 B = 4.0 * areacoord[0] *
mbcube( areacoord[1] );
831 pt += B * ctrl_pts[3];
837 for( k = 1; k < 4; k++ )
838 ctrl_pts[k] = CP[k - 1];
843 pt += B * ctrl_pts[0];
846 B = 4.0 *
mbcube( areacoord[1] ) * areacoord[2];
847 pt += B * ctrl_pts[1];
850 B = 6.0 *
mbsqr( areacoord[1] ) *
mbsqr( areacoord[2] );
851 pt += B * ctrl_pts[2];
854 B = 4.0 * areacoord[1] *
mbcube( areacoord[2] );
855 pt += B * ctrl_pts[3];
861 for( k = 1; k < 4; k++ )
862 ctrl_pts[k] = CP[k + 2];
867 pt += B * ctrl_pts[0];
870 B = 4.0 * areacoord[0] *
mbcube( areacoord[2] );
871 pt += B * ctrl_pts[1];
874 B = 6.0 *
mbsqr( areacoord[0] ) *
mbsqr( areacoord[2] );
875 pt += B * ctrl_pts[2];
878 B = 4.0 *
mbcube( areacoord[0] ) * areacoord[2];
879 pt += B * ctrl_pts[3];
882 B = 12.0 *
mbsqr( areacoord[0] ) * areacoord[1] * areacoord[2];
883 pt += B * P_facet[0];
886 B = 12.0 * areacoord[0] *
mbsqr( areacoord[1] ) * areacoord[2];
887 pt += B * P_facet[1];
890 B = 12.0 * areacoord[0] * areacoord[1] *
mbsqr( areacoord[2] );
891 pt += B * P_facet[2];
905 double& dist_to_plane )
915 double dist = normal % pt + plane[3];
916 dist_to_plane = fabs( dist );
917 point_on_plane = pt - dist * normal;
965 if( area2 < 100 * tol )
969 CartVect absnorm( fabs( normal[0] ), fabs( normal[1] ), fabs( normal[2] ) );
973 if( absnorm[0] >= absnorm[1] && absnorm[0] >= absnorm[2] )
975 area2 =
determ3( p[0][1], p[0][2], p[1][1], p[1][2], p[2][1], p[2][2] );
976 if( fabs( area2 ) < tol )
978 areacoord =
CartVect( -std::numeric_limits< double >::min() );
998 areacoord[0] =
determ3( pt_on_plane[1], pt_on_plane[2], p[1][1], p[1][2], p[2][1], p[2][2] ) / area2;
1000 areacoord[1] =
determ3( p[0][1], p[0][2], pt_on_plane[1], pt_on_plane[2], p[2][1], p[2][2] ) / area2;
1002 areacoord[2] =
determ3( p[0][1], p[0][2], p[1][1], p[1][2], pt_on_plane[1], pt_on_plane[2] ) / area2;
1005 else if( absnorm[1] >= absnorm[0] && absnorm[1] >= absnorm[2] )
1008 area2 =
determ3( p[0][0], p[0][2], p[1][0], p[1][2], p[2][0], p[2][2] );
1009 if( fabs( area2 ) < tol )
1011 areacoord =
CartVect( -std::numeric_limits< double >::min() );
1018 areacoord =
CartVect( 1., 0., 0. );
1022 areacoord =
CartVect( 0., 1., 0. );
1026 areacoord =
CartVect( 0., 0., 1. );
1031 areacoord[0] =
determ3( pt_on_plane[0], pt_on_plane[2], p[1][0], p[1][2], p[2][0], p[2][2] ) / area2;
1033 areacoord[1] =
determ3( p[0][0], p[0][2], pt_on_plane[0], pt_on_plane[2], p[2][0], p[2][2] ) / area2;
1035 areacoord[2] =
determ3( p[0][0], p[0][2], p[1][0], p[1][2], pt_on_plane[0], pt_on_plane[2] ) / area2;
1043 area2 =
determ3( p[0][0], p[0][1], p[1][0], p[1][1], p[2][0], p[2][1] );
1044 if( fabs( area2 ) < tol )
1046 areacoord =
CartVect( -std::numeric_limits< double >::min() );
1053 areacoord =
CartVect( 1., 0., 0. );
1057 areacoord =
CartVect( 0., 1., 0. );
1061 areacoord =
CartVect( 0., 0., 1. );
1066 areacoord[0] =
determ3( pt_on_plane[0], pt_on_plane[1], p[1][0], p[1][1], p[2][0], p[2][1] ) / area2;
1068 areacoord[1] =
determ3( p[0][0], p[0][1], pt_on_plane[0], pt_on_plane[1], p[2][0], p[2][1] ) / area2;
1070 areacoord[2] =
determ3( p[0][0], p[0][1], p[1][0], p[1][1], pt_on_plane[0], pt_on_plane[1] ) / area2;
1087 std::vector< EntityHandle > facets_out;
1093 int interpOrder = 4;
1094 double compareTol = 1.e-5;
1096 rval =
project_to_facets( facets_out, lastFacet, interpOrder, compareTol, this_point, trim, outside,
1097 closest_point_ptr, normal_ptr );
1112 bool outside_facet =
false;
1113 bool best_outside_facet =
true;
1114 double mindist = 1.e20;
1115 CartVect close_point, best_point( mindist, mindist, mindist ), best_areacoord;
1118 assert( facet_list.size() > 0 );
1120 double big_dist = compareTol * 1.0e3;
1123 for(
size_t i = 0; i < facet_list.size(); i++ )
1125 facet = facet_list[i];
1127 double dist_to_plane;
1133 if( interpOrder != 0 )
1148 double dist = ( close_point - this_point ).
length();
1149 if( ( best_outside_facet == outside_facet && dist < mindist ) ||
1150 ( best_outside_facet && !outside_facet && ( dist < big_dist || best_facet == 0L ) ) )
1153 best_point = close_point;
1155 best_areacoord = areacoord;
1156 best_outside_facet = outside_facet;
1158 if( dist < compareTol )
1162 big_dist = 10.0 * mindist;
1175 *normal_ptr = normal;
1178 if( closest_point_ptr )
1180 *closest_point_ptr = best_point;
1183 outside = best_outside_facet;
1184 lastFacet = best_facet;
1214 const double tol = compare_tol;
1216 if(
is_at_vertex( facet, pt, ac, compare_tol, eval_pt, eval_norm ) )
1225 const double atol = 0.001;
1233 double lastdist = move.
length();
1234 double bestdist = lastdist;
1241 if( lastdist <= tol && !eval_norm && nout == 0 )
1248 double ratio, mag, umove, vmove, det, distnew, movedist;
1252 CartVect xpt, ypt, zpt, xac, yac, zac, xvec, yvec, zvec;
1264 if( lastac[0] >= lastac[1] && lastac[0] >= lastac[2] )
1268 else if( lastac[1] >= lastac[2] )
1280 if( system == 1 || system == 2 )
1282 xac[0] = lastac[0] +
INCR;
1283 if( lastac[1] + lastac[2] == 0.0 )
return MB_FAILURE;
1284 ratio = lastac[2] / ( lastac[1] + lastac[2] );
1285 xac[1] = ( 1.0 - xac[0] ) * ( 1.0 - ratio );
1286 xac[2] = 1.0 - xac[0] - xac[1];
1288 xvec = xpt - lastpt;
1291 if( system == 0 || system == 2 )
1293 yac[1] = ( lastac[1] +
INCR );
1294 if( lastac[0] + lastac[2] == 0.0 )
1296 ratio = lastac[2] / ( lastac[0] + lastac[2] );
1297 yac[0] = ( ( 1.0 - yac[1] ) * ( 1.0 - ratio ) );
1298 yac[2] = ( 1.0 - yac[0] - yac[1] );
1300 yvec = ypt - lastpt;
1303 if( system == 0 || system == 1 )
1305 zac[2] = ( lastac[2] +
INCR );
1306 if( lastac[0] + lastac[1] == 0.0 )
1308 ratio = lastac[1] / ( lastac[0] + lastac[1] );
1309 zac[0] = ( ( 1.0 - zac[2] ) * ( 1.0 - ratio ) );
1310 zac[1] = ( 1.0 - zac[0] - zac[2] );
1312 zvec = zpt - lastpt;
1335 if( mag < DBL_EPSILON )
1342 if( iter == 0 ) bestnorm = norm;
1346 move = ( norm * move ) * norm;
1350 CartVect absnorm( fabs( norm[0] ), fabs( norm[1] ), fabs( norm[2] ) );
1351 if( absnorm[2] >= absnorm[1] && absnorm[2] >= absnorm[0] )
1353 det = du[0] * dv[1] - dv[0] * du[1];
1354 if( fabs( det ) <= DBL_EPSILON )
1358 umove = ( move[0] * dv[1] - dv[0] * move[1] ) / det;
1359 vmove = ( du[0] * move[1] - move[0] * du[1] ) / det;
1361 else if( absnorm[1] >= absnorm[2] && absnorm[1] >= absnorm[0] )
1363 det = du[0] * dv[2] - dv[0] * du[2];
1364 if( fabs( det ) <= DBL_EPSILON )
1368 umove = ( move[0] * dv[2] - dv[0] * move[2] ) / det;
1369 vmove = ( du[0] * move[2] - move[0] * du[2] ) / det;
1373 det = du[1] * dv[2] - dv[1] * du[2];
1374 if( fabs( det ) <= DBL_EPSILON )
1378 umove = ( move[1] * dv[2] - dv[1] * move[2] ) / det;
1379 vmove = ( du[1] * move[2] - move[1] * du[2] ) / det;
1387 newac[1] = ( lastac[1] + umove );
1388 newac[2] = ( lastac[2] + vmove );
1389 newac[0] = ( 1.0 - newac[1] - newac[2] );
1392 newac[2] = ( lastac[2] + umove );
1393 newac[0] = ( lastac[0] + vmove );
1394 newac[1] = ( 1.0 - newac[2] - newac[0] );
1397 newac[0] = ( lastac[0] + umove );
1398 newac[1] = ( lastac[1] + vmove );
1399 newac[2] = ( 1.0 - newac[0] - newac[1] );
1405 if( newac[0] >= -atol && newac[1] >= -atol && newac[2] >= -atol )
1416 if( edge_id != -1 )
ac_at_edge( newac, newac, edge_id );
1421 distnew = ( pt - newpt ).
length();
1422 move = newpt - lastpt;
1423 movedist = move.
length();
1424 if( movedist < tol || distnew < tol )
1427 if( distnew < bestdist )
1450 if( distnew > lastdist )
1472 if( distnew < bestdist )
1490 *eval_norm = bestnorm;
1492 outside = ( nout > 0 ) ?
true :
false;
1513 v = fac[1] / ( fac[1] + fac[2] );
1517 u = fac[0] / ( fac[0] + fac[2] );
1522 u = fac[0] / ( fac[0] + fac[1] );
1549 bool& outside_facet,
1550 double compare_tol )
1585 const double actol = 0.1;
1598 if( fabs( ac[0] ) < actol && fabs( ac[1] ) < actol )
1601 dist = ( pt - vert_loc ).
length();
1602 if( dist <= compare_tol )
1607 *eval_norm_ptr = NN[2];
1613 if( fabs( ac[0] ) < actol && fabs( ac[2] ) < actol )
1616 dist = ( pt - vert_loc ).
length();
1617 if( dist <= compare_tol )
1622 *eval_norm_ptr = NN[1];
1628 if( fabs( ac[1] ) < actol && fabs( ac[2] ) < actol )
1631 dist = ( pt - vert_loc ).
length();
1632 if( dist <= compare_tol )
1637 *eval_norm_ptr = NN[0];
1660 ac[1] = ac[1] / ( ac[1] + ac[2] );
1667 ac[0] = ac[0] / ( ac[0] + ac[2] );
1674 ac[0] = ac[0] / ( ac[0] + ac[1] );
1678 return ( nout > 0 ) ? true :
false;
1731 if( fabs( areacoord[1] + areacoord[2] ) < 1.0e-6 )
1736 if( fabs( areacoord[0] + areacoord[2] ) < 1.0e-6 )
1741 if( fabs( areacoord[0] + areacoord[1] ) < 1.0e-6 )
1761 ( 1.0e0 / ( areacoord[1] + areacoord[2] ) ) * ( areacoord[1] * gctrl_pts[3] + areacoord[2] * gctrl_pts[4] );
1767 ( 1.0e0 / ( areacoord[0] + areacoord[2] ) ) * ( areacoord[0] * gctrl_pts[0] + areacoord[2] * gctrl_pts[5] );
1773 ( 1.0e0 / ( areacoord[0] + areacoord[1] ) ) * ( areacoord[0] * gctrl_pts[1] + areacoord[1] * gctrl_pts[2] );
1799 Nijk[1] = ( CP[7] - CP[6] ) * ( P_facet[0] - CP[6] );
1804 Nijk[2] = ( CP[8] - CP[7] ) * ( P_facet[1] - CP[7] );
1812 Nijk[6] = ( CP[0] - P_facet[1] ) * ( CP[1] - P_facet[1] );
1817 Nijk[8] = ( CP[1] - P_facet[2] ) * ( CP[2] - P_facet[2] );
1825 Nijk[7] = ( P_facet[2] - CP[4] ) * ( CP[3] - CP[4] );
1830 Nijk[4] = ( P_facet[0] - CP[5] ) * ( CP[4] - CP[5] );
1834 Nijk[5] = ( P_facet[1] - P_facet[0] ) * ( P_facet[2] - P_facet[0] );
1840 normal =
CartVect( 0.0e0, 0.0e0, 0.0e0 );
1844 double B =
mbcube( areacoord[0] );
1846 normal += B * Nijk[0];
1849 B = 3.0 *
mbsqr( areacoord[0] ) * areacoord[1];
1851 normal += B * Nijk[1];
1854 B = 3.0 * areacoord[0] *
mbsqr( areacoord[1] );
1856 normal += B * Nijk[2];
1859 B =
mbcube( areacoord[1] );
1861 normal += B * Nijk[3];
1864 B = 3.0 *
mbsqr( areacoord[0] ) * areacoord[2];
1866 normal += B * Nijk[4];
1869 B = 6.0 * areacoord[0] * areacoord[1] * areacoord[2];
1871 normal += B * Nijk[5];
1874 B = 3.0 *
mbsqr( areacoord[1] ) * areacoord[2];
1876 normal += B * Nijk[6];
1879 B = 3.0 * areacoord[0] *
mbsqr( areacoord[2] );
1881 normal += B * Nijk[7];
1884 B = 3.0 * areacoord[1] *
mbsqr( areacoord[2] );
1886 normal += B * Nijk[8];
1889 B =
mbcube( areacoord[2] );
1891 normal += B * Nijk[9];
1920 double improvement = 1.e20;
1922 while( numIter++ < 5 && improvement > 0.01 )
1934 diff = newPos - currentPoint;
1935 improvement = diff.
length();
1939 double dot = normal % ray;
1945 double t = ( ( newPos - pt ) % normal ) / (
dot );
1946 currentPoint = pt + t * ray;
1948 eval_pt = currentPoint;
1949 diff = currentPoint - pt;
1950 distance = diff.
length();