Class VertexSelector

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

public abstract class VertexSelector extends 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 Details

    • VertexSelector

      public VertexSelector(Mesh3D mesh)
      Creates a new selector assigned to the given mesh
      Parameters:
      mesh -
  • Method Details

    • 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 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(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