Пример #1
0
int main (int argc, char ** argv)
{
  int n, j, g, choice;
  double p;
  double** A;
  int i=1;
  while (i!=0)
  {
    clear();
    printf("Menu principal : Polynome caractéristique, valeurs propres et vecteurs propres\n\n");
    printf("Choisir le mode de saisie de la matrice :\n");
    printf("1- Utiliser le générateur de matrices\n");
    printf("0- Entrer manuellement les valeurs\n");
    printf("Votre choix : ");
    scanf("%d",&g);
    clear();
    if(g)
    {
      printf("MENU : GENERATION DE MATRICES\n\n");
      printf("Choisir un type de matrice à générer :\n");
      printf("1. Creuse à 70%%\n");
      printf("2. A bord\n");
      printf("3. Ding-Dong\n");
      printf("4. Franc\n");
      printf("5. Hilbert\n");
      printf("6. KMS\n");
      printf("7. Lehmer\n");
      printf("8. Lotkin\n");
      printf("9. Moler\n");
      printf("Votre choix : ");
      scanf("%d", &choice);
      printf("Dimension : ");
      scanf("%d", &n);
      switch (choice)
      {
	case 1:
	  A=creuse70(n);
	  break;
	case 2:
	  A=bord(n);
	  break;
	case 3:
	  A=dingDong(n);
	  break;
	case 4:
	  A=franc(n);
	  break;
	case 5:
	  A=hilbert(n);
	  break;
	case 6:
	  printf("Parametre p : ");
	  scanf("%lf", &p);
	  A=kms(n,p);
	  break;
	case 7:
	  A=lehmer(n);
	  break;
	case 8:
	  A=lotkin(n);
	  break;
	case 9:
	  A=moler(n);
	  break;
      }
//    Déplacement de afficher matrice pour l'afficher au-dessus du menu de choix, ainsi elle est systématiquement affichée
    }
    else
    {
      printf("Matrice A :\n");
      printf("Dimension : ");
      scanf("%d",&n);
      A=creerRemplirMatrice(n,n);
    }
      convertMattoLatex(A,n,n);
    i=1;
    while (i!=0 && i!=9)
    {
      clear();
      printf("Matrice :\n");
      afficherMatrice(A, n, n);
      printf("\nQue voulez-vous faire ?\n");
      printf("1- Méthode de Leverrier\n");
      printf("2- Méthode de Leverrier améliorée\n");
      printf("3- Méthode des Puissances Itérées\n");
      printf("9- Nouvelle matrice (Menu principal)\n");
      printf("0- Quitter\n");
      printf("Votre choix : ");
      scanf("%d", &i);
      cleanBuffer(); //vidage buffer
      clear();
      switch (i)
      {
	case 1:
	  printf("Polynome caracteristique par Leverrier... \n");
	  leverrier(A,n);
	  hitToContinue();
	  break;
	case 2:
	  printf("Polynome caracteristique par Leverrier améliorée ... \n");
	  leverrierA(A,n);
	  hitToContinue();
	  break;
	case 3:
	  printf("Méthode des puissances itérées ... \n");
	  printf("Précision souhaitée : ");
	  scanf("%lf", &p);
	  cleanBuffer();
	  puissancesIt(A,n,p);
	  hitToContinue();
	  break;
      }
    }
    
    //libération mémoire
    for (j=0; j<n; j++)
    {
      free(A[j]);
    }
    free(A);
  }
  return 0;
}
Пример #2
0
void VideoSlider::DrawImage(wxDC &destdc) {
	int w,h;
	GetClientSize(&w,&h);

	// Back buffer
	wxMemoryDC dc;
	wxBitmap bmp(w,h);
	dc.SelectObject(bmp);

	// Colors
	wxColour shad = wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW);
	wxColour high = wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT);
	wxColour face = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
	wxColour sel(123,251,232);
	wxColour notSel(sel.Red()*2/5,sel.Green()*2/5,sel.Blue()*2/5);
	wxColour bord(0,0,0);
	int x1,x2,y1,y2;

	// Background
	dc.SetPen(*wxTRANSPARENT_PEN);
	dc.SetBrush(face);
	dc.DrawRectangle(0,0,w,h);

	// Selection border
	bool selected = wxWindow::FindFocus() == this;
	if (selected) {
		dc.SetBrush(*wxTRANSPARENT_BRUSH);
		dc.SetPen(wxPen(shad,1,wxDOT));
		dc.DrawRectangle(0,0,w,h);
	}

	// Draw slider
	x1 = 5;
	x2 = w-5;
	y1 = 8;
	y2 = h-8;
	dc.SetPen(wxPen(shad));
	dc.DrawLine(x1,y1,x2,y1);
	dc.DrawLine(x1,y1,x1,y2);
	dc.SetPen(wxPen(high));
	dc.DrawLine(x1,y2,x2,y2);
	dc.DrawLine(x2,y1,x2,y2);

	// Draw keyframes
	int curX;
	if (OPT_GET("Video/Slider/Show Keyframes")->GetBool()) {
		dc.SetPen(wxPen(shad));
		for (size_t i=0;i<keyframes.size();i++) {
			curX = GetXAtValue(keyframes[i]);
			dc.DrawLine(curX,2,curX,8);
		}
	}

	// Draw cursor
	curX = GetXAtValue(val);

	// Fill bg
	dc.SetBrush(wxBrush(face));
	dc.SetPen(*wxTRANSPARENT_PEN);
	dc.DrawRectangle(curX-2,y1-1,4,y2-y1+5);
	dc.SetBrush(wxNullBrush);

	// Draw cursor highlights
	dc.SetPen(wxPen(high));
	dc.DrawLine(curX,y1-2,curX-4,y1+2);
	dc.DrawLine(curX-3,y1+2,curX-3,y2+5);

	// Draw cursor shades
	dc.SetPen(wxPen(shad));
	dc.DrawLine(curX+1,y1-1,curX+4,y1+2);
	dc.DrawLine(curX+3,y1+2,curX+3,y2+5);
	dc.DrawLine(curX-3,y2+4,curX+3,y2+4);

	// Draw cursor outline
	dc.SetPen(wxPen(bord));
	dc.DrawLine(curX,y1-3,curX-4,y1+1);
	dc.DrawLine(curX,y1-3,curX+4,y1+1);
	dc.DrawLine(curX-4,y1+1,curX-4,y2+5);
	dc.DrawLine(curX+4,y1+1,curX+4,y2+5);
	dc.DrawLine(curX-3,y2+5,curX+4,y2+5);
	dc.DrawLine(curX-3,y2,curX+4,y2);

	// Draw selection
	dc.SetPen(*wxTRANSPARENT_PEN);
	if (selected) dc.SetBrush(wxBrush(sel));
	else dc.SetBrush(wxBrush(notSel));
	dc.DrawRectangle(curX-3,y2+1,7,4);

	// Draw final
	destdc.Blit(0,0,w,h,&dc,0,0);
}
Пример #3
0
//////////////
// Draw image
void VideoSlider::DrawImage(wxDC &dc) {
	// Get dimensions
	int w,h;
	GetClientSize(&w,&h);

	// Draw background
	dc.Clear();

	// Colors
	wxColour shad = wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW);
	wxColour high = wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT);
	wxColour face = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
	//wxColour sel(244,198,38);
	wxColour sel(123,251,232);
	wxColour notSel(sel.Red()*2/5,sel.Green()*2/5,sel.Blue()*2/5);
	wxColour bord(0,0,0);
	int x1,x2,y1,y2;

	// Selection border
	bool selected = wxWindow::FindFocus() == this;
	if (selected) {
		dc.SetBrush(*wxTRANSPARENT_BRUSH);
		dc.SetPen(wxPen(shad,1,wxDOT));
		dc.DrawRectangle(0,0,w,h);
	}

	// Draw slider
	x1 = 5;
	x2 = w-5;
	y1 = 8;
	y2 = h-8;
	dc.SetPen(wxPen(shad));
	dc.DrawLine(x1,y1,x2,y1);
	dc.DrawLine(x1,y1,x1,y2);
	dc.SetPen(wxPen(high));
	dc.DrawLine(x1,y2,x2,y2);
	dc.DrawLine(x2,y1,x2,y2);

	// Draw keyframes
	int curX;
	if (Display && Options.AsBool(_T("Show keyframes on video slider"))) {
		dc.SetPen(wxPen(shad));
		wxArrayInt KeyFrames = Display->GetKeyFrames();
		int keys = KeyFrames.Count();
		for (int i=0;i<keys;i++) {
			curX = GetXAtValue(KeyFrames[i]);
			dc.DrawLine(curX,2,curX,8);
		}
	}

	// Draw cursor
	curX = GetXAtValue(GetValue());

	// Fill bg
	dc.SetBrush(wxBrush(face));
	dc.SetPen(*wxTRANSPARENT_PEN);
	dc.DrawRectangle(curX-2,y1-1,4,y2-y1+5);
	dc.SetBrush(wxNullBrush);

	// Draw cursor highlights
	dc.SetPen(wxPen(high));
	dc.DrawLine(curX,y1-2,curX-4,y1+2);
	dc.DrawLine(curX-3,y1+2,curX-3,y2+5);

	// Draw cursor shades
	dc.SetPen(wxPen(shad));
	dc.DrawLine(curX+1,y1-1,curX+4,y1+2);
	dc.DrawLine(curX+3,y1+2,curX+3,y2+5);
	dc.DrawLine(curX-3,y2+4,curX+3,y2+4);

	// Draw cursor outline
	dc.SetPen(wxPen(bord));
	dc.DrawLine(curX,y1-3,curX-4,y1+1);
	dc.DrawLine(curX,y1-3,curX+4,y1+1);
	dc.DrawLine(curX-4,y1+1,curX-4,y2+5);
	dc.DrawLine(curX+4,y1+1,curX+4,y2+5);
	dc.DrawLine(curX-3,y2+5,curX+4,y2+5);
	dc.DrawLine(curX-3,y2,curX+4,y2);

	// Draw selection
	dc.SetPen(*wxTRANSPARENT_PEN);
	if (selected) dc.SetBrush(wxBrush(sel));
	else dc.SetBrush(wxBrush(notSel));
	dc.DrawRectangle(curX-3,y2+1,7,4);
}