Sign in to follow this  

OpenMesh library

This topic is 3856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everybody, I've started using OpenMesh lib recently and I don't know how to do some things... I want to add some extra attributes to my mesh. For example, I want to add a flag (a boolean variable) just to mark interior and exterior vertices, how can I do it? I coded a "MyTraits" class and added this attribute using the "VertexTraits" macro but I don't know if this is ok... if it's correct, how can I access to these attributes? Thank you very much

Share this post


Link to post
Share on other sites
It's me again, I've solved the problem without adding attributes to my OpenMesh structure, I've built a struct like this (it's a very stupid solution but it will work):

typedef OpenMesh::TriMesh_ArrayKernelT<> TriMesh;

typedef struct
{
TriMesh chart;
//this is for identifying submeshes, etc.
std::vector<int> geo;
std::vector<int> triSet;
std::vector<int> tri;
//the flag I mentioned, this vector contains a flag for each vertex of the mesh
std::vector<bool> interior;
} MyMesh;

Anyway, I'd like to know how can be done what I asked before...


Thanks again

Share this post


Link to post
Share on other sites
Ok, now I've done what I told you in the first post and it works fine:

------------------
struct Traits : public OpenMesh::DefaultTraits
{
VertexTraits
{
private:
int _geo, _triSet, _tri;
bool _interior;
public:
int geo() { return _geo; }
void set_geo(int g) { _geo = g; }
int triSet() { return _triSet; }
void set_triSet(int t) { _triSet = t; }
int tri() { return _tri; }
void set_tri(int tr) { _tri = tr; }
bool interior() { return _interior; }
void set_interior(bool in) { _interior = in; }
};
};

typedef OpenMesh::TriMesh_ArrayKernelT<Traits> MyMesh;
------------------


I've got some meshes segmented in multiple charts and I'm trying to classify its vertices into boundary or interior ones. To do so I'm using OpenMesh's "is_boundary" method like this:

------------------
MyMesh::VertexIter v_it;

for (v_it = mesh[i].vertices_begin(); v_it != mesh[i].vertices_end(); ++v_it)
{
if (!mesh[i].is_boundary(v_it.handle())) std::cout<<"Chart: "<< i<< ". This is a boundary vertex\n";
else std::cout<<"Chart: "<< i<<". This is an interior vertex\n";
}
------------------

"mesh" is a pointer and each position contains one of the mentioned charts, with all its geometry.

I don't know what I'm doing wrong but the message is always the same "This is an interior vertex". Anybody knows how to find interior and exterior nodes?

Here you have two images of a very simple mesh divided in 2 charts:
http://ima.udg.edu/~sfuntane/Boundary1.jpg
http://ima.udg.edu/~sfuntane/Boundary2.jpg


The red dots are the vertices and as you can see they aren't always interior...

Thank you very much

Share this post


Link to post
Share on other sites

This topic is 3856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this