meshmash / Plankton

A C# half-edge mesh data structure, and components for using this in Grasshopper/Rhino
http://meshmash.github.io/Plankton
GNU Lesser General Public License v3.0
216 stars 66 forks source link

Vertex truncation #25

Closed pearswj closed 9 years ago

pearswj commented 9 years ago

I thought I'd open this one up to the floor because I'm can't decide what the most easy and useful parameters and return values should be. I'd rather the function didn't make any geometrical assumptions but rather stick to handling the topological changes. This results in a new face being created at the vertex whose vertices are all coincident. Usually the desire is to move these vertices to a specified parameter along the adjacent (original) halfedge. As such it must be easy to identify the necessary vertices that need adjusting after the topology has been altered. The vertices in question will be the start vertex of each of the outgoing halfedges of the truncated vertex.

The function currently takes the index of the vertex to be truncated as it's sole parameter and returns the index of the newly created vertex-face. Is this sensible?

I'm also toying with basing everything on halfedges (as with SplitVertex/MergeFace/etc.)...

pearswj commented 9 years ago

I'll write some examples showing how the function can be called.

Dan-Piker commented 9 years ago

That all sounds good to me. I think it is correct to keep the topology and geometry separate, and as you describe, the starts of the original outgoing halfedges will be the ones that need relocating. I guess when this is used on actual geometry we would often want to also make a method that takes a double for how far along each edge to truncate, but keeping the function here purely topological is cleaner.

pearswj commented 9 years ago

The age-old problem of keeping things both flexible and easy to use...! Thanks for your insight. This being a purely local modifier, I think I'll write the global one that would make use of this before I merge it all in. This should take a single parameter (perhaps with a default of 1/3rd).

On 13 Oct 2014, at 00:42, Daniel Piker notifications@github.com wrote:

That all sounds good to me. I think it is correct to keep the topology and geometry separate, and as you describe, the starts of the original outgoing halfedges will be the ones that need relocating. I guess when this is used on actual geometry we would often want to also make a method that takes a double for how far along each edge to truncate, but keeping the function here purely topological is cleaner.

— Reply to this email directly or view it on GitHub.

pearswj commented 9 years ago

http://wjp-builds-data.s3-eu-west-1.amazonaws.com/plankton-88.zip

pearswj commented 9 years ago

Global truncation tested and working in Grasshopper. Considering a name change to "TruncateVertices" before merging. Thoughts welcomed.

Dan-Piker commented 9 years ago

Great stuff, and I agree TruncateVertices is a better name.