• R/O
  • HTTP
  • SSH
  • HTTPS

fermisurfer: Commit

fermisurfer Git


Commit MetaInfo

Revision1d65fb1543da5869da5412a690303b2704ab96ce (tree)
Zeit2021-03-08 18:23:54
AutorMitsuaki Kawamura <kawamitsuaki@gmai...>
CommiterMitsuaki Kawamura

Log Message

Display arbitrary arrow

Ändern Zusammenfassung

Diff

--- a/javascript/fermisurfer.html
+++ b/javascript/fermisurfer.html
@@ -67,10 +67,16 @@
6767 </tr>
6868 <tr align="left">
6969 <form id="tetrahedron">
70- <td><input type="radio" name="tetrahedron" value="1" checked="checked">1</td>
71- <td><input type="radio" name="tetrahedron" value="2">2</td>
72- <td><input type="radio" name="tetrahedron" value="3">3</td>
73- <td><input type="radio" name="tetrahedron" value="3">4</td>
70+ <td><input type="radio" name="tetrahedron" value="0" checked="checked" onchange="update_tetra();">0
71+ <input type="radio" name="tetrahedron" value="1" onchange="update_tetra();">1
72+ <input type="radio" name="tetrahedron" value="2" onchange="update_tetra();">2</td>
73+ <td><input type="radio" name="tetrahedron" value="3" onchange="update_tetra();">3
74+ <input type="radio" name="tetrahedron" value="4" onchange="update_tetra();">4
75+ <input type="radio" name="tetrahedron" value="5" onchange="update_tetra();">5</td>
76+ <td><input type="radio" name="tetrahedron" value="6" onchange="update_tetra();">6
77+ <input type="radio" name="tetrahedron" value="7" onchange="update_tetra();">7</td>
78+ <td><input type="radio" name="tetrahedron" value="8" onchange="update_tetra();">8
79+ <input type="radio" name="tetrahedron" value="9" onchange="update_tetra();">9</td>
7480 </form>
7581 </tr>
7682 <tr align="left">
@@ -130,10 +136,10 @@
130136 <td><input type="number" name="linecolobr" id="linecolorb" value="1" onchange="update_now();" step="0.1" min="0" max="1"></td>
131137 </tr>
132138 <tr align="left">
133- <td><input type="button" value="Rotate"></td>
134- <td><input type="number" name="rotatex" id="rotatex" value="0" onchange="update_now();"></td>
135- <td><input type="number" name="rotatey" id="rotatey" value="0" onchange="update_now();"></td>
136- <td><input type="number" name="rotatez" id="rotatez" value="0" onchange="update_now();"></td>
139+ <td><input type="button" value="Rotate" onclick="update_now();"></td>
140+ <td><input type="number" name="rotatex" id="rotatex" value="0"></td>
141+ <td><input type="number" name="rotatey" id="rotatey" value="0"></td>
142+ <td><input type="number" name="rotatez" id="rotatez" value="0"></td>
137143 </tr>
138144 <tr align="left">
139145 <td>Scale : <input type="number" name="scale" id="scale" value="1" onchange="update_now();" step="0.1" min="0"></td>
--- a/javascript/fermisurfer.js
+++ b/javascript/fermisurfer.js
@@ -3129,6 +3129,11 @@ function update_minmax() {
31293129 refresh_color = 1;
31303130 skip_minmax = 1;
31313131 }
3132+function update_tetra() {
3133+ itet = Number(document.getElementById('tetrahedron').tetrahedron.value);
3134+ init_corner();
3135+ refresh_patch = 1;
3136+}
31323137 function button_update() {
31333138 let ii = 0, jj = 0;
31343139 /*
@@ -3158,8 +3163,6 @@ function button_update() {
31583163 }/*for (jj = 0; jj < 3; jj++)*/
31593164 }/*for (ii = 0; ii < 3; ii++)*/
31603165 /* */
3161- itet = Number(document.getElementById('tetrahedron').tetrahedron.value);
3162- init_corner();
31633166 /**/
31643167 fbz = Number(document.getElementById('brillouinzone').brillouinzone.value);
31653168 lstereo = Number(document.getElementById('stereogram').stereogram.value);
--- a/src/draw.cpp
+++ b/src/draw.cpp
@@ -219,19 +219,19 @@ static void draw_bz_lines() {
219219 int ibzl, i, j, a0, a1, a2, ia;
220220 GLfloat bzl2[3], bvec2[3][3], linecolor[4], secvec2[3], kshift[3];
221221 GLfloat vertices[300];
222- /*
223- Line color is oposit of BG color
224- */
222+ //
223+ // Line color is oposit of BG color
224+ //
225225 for (i = 0; i < 4; i++) linecolor[i] = LineColor[i];
226- /**/
226+ //
227227 glLineWidth(linewidth);
228228 for (a0 = 0; a0 < BZ_number[0]; a0++) {
229229 for (a1 = 0; a1 < BZ_number[1]; a1++) {
230230 for (a2 = 0; a2 < BZ_number[2]; a2++) {
231231 for (ia = 0; ia < 3; ia++) kshift[ia] = bvec[0][ia] * a0 + bvec[1][ia] * a1 + bvec[2][ia] * a2;
232- /*
233- First Brillouin zone mode
234- */
232+ //
233+ // First Brillouin zone mode
234+ //
235235 if (fbz == 1) {
236236 for (ibzl = 0; ibzl < nbzl; ++ibzl) {
237237 for (i = 0; i < 2; ++i) {
@@ -249,9 +249,9 @@ static void draw_bz_lines() {
249249 }/*for (ibzl = 0; ibzl < nbzl; ++ibzl)*/
250250 }/*if (fbz == 1)*/
251251 else {
252- /*
253- Premitive BZ mode
254- */
252+ //
253+ // Premitive BZ mode
254+ //
255255 for (i = 0; i < 3; ++i) {
256256 for (j = 0; j < 3; ++j) {
257257 bvec2[i][j] = rot[j][0] * bvec[i][0]
@@ -292,9 +292,23 @@ static void draw_bz_lines() {
292292 }
293293 }
294294 }
295- /*
296- Section for the 2D Fermi line
297- */
295+ //
296+ // Arrow
297+ //
298+ for (i = 0; i < 2; ++i) {
299+ for (j = 0; j < 3; ++j)
300+ vertices[j + 3 * i] = rot[j][0] * arrow[i][0]
301+ + rot[j][1] * arrow[i][1]
302+ + rot[j][2] * arrow[i][2]
303+ + trans[j];
304+ }/*for (i = 0; i< 2; ++i)*/
305+ glColor3fv(linecolor);
306+ glNormal3f(0.0f, 0.0f, 1.0f);
307+ glVertexPointer(3, GL_FLOAT, 0, vertices);
308+ glDrawArrays(GL_LINES, 0, 2);
309+ //
310+ // Section for the 2D Fermi line
311+ //
298312 if (lsection == 1 && fbz == 1) {
299313 for (j = 0; j < 3; ++j)
300314 secvec2[j] = rot[j][0] * secvec[0]
--- a/src/fermisurfer.cpp
+++ b/src/fermisurfer.cpp
@@ -210,6 +210,7 @@ GLfloat LineColor[4] = { 1.0, 1.0, 1.0, 1.0 };//!< Line color code
210210 GLfloat SectionColor[4] = { 0.5f, 0.5f, 0.5f, 1.0 };//!< Line color code
211211 GLfloat BarColor[5][4] = { { 0.0, 0.0, 1.0, 1.0 } , { 0.0, 1.0, 1.0, 1.0 } ,
212212 { 0.0, 1.0, 0.0, 1.0 } ,{ 1.0, 1.0, 0.0, 1.0 } ,{ 1.0, 0.0, 0.0, 1.0 } };
213+GLfloat arrow[2][3];
213214 /*
214215 Others
215216 */
--- a/src/free_patch.cpp
+++ b/src/free_patch.cpp
@@ -435,7 +435,7 @@ private(itri, j)
435435 }/*if (color_scale == 4)*/
436436 else if (color_scale == 3 || color_scale == 5) {
437437 #pragma omp parallel default(none) \
438-shared(nb,ntri,matp,clr,BarColor,color_scale,kvp,arw,patch_max) \
438+shared(nb,ntri,matp,clr,BarColor,color_scale,kvp,arw,patch_max,rgb_band) \
439439 private(itri, j)
440440 {
441441 int i, ib;
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -139,6 +139,15 @@ enum
139139 itext_SectionR,
140140 itext_SectionG,
141141 itext_SectionB,
142+ itext_ArrowStart0,
143+ itext_ArrowStart1,
144+ itext_ArrowStart2,
145+ itext_ArrowEnd0,
146+ itext_ArrowEnd1,
147+ itext_ArrowEnd2,
148+ itext_ArrowDiff0,
149+ itext_ArrowDiff1,
150+ itext_ArrowDiff2,
142151 icheck_band
143152 };
144153
@@ -189,6 +198,80 @@ void MyFrame::button_section(
189198 /**
190199 @brief Change Line color color (::blackback)
191200 */
201+void MyFrame::textctrl_Arrow(
202+ wxCommandEvent& event //!<[in] Selected menu
203+)
204+{
205+ int ierr;
206+ double dvalue;
207+
208+ if (event.GetId() == itext_ArrowStart0) {
209+ if (event.GetString().ToDouble(&dvalue)) {
210+ arrow[0][0] = (GLfloat)dvalue;
211+ textbox_ArrowDiff0->ChangeValue(wxString::Format(wxT("%f"), arrow[1][0] - arrow[0][0]));
212+ Refresh(false);
213+ }
214+ }
215+ else if (event.GetId() == itext_ArrowStart1) {
216+ if (event.GetString().ToDouble(&dvalue)) {
217+ arrow[0][1] = (GLfloat)dvalue;
218+ textbox_ArrowDiff1->ChangeValue(wxString::Format(wxT("%f"), arrow[1][1] - arrow[0][1]));
219+ Refresh(false);
220+ }
221+ }
222+ else if (event.GetId() == itext_ArrowStart2) {
223+ if (event.GetString().ToDouble(&dvalue)) {
224+ arrow[0][2] = (GLfloat)dvalue;
225+ textbox_ArrowDiff2->ChangeValue(wxString::Format(wxT("%f"), arrow[1][2] - arrow[0][2]));
226+ Refresh(false);
227+ }
228+ }
229+ else if (event.GetId() == itext_ArrowEnd0) {
230+ if (event.GetString().ToDouble(&dvalue)) {
231+ arrow[1][0] = (GLfloat)dvalue;
232+ textbox_ArrowDiff0->ChangeValue(wxString::Format(wxT("%f"), arrow[1][0] - arrow[0][0]));
233+ Refresh(false);
234+ }
235+ }
236+ else if (event.GetId() == itext_ArrowEnd1) {
237+ if (event.GetString().ToDouble(&dvalue)) {
238+ arrow[1][1] = (GLfloat)dvalue;
239+ textbox_ArrowDiff1->ChangeValue(wxString::Format(wxT("%f"), arrow[1][1] - arrow[0][1]));
240+ Refresh(false);
241+ }
242+ }
243+ else if (event.GetId() == itext_ArrowEnd2) {
244+ if (event.GetString().ToDouble(&dvalue)) {
245+ arrow[1][2] = (GLfloat)dvalue;
246+ textbox_ArrowDiff2->ChangeValue(wxString::Format(wxT("%f"), arrow[1][2] - arrow[0][2]));
247+ Refresh(false);
248+ }
249+ }
250+ else if (event.GetId() == itext_ArrowDiff0) {
251+ if (event.GetString().ToDouble(&dvalue)) {
252+ arrow[1][0] = arrow[0][0] + (GLfloat)dvalue;
253+ textbox_ArrowEnd0->ChangeValue(wxString::Format(wxT("%f"), arrow[1][0]));
254+ Refresh(false);
255+ }
256+ }
257+ else if (event.GetId() == itext_ArrowDiff1) {
258+ if (event.GetString().ToDouble(&dvalue)) {
259+ arrow[1][1] = arrow[0][1] + (GLfloat)dvalue;
260+ textbox_ArrowEnd1->ChangeValue(wxString::Format(wxT("%f"), arrow[1][1]));
261+ Refresh(false);
262+ }
263+ }
264+ else if (event.GetId() == itext_ArrowDiff2) {
265+ if (event.GetString().ToDouble(&dvalue)) {
266+ arrow[1][2] = arrow[0][2] + (GLfloat)dvalue;
267+ textbox_ArrowEnd2->ChangeValue(wxString::Format(wxT("%f"), arrow[1][2]));
268+ Refresh(false);
269+ }
270+ }
271+}
272+/**
273+@brief Change Line color color (::blackback)
274+*/
192275 void MyFrame::textctrl_LineColor(
193276 wxCommandEvent& event //!<[in] Selected menu
194277 )
@@ -1007,7 +1090,9 @@ wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"),
10071090 wxDefaultPosition, wxDefaultSize,
10081091 WXSIZEOF(choices_BarColor), choices_BarColor,
10091092 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 1), wxGBSpan(4, 1));
1010-
1093+ //
1094+ // Section color
1095+ //
10111096 gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Section (RGB) : ")),
10121097 wxGBPosition(19, 0), wxGBSpan(1, 1), wxALIGN_RIGHT);
10131098 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Section, this, itext_SectionR);
@@ -1022,7 +1107,58 @@ wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"),
10221107 textbox_SectionR->ChangeValue(wxT("0.5"));
10231108 textbox_SectionG->ChangeValue(wxT("0.5"));
10241109 textbox_SectionB->ChangeValue(wxT("0.5"));
1025-
1110+ //
1111+ // Arrow Start
1112+ //
1113+ gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Arrow (Start) : ")),
1114+ wxGBPosition(20, 0), wxGBSpan(1, 1), wxALIGN_RIGHT);
1115+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowStart0);
1116+ textbox_ArrowStart0 = new wxTextCtrl(panel, itext_ArrowStart0, wxT(""));
1117+ gbsizer->Add(textbox_ArrowStart0, wxGBPosition(20, 1), wxGBSpan(1, 1));
1118+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowStart1);
1119+ textbox_ArrowStart1 = new wxTextCtrl(panel, itext_ArrowStart1, wxT(""));
1120+ gbsizer->Add(textbox_ArrowStart1, wxGBPosition(20, 2), wxGBSpan(1, 1));
1121+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowStart2);
1122+ textbox_ArrowStart2 = new wxTextCtrl(panel, itext_ArrowStart2, wxT(""));
1123+ gbsizer->Add(textbox_ArrowStart2, wxGBPosition(20, 3), wxGBSpan(1, 1));
1124+ textbox_ArrowStart0->ChangeValue(wxT("0.0"));
1125+ textbox_ArrowStart1->ChangeValue(wxT("0.0"));
1126+ textbox_ArrowStart2->ChangeValue(wxT("0.0"));
1127+ //
1128+ // Arrow End
1129+ //
1130+ gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Arrow (End) : ")),
1131+ wxGBPosition(21, 0), wxGBSpan(1, 1), wxALIGN_RIGHT);
1132+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowEnd0);
1133+ textbox_ArrowEnd0 = new wxTextCtrl(panel, itext_ArrowEnd0, wxT(""));
1134+ gbsizer->Add(textbox_ArrowEnd0, wxGBPosition(21, 1), wxGBSpan(1, 1));
1135+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowEnd1);
1136+ textbox_ArrowEnd1 = new wxTextCtrl(panel, itext_ArrowEnd1, wxT(""));
1137+ gbsizer->Add(textbox_ArrowEnd1, wxGBPosition(21, 2), wxGBSpan(1, 1));
1138+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowEnd2);
1139+ textbox_ArrowEnd2 = new wxTextCtrl(panel, itext_ArrowEnd2, wxT(""));
1140+ gbsizer->Add(textbox_ArrowEnd2, wxGBPosition(21, 3), wxGBSpan(1, 1));
1141+ textbox_ArrowEnd0->ChangeValue(wxT("0.0"));
1142+ textbox_ArrowEnd1->ChangeValue(wxT("0.0"));
1143+ textbox_ArrowEnd2->ChangeValue(wxT("0.0"));
1144+ //
1145+ // Arrow Diff
1146+ //
1147+ gbsizer->Add(new wxStaticText(panel, wxID_ANY, wxT("Arrow (Diff) : ")),
1148+ wxGBPosition(22, 0), wxGBSpan(1, 1), wxALIGN_RIGHT);
1149+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowDiff0);
1150+ textbox_ArrowDiff0 = new wxTextCtrl(panel, itext_ArrowDiff0, wxT(""));
1151+ gbsizer->Add(textbox_ArrowDiff0, wxGBPosition(22, 1), wxGBSpan(1, 1));
1152+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowDiff1);
1153+ textbox_ArrowDiff1 = new wxTextCtrl(panel, itext_ArrowDiff1, wxT(""));
1154+ gbsizer->Add(textbox_ArrowDiff1, wxGBPosition(22, 2), wxGBSpan(1, 1));
1155+ Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Arrow, this, itext_ArrowDiff2);
1156+ textbox_ArrowDiff2 = new wxTextCtrl(panel, itext_ArrowDiff2, wxT(""));
1157+ gbsizer->Add(textbox_ArrowDiff2, wxGBPosition(22, 3), wxGBSpan(1, 1));
1158+ textbox_ArrowDiff0->ChangeValue(wxT("0.0"));
1159+ textbox_ArrowDiff1->ChangeValue(wxT("0.0"));
1160+ textbox_ArrowDiff2->ChangeValue(wxT("0.0"));
1161+ //
10261162 SetSizer(sizermain);
10271163 SetAutoLayout(true);
10281164
@@ -1062,7 +1198,7 @@ void MyFrame::modify_band() {
10621198 Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &MyFrame::check_band, this, icheck_band + 4*ib);
10631199 check[ib] = new wxCheckBox(panel, icheck_band + 4*ib,
10641200 wxString::Format(wxT("Band %d, RGB :"), ib));
1065- gbsizer->Add(check[ib], wxGBPosition(20 + ib, 0), wxGBSpan(1, 1));
1201+ gbsizer->Add(check[ib], wxGBPosition(23 + ib, 0), wxGBSpan(1, 1));
10661202 check[ib]->SetValue(true);
10671203
10681204 if (nb == 1) mat2 = 0.5f;
@@ -1086,13 +1222,13 @@ void MyFrame::modify_band() {
10861222
10871223 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Band, this, icheck_band + 4 * ib+1);
10881224 textbox_BandR[ib] = new wxTextCtrl(panel, icheck_band + 4 * ib+1, wxT(""));
1089- gbsizer->Add(textbox_BandR[ib], wxGBPosition(20 + ib, 1), wxGBSpan(1, 1));
1225+ gbsizer->Add(textbox_BandR[ib], wxGBPosition(23 + ib, 1), wxGBSpan(1, 1));
10901226 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Band, this, icheck_band + 4 * ib+2);
10911227 textbox_BandG[ib] = new wxTextCtrl(panel, icheck_band + 4 * ib+2, wxT(""));
1092- gbsizer->Add(textbox_BandG[ib], wxGBPosition(20 + ib, 2), wxGBSpan(1, 1));
1228+ gbsizer->Add(textbox_BandG[ib], wxGBPosition(23 + ib, 2), wxGBSpan(1, 1));
10931229 Bind(wxEVT_COMMAND_TEXT_UPDATED, &MyFrame::textctrl_Band, this, icheck_band + 4 * ib+3);
10941230 textbox_BandB[ib] = new wxTextCtrl(panel, icheck_band + 4 * ib+3, wxT(""));
1095- gbsizer->Add(textbox_BandB[ib], wxGBPosition(20 + ib, 3), wxGBSpan(1, 1));
1231+ gbsizer->Add(textbox_BandB[ib], wxGBPosition(23 + ib, 3), wxGBSpan(1, 1));
10961232 textbox_BandR[ib]->ChangeValue(wxString::Format(wxT("%f"), rgb_band[ib][0]));
10971233 textbox_BandG[ib]->ChangeValue(wxString::Format(wxT("%f"), rgb_band[ib][1]));
10981234 textbox_BandB[ib]->ChangeValue(wxString::Format(wxT("%f"), rgb_band[ib][2]));
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -74,6 +74,15 @@ public:
7474 wxTextCtrl* textbox_SectionR;
7575 wxTextCtrl* textbox_SectionG;
7676 wxTextCtrl* textbox_SectionB;
77+ wxTextCtrl* textbox_ArrowStart0;
78+ wxTextCtrl* textbox_ArrowStart1;
79+ wxTextCtrl* textbox_ArrowStart2;
80+ wxTextCtrl* textbox_ArrowEnd0;
81+ wxTextCtrl* textbox_ArrowEnd1;
82+ wxTextCtrl* textbox_ArrowEnd2;
83+ wxTextCtrl* textbox_ArrowDiff0;
84+ wxTextCtrl* textbox_ArrowDiff1;
85+ wxTextCtrl* textbox_ArrowDiff2;
7786
7887 private:
7988 void OnExit(wxCommandEvent& event);
@@ -101,6 +110,7 @@ private:
101110 void textctrl_BZ_number(wxCommandEvent& event);
102111 void textctrl_Section(wxCommandEvent& event);
103112 void textctrl_Band(wxCommandEvent& event);
113+ void textctrl_Arrow(wxCommandEvent& event);
104114 //wxDECLARE_EVENT_TABLE();
105115 };
106116
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -155,6 +155,7 @@ extern GLfloat BackGroundColor[4];//!< Background color code
155155 extern GLfloat LineColor[4];//!< Line color code
156156 extern GLfloat SectionColor[4];//!< Line color code
157157 extern GLfloat BarColor[5][4];
158+extern GLfloat arrow[2][3];
158159 /*
159160 Others
160161 */
Show on old repository browser