• [^] # Re: «Faire des schémas comme ceux-ci est simple»

    Posté par (site web personnel) . En réponse au journal Redécouverte : Roff. Évalué à 5.

    Et pour ceux qui se demandent, voici la diffraction circulaire.

    .\" Radius for different circles.
    rad_large_circle = 0.6
    rad_empty_space = 0.5
    rad_light_source = 0.3
    rad_aperture = 0.1
    .\" Light intensity.
    fill_large_circle = 0.1 # Very bright.
    fill_empty_space = 0.6 # Little bright.
    fill_light_source = 0 # Completely bright.
    arrow_x_shift = 0.05
    txt_y_shift = 0.25 # Allow space for text.
    .\" Circles.
    HALO: circle rad rad_large_circle fill fill_large_circle
    EMPTY: circle with .c at HALO.c rad rad_empty_space fill fill_empty_space 
    SOURCE: circle with .c at HALO.c rad rad_light_source fill fill_light_source
    APERTURE: circle with .c at HALO.c rad rad_aperture fill fill_light_source dashed
    .\" Legend.
    TAPERTURE: "Aperture, where light can pass through" ljust at HALO.e + (0.3, 0)
    TSOURCE: "Main visible light source, very bright" ljust at Here + (0, -txt_y_shift)
    TEMPTY: "Empty space, very little light" ljust at Here + (0, -txt_y_shift)
    THALO: "Halo, thin light" ljust at Here + (0, -txt_y_shift)
    .\" Arrows.
    arrow from TAPERTURE + (-arrow_x_shift,0) to APERTURE chop 0 chop rad_aperture
    arrow from TSOURCE + (-arrow_x_shift,0) to SOURCE chop 0 chop rad_light_source
    arrow from TEMPTY + (-arrow_x_shift,0) to EMPTY chop 0 chop rad_empty_space
    arrow from THALO + (-arrow_x_shift,0) to HALO chop 0 chop rad_large_circle
    .\" Let's cheat a little: centering the figure.
    false_line_x = 2.7
    line from SOURCE + (false_line_x,0) to SOURCE + (false_line_x,0)
    .ps 14
    "Circular diffraction" at HALO.s + (1, -1)

    Là encore, on peut voir qu'un objet de l'image correspond à une ligne. Il y a quelques exceptions à cela, comme les variables (des distances par exemple) ou des requêtes troff pour changer ce qui n'est pas relatif à pic spécifiquement (comme la taille des polices avec .ps 14), mais c'est parfaitement raisonnable.

    Au final on se retrouve avec des images de bonne qualité en quelques lignes, entièrement générées par troff. Pas besoin de programme externe.