VertexAligner

Since v9.0
public static class VertexAligner
Moves vertices of different kinds of geometry onto one another, within a distance.

See the

_AlignVertices
Rhino command for more information.

Methods

Align

#Since v9.0
public static int Align(IEnumerable<GeometryBase> geometry, double distance, bool onlyNaked, bool average, IEnumerable<IEnumerable<bool>> whichVertices)
Moves vertices that lie within the specified distance of one another onto the same location.

This is helpful to close the seams between separate pieces of geometry.

See the

_AlignVertices
Rhino command for more information.

geometry (IEnumerable<GeometryBase>)The geometry to adjust. It is modified in place.

Meshes, SubDs, point clouds and degree 1 curves are supported.

distance (double)Distance that should not be exceed when moving a vertex.
onlyNaked (bool)If true, only vertices that lie along naked edges are moved, and only such vertices are used as targets to align to. Point cloud points and curve points are always considered, because neither has an interior for this to exclude.
average (bool)If true, vertices that are candidates for one another are moved towards each other, rather than one of them being privileged and the others moved onto it.
whichVertices (IEnumerable<IEnumerable<bool>>)If not null, defines which vertices should be considered for adjustment.

If this parameter is non-null, it needs one item per piece of geometry, and each item needs one value per vertex of the geometry it belongs to.

SubD vertices are not currently supported: a list given for a SubD is ignored, and every one of its vertices is considered. This may be supported in a future version.

If the operation succeeded, the number of vertices that were moved, or -1 on error.

Align

#Since v9.0
public static int Align(IEnumerable<GeometryBase> geometry, double distance, bool onlyNaked, bool average)
Moves vertices that lie within the specified distance of one another onto the same location.

This is helpful to close the seams between separate pieces of geometry.

All vertices are considered, not only those on naked edges, unless onlyNaked says otherwise.

See the

_AlignVertices
Rhino command for more information.

geometry (IEnumerable<GeometryBase>)The geometry to adjust. It is modified in place.

Meshes, SubDs, point clouds and degree 1 curves are supported.

distance (double)Distance that should not be exceed when moving a vertex.
onlyNaked (bool)If true, only vertices that lie along naked edges are moved, and only such vertices are used as targets to align to. Point cloud points and curve points are always considered, because neither has an interior for this to exclude.
average (bool)If true, vertices that are candidates for one another are moved towards each other, rather than one of them being privileged and the others moved onto it.
If the operation succeeded, the number of vertices that were moved, or -1 on error.

SuggestDistance

#Since v9.0
public static double SuggestDistance(IEnumerable<GeometryBase> geometry)
Suggests a distance for Align(IEnumerable<GeometryBase>, double, bool, bool) from the geometry itself, so the gaps do not have to be measured first.

A vertex whose nearest neighbour of all belongs to another object was meant to be shared with it. Within one mesh or SubD, a cluster of naked vertices at least 1000 times closer together than to any other naked vertex of that object was meant to be one vertex.

The suggestion closes all of these gaps, rounded up to the next power of ten unless that would reach the spacing next to a gap.

geometry (IEnumerable<GeometryBase>)The geometry that would be aligned. A single object is enough.
A distance greater than zero, or zero when no such gap is found.

SupportsGeometry

#Since v9.0
public static bool SupportsGeometry(GeometryBase geometry)
Tests whether a piece of geometry can have its vertices aligned.

Meshes, SubDs, point clouds and degree 1 curves are supported.

geometry (GeometryBase)The geometry to test. Can be null.
True if Align(IEnumerable<GeometryBase>, double, bool, bool) accepts this geometry.