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
6c44e6d6
Verified
Commit
6c44e6d6
authored
Aug 14, 2020
by
Tobias WEBER
Browse files
continued with convex hull
parent
03d57416
Changes
2
Hide whitespace changes
Inline
Side-by-side
tools/moldyn/moldyn.cpp
View file @
6c44e6d6
...
...
@@ -306,10 +306,10 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
/**
* add an atom
*/
std
::
size_t
MolDynDlg
::
Add3D
Ite
m
(
const
t_vec
&
vec
,
const
t_vec
&
col
,
t_real
scale
,
const
std
::
string
&
typelabel
,
int
atomindex
)
std
::
size_t
MolDynDlg
::
Add3D
Ato
m
(
const
t_vec
&
vec
,
const
t_vec
&
col
,
t_real
scale
,
const
std
::
string
&
typelabel
,
int
atomindex
)
{
auto
obj
=
m_plot
->
GetImpl
()
->
AddLinkedObject
(
m_sphere
,
0
,
0
,
0
,
col
[
0
],
col
[
1
],
col
[
2
],
1
);
Change3D
Ite
m
(
obj
,
&
vec
,
&
col
,
&
scale
,
&
typelabel
,
atomindex
);
Change3D
Ato
m
(
obj
,
&
vec
,
&
col
,
&
scale
,
&
typelabel
,
atomindex
);
return
obj
;
}
...
...
@@ -317,7 +317,7 @@ std::size_t MolDynDlg::Add3DItem(const t_vec& vec, const t_vec& col, t_real scal
/**
* change an atom
*/
void
MolDynDlg
::
Change3D
Ite
m
(
std
::
size_t
obj
,
const
t_vec
*
vec
,
const
t_vec
*
col
,
const
t_real
*
scale
,
void
MolDynDlg
::
Change3D
Ato
m
(
std
::
size_t
obj
,
const
t_vec
*
vec
,
const
t_vec
*
col
,
const
t_real
*
scale
,
const
std
::
string
*
label
,
int
atomindex
)
{
if
(
vec
)
...
...
@@ -678,14 +678,25 @@ void MolDynDlg::CalculateConvexHulls()
}
auto
polys
=
tl2_qh
::
get_convexhull
(
vertices
);
for
(
const
auto
&
poly
:
polys
)
auto
[
polys
,
normals
]
=
tl2_qh
::
get_convexhull
<
t_vec
>
(
vertices
);
std
::
vector
<
t_vec3_gl
>
glvertices
;
std
::
vector
<
t_vec3_gl
>
glnormals
;
for
(
std
::
size_t
polyidx
=
0
;
polyidx
<
polys
.
size
();
++
polyidx
)
{
std
::
cout
<<
"hull polygon:
\n
"
;
const
auto
&
poly
=
polys
[
polyidx
];
const
auto
&
normal
=
normals
[
polyidx
];
for
(
const
auto
&
vert
:
poly
)
std
::
cout
<<
"
\t
vertex: "
<<
vert
<<
std
::
endl
;
glvertices
.
emplace_back
(
tl2
::
convert
<
t_vec3_gl
,
t_vec
>
(
vert
));
glnormals
.
emplace_back
(
tl2
::
convert
<
t_vec3_gl
,
t_vec
>
(
normal
));
}
m_plot
->
GetImpl
()
->
AddSolidObject
(
glvertices
,
glnormals
,
0
,
0
,
1
,
0.5
);
// TODO
}
}
...
...
@@ -809,7 +820,7 @@ void MolDynDlg::Load()
{
t_real
atomscale
=
m_spinScale
->
value
();
std
::
size_t
handle
=
Add3D
Ite
m
(
vec
,
cols
[
atomtypeidx
%
cols
.
size
()],
atomscale
,
std
::
size_t
handle
=
Add3D
Ato
m
(
vec
,
cols
[
atomtypeidx
%
cols
.
size
()],
atomscale
,
m_mol
.
GetAtomName
(
atomtypeidx
),
atomidx
);
m_sphereHandles
.
push_back
(
handle
);
...
...
@@ -1044,7 +1055,7 @@ void MolDynDlg::SliderValueChanged(int val)
for
(
const
t_vec
&
vec
:
coords
)
{
std
::
size_t
obj
=
m_sphereHandles
[
counter
];
Change3D
Ite
m
(
obj
,
&
vec
,
nullptr
,
&
atomscale
,
nullptr
,
atomidx
);
Change3D
Ato
m
(
obj
,
&
vec
,
nullptr
,
&
atomscale
,
nullptr
,
atomidx
);
++
counter
;
++
atomidx
;
...
...
tools/moldyn/moldyn.h
View file @
6c44e6d6
...
...
@@ -47,8 +47,8 @@ public:
~
MolDynDlg
()
=
default
;
protected:
std
::
size_t
Add3D
Ite
m
(
const
t_vec
&
vec
,
const
t_vec
&
col
,
t_real
scale
,
const
std
::
string
&
typelabel
,
int
atomindex
=-
1
);
void
Change3D
Ite
m
(
std
::
size_t
obj
,
const
t_vec
*
vec
,
const
t_vec
*
col
=
nullptr
,
const
t_real
*
scale
=
nullptr
,
std
::
size_t
Add3D
Ato
m
(
const
t_vec
&
vec
,
const
t_vec
&
col
,
t_real
scale
,
const
std
::
string
&
typelabel
,
int
atomindex
=-
1
);
void
Change3D
Ato
m
(
std
::
size_t
obj
,
const
t_vec
*
vec
,
const
t_vec
*
col
=
nullptr
,
const
t_real
*
scale
=
nullptr
,
const
std
::
string
*
typelabel
=
nullptr
,
int
atomindex
=-
1
);
void
SetStatusMsg
(
const
std
::
string
&
msg
);
...
...
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