Μετάβαση στο περιεχόμενο

Αρχείο:Hilbert curve 3.svg

Τα περιεχόμενα της σελίδας δεν υποστηρίζονται σε άλλες γλώσσες.
Αυτό το αρχείο προέρχεται από το Wikimedia Commons
Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια

Εικόνα σε υψηλότερη ανάλυση(Αρχείο SVG, ονομαστικό μέγεθος 512 × 512 εικονοστοιχεία, μέγεθος αρχείου: 619 bytes)

Σύνοψη

Περιγραφή
English: First, second, and third order Hilbert Curves overlayed, with the lines getting thinner and darker as the order increases.
Ημερομηνία
Πηγή Έργο αυτού που το ανεβάζει (Original text: Own work by uploader, generated by an original program described below)
Δημιουργός Geoff Richards (Qef)
άλλες εκδόσεις
SVG ανάπτυξη
InfoField
 
Ο πηγαίος κώδικας αυτού του SVG είναι έγκυρος.
Πηγαίος κώδικας
InfoField

Acknowledge

This SVG image, as well as the other two versions draw to lower orders, were generated by running the following [[:en:Lua (programming language)|Lua]] program.  It uses the L-system described in the [[:en:Hilbert curve|Wikipedia article on Hilbert curves]], using simple string replacement to generate a complete turtle-graphics program, which is then run to generate SVG path instructions.

Lua code

local IMG_SZ, DEPTH = 512, 3

local fh = assert(io.open("Hilbert_curve.svg", "wb"))
fh:write('<?xml version="1.0" encoding="UTF-8"?>\n',
         '<svg version="1.0" width="', IMG_SZ, '" height="', IMG_SZ,
         '" xmlns="http://www.w3.org/2000/svg">\n')

local L_SYSTEM_RULES = {    -- these are from the Wikipedia article
    L = "+RF-LFL-FR+",
    R = "-LF+RFR+FL-",
}
local ANGLE_COMMANDS = {    -- angle expressed in units of 90 degrees
    [0] = "h",
    [1] = "v",
    [2] = "h-",
    [3] = "v-",
}
local STROKE_STYLE = {      -- each order drawn with different stroke style
    [1] = "stroke:#f00;stroke-width:6;fill:none",
    [2] = "stroke:#00f;stroke-width:4;fill:none",
    [3] = "stroke:#000;stroke-width:2;fill:none",
    [4] = "stroke:#000;stroke-width:1;fill:none",
    [5] = "stroke:#000;stroke-width:0.5;fill:none",
}

function turtle_graphics (input, startpos, line_len)
    local output = "M" .. startpos .. "," .. startpos
    local angle = 0
    for i = 1, input:len() do
        local cmd = input:sub(i, i)
        if cmd == "F" then
            output = output .. ANGLE_COMMANDS[angle] .. line_len
        elseif cmd == "+" then
            angle = (angle + 1) % 4
        elseif cmd == "-" then
            angle = (angle - 1) % 4
        end
    end
    return output
end

local line_len = IMG_SZ / 2
for d = 1, DEPTH do
    local lsys = "L"
    for _ = 1, d do
        -- Apply the production rules.  Note that both 'L' and 'R' rules are
        -- applied simultaneously.
        lsys = lsys:gsub("([LR])", function (orig)
            return L_SYSTEM_RULES[orig]
        end)
    end
    fh:write(' <path style="', STROKE_STYLE[d], '" d="',
             turtle_graphics(lsys, line_len / 2, line_len), '"/>\n')
    line_len = line_len / 2
end

fh:write('</svg>\n')

Αδειοδότηση

Public domain Το έργο αυτό έχει απελευθερωθεί στην public domain από τον δημιουργό του, Qef. Αυτό ισχύει σε όλο τον κόσμο.

Σε ορισμένες χώρες αυτό μπορεί να μην είναι νομικά εφικτό. Αν ναι:
Qef Παραχωρώ σε οποιονδήποτε το δικαίωμα να χρησιμοποιήσει αυτό το έργο "για οποιονδήποτε σκοπό", χωρίς κανέναν όρο, εκτός και αν τέτοιοι όροι τίθενται από την νομοθεσία

Λεζάντες

Δεν ορίστηκε λεζάντα

Items portrayed in this file

απεικονίζει

Ιστορικό αρχείου

Κλικάρετε σε μια ημερομηνία/ώρα για να δείτε το αρχείο όπως εμφανιζόταν εκείνη τη στιγμή.

Ώρα/Ημερομ.ΜικρογραφίαΔιαστάσειςΧρήστηςΣχόλια
τελευταία15:18, 13 Ιουλίου 2008Μικρογραφία για την έκδοση της 15:18, 13 Ιουλίου 2008512 × 512 (619 bytes)Qef{{Information |Description={{en|1=First, second, and third order Hilbert Curves overlayed, with the lines getting thinner and darker as the order increases.}} |Source=Own work by uploader, generated by an original program described below |Author=Geoff Ric

Τα παρακάτω λήμματα συνδέουν σε αυτό το αρχείο:

Καθολική χρήση αρχείου

Τα ακόλουθα άλλα wiki χρησιμοποιούν αυτό το αρχείο: