| 27 | } |
| 28 | |
| 29 | std::optional<Vector3f> getPickedPointPosition( const VisualObject& object, const PickedPoint& point ) |
| 30 | { |
| 31 | return std::visit( overloaded{ |
| 32 | []( const std::monostate& ) -> std::optional<Vector3f> |
| 33 | { |
| 34 | return {}; |
| 35 | }, |
| 36 | [&object]( const MeshTriPoint& triPoint ) -> std::optional<Vector3f> |
| 37 | { |
| 38 | if ( auto objMesh = dynamic_cast< const ObjectMeshHolder* >( &object ) ) |
| 39 | { |
| 40 | if ( const auto& mesh = objMesh->mesh() ) |
| 41 | { |
| 42 | const auto & topology = mesh->topology; |
| 43 | if ( topology.hasEdge( triPoint.e ) ) |
| 44 | { |
| 45 | if ( triPoint.bary.b == 0 || topology.left( triPoint.e ) ) |
| 46 | return mesh->triPoint( triPoint ); |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | return {}; |
| 51 | }, |
| 52 | [&object]( const EdgePoint& edgePoint ) -> std::optional<Vector3f> |
| 53 | { |
| 54 | if ( auto objLines = dynamic_cast< const ObjectLinesHolder* >( &object ) ) |
| 55 | { |
| 56 | if ( const auto& polyline = objLines->polyline() ) |
| 57 | { |
| 58 | const auto & topology = polyline->topology; |
| 59 | if ( topology.hasEdge( edgePoint.e ) ) |
| 60 | return objLines->polyline()->edgePoint( edgePoint ); |
| 61 | } |
| 62 | } |
| 63 | return {}; |
| 64 | }, |
| 65 | [&object]( VertId vertId ) -> std::optional<Vector3f> |
| 66 | { |
| 67 | if ( auto objPoints = dynamic_cast< const ObjectPointsHolder* >( &object ) ) |
| 68 | { |
| 69 | if ( const auto& pointCloud = objPoints->pointCloud() ) |
| 70 | { |
| 71 | if ( pointCloud->validPoints.test( vertId ) ) |
| 72 | return pointCloud->points[vertId]; |
| 73 | } |
| 74 | } |
| 75 | return {}; |
| 76 | } |
| 77 | }, point ); |
| 78 | } |
| 79 | |
| 80 | std::optional<Vector3f> getPickedPointNormal( const VisualObject& object, const PickedPoint& point, bool interpolated ) |
| 81 | { |
no test coverage detected