Closed manuelsotoma closed 10 years ago
Thanks for your interest in Plankton!
I removed this constructor because it doesn't really do much. Apologies for not mentioning this in the release notes for 0.3.0.
The source for the old constructor can be viewed here: v0.2.0/Plankton/PlanktonMesh.cs#L210
I'm assuming you're using Plankton in Grasshopper and that you're referencing both Plankton.dll and Plankton.gha. Try something like this...
// IEnumerable<Point3d> pts
// IEnumerable<IEnumerable<int>> faces
PlanktonMesh pMesh = new PlanktonMesh();
// Add vertices
foreach (Point3d pt in pts)
{
pMesh.Vertices.Add(pt);
}
// Add faces (and half-edges)
foreach (IEnumerable<int> face in faces)
{
pMesh.Faces.AddFace(face);
}
Maybe I could add an AddVertices method and an AddFaces method to make this process easier?
The face adding is quite robust and should only prevent a face from being added if doing so would create a non-manifold edge. Could you please send me an example set of face indices that is causing you problems?
HI Will
Sorry for the late answer. A bit of Holiday and New Year. Happy new Year by the way.
I dont have anymore the code that was giving me troubles, as I was then overwriting a file and went back to the old release of Plankton as It was working for me. But just for trial i did that:
Plankton.PlanktonMesh m = new Plankton.PlanktonMesh();
int a = m.Vertices.Add(5, 0, 7);
int b = m.Vertices.Add(5, 4, 6);
int c = m.Vertices.Add(4, 3, 5);
int d = m.Vertices.Add(6, 2, 4);
int fa = m.Faces.AddFace(a, b, c);
int fb = m.Faces.AddFace(a, b, d);
m.Compact();
the resulting mesh would just have 3 vertices and one faces.
Otherwise, with this code:
Plankton.PlanktonMesh m = new Plankton.PlanktonMesh();
int a = m.Vertices.Add(5, 0, 7);
int b = m.Vertices.Add(5, 4, 6);
int c = m.Vertices.Add(4, 3, 5);
int d = m.Vertices.Add(5, 0, 7);
int g = m.Vertices.Add(5, 4, 6);
int h = m.Vertices.Add(3, 8, 3);
int fa = m.Faces.AddFace(a, b, c);
int fb = m.Faces.AddFace(d, g, h);
the resulting mesh would just have 6 vertices and 2 faces. But Note that a and d are the same vertex. b and g are the same vertex
The second face would not be added if vertices are already existing on another face.
Thanks Manuel
Hi Manuel,
No problem. Happy New Year to you too!
OK, so the issue here is that Plankton only handles orientable, non-manifold meshes. This means that, in addition to only handling two faces per edge, all faces must be 'wound' in the same direction (i.e. their vertices must always be ordered in either clockwise or counterclockwise direction, but not both).
Using you first example, when trying to add face ABD, plankton is attempting to assign halfedge AB to the new face however this is not possible as it already has an adjacent face.
Instead, try adding face BAD. This will assign halfedge BA to the new face, thus enabling the mesh to be traversed from to old face to the new one via the halfedge pair between vertices A and B.
I hope this helps!
I see Thanks. I ll give it a try.
Enviado desde mi iPhone
El 06/01/2014, a las 10:05, "Will Pearson" notifications@github.com escribió:
Hi Manuel,
No problem. Happy New Year to you too!
OK, so the issue here is that Plankton only handles orientable, non-manifold meshes. This means that, in addition to only handling two faces per edge, all faces must be 'wound' in the same direction (i.e. their vertices must always be ordered in either clockwise or counterclockwise direction, but not both).
Using you first example, when trying to add face ABD, plankton is attempting to assign halfedge AB to the new face however this is not possible as it already has an adjacent face.
Instead, try adding face BAD. This will assign halfedge BA to the new face, thus enabling the mesh to be traversed from to old face to the new one via the halfedge pair between vertices A and B.
I hope this helps!
— Reply to this email directly or view it on GitHub.
Hi Will.
I wonder then. It would not be possible to make a mesh in which more than two faces share an edge right??
Subject: Re: [Plankton] PlanktonMesh Constructor (#8) From: manuelsotoma@hotmail.com Date: Mon, 6 Jan 2014 10:08:40 +0100 To: reply@reply.github.com
I seeThanks. I ll give it a try.
Enviado desde mi iPhone El 06/01/2014, a las 10:05, "Will Pearson" notifications@github.com escribió:
Hi Manuel,
No problem. Happy New Year to you too!
OK, so the issue here is that Plankton only handles orientable, non-manifold meshes. This means that, in addition to only handling two faces per edge, all faces must be 'wound' in the same direction (i.e. their vertices must always be ordered in either clockwise or counterclockwise direction, but not both).
Using you first example, when trying to add face ABD, plankton is attempting to assign halfedge AB to the new face however this is not possible as it already has an adjacent face.
Instead, try adding face BAD. This will assign halfedge BA to the new face, thus enabling the mesh to be traversed from to old face to the new one via the halfedge pair between vertices A and B.
I hope this helps!
— Reply to this email directly or view it on GitHub.
Correct. The data structure is optimised for manifold meshes.
EDIT: I haphazardly wrote "non-manifold" the first time round.
On 6 Jan 2014, at 11:11, manuelsotoma notifications@github.com wrote:
Hi Will.
I wonder then. It would not be possible to make a mesh in which more than two faces share an edge right??
Subject: Re: [Plankton] PlanktonMesh Constructor (#8) From: manuelsotoma@hotmail.com Date: Mon, 6 Jan 2014 10:08:40 +0100 To: reply@reply.github.com
I seeThanks. I ll give it a try.
Enviado desde mi iPhone El 06/01/2014, a las 10:05, "Will Pearson" notifications@github.com escribió:
Hi Manuel,
No problem. Happy New Year to you too!
OK, so the issue here is that Plankton only handles orientable, non-manifold meshes. This means that, in addition to only handling two faces per edge, all faces must be 'wound' in the same direction (i.e. their vertices must always be ordered in either clockwise or counterclockwise direction, but not both).
Using you first example, when trying to add face ABD, plankton is attempting to assign halfedge AB to the new face however this is not possible as it already has an adjacent face.
Instead, try adding face BAD. This will assign halfedge BA to the new face, thus enabling the mesh to be traversed from to old face to the new one via the halfedge pair between vertices A and B.
I hope this helps!
— Reply to this email directly or view it on GitHub. — Reply to this email directly or view it on GitHub.
optimised for manifold meshes!
Hi Manuel, also, here's a handy overview with more illustrations of some of the terminology Will describes above http://www.cs.mtu.edu/~shene/COURSES/cs3621/SLIDES/Mesh.pdf
Thanks for catching that Daniel! Apologies for any confusion caused...
Thanks Daniel and Will
Enviado desde mi iPhone
El 06/01/2014, a las 16:36, "Will Pearson" notifications@github.com escribió:
Thanks for catching that Daniel! Apologies for any confusion caused...
— Reply to this email directly or view it on GitHub.
Hi. There used to be a PlanktonMesh Constructor in the 0.2.0 release, able to build up a mesh with an ienumerable of vertices, and an ienumerable of ienumerables of indices representing the faces. I miss it in the 0.3 release, and I am not able to build now a mesh.
I tried with the AddVertex and AddFace methods, but it does not add a face on a vertex which is included in an existing Face. Might be a bug??