IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Mathématiques Discussion :

Dessiner des polygones autour des nœuds


Sujet :

Mathématiques

  1. #1
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2015
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2015
    Messages : 8
    Points : 2
    Points
    2
    Par défaut Dessiner des polygones autour des nœuds
    Bonjour, j'ai besoin d'obtenir des polygones autour des nœuds aléatoires en Matlab.
    Y a-t-il une manière intéressante, une boucle par exemple, de déclarer les coordonnées des points ?
    Merci

  2. #2
    Modérateur

    Homme Profil pro
    Ingénieur en calculs scientifiques
    Inscrit en
    Août 2007
    Messages
    4 639
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Ingénieur en calculs scientifiques

    Informations forums :
    Inscription : Août 2007
    Messages : 4 639
    Points : 7 614
    Points
    7 614
    Par défaut
    Bonjour,

    La question manque de précision : que sont les noeuds aléatoires? comment sont définis les polygones?
    Pour une bonne utilisation des balises code c'est ici!
    Petit guide du voyageur MATLABien : Le forum La faq Les tutoriels Les sources


    La nature est un livre écrit en langage mathématique. Galilée.

  3. #3
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2015
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2015
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    les nœuds sont des points dessinés aléatoirement ,je veux intégrer une polygone dans chaque cellule de voronoi.
    Mon but est d'obtenir une figure comme celle-ci Nom : Image20.jpg
Affichages : 604
Taille : 132,7 Ko
    j'ai déjà trouver celle-ci Nom : Capture.PNG
Affichages : 614
Taille : 188,5 Ko
    L'étape suivante consiste à tirer une forme dans chaque polygone afin d'introduire une distance entre les polygones et aussi pour lisser les coins d'entre eux.

  4. #4
    Modérateur

    Homme Profil pro
    Ingénieur en calculs scientifiques
    Inscrit en
    Août 2007
    Messages
    4 639
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Ingénieur en calculs scientifiques

    Informations forums :
    Inscription : Août 2007
    Messages : 4 639
    Points : 7 614
    Points
    7 614
    Par défaut
    Si je comprends bien, tu veux arriver à obtenir les courbes qui sont à l'intérieur des cellules de Voronoï?

    Ces courbes me rappellent un peu à des courbes de bezier ou les noeuds seraient les points de contrô

    Citation Envoyé par papillon r Voir le message
    L'étape suivante consiste à tirer une forme dans chaque polygone afin d'introduire une distance entre les polygones
    cette phrase n'est pas claire du tout: qu'entend-tu par "tirer une forme"? de quelle distance parles-tu?
    Pour une bonne utilisation des balises code c'est ici!
    Petit guide du voyageur MATLABien : Le forum La faq Les tutoriels Les sources


    La nature est un livre écrit en langage mathématique. Galilée.

  5. #5
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2015
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2015
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    Bonjour, c'est à dire je veux obtenir une forme quelconque dans chaque cellule de voronoi, et la distance entre les formes voisins soit calculés

  6. #6
    Modérateur

    Homme Profil pro
    Ingénieur en calculs scientifiques
    Inscrit en
    Août 2007
    Messages
    4 639
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Ingénieur en calculs scientifiques

    Informations forums :
    Inscription : Août 2007
    Messages : 4 639
    Points : 7 614
    Points
    7 614
    Par défaut
    Je ne vois vraiment pas ou tu veux en venir. Explique nous peut-être la finalité de ton étude, sinon on ne va pas s'en sortir.

    Je déplace dans le forum algorithme car pour le moment, le problème n'a pas de lien avec matlab.
    Pour une bonne utilisation des balises code c'est ici!
    Petit guide du voyageur MATLABien : Le forum La faq Les tutoriels Les sources


    La nature est un livre écrit en langage mathématique. Galilée.

  7. #7
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2015
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2015
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    je veux écrire un code matlab qui me permet d'obtenir la 1ére image, mais je ne sais pas comment introduire les formes dans les cellules voronoi ?!

  8. #8
    Modérateur

    Homme Profil pro
    Ingénieur en calculs scientifiques
    Inscrit en
    Août 2007
    Messages
    4 639
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Ingénieur en calculs scientifiques

    Informations forums :
    Inscription : Août 2007
    Messages : 4 639
    Points : 7 614
    Points
    7 614
    Par défaut
    Avant de penser au code, il faut savoir comment obtenir ces formes! D'ou provient l'image?
    Pour une bonne utilisation des balises code c'est ici!
    Petit guide du voyageur MATLABien : Le forum La faq Les tutoriels Les sources


    La nature est un livre écrit en langage mathématique. Galilée.

  9. #9
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2015
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2015
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    j'ai utilisé fonction voronoi tesselation et voici le code :

    Code matlab : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    function [ p, t ] = cvt_square_uniform ( n, sample_num, delaunay_display)
    %*****************************************************************************80
    %
    %% CVT_SQUARE_UNIFORM demonstrates how a CVT can be computed and displayed in MATLAB.
    %
    %  Discussion:
    %
    %    This simple example carries out an iterative CVT calculation in the 
    %    unit square, with a uniform density.  The initial placement of the
    %    generators is random.
    %
    %  Licensing:
    %
    %    This code is distributed under the GNU LGPL license.
    %
    %  Modified:
    %
    %    22 May 2006
    %
    %  Author:
    %
    %    John Burkardt
    %
    %  Reference:
    %
    %    Qiang Du, Vance Faber, Max Gunzburger,
    %    Centroidal Voronoi Tessellations: Applications and Algorithms,
    %    SIAM Review, 
    %    Volume 41, 1999, pages 637-676.
    %
    %  Parameters:
    %
    %    Input, integer N, the number of generators.
    %
    %    Input, integer SAMPLE_NUM, the number of sample points.
    %
    %    Input, logical DELAUNAY_DISPLAY, is TRUE (nonzero) if the Delaunay
    %    triangulation is to be displayed.
    %
    %    Output, real P(N,2), the location of the generators.
    %
    %    Output, integer T(NT,3), information defining the Delaunay
    %    triangulation of the generators.  NT is the number of triangles,
    %    which varies depending on the arrangement of the generators.
    %
      fprintf ( 1, '\n' );
      fprintf ( 1, 'CVT_SQUARE_UNIFORM:\n' );
      fprintf ( 1, '  A simple demonstration of a CVT computation\n' );
      fprintf ( 1, '  (Centroidal Voronoi Tessellation)\n' );
      fprintf ( 1, '  in a square, with a uniform density.\n' );
     
      if ( nargin < 1 )
        n = 100;
        fprintf ( 1, '\n' );
        fprintf ( 1, 'CVT_SQUARE_UNIFORM - Note:\n' );
        fprintf ( 1, '  No value of N was supplied.\n' );
        fprintf ( 1, '  N is the number of generators.\n' );
        fprintf ( 1, '  A default value N = %d will be used.\n', n );
      else
        fprintf ( 1, '\n' );
        fprintf ( 1, '  User specified number of generators = %d\n',  n );
      end
     
      if ( nargin < 2 )
        sample_num = 1000 * n;
        fprintf ( 1, '\n' );
        fprintf ( 1, 'CVT_SQUARE_UNIFORM - Note:\n' );
        fprintf ( 1, '  No value of SAMPLE_NUM was supplied.\n' );
        fprintf ( 1, '  SAMPLE_NUM is the number of sample points.\n' );
        fprintf ( 1, '  A default value SAMPLE_NUM = %d will be used.\n', ...
          sample_num );
      else
        fprintf ( 1, '\n' );
        fprintf ( 1, '  User specified number of sample points = %d\n', ...
          sample_num );
      end
     
      if ( nargin < 3 )
        delaunay_display = 0;
        fprintf ( 1, '\n' );
        fprintf ( 1, 'CVT_SQUARE_UNIFORM - Note:\n' );
        fprintf ( 1, '  No value of DELAUNAY_DISPLAY was supplied.\n' );
        fprintf ( 1, '  DELAUNAY_DISPLAY is TRUE (nonzero) if the\n' );
        fprintf ( 1, '  Delaunay triangulation is also to be displayed.\n' );
        fprintf ( 1, '  A default value DELAUNAY_DISPLAY = %d will be used.\n', ...
          delaunay_display );
      else
        fprintf ( 1, '\n' );
        fprintf ( 1, '  User specified DELAUNAY_DISPLAY = %d\n', ...
          delaunay_display );
      end
    %
    %  This switch is set to 1 (TRUE) if the ACCUMARRAY command is available.
    %  That speeds up the calculation a lot.  If you don't have the ACCUMARRAY
    %  command, just set this to 0.
    % 
      fprintf ( 1, '\n' );
      fprintf ( 1, 'CVT_SQUARE_UNIFORM:\n' );
      fprintf ( 1, '  MATLAB''s ACCUMARRAY command can be used for faster\n' );
      fprintf ( 1, '  computation.  This command is not available in\n' );
      fprintf ( 1, '  some versions of MATLAB.  If ACCUMARRAY is available,\n' );
      fprintf ( 1, '  simply make sure that the ACCUMARAY_AVAILABLE variable\n' );
      fprintf ( 1, '  is set to 1!\n' );
     
      accumarray_available = 1;
     
      if ( accumarray_available )
        fprintf ( 1, '\n' );
        fprintf ( 1, '  The ACCUMARRAY command will be used.\n' );
      else
        fprintf ( 1, '\n' );
        fprintf ( 1, '  The ACCUMARRAY command will NOT be used.\n' );
      end
    %
    %  Clear the figure screen, if already open.
    %
      clf
     
    %  Randomize the initial locations of the generators in the unit square.
    %  If another region is used, then this initialization should be changed.
     
      p = rand ( n, 2 );
      plot ( p(:,1), p(:,2), 'b.' );
      axis ( [ 0.0, 1.0, 0.0, 1.0 ] )
      line ( [ 0.0, 1.0, 1.0, 0.0, 0.0 ], [ 0.0, 0.0, 1.0, 1.0, 0.0 ], ...
        'Color', 'r', 'LineWidth', 2 );
      title_string = sprintf ( 'Initial Generators' );
      title ( title_string );
      axis equal
      drawnow
     
      string = input ( 'RETURN, or Q to quit: ', 's' );
     
      if ( string == 'q' | string == 'Q' )
        return
      end
     
      it = 0;
     
      while ( 1 )
     
    %  Compute the Delaunay triangle information T for the current nodes.
     
        t = delaunay ( p(:,1), p(:,2) );
     
    %  Display the Delaunay triangulation, if requested.
     
        if ( delaunay_display )
          subplot ( 1, 2, 2 )
          trimesh ( t, p(:,1), p(:,2), zeros(n,1), 'EdgeColor', 'b' )
          hold on
          plot ( p(:,1), p(:,2), 'b.' );
          axis ( [ -0.0, 1.0, -0.0, 1.0 ] )
          line ( [ 0.0, 1.0, 1.0, 0.0, 0.0 ], [ 0.0, 0.0, 1.0, 1.0, 0.0 ], ...
            'Color', 'r', 'LineWidth', 2 );
          title_string = sprintf ( 'Delaunay, step %d', it );
          title ( title_string );
          axis equal
          view ( 2 )
          hold off
        end
     
    %  Display the CVT generators, and the associated Voronoi diagram.
     
        if ( delaunay_display )
          subplot ( 1, 2, 1 )
        end
     
        voronoi ( p(:,1), p(:,2), t );
        axis ( [ -0.0, 1.0, -0.0, 1.0 ] )
        line ( [ 0.0, 1.0, 1.0, 0.0, 0.0 ], [ 0.0, 0.0, 1.0, 1.0, 0.0 ], ...
          'Color', 'r', 'LineWidth', 2 );
        title_string = sprintf ( 'Voronoi, step %d', it );
        title ( title_string );
        axis equal
        axis tight
        drawnow
     
    %  Generate sample points.  
    %
    %  These sample points implicitly define the geometry of the region.  
    %  If the region is not a unit square, then the range of the sample 
    %  data must be changed.
    %
    %  The data is sampled uniformly.  If a nonuniform density is desired,
    %  then the sampling must be done in a biased way.
     
        xs = rand ( sample_num, 1 );
        ys = rand ( sample_num, 1 );
     
     
     
        k(1:sample_num,1) = dsearch ( p(:,1), p(:,2), t, xs, ys );
     
    %  The centroid of the Voronoi region associated with each generator
    %  is approximated by the average of the sample points it was closest to.
     
        if ( accumarray_available )
     
          count(1:n) = accumarray ( k, ones(sample_num,1) );
          centroid(1,1:n) = accumarray ( k, xs );
          centroid(2,1:n) = accumarray ( k, ys );
     
        else
     
          count(1:n) = 0;
          centroid(1,1:n) = 0.0;
          centroid(2,1:n) = 0.0;
     
          for i = 1 : sample_num
            j = k(i);
            count(j) = count(j) + 1;
            centroid(1,j) = centroid(1,j) + xs(i);
            centroid(2,j) = centroid(2,j) + ys(i);
          end
     
        end
    %
    %  Replace the generators by the centroids.
    %
        p(1:n,1) = ( centroid(1,1:n) ./ count(1:n) )';
        p(1:n,2) = ( centroid(2,1:n) ./ count(1:n) )';
     
        string = input ( 'RETURN, or Q to quit: ', 's' );
     
        if ( string == 'q' | string == 'Q' )
          break
        end
     
        it = it + 1;
     
      end
     
      fprintf ( 1, '\n' );
      fprintf ( 1, 'CVT_SQUARE_UNIFORM:\n' );
      fprintf ( 1, '  Normal end of execution.\n' );
     
      return
    end
    function p = square_uniform ( n )
    %% SQUARE_UNIFORM returns sample points from the unit square.
     
      p(1:n,1:2) = rand(n,2);
     
      return
    end

  10. #10
    Expert éminent sénior Avatar de Flodelarab
    Homme Profil pro
    Inscrit en
    Septembre 2005
    Messages
    5 238
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Charente (Poitou Charente)

    Informations forums :
    Inscription : Septembre 2005
    Messages : 5 238
    Points : 13 443
    Points
    13 443
    Par défaut
    Bonjour

    ça, on avait compris. La question était plutôt: "D'où vient le dessin des courbes à l'intérieur des polygones du premier dessin ? Quelle technique a été employée ?"
    Cette réponse vous apporte quelque chose ? Cliquez sur en bas à droite du message.

  11. #11
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2015
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2015
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    oui exactement, j'ai essayé plusieurs fonctions( pdepoly-spline................) et ça ne marche plus.

  12. #12
    Expert éminent sénior Avatar de Flodelarab
    Homme Profil pro
    Inscrit en
    Septembre 2005
    Messages
    5 238
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Charente (Poitou Charente)

    Informations forums :
    Inscription : Septembre 2005
    Messages : 5 238
    Points : 13 443
    Points
    13 443
    Par défaut
    Tu as réussi un dessin mais tu ne sais plus comment ?
    Cette réponse vous apporte quelque chose ? Cliquez sur en bas à droite du message.

  13. #13
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2015
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2015
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    Je cherche à obtenir avec Matlab une structure poreuse dont les pores sont de formes aléatoires.
    Dans un document j'ai trouvé cette image qui me semble intéressante, mon problème est de déterminer les formes placées dans les polygones.

  14. #14
    Expert éminent sénior

    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    10 603
    Détails du profil
    Informations personnelles :
    Âge : 66
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 10 603
    Points : 17 913
    Points
    17 913
    Billets dans le blog
    2
    Par défaut
    A vue de nez ça me semblerait être une courbe de Béziers passant par les milieux des côtés des cellules de Voronoi...
    "Un homme sage ne croit que la moitié de ce qu’il lit. Plus sage encore, il sait laquelle".

    Consultant indépendant.
    Architecture systèmes complexes. Programmation grosses applications critiques. Ergonomie.
    C, Fortran, XWindow/Motif, Java

    Je ne réponds pas aux MP techniques

  15. #15
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2015
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2015
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    est ce que je peux utiliser ''spline"??

Discussions similaires

  1. [CKEditor] Ajouter des guillemets autour des URIs des images
    Par anaranjado dans le forum Bibliothèques & Frameworks
    Réponses: 1
    Dernier message: 17/08/2010, 17h45
  2. Réponses: 10
    Dernier message: 16/03/2010, 21h14
  3. Réponses: 0
    Dernier message: 12/10/2009, 23h56
  4. créer des cadres autour des controles dans un état
    Par isabelle b dans le forum VBA Access
    Réponses: 10
    Dernier message: 24/12/2008, 15h01
  5. Dessiner un cadre autour des composants
    Par Pill_S dans le forum Composants
    Réponses: 5
    Dernier message: 03/07/2004, 15h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo