| 301 | } |
| 302 | |
| 303 | CurvePoints meshPathCurvePoints( const Mesh& mesh, const GeodesicPath& path ) |
| 304 | { |
| 305 | MR_TIMER; |
| 306 | CurvePoints cp; |
| 307 | cp.reserve( path.numVertices() ); |
| 308 | if (path.start.valid() ) |
| 309 | cp.push_back( { .pos = mesh.triPoint( path.start ), .snorm = mesh.normal( path.start ) } ); |
| 310 | for ( const auto & ep : path.mids ) |
| 311 | cp.push_back( { .pos = mesh.triPoint( ep ), .snorm = mesh.normal( ep ) } ); |
| 312 | if ( path.end.valid() ) |
| 313 | cp.push_back( { .pos = mesh.triPoint( path.end ), .snorm = mesh.normal( path.end ) } ); |
| 314 | assert( cp.size() == path.numVertices() ); |
| 315 | |
| 316 | if ( cp.size() < 2 ) |
| 317 | { |
| 318 | assert( false ); |
| 319 | return {}; |
| 320 | } |
| 321 | cp[0].dir = ( cp[1].pos - cp[0].pos ).normalized(); |
| 322 | for ( int i = 1; i + 1 < cp.size(); ++i ) |
| 323 | cp[i].dir = ( cp[i + 1].pos - cp[i - 1].pos ).normalized(); |
| 324 | cp.back().dir = ( cp[cp.size() - 1].pos - cp[cp.size() - 2].pos ).normalized(); |
| 325 | return cp; |
| 326 | } |
| 327 | |
| 328 | CurvePoints meshPathCurvePoints( const Mesh& mesh, const SurfacePath& path ) |
| 329 | { |
no test coverage detected