Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
Takin
mag-core
Commits
a172a4e5
Verified
Commit
a172a4e5
authored
Aug 21, 2020
by
Tobias WEBER
Browse files
continued with polyhedra calculation
parent
6c44e6d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
tools/moldyn/moldyn.cpp
View file @
a172a4e5
...
...
@@ -645,7 +645,7 @@ void MolDynDlg::CalculateDeltaDistancesOfAtoms()
void
MolDynDlg
::
CalculateConvexHullOfAtoms
()
{
// get selected atoms
Hull
Indices
hull
;
Hull
hull
;
hull
.
vertices
=
GetSelectedAtoms
();
if
(
hull
.
vertices
.
size
()
<=
3
)
...
...
@@ -667,8 +667,15 @@ void MolDynDlg::CalculateConvexHulls()
{
std
::
size_t
frameidx
=
m_sliderFrame
->
value
();
for
(
const
auto
&
hull
:
m_hulls
)
for
(
auto
&
hull
:
m_hulls
)
{
// remove old plot object
if
(
hull
.
plotObj
)
{
m_plot
->
GetImpl
()
->
RemoveObject
(
*
hull
.
plotObj
);
hull
.
plotObj
.
reset
();
}
std
::
vector
<
t_vec
>
vertices
;
for
(
const
auto
[
objTypeIdx
,
objSubTypeIdx
]
:
hull
.
vertices
)
...
...
@@ -695,7 +702,7 @@ void MolDynDlg::CalculateConvexHulls()
glnormals
.
emplace_back
(
tl2
::
convert
<
t_vec3_gl
,
t_vec
>
(
normal
));
}
m_plot
->
GetImpl
()
->
Add
Solid
Object
(
glvertices
,
glnormals
,
0
,
0
,
1
,
0.5
);
hull
.
plotObj
=
m_plot
->
GetImpl
()
->
Add
Triangle
Object
(
glvertices
,
glnormals
,
0
,
0
,
1
,
0.5
);
// TODO
}
...
...
@@ -709,6 +716,14 @@ void MolDynDlg::CalculateConvexHulls()
void
MolDynDlg
::
New
()
{
m_mol
.
Clear
();
for
(
auto
&
hull
:
m_hulls
)
{
if
(
hull
.
plotObj
)
m_plot
->
GetImpl
()
->
RemoveObject
(
*
hull
.
plotObj
);
}
m_hulls
.
clear
();
for
(
const
auto
&
obj
:
m_sphereHandles
)
m_plot
->
GetImpl
()
->
RemoveObject
(
obj
);
...
...
@@ -1062,6 +1077,7 @@ void MolDynDlg::SliderValueChanged(int val)
}
}
CalculateConvexHulls
();
UpdateAtomsStatusMsg
();
m_plot
->
update
();
}
...
...
tools/moldyn/moldyn.h
View file @
a172a4e5
...
...
@@ -34,9 +34,10 @@ using t_mat = tl2::mat<t_real, std::vector>;
/**
* atom indices for convex hull calculation
*/
struct
Hull
Indices
struct
Hull
{
std
::
vector
<
std
::
tuple
<
std
::
size_t
,
std
::
size_t
>>
vertices
;
std
::
optional
<
std
::
size_t
>
plotObj
;
};
...
...
@@ -113,7 +114,7 @@ protected:
std
::
size_t
m_sphere
=
0
;
std
::
vector
<
std
::
size_t
>
m_sphereHandles
;
std
::
vector
<
Hull
Indices
>
m_hulls
;
std
::
vector
<
Hull
>
m_hulls
;
private:
...
...
Write
Preview
Markdown
is supported
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