Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
Plugin-HoleFilling
Commits
f351abba
Commit
f351abba
authored
Jul 13, 2016
by
Jan Möbius
Browse files
Fly to hole in holefiller plugin
parent
43762d63
Changes
3
Hide whitespace changes
Inline
Side-by-side
HoleFillerPlugin.cc
View file @
f351abba
...
...
@@ -195,6 +195,7 @@ void HoleFillerPlugin::slotItemSelectionChanged() {
// TYPE is TRIMESH
if
(
o_it
->
dataType
(
DATA_TRIANGLE_MESH
)
)
{
TriMeshObject
*
object
=
PluginFunctions
::
triMeshObject
(
*
o_it
);
TriMesh
*
mesh
=
PluginFunctions
::
triMesh
(
o_it
);
//get perObjectData
...
...
@@ -213,6 +214,22 @@ void HoleFillerPlugin::slotItemSelectionChanged() {
if
(
objects
[
i
]
==
o_it
->
id
()
)
holeInfo
->
selectHole
(
holes
[
i
]
);
// We only fly if we have exacly one object and one hole
if
(
(
objects
[
0
]
==
o_it
->
id
()
)
&&
(
objects
.
size
()
==
1
)
&&
(
holes
.
size
()
==
1
)
){
TriMesh
::
Point
center
;
TriMesh
::
Normal
normal
;
holeInfo
->
getHoleInfo
(
holes
[
0
],
normal
,
center
);
// Get bounding box to get a scaling for the movement
TriMesh
::
Point
_bbMin
;
TriMesh
::
Point
_bbMax
;
object
->
boundingBox
(
_bbMin
,
_bbMax
);
PluginFunctions
::
flyTo
(
center
+
normal
*
(
_bbMax
-
_bbMin
).
length
()
,
center
,
10.0
);
}
//update the object
emit
updatedObject
(
o_it
->
id
(),
UPDATE_SELECTION
);
}
...
...
HoleInfoT.cc
View file @
f351abba
...
...
@@ -236,6 +236,30 @@ void HoleInfo< MeshT >::selectHole(int _index)
}
/// select a hole with given index
template
<
class
MeshT
>
void
HoleInfo
<
MeshT
>::
getHoleInfo
(
const
int
_index
,
typename
MeshT
::
Normal
&
_holeNormal
,
typename
MeshT
::
Point
&
_holeCenter
)
const
{
_holeCenter
=
typename
MeshT
::
Point
(
0.0
,
0.0
,
0.0
);
_holeNormal
=
typename
MeshT
::
Normal
(
0.0
,
0.0
,
0.0
);
// Center of gravity of hole and an average normal at the hole boundary
for
(
size_t
i
=
0
;
i
<
holes_
[
_index
].
size
()
;
++
i
)
{
const
typename
MeshT
::
HalfedgeHandle
he
=
mesh_
->
halfedge_handle
(
holes_
[
_index
][
i
],
0
);
const
typename
MeshT
::
VertexHandle
vh_to
=
mesh_
->
to_vertex_handle
(
he
);
_holeCenter
+=
mesh_
->
point
(
vh_to
);
_holeNormal
+=
mesh_
->
normal
(
vh_to
);
}
_holeCenter
/=
typename
MeshT
::
Scalar
(
holes_
[
_index
].
size
());
_holeNormal
/=
typename
MeshT
::
Scalar
(
holes_
[
_index
].
size
());
_holeNormal
.
normalize
();
}
/// get the holes vector
template
<
class
MeshT
>
std
::
vector
<
std
::
vector
<
typename
MeshT
::
EdgeHandle
>
>*
HoleInfo
<
MeshT
>::
holes
()
...
...
HoleInfoT.hh
View file @
f351abba
...
...
@@ -96,6 +96,9 @@ class HoleInfo : public PerObjectData
//select a hole with given index
void
selectHole
(
int
_index
);
//Collect information to fly to a hole
void
getHoleInfo
(
const
int
_index
,
typename
MeshT
::
Normal
&
_holeNormal
,
typename
MeshT
::
Point
&
_holeCenter
)
const
;
std
::
vector
<
std
::
vector
<
typename
MeshT
::
EdgeHandle
>
>*
holes
();
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment