toxi.geom.mesh
Class VertexSelector

java.lang.Object
  extended by toxi.geom.mesh.VertexSelector
Direct Known Subclasses:
BoxSelector, DefaultSelector, PlaneSelector

public abstract class VertexSelector
extends java.lang.Object

Abstract parent class for selecting mesh vertices and manipulating resulting selections using set theory operations. Implementations of this class should aim to work with all mesh types (e.g. TriangleMesh, WETriangleMesh).


Constructor Summary
VertexSelector(Mesh3D mesh)
          Creates a new selector assigned to the given mesh
 
Method Summary
 VertexSelector addSelection(VertexSelector sel2)
          Adds all vertices selected by the given selector to the current selection.
 VertexSelector clearSelection()
          Clears the current selection.
 Mesh3D getMesh()
          Returns the associated mesh for this selector.
 java.util.Collection<Vertex> getSelection()
          Returns the actual collection of selected vertices
 VertexSelector invertSelection()
          Creates a new selection of all vertices NOT currently selected.
 VertexSelector selectSimilar(java.util.Collection<? extends Vec3D> points)
          Selects vertices identical or closest to the ones given in the list of points.
abstract  VertexSelector selectVertices()
          Selects vertices using an implementation specific method.
 void setMesh(Mesh3D mesh)
          Assigns a new mesh instance to this selector and clears the current selection.
 int size()
          Returns the current number of selected vertices.
 VertexSelector subtractSelection(VertexSelector sel2)
          Removes all vertices selected by the given selector from the current selection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VertexSelector

public VertexSelector(Mesh3D mesh)
Creates a new selector assigned to the given mesh

Parameters:
mesh -
Method Detail

addSelection

public VertexSelector addSelection(VertexSelector sel2)
Adds all vertices selected by the given selector to the current selection. The other selector needs to be assigned to the same mesh instance.

Parameters:
sel2 - other selector
Returns:
itself

clearSelection

public VertexSelector clearSelection()
Clears the current selection.

Returns:
itself

getMesh

public Mesh3D getMesh()
Returns the associated mesh for this selector.

Returns:
itself

getSelection

public java.util.Collection<Vertex> getSelection()
Returns the actual collection of selected vertices

Returns:
vertex collection

invertSelection

public VertexSelector invertSelection()
Creates a new selection of all vertices NOT currently selected.

Returns:
itself

selectSimilar

public VertexSelector selectSimilar(java.util.Collection<? extends Vec3D> points)
Selects vertices identical or closest to the ones given in the list of points.

Parameters:
points -
Returns:
itself

selectVertices

public abstract VertexSelector selectVertices()
Selects vertices using an implementation specific method. This is the only method which needs to be implemented by any selector subclass.

Returns:
itself

setMesh

public void setMesh(Mesh3D mesh)
Assigns a new mesh instance to this selector and clears the current selection.

Parameters:
mesh - the mesh to set

size

public int size()
Returns the current number of selected vertices.

Returns:
number of vertices

subtractSelection

public VertexSelector subtractSelection(VertexSelector sel2)
Removes all vertices selected by the given selector from the current selection. The other selector needs to be assigned to the same mesh instance.

Parameters:
sel2 - other selector
Returns:
itself