43#include "VolumeMeshSelectionPlugin.hh"
61 PrimitiveType _primitiveType,
bool _deselection) {
62 using namespace OpenVolumeMesh;
69 for (
auto v_it : _mesh->vertices())
70 status[v_it].set_tagged(
false);
73 for (
auto v_it : _mesh->vertices()) {
77 if (_region->contains(QPoint((
int)proj[0], _state.
context_height()- (
int)proj[1]))) {
79 status[v_it].set_tagged(
true);
82 status[v_it].set_selected(!_deselection);
89 for (
auto e_it : _mesh->edges())
95 if (status[v1].tagged() && status[v2].tagged()) {
97 status[e_it].set_selected(!_deselection);
104 for (
auto f_it : _mesh->faces()) {
105 const std::vector<HalfEdgeHandle>& halfedges = _mesh->
face(f_it).halfedges();
106 bool all_fv_tagged =
true;
108 for (std::size_t i = 0; i < halfedges.size(); ++i) {
109 VertexHandle v = _mesh->
halfedge(halfedges[i]).to_vertex();
110 all_fv_tagged &= status[v].tagged();
116 status[f_it].set_selected(!_deselection);
123 for (
auto c_it : _mesh->cells()) {
124 bool all_cv_tagged =
true;
125 for (
CellVertexIter cv_it(_mesh->cv_iter(c_it)); cv_it.valid(); ++cv_it) {
126 all_cv_tagged &= status[*cv_it].tagged();
131 status[c_it].set_selected(!_deselection);
151 PrimitiveType _primitiveTypes,
bool _deselection)
153 using namespace OpenVolumeMesh;
155 FaceHandle hitFace(_fh);
157 if (!_mesh->is_boundary(hitFace))
162 if (!_mesh->is_boundary(hitHalfFace))
168 for (
auto hf_it : _mesh->halffaces())
170 status[hf_it].set_tagged(
false);
173 status[hitHalfFace].set_tagged(
true);
175 std::stack<HalfFaceHandle> hf_handles;
176 hf_handles.push(hitHalfFace);
179 typename MeshT::PointT n1 = normals[hitHalfFace];
180 double maxAngle = _maxAngle / 180.0 * M_PI;
184 while (!hf_handles.empty())
191 if (status[*bhfhf_it].tagged())
194 typename MeshT::PointT n2 = normals[*bhfhf_it];
196 double angle = std::acos(n1 | n2);
198 if (angle <= maxAngle) {
199 status[*bhfhf_it].set_tagged(
true);
200 hf_handles.push(*bhfhf_it);
206 for (
auto hf_it : _mesh->halffaces())
208 if (status[hf_it].tagged())
210 FaceHandle fh = _mesh->face_handle(hf_it);
213 for (
auto hfv_it : _mesh->halfface_vertices(hf_it))
214 status[hfv_it].set_selected(!_deselection);
218 std::vector<HalfEdgeHandle>
const& halfedges = _mesh->
face(fh).halfedges();
220 for (std::size_t i = 0; i < halfedges.size(); ++i)
221 status[_mesh->
edge_handle(halfedges[i])].set_selected(!_deselection);
225 status[fh].set_selected(!_deselection);
int context_height() const
get gl context height
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
const VecT & vertex(VertexHandle _vh) const
Get point _vh's coordinates.
static HalfEdgeHandle halfedge_handle(EdgeHandle _h, const unsigned char _subIdx)
Conversion function.
static EdgeHandle edge_handle(HalfEdgeHandle _h)
Handle conversion.
static HalfFaceHandle halfface_handle(FaceHandle _h, const unsigned char _subIdx)
Conversion function.
Edge halfedge(HalfEdgeHandle _halfEdgeHandle) const
Get edge that corresponds to halfedge with handle _halfEdgeHandle.
const Face & face(FaceHandle _faceHandle) const
Get face with handle _faceHandle.
PrimitiveType vertexType_
Primitive type handles:
void floodFillSelection(MeshT *_mesh, uint _fh, double _maxAngle, PrimitiveType _primitiveTypes, bool _deselection)
Select all entities that are connected (and do not exceed the maximum dihedral angle)
PrimitiveType cellType_
Handle to selection environment.
bool volumeSelection(MeshT *_mesh, ACG::GLState &_state, QRegion *_region, PrimitiveType _primitiveTypes, bool _deselection)
Surface volume selection tool.
PrimitiveType edgeType_
Handle to selection environment.
PrimitiveType faceType_
Handle to selection environment.