| 86 | } |
| 87 | |
| 88 | UndirectedEdgeId getClosestEdge( const MeshTopology & topology, const VertCoords & points, const PointOnFace & p ) |
| 89 | { |
| 90 | EdgeId e = topology.edgeWithLeft( p.face ); |
| 91 | Vector3f a, b, c; |
| 92 | getLeftTriPoints( topology, points, e, a, b, c ); |
| 93 | |
| 94 | auto distSq = [&]( const LineSegm3f & l ) |
| 95 | { |
| 96 | return ( p.point - closestPointOnLineSegm( p.point, l ) ).lengthSq(); |
| 97 | }; |
| 98 | |
| 99 | UndirectedEdgeId res = e.undirected(); |
| 100 | float closestDistSq = distSq( { a, b } ); |
| 101 | |
| 102 | e = topology.prev( e.sym() ); |
| 103 | if ( auto eDistSq = distSq( { b, c } ); eDistSq < closestDistSq ) |
| 104 | { |
| 105 | res = e.undirected(); |
| 106 | closestDistSq = eDistSq; |
| 107 | } |
| 108 | |
| 109 | e = topology.prev( e.sym() ); |
| 110 | if ( auto eDistSq = distSq( { c, a } ); eDistSq < closestDistSq ) |
| 111 | { |
| 112 | res = e.undirected(); |
| 113 | closestDistSq = eDistSq; |
| 114 | } |
| 115 | |
| 116 | return res; |
| 117 | } |
| 118 | |
| 119 | Vector3f triCenter( const MeshTopology & topology, const VertCoords & points, FaceId f ) |
| 120 | { |
nothing calls this directly
no test coverage detected