Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part of the feature edge #1429

Closed
xiaodongdong101 opened this issue Jul 17, 2023 · 2 comments
Closed

Part of the feature edge #1429

xiaodongdong101 opened this issue Jul 17, 2023 · 2 comments

Comments

@xiaodongdong101
Copy link

I found that there is a global search for feature edges in the software.But if I want to find a local segment of a line.What should I do better?
For example, the cyan edge has two tangent lines at both ends.
27f4d1b5896df1b3fc39f1d30a05b49
How should I find out the local characteristic edge out

@Grantim
Copy link
Contributor

Grantim commented Jul 17, 2023

Hello, we have manual edge selector tool. Finding this edge automaticaly may be challenging and require some geometry specific code, I don't think it can be done in common case.
I suggest you can do something like this:

UndirectedEdgeBitSet creaseEdges = mesh.findCreaseEdges( 15.0f/180.0f * PI_F ); // 15 deg like on your screen
UndirectedEdgeBitSet resEdges = creaseEdges;
for ( auto ue : creaseEdges )
{
    if ( !doesMeetCriteria( mesh, creaseEdges, ue ) )
        resEdges.set( ue, false );
}

In your case it can be

bool doesMeetCriteria( const Mesh& m, const UndirectedEdgeBitSet& creases , UndirectedEdgeId ue )
{
    auto lengthSq = mesh.lengthSq( ue );
    for ( auto e : orgRing( mesh.topology, EdgeId( ue ) ) ) // check length of nearby creases (around one of the edge vertices)
    {
        if ( !creases.test( e.undirected() ) )
            continue;
        if ( mesh.lengthSq( e.undirected() ) >= lengthSq )
            return false;
    }
    for ( auto e : orgRing( mesh.topology, EdgeId( ue ).sym() ) ) // check length of nearby creases (around another one of the edge vertices)
    {
        if ( !creases.test( e.undirected() ) )
            continue;
        if ( mesh.lengthSq( e.undirected() ) >= lengthSq )
            return false;
    }
    return true;
}

This code sample select first all creases edges like on your screen, than it removes all creases with neighbour creases that are longer then them. ( it have not tested this code, it may require fixes, but the idea is to make good criteria based on your specific data )

@xiaodongdong101
Copy link
Author

Thanks a lot.That's a good way to mention it, I'll try it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants