Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
Takin
mag-core
Commits
00000c98
Verified
Commit
00000c98
authored
May 29, 2022
by
Tobias WEBER
Browse files
continued with bz tool
parent
e54566a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
tools/bz/bz.cpp
View file @
00000c98
...
...
@@ -473,9 +473,17 @@ void BZDlg::CalcBZ()
PlotAddVoronoiVertex
(
voro
);
std
::
vector
<
t_vec
>
plane
;
plane
.
push_back
(
voro
);
ostr
<<
"vertex "
<<
idx
<<
": "
<<
voro
<<
std
::
endl
;
for
(
std
::
size_t
nidx
:
neighbours
[
idx
])
{
plane
.
push_back
(
voronoi
[
nidx
]);
ostr
<<
"
\t
neighbour index: "
<<
nidx
<<
std
::
endl
;
}
//PlotAddPlane(plane);
}
// brillouin zone description
...
...
tools/bz/bz.h
View file @
00000c98
...
...
@@ -43,6 +43,9 @@
#include
<vector>
#include
<sstream>
#include
<boost/math/quaternion.hpp>
namespace
math
=
boost
::
math
;
#include
"tlibs2/libs/qt/glplot.h"
#include
"tlibs2/libs/math20.h"
#include
"tlibs2/libs/qt/numerictablewidgetitem.h"
...
...
@@ -51,6 +54,7 @@
using
t_real
=
double
;
using
t_vec
=
tl2
::
vec
<
t_real
,
std
::
vector
>
;
using
t_mat
=
tl2
::
mat
<
t_real
,
std
::
vector
>
;
using
t_quat
=
math
::
quaternion
<
t_real
>
;
using
t_real_gl
=
tl2
::
t_real_gl
;
using
t_vec2_gl
=
tl2
::
t_vec2_gl
;
...
...
@@ -134,6 +138,7 @@ protected:
void
ClearPlot
();
void
PlotAddVoronoiVertex
(
const
t_vec
&
pos
);
void
PlotAddBraggPeak
(
const
t_vec
&
pos
);
void
PlotAddPlane
(
const
std
::
vector
<
t_vec
>&
vecs
);
void
Set3DStatusMsg
(
const
std
::
string
&
msg
);
void
ShowBZPlot
();
...
...
tools/bz/bz_plot.cpp
View file @
00000c98
...
...
@@ -45,6 +45,7 @@ void BZDlg::ShowBZPlot()
m_dlgPlot
->
setWindowTitle
(
"Brillouin Zone - 3D View"
);
m_plot
=
std
::
make_shared
<
tl2
::
GlPlot
>
(
this
);
m_plot
->
GetRenderer
()
->
SetCull
(
false
);
m_plot
->
GetRenderer
()
->
SetLight
(
0
,
tl2
::
create
<
t_vec3_gl
>
({
5
,
5
,
5
}));
m_plot
->
GetRenderer
()
->
SetLight
(
1
,
tl2
::
create
<
t_vec3_gl
>
({
-
5
,
-
5
,
-
5
}));
m_plot
->
GetRenderer
()
->
SetCoordMax
(
1.
);
...
...
@@ -142,6 +143,40 @@ void BZDlg::PlotAddBraggPeak(const t_vec& pos)
}
/**
* add a plane to the plot
*/
void
BZDlg
::
PlotAddPlane
(
const
std
::
vector
<
t_vec
>&
_vecs
)
{
if
(
!
m_plot
)
return
;
if
(
_vecs
.
size
()
<
3
)
return
;
t_real_gl
r
=
1
,
g
=
0
,
b
=
0
;
std
::
vector
<
t_vec3_gl
>
vecs
,
norms
;
vecs
.
reserve
(
_vecs
.
size
());
norms
.
reserve
(
_vecs
.
size
());
t_vec
_norm
=
tl2
::
cross
(
_vecs
[
2
]
-
_vecs
[
0
],
_vecs
[
1
]
-
_vecs
[
0
]);
t_vec3_gl
norm
=
tl2
::
convert
<
t_vec3_gl
>
(
_norm
);
t_vec3_gl
vec1
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
0
]);
for
(
std
::
size_t
idx
=
1
;
idx
<
_vecs
.
size
()
-
2
;
++
idx
)
{
t_vec3_gl
vec2
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
idx
]);
t_vec3_gl
vec3
=
tl2
::
convert
<
t_vec3_gl
>
(
_vecs
[
idx
+
1
]);
vecs
.
push_back
(
vec1
);
vecs
.
emplace_back
(
std
::
move
(
vec2
));
vecs
.
emplace_back
(
std
::
move
(
vec3
));
norms
.
push_back
(
norm
);
}
auto
obj
=
m_plot
->
GetRenderer
()
->
AddTriangleObject
(
vecs
,
norms
,
r
,
g
,
b
,
1
);
m_plotObjs
.
push_back
(
obj
);
m_plot
->
update
();
}
void
BZDlg
::
ClearPlot
()
{
if
(
!
m_plot
)
return
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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