Datei:Cone-fundamentals-with-srgb-spectrum.svg

Aus testwiki
Zur Navigation springen Zur Suche springen
    Originaldatei (SVG-Datei, Basisgröße: 540 × 380 Pixel, Dateigröße: 5 KB)

    Diese Datei stammt aus Wikimedia Commons und kann von anderen Projekten verwendet werden. Die Beschreibung von deren Dateibeschreibungsseite wird unten angezeigt.

    Beschreibung

    Beschreibung
    English: The Stockman and Sharpe (2000) 2° cone fundamentals, as found at Cone Fundamentals. cvrl.ucl.ac.uk. Retrieved on 2025-11-11., plotted against the most accurate sRGB spectrum I could manage. Now in SVG.
    Datum
    Quelle Eigenes Werk
    Urheber BenRG
    Andere Versionen
    SVG‑Erstellung
    InfoField
     Der SVG-Code ist valide.
     Dieses Diagramm wurde mit einem unbekannten SVG-Editor erstellt.
      Dieses Diagramm verwendet Text-Einbettung, die mit einem Texteditor leicht übersetzbar ist.

    Lizenz

    Public domain Ich, der Urheberrechtsinhaber dieses Werkes, veröffentliche es als gemeinfrei. Dies gilt weltweit.
    In manchen Staaten könnte dies rechtlich nicht möglich sein. Sofern dies der Fall ist:
    Ich gewähre jedem das bedingungslose Recht, dieses Werk für jedweden Zweck zu nutzen, es sei denn, Bedingungen sind gesetzlich erforderlich.

    Perl code

    use strict;
    use Svg;
    
    sub MakeGrad {
    	my ($grad,$a) = @_;
    	my ($lo,$hi) = ($$a[0][0], $$a[$#$a][0]);
    	for my $stop (@$a) {
    		$grad->stop(offset => int(($$stop[0]-$lo)/($hi-$lo)*100+0.5) . '%', 'stop-color' => $$stop[1]);
    	}
    }
    
    # cone fundamentals in steps of 5nm from 390nm to 710nm, normalized to max=1000
    my @lfund = (0,1,2,5,9,13,18,23,28,34,40,45,50,55,65,81,99,119,140,164,192,233,289,360,444,536,629,705,771,826,881,919,940,966,981,994,1000,992,969,956,928,886,834,775,706,631,554,480,401,328,266,213,165,125,93,69,50,36,25,18,12,8,6,4,3);
    my @mfund = (0,1,2,5,9,15,22,30,39,52,65,76,87,98,116,145,176,205,236,268,304,357,428,516,616,719,817,886,936,969,995,997,977,957,918,873,814,740,653,573,493,411,334,265,205,156,117,86,62,44,31,22,15,11,7,5,3,2,2,1,1,1,0,0,0);
    my @sfund = (10,24,57,122,233,381,544,674,803,904,991,992,955,860,787,738,646,516,390,290,212,161,123,89,61,43,29,19,13,8,5,3,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
    
    my @colorgradient1 = ([390,'#000001'],[400,'#010002'],[410,'#020007'],[420,'#060013'],[440,'#170039'],[450,'#1D004E'],[455,'#1D005B'],[460,'#18006B'],[465,'#000879'],[470,'#002061'],[480,'#00334D'],[490,'#004245'],[500,'#005446'],[520,'#007C4F'],[530,'#00884D'],[535,'#008C48'],[545,'#00912F'],[550,'#159300'],[555,'#409000'],[570,'#7E8000'],[585,'#A56400'],[595,'#B44A00'],[605,'#BA2700'],[610,'#B90C00'],[615,'#B00016'],[620,'#A4001F'],[630,'#8B0021'],[640,'#72001D'],[670,'#310009'],[680,'#220005'],[700,'#0D0001'],[710,'#070001']);
    my @colorgradient2 = ([390,'#8E8D8F'],[400,'#8E8D93'],[410,'#908B9C'],[420,'#9587B6'],[430,'#9C7FDA'],[440,'#9C7DE8'],[450,'#9780E9'],[460,'#8F86E5'],[470,'#8390D5'],[490,'#68A6AA'],[500,'#55B29C'],[510,'#30C292'],[520,'#00D189'],[530,'#33D985'],[540,'#5FDB82'],[555,'#96D681'],[570,'#C5C783'],[585,'#EAB186'],[595,'#FAA088'],[605,'#FF918A'],[615,'#FA888B'],[625,'#EB848C'],[655,'#B1898D'],[670,'#9D8C8D'],[690,'#928D8E'],[710,'#8F8D8E']);
    
    my ($bgcolor,$legendcolor,$tracecolor,$spectrum) = (qw(white black white), \@colorgradient1);
    #my ($bgcolor,$legendcolor,$tracecolor,$spectrum) = (qw(black white black), \@colorgradient2);
    my $graph_width = 480;
    my $graph_height = 300;
    my $spectrum_top_padding = 10;
    my $graph_ofs_x = 40;
    my $graph_ofs_y = 20;
    my $image_width = $graph_ofs_x + $graph_width + 20;
    my $image_height = $graph_ofs_y + $graph_height + 60;
    
    my $svg = new Svg(width => $image_width, height => $image_height, fill => 'none');
    MakeGrad($svg->defs()->linearGradient(id => 'spectrum'), $spectrum);
    
    $svg->rect(width => $image_width, height => $image_height, fill => $bgcolor);
    
    my $graph = $svg->group(stroke => $tracecolor, 'stroke-width' => 3, 'stroke-linecap' => 'square');
    $graph->translate($graph_ofs_x, $graph_ofs_y);
    $graph->rect(x => 0, y => 0, width => $graph_width, height => $graph_height, stroke => 'none', fill => 'url(#spectrum)');
    for my $a (\@lfund,\@mfund,\@sfund) {
    	$graph->path(d => MakePath(Interpolate([0..$#$a], $a, 4), $graph_width / $#$a, ($graph_height-$spectrum_top_padding)/-1000, 0, $graph_height, 0.25));
    }
    $graph->line(x1 => 0, y1 => $graph_height, x2 => $graph_width, y2 => $graph_height, stroke => $bgcolor);
    
    my $text = $svg->group('font-family' => 'Nimbus Roman No9 L, Times, serif', 'font-size' => 20, 'text-anchor' => 'middle', stroke => 'none', fill => $legendcolor);
    my $ticks = do { my $w = $graph_width+19; my $h = $graph_height+19; "M30.5,10.5l$w,0l0,${h}l-$w,0l0,-$h" };
    for (my $i = 390; $i <= 710; $i += 10) {
    	my $h = $i % 50 ? 3 : 6;
    	my $x = $graph_ofs_x + 0.5 + $graph_width * ($i-390)/(710-390);
    	my $y2 = $graph_ofs_y + $graph_height + 9.5 - $h;
    	$ticks .= "M$x,10.5l0,${h}M$x,${y2}l0,$h";
    	if ($i % 50 == 0) {
    		$text->text(x => $x, y => $graph_ofs_y + $graph_height + 30)->add($i);
    	}
    }
    $text->text(x => $graph_ofs_x + $graph_width * 0.5, y => $graph_ofs_y + $graph_height + 50)->add('Wavelength (nm)');
    $text->text()->rotate(-90)->translate(20, $graph_ofs_y + $graph_height/2)->add('Normalized cone response (linear energy)');
    my $sml_text = $text->group(fill => $tracecolor);
    $sml_text->text(x => 145, y => 50)->add('S');
    $sml_text->text(x => 230, y => 50)->add('M');
    $sml_text->text(x => 355, y => 50)->add('L');
    $svg->path(stroke => $legendcolor, 'stroke-width' => 1, d => $ticks);
    
    $svg->write('Cone-fundamentals-with-srgb-spectrum.svg');
    

    Kurzbeschreibungen

    Ergänze eine einzeilige Erklärung, was diese Datei darstellt.

    In dieser Datei abgebildete Objekte

    Motiv

    image/svg+xml

    15f4919b7ec6bb0f955837af49ad332379eced4e

    5.063 Byte

    380 Pixel

    540 Pixel

    Dateiversionen

    Klicke auf einen Zeitpunkt, um diese Version zu laden.

    Version vomVorschaubildMaßeBenutzerKommentar
    aktuell18:14, 23. Sep. 2009Vorschaubild der Version vom 18:14, 23. Sep. 2009540 × 380 (5 KB)wikimediacommons>BenRGuse font-family="Nimbus Roman No9 L, Times, serif"

    Keine Seite verwendet diese Datei.