For faster navigation, this Iframe is preloading the Wikiwand page for Archivo:Closest pair of points.svg.

Archivo:Closest pair of points.svg

Ver la imagen en su resolución original((Imagen SVG, nominalmente 256 × 256 pixels, tamaño de archivo: 1 kB))

Este es un archivo de Wikimedia Commons, un depósito de contenido libre hospedado por la Fundación Wikimedia. Más abajo se reproduce su página de descripción con la información sobre su origen y licencia.

Resumen

Descripción
English: Closest pair of points shown in red.
Fecha
Fuente Trabajo propio
Autor Qef
Otras versiones Bitmap version: file:ClosestPair.png

Licencia

Creative Commons CC-Zero Este archivo está disponible bajo la licencia Creative Commons Dedicación de Dominio Público CC0 1.0 Universal.
La persona que ha asociado una obra a este documento lo dedica al dominio público mediante la cesión mundial de sus derechos bajo la ley de derechos de autor y todos los derechos legales adyacentes propios de dicha, en el ámbito permitido por ley. Puedes copiar, modificar, distribuir y reproducir el trabajo, incluso con objetivos comerciales, sin pedir aprobación del autor.

Source code

The SVG was generated by running the Lua program given below. It deliberately fails if the closest points would be overlapping in the image, because that would be confusing.

local WD, HT, NUM_POINTS = 256, 256, 16
local COLOR = { normal = '#000', closest = '#f00' }
local RADIUS = 5

math.randomseed(os.time())
local P = {}
for _ = 1, NUM_POINTS do
    P[#P+1] = { x = RADIUS + (WD - 2*RADIUS) * math.random(),
                y = RADIUS + (HT - 2*RADIUS) * math.random() }
end

-- Find closest pair, using naive algorithm.
local closest_a, closest_b
local min_dist
for i, p in ipairs(P) do
    for j, q in ipairs(P) do
        if i ~= j then
            local dist = math.sqrt((p.x - q.x)^2 + (p.y - q.y)^2)
            if not min_dist or dist < min_dist then
                min_dist = dist
                closest_a, closest_b = i, j
            end
        end
    end
end

if min_dist < RADIUS then
    error("points on top of each other, run me again")
end

io.write('<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n',
         '<svg svg="http://www.w3.org/2000/svg" version="1.0"',
         ' width="', WD, '" height="', HT, '">\n')
for i, p in ipairs(P) do
    local color = COLOR.normal
    if i == closest_a or i == closest_b then color = COLOR.closest end
    io.write(' <circle cx="', RADIUS + p.x, '" cy="', RADIUS + p.y,
             '" r="', RADIUS, '" style="fill:', color, '"/>\n')
end
io.write('</svg>\n')

Leyendas

Añade una explicación corta acerca de lo que representa este archivo

Elementos representados en este archivo

representa a

image/svg+xml

120742ed70c3028e512f55d9b9e19453b4a7df2f

256 píxel

256 píxel

Historial del archivo

Haz clic sobre una fecha y hora para ver el archivo tal como apareció en ese momento.

Fecha y horaMiniaturaDimensionesUsuarioComentario
actual04:03 22 jun 2009Miniatura de la versión del 04:03 22 jun 2009256 × 256 (1 kB)Qef((Information |Description=((en|1=Closest pair of points shown in red.)) |Source=Own work by uploader |Author=Qef |Date=2009-06-22 |Permission= |other_versions=Bitmap version: file:ClosestPair.png )) <!--((ImageUpload|full))--> [[Catego

Usos del archivo

Las siguientes páginas usan este archivo:

Uso global del archivo

Las wikis siguientes utilizan este archivo:

{{bottomLinkPreText}} {{bottomLinkText}}
Archivo:Closest pair of points.svg
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?