• R/O
  • HTTP
  • SSH
  • HTTPS

fermisurfer: Commit

fermisurfer Git


Commit MetaInfo

Revisioncecbea8c1835f744fb77fb991b6007f41f085636 (tree)
Zeit2021-03-08 22:14:50
AutorMitsuaki Kawamura <kawamitsuaki@gmai...>
CommiterMitsuaki Kawamura

Log Message

Color palette for Blue -> White -> Red

Ändern Zusammenfassung

Diff

--- a/src/draw.cpp
+++ b/src/draw.cpp
@@ -297,9 +297,9 @@ static void draw_bz_lines() {
297297 //
298298 for (i = 0; i < 2; ++i) {
299299 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]
300+ vertices[j + 3 * i] = rot[j][0] * arrow_c[i][0]
301+ + rot[j][1] * arrow_c[i][1]
302+ + rot[j][2] * arrow_c[i][2]
303303 + trans[j];
304304 }/*for (i = 0; i< 2; ++i)*/
305305 glColor3fv(linecolor);
@@ -360,6 +360,7 @@ static void draw_colorbar()
360360 vector_color[j + 8 * i + 4] = BarColor[i * 2][j];
361361 }
362362 }
363+ glLineWidth(linewidth);
363364 glNormal3f(0.0f, 0.0f, 1.0f);
364365 glVertexPointer(3, GL_FLOAT, 0, vector);
365366 glColorPointer(4, GL_FLOAT, 0, vector_color);
--- a/src/fermisurfer.cpp
+++ b/src/fermisurfer.cpp
@@ -210,7 +210,8 @@ 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];
213+GLfloat arrow_f[2][3];
214+GLfloat arrow_c[2][3];
214215 /*
215216 Others
216217 */
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -167,7 +167,7 @@ void MyFrame::button_compute(
167167 void MyFrame::button_section(
168168 wxCommandEvent& event//!<[in] Selected menu
169169 ) {
170- int ib, i2d, i, j;
170+ int ib, i2d, i;
171171 FILE *fp;
172172 fp = fopen("fermi_line.dat", "w");
173173 for (ib = 0; ib < nb; ib++) {
@@ -202,72 +202,80 @@ void MyFrame::textctrl_Arrow(
202202 wxCommandEvent& event //!<[in] Selected menu
203203 )
204204 {
205- int ierr;
205+ int ii, jj;
206206 double dvalue;
207207
208208 if (event.GetId() == itext_ArrowStart0) {
209209 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]));
210+ arrow_f[0][0] = (GLfloat)dvalue;
211+ textbox_ArrowDiff0->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][0] - arrow_f[0][0]));
212212 Refresh(false);
213213 }
214214 }
215215 else if (event.GetId() == itext_ArrowStart1) {
216216 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]));
217+ arrow_f[0][1] = (GLfloat)dvalue;
218+ textbox_ArrowDiff1->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][1] - arrow_f[0][1]));
219219 Refresh(false);
220220 }
221221 }
222222 else if (event.GetId() == itext_ArrowStart2) {
223223 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]));
224+ arrow_f[0][2] = (GLfloat)dvalue;
225+ textbox_ArrowDiff2->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][2] - arrow_f[0][2]));
226226 Refresh(false);
227227 }
228228 }
229229 else if (event.GetId() == itext_ArrowEnd0) {
230230 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]));
231+ arrow_f[1][0] = (GLfloat)dvalue;
232+ textbox_ArrowDiff0->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][0] - arrow_f[0][0]));
233233 Refresh(false);
234234 }
235235 }
236236 else if (event.GetId() == itext_ArrowEnd1) {
237237 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]));
238+ arrow_f[1][1] = (GLfloat)dvalue;
239+ textbox_ArrowDiff1->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][1] - arrow_f[0][1]));
240240 Refresh(false);
241241 }
242242 }
243243 else if (event.GetId() == itext_ArrowEnd2) {
244244 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]));
245+ arrow_f[1][2] = (GLfloat)dvalue;
246+ textbox_ArrowDiff2->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][2] - arrow_f[0][2]));
247247 Refresh(false);
248248 }
249249 }
250250 else if (event.GetId() == itext_ArrowDiff0) {
251251 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]));
252+ arrow_f[1][0] = arrow_f[0][0] + (GLfloat)dvalue;
253+ textbox_ArrowEnd0->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][0]));
254254 Refresh(false);
255255 }
256256 }
257257 else if (event.GetId() == itext_ArrowDiff1) {
258258 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]));
259+ arrow_f[1][1] = arrow_f[0][1] + (GLfloat)dvalue;
260+ textbox_ArrowEnd1->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][1]));
261261 Refresh(false);
262262 }
263263 }
264264 else if (event.GetId() == itext_ArrowDiff2) {
265265 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]));
266+ arrow_f[1][2] = arrow_f[0][2] + (GLfloat)dvalue;
267+ textbox_ArrowEnd2->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][2]));
268268 Refresh(false);
269269 }
270270 }
271+ //
272+ // Fractional -> Cartesian
273+ //
274+ for (ii = 0; ii < 2; ++ii)
275+ for (jj = 0; jj < 3; ++jj)
276+ arrow_c[ii][jj] = bvec[0][jj] * arrow_f[ii][0]
277+ + bvec[1][jj] * arrow_f[ii][1]
278+ + bvec[2][jj] * arrow_f[ii][2];
271279 }
272280 /**
273281 @brief Change Line color color (::blackback)
@@ -276,7 +284,6 @@ void MyFrame::textctrl_LineColor(
276284 wxCommandEvent& event //!<[in] Selected menu
277285 )
278286 {
279- int ierr;
280287 double dvalue;
281288
282289 if (event.GetId() == itext_LineColorR) {
@@ -305,7 +312,6 @@ void MyFrame::textctrl_Section(
305312 wxCommandEvent& event //!<[in] Selected menu
306313 )
307314 {
308- int ierr;
309315 double dvalue;
310316
311317 if (event.GetId() == itext_SectionR) {
@@ -334,7 +340,6 @@ void MyFrame::textctrl_Band(
334340 wxCommandEvent& event //!<[in] Selected menu
335341 )
336342 {
337- int ierr;
338343 double dvalue;
339344 int ib = (event.GetId() - icheck_band) / 4;
340345
@@ -367,7 +372,6 @@ void MyFrame::textctrl_BackGround(
367372 wxCommandEvent& event //!<[in] Selected menu
368373 )
369374 {
370- int ierr;
371375 double dvalue;
372376
373377 if (event.GetId() == itext_BackGroundR) {
@@ -402,7 +406,6 @@ void MyFrame::textctrl_BZ_number(
402406 wxCommandEvent& event //!<[in] Selected menu
403407 )
404408 {
405- int ierr;
406409 double dvalue;
407410
408411 if (event.GetId() == itext_BZ_number0) {
@@ -490,6 +493,15 @@ void MyFrame::radio_BarColor(
490493 BarColor[4][ii] = yellow[ii];
491494 }
492495 }
496+ else if (event.GetString().Cmp(wxT("BWR")) == 0) {
497+ for (ii = 0; ii < 4; ii++) {
498+ BarColor[0][ii] = blue[ii];
499+ BarColor[1][ii] = 0.5f * (blue[ii] + wgray[ii]);
500+ BarColor[2][ii] = wgray[ii];
501+ BarColor[3][ii] = 0.5f * (red[ii] + wgray[ii]);
502+ BarColor[4][ii] = red[ii];
503+ }
504+ }
493505 paint();
494506 Refresh(false);
495507 } /* menu_brillouinzone */
@@ -511,7 +523,6 @@ void MyFrame::radiovalue_colorscale(
511523 wxCommandEvent& event //!<[in] Selected menu
512524 )
513525 {
514- int ierr, ii;
515526 double dminmax;
516527
517528 if (event.GetId() == itext_colorscalemin) {
@@ -547,7 +558,7 @@ void MyFrame::checkvalue_equator(
547558 wxCommandEvent& event //!<[in] Selected menu
548559 )
549560 {
550- int ierr, ii, jj, ib;
561+ int ii, jj;
551562 double deqvec;
552563
553564 if (event.GetId() == icheck_equator) {
@@ -587,7 +598,6 @@ void MyFrame::textctrl_interpol(
587598 wxCommandEvent& event //!<[in] Selected menu
588599 )
589600 {
590- int ierr;
591601 long int long_interpol;
592602
593603 if (event.GetString().ToLong(&long_interpol)) {
@@ -623,7 +633,6 @@ void MyFrame::textctrl_line(
623633 wxCommandEvent& event //!<[in] Selected menu
624634 )
625635 {
626- int ierr;
627636 double dlinewidth;
628637
629638 if (event.GetString().ToDouble(&dlinewidth)) linewidth = (GLfloat)dlinewidth;
@@ -659,7 +668,7 @@ void MyFrame::radiovalue_section(
659668 wxCommandEvent& event //!<[in] Selected menu
660669 )
661670 {
662- int ierr, ii, jj, ib;
671+ int ii, jj;
663672 double dsecvec;
664673
665674 if (event.GetId() == icheck_section) {
@@ -739,7 +748,6 @@ void MyFrame::textctrl_view(
739748 wxCommandEvent& event //!<[in] Selected menu
740749 )
741750 {
742- int ierr;
743751 double dvalue;
744752
745753 if (event.GetId() == itext_scale) {
@@ -816,9 +824,6 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos,
816824 : wxFrame(frame, wxID_ANY, title, pos, size, style),
817825 m_canvas(NULL)
818826 {
819- int ib, itet;
820- char menuname[8];
821-
822827 SetIcon(wxICON(fermisurfer));
823828
824829 // Make a menubar
@@ -1082,14 +1087,14 @@ wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"),
10821087 gbsizer->Add(new wxRadioBox(panel, iradio_lighting, wxT("Lighting"),
10831088 wxDefaultPosition, wxDefaultSize,
10841089 WXSIZEOF(choices_light), choices_light,
1085- 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 0), wxGBSpan(4, 1));
1090+ 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 1), wxGBSpan(4, 1));
10861091
1087- wxString choices_BarColor[] = { wxT("BGR"), wxT("CMY"), wxT("MCY")};
1092+ wxString choices_BarColor[] = { wxT("BGR"), wxT("CMY"), wxT("MCY"), wxT("BWR") };
10881093 Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_BarColor, this, iradio_BarColor);
10891094 gbsizer->Add(new wxRadioBox(panel, iradio_BarColor, wxT("Bar Color"),
10901095 wxDefaultPosition, wxDefaultSize,
10911096 WXSIZEOF(choices_BarColor), choices_BarColor,
1092- 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 1), wxGBSpan(4, 1));
1097+ 1, wxRA_SPECIFY_COLS), wxGBPosition(14, 0), wxGBSpan(5, 1));
10931098 //
10941099 // Section color
10951100 //
@@ -1182,7 +1187,7 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
11821187 }
11831188
11841189 void MyFrame::modify_band() {
1185- int ib, width, height, j;
1190+ int ib, j;
11861191 wxCheckBox** check;
11871192 wxTextCtrl** textbox_BandR, ** textbox_BandG, ** textbox_BandB;
11881193 GLfloat mat2;
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -155,7 +155,8 @@ 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];
158+extern GLfloat arrow_f[2][3];
159+extern GLfloat arrow_c[2][3];
159160 /*
160161 Others
161162 */
Show on old repository browser