Fichier:Relative neighborhood graph.svg

De testwiki
Aller à la navigation Aller à la recherche
    Fichier d’origine (Fichier SVG, nominalement de 450 × 450 pixels, taille : 53 kio)

    Ce fichier provient de Wikimedia Commons et peut être utilisé par d'autres projets. Sa description sur sa page de description est affichée ci-dessous.

    Description

    Description
    English: The relative neighborhood graph of 100 random points in a square
    Date
    Source Travail personnel
    Auteur ou autrice David Eppstein

    Conditions d’utilisation

    Public domain Moi, propriétaire des droits d’auteur sur cette œuvre, la place dans le domaine public. Ceci s'applique dans le monde entier.
    Dans certains pays, ceci peut ne pas être possible ; dans ce cas :
    J’accorde à toute personne le droit d’utiliser cette œuvre dans n’importe quel but, sans aucune condition, sauf celles requises par la loi.

    Source code

    This image was created with the following Python source code and then recolored and converted to SVG in Adobe Illustrator.

    from pyx import canvas,path,color
    from math import *
    from random import seed,random
    seed(12345)
    
    npoints = 100
    radius = 0.05
    exclusion = 0.2     # prevent points from being too close
    scale = 5
    beta1 = 1.1
    beta2 = 0.9
    theta1 = asin(1/beta1)
    theta2 = pi - asin(beta2)
    
    def dist2(p,q):
        return (p[0]-q[0])**2 + (p[1]-q[1])**2
    
    points = []
    while len(points) < 100:
        p = (random()*scale,random()*scale)
        if points:
            nn = min(dist2(p,q)**0.5 for q in points)
            if nn < exclusion:
                continue
        points.append(p)
    
    def neighbors(p,q):
        for r in points:
            if max(dist2(p,r),dist2(q,r)) < dist2(p,q):
                return False
        return True
    
    c = canvas.canvas()
    
    def edge(p,q):
        c.stroke(path.line(p[0],p[1],q[0],q[1]),
                 [color.rgb.black])
    
    def point(p):
        c.fill(path.circle(p[0],p[1],radius),[color.rgb.red])
    
    for p in points:
        for q in points:
            if p < q and neighbors(p,q):
                edge(p,q)
    
    for p in points:
        point(p)
    
    c.writePDFfile("Relative_neighborhood_graph")
    

    Légendes

    Ajoutez en une ligne la description de ce que représente ce fichier

    Éléments décrits dans ce fichier

    dépeint

    54 469 octet

    image/svg+xml

    f23241ad6d955a1d7a1b89c46a339cbe75794a39

    Historique du fichier

    Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.

    Date et heureVignetteDimensionsUtilisateurCommentaire
    actuel16 avril 2010 à 00:07Vignette pour la version du 16 avril 2010 à 00:07450 × 450 (53 kio)wikimediacommons>David Eppstein{{Information |Description={{en|1=The relative neighborhood graph of 100 random points in a square}} |Source={{own}} |Author=David Eppstein |Date=2010-04-15 |Permission= |other_versions= }} [[Ca

    Aucune page n’utilise ce fichier.