/// Picking used for determining whether a mouse click starts a morph operation. Returns a close vertex and the position of the click on the mesh surface.
Picking used for determining whether a mouse click starts a morph operation. Returns a close vertex and the position of the click on the mesh surface.
Picking used for determining whether a mouse click starts a morph operation . Returns a close vertex and the position of the click on the mesh surface .
fn pick(mesh: &Mesh, ray_start_point: &Vec3, ray_direction: &Vec3) -> Option<(VertexID, Vec3)>
{
    if let Some(Intersection::Point {primitive, point}) = mesh.ray_intersection(ray_start_point, ray_direction) {
        let start_vertex_id = match primitive {
            Primitive::Face(face_id) => {
                mesh.walker_from_face(face_id).vertex_id().unwrap()
            },
            Primitive::Edge(halfedge_id) => {
                let (vertex_id, ..) = mesh.edge_vertices(halfedge_id);
                vertex_id
            },
            Primitive::Vertex(vertex_id) => {
                vertex_id
            }
        };
        Some((start_vertex_id, point))
    }
    else {None}
}
fn pick ( mesh : & Mesh , ray_start_point : & Vec3 , ray_direction : & Vec3 ) -> Option < ( VertexID , Vec3 ) > { if let Some ( Intersection :: Point { primitive , point } ) = mesh . ray_intersection ( ray_start_point , ray_direction ) { let start_vertex_id = match primitive { Primitive :: Face ( face_id ) => { mesh . walker_from_face ( face_id ) . vertex_id ( ) . unwrap ( ) } , Primitive :: Edge ( halfedge_id ) => { let ( vertex_id , .. ) = mesh . edge_vertices ( halfedge_id ) ; vertex_id } , Primitive :: Vertex ( vertex_id ) => { vertex_id } } ; Some ( ( start_vertex_id , point ) ) } else { None } }
Picking used for determining whether a mouse click starts a morph operation.
Picking used for determining whether a mouse click starts a morph operation .
mesh
&Mesh
ray_start_point
&Vec3
ray_direction
&Vec3