eltopo3d/surftrack.cpp
// ---------------------------------------------------------
///
/// Add a triangle to the surface.  Update the underlying TriMesh and acceleration grid. 
///
// ---------------------------------------------------------
Add a triangle to the surface.  Update the underlying TriMesh and acceleration grid.
Add a triangle to the surface . Update the underlying TriMesh and acceleration grid .
size_t SurfTrack::add_triangle( const Vec3st& t )
{
    size_t new_triangle_index = m_mesh.add_triangle( t );
    assert( t[0] < get_num_vertices() );
    assert( t[1] < get_num_vertices() );
    assert( t[2] < get_num_vertices() );
    if ( m_collision_safety )
    {
        Vec3d low, high;
        triangle_static_bounds( new_triangle_index, low, high );
        m_broad_phase->add_triangle( new_triangle_index, low, high, triangle_is_solid(new_triangle_index) );
        size_t new_edge_index = m_mesh.get_edge_index( t[0], t[1] );
        assert( new_edge_index != m_mesh.m_edges.size() );
        edge_static_bounds( new_edge_index, low, high );
        m_broad_phase->add_edge( new_edge_index, low, high, edge_is_solid( new_edge_index ) );
        new_edge_index = m_mesh.get_edge_index( t[1], t[2] );
        assert( new_edge_index != m_mesh.m_edges.size() );   
        edge_static_bounds( new_edge_index, low, high );
        m_broad_phase->add_edge( new_edge_index, low, high, edge_is_solid( new_edge_index )  );
        new_edge_index = m_mesh.get_edge_index( t[2], t[0] );
        assert( new_edge_index != m_mesh.m_edges.size() );   
        edge_static_bounds( new_edge_index, low, high );
        m_broad_phase->add_edge( new_edge_index, low, high, edge_is_solid( new_edge_index )  );
    }
    m_triangle_change_history.push_back( TriangleUpdateEvent( TriangleUpdateEvent::TRIANGLE_ADD, new_triangle_index, t ) );
    return new_triangle_index;
}
size_t SurfTrack :: add_triangle ( const Vec3st & t ) { size_t new_triangle_index = m_mesh . add_triangle ( t ) ; assert ( t [ 0 ] < get_num_vertices ( ) ) ; assert ( t [ 1 ] < get_num_vertices ( ) ) ; assert ( t [ 2 ] < get_num_vertices ( ) ) ; if ( m_collision_safety ) { Vec3d low , high ; triangle_static_bounds ( new_triangle_index , low , high ) ; m_broad_phase -> add_triangle ( new_triangle_index , low , high , triangle_is_solid ( new_triangle_index ) ) ; size_t new_edge_index = m_mesh . get_edge_index ( t [ 0 ] , t [ 1 ] ) ; assert ( new_edge_index != m_mesh . m_edges . size ( ) ) ; edge_static_bounds ( new_edge_index , low , high ) ; m_broad_phase -> add_edge ( new_edge_index , low , high , edge_is_solid ( new_edge_index ) ) ; new_edge_index = m_mesh . get_edge_index ( t [ 1 ] , t [ 2 ] ) ; assert ( new_edge_index != m_mesh . m_edges . size ( ) ) ; edge_static_bounds ( new_edge_index , low , high ) ; m_broad_phase -> add_edge ( new_edge_index , low , high , edge_is_solid ( new_edge_index ) ) ; new_edge_index = m_mesh . get_edge_index ( t [ 2 ] , t [ 0 ] ) ; assert ( new_edge_index != m_mesh . m_edges . size ( ) ) ; edge_static_bounds ( new_edge_index , low , high ) ; m_broad_phase -> add_edge ( new_edge_index , low , high , edge_is_solid ( new_edge_index ) ) ; } m_triangle_change_history . push_back ( TriangleUpdateEvent ( TriangleUpdateEvent :: TRIANGLE_ADD , new_triangle_index , t ) ) ; return new_triangle_index ; }
Add a triangle to the surface.
Add a triangle to the surface .
// Add to the triangle grid // Add edges to grid as well