Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
metapost [2018/12/04 12:42] – sluka | metapost [2019/01/03 17:00] – [MetaPost] - Added online previewer andrew.atkinson | ||
---|---|---|---|
Line 10: | Line 10: | ||
[[http:// | [[http:// | ||
[[http:// | [[http:// | ||
- | [[http:// | + | [[http:// |
- | or: [[http:// | + | or: [[http:// |
[[http:// | [[http:// | ||
[[http:// | [[http:// | ||
[[http:// | [[http:// | ||
+ | |||
+ | ==== Previewers ==== | ||
+ | |||
+ | [[http:// | ||
[[http:// | [[http:// | ||
Line 406: | Line 410: | ||
---- | ---- | ||
+ | ==== Line - Hand Rail ==== | ||
+ | |||
+ | |||
+ | {{: | ||
+ | |||
+ | def l_u_rail (expr P) = | ||
+ | T: | ||
+ | cas := 0; | ||
+ | dlzka := arclength P; | ||
+ | mojkrok: | ||
+ | pickup PenC; | ||
+ | forever: | ||
+ | t0 := arctime (cas) of P; | ||
+ | t1 := arctime (cas + mojkrok*2/ | ||
+ | t := arctime (cas + mojkrok/2) of P; | ||
+ | t4 := arctime (cas + mojkrok*3/ | ||
+ | t5 := arctime (cas + mojkrok) of P; | ||
+ | thdraw (subpath (t0,t1) of P); | ||
+ | thdraw (subpath (t4,t5) of P); | ||
+ | drawdot | ||
+ | | ||
+ | #mark_ (P, | ||
+ | #mark_ (P, | ||
+ | #f := (P,t,0.2u); | ||
+ | #draw f; | ||
+ | cas := cas + mojkrok; | ||
+ | exitif cas > dlzka - (2*mojkrok/ | ||
+ | endfor; | ||
+ | enddef; | ||
+ | |||
+ | |||
+ | initsymbol(" | ||
+ | |||
+ | Andrew Atkinson | ||
=====Cave Symbol Size and Density Examples===== | =====Cave Symbol Size and Density Examples===== | ||
**Modification MetaPost code for NSS (Philip Schuchardt)** | **Modification MetaPost code for NSS (Philip Schuchardt)** | ||
Line 1326: | Line 1364: | ||
+ | |||
+ | ---- | ||
+ | ---- | ||
+ | ====== Customisable Area Blocks with Different Number of Sides ====== | ||
+ | |||
+ | |||
+ | {{: | ||
+ | |||
+ | Blocks shown as produced by default settings, at about half scale. | ||
+ | |||
+ | Various things could be improved, the drawing of the different sided boulders, and calling of thclean qq; three times to stop transparency cannot be the best way. | ||
+ | |||
+ | **Code for blocks, Variables can be amended at the start** | ||
+ | initsymbol(" | ||
+ | | ||
+ | def a_blocks_BCA (expr p) = | ||
+ | T: | ||
+ | symbol_distance: | ||
+ | block_randomisation: | ||
+ | base_rotation: | ||
+ | random_rotation: | ||
+ | min_scale_factor: | ||
+ | add_scale_factor: | ||
+ | block_rectangle: | ||
+ | shift_randomisation: | ||
+ | %Now set the proportions of different sided block | ||
+ | b_tri:=1; | ||
+ | b_quad:=3; | ||
+ | b_pent:=4; | ||
+ | b_hex:=2; | ||
+ | pickup PenC; | ||
+ | path q, regular, qq; q = bbox p; | ||
+ | pair outside; | ||
+ | outside:= ulcorner q + up; | ||
+ | picture tmp_pic; | ||
+ | uu := max(u, (xpart urcorner q - xpart llcorner q)/100, (ypart urcorner q - ypart | ||
+ | iu := uu * block_rectangle; | ||
+ | blocks := b_tri+b_quad + b_pent + b_hex; | ||
+ | tmp_pic := image( | ||
+ | for i = xpart llcorner q step symbol_distance * block_rectangle * uu until xpart urcorner q: | ||
+ | for j = ypart llcorner q step symbol_distance*uu until ypart urcorner q: | ||
+ | pick_sides := uniformdeviate(blocks); | ||
+ | if pick_sides < b_tri: | ||
+ | sides:=3; | ||
+ | elseif pick_sides < b_tri + b_quad: | ||
+ | sides:=4; | ||
+ | elseif pick_sides < b_tri + b_quad +b_pent: | ||
+ | sides:=5; | ||
+ | else: | ||
+ | sides:=6 | ||
+ | fi; | ||
+ | | ||
+ | qq := for n:=0 upto sides-1: | ||
+ | ((cosd(360*n/ | ||
+ | endfor cycle; %radius is 0.5 divide by 2 | ||
+ | qq := punked ((qq) | ||
+ | randomized (block_randomisation * uu)) | ||
+ | scaled (uniformdeviate(add_scale_factor)+min_scale_factor) | ||
+ | rotated (base_rotation + random_rotation / 2 - uniformdeviate(random_rotation) ) | ||
+ | shifted ((i,j) randomized (shift_randomisation * uu)); | ||
+ | |||
+ | |||
+ | forever: % Repeatedly reduces the size of the image, as this is done round zero it also moves it to the zero location, until it fits in the area | ||
+ | | ||
+ | qq:= qq scaled (0.99 ); | ||
+ | endfor; | ||
+ | if pointinside((i, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | fi; | ||
+ | endfor; | ||
+ | | ||
+ | ); | ||
+ | clip tmp_pic to p; | ||
+ | drawoptions(); | ||
+ | draw tmp_pic; | ||
+ | enddef; | ||
+ | |||
+ | The base_rotation is an attempt to produce bedding plane breakdown, it could do with more time but this is possible | ||
+ | |||
+ | {{: | ||
+ | |||
+ | using the settings | ||
+ | |||
+ | symbol_distance: | ||
+ | block_randomisation: | ||
+ | base_rotation: | ||
+ | random_rotation: | ||
+ | min_scale_factor: | ||
+ | add_scale_factor: | ||
+ | block_rectangle: | ||
+ | shift_randomisation: | ||
+ | %Now set the propotions of different sided block | ||
+ | b_tri:=1; | ||
+ | b_quad:=2; | ||
+ | b_pent:=4; | ||
+ | b_hex:=7; | ||
+ | |||
+ | |||
+ | Andrew Atkinson | ||
---- | ---- | ||
Line 1419: | Line 1560: | ||
Point symbol for shell limestone: | Point symbol for shell limestone: | ||
- | | + | |
- | T:=identity shifted pos; | + | T:=identity shifted pos; |
- | pickup PenB; | + | pickup PenB; |
- | numeric turns, radius; | + | numeric turns, radius; |
- | path ss, cesta; | + | path ss, cesta; |
- | pair za, zb; | + | pair za, zb; |
- | turns = 1.55; | + | turns = 1.55; |
- | radius = .3u; | + | radius = .3u; |
- | za = ( xpart(origin)+0, | + | za = ( xpart(origin)+0, |
- | zb = ( xpart(origin)+.3u, | + | zb = ( xpart(origin)+.3u, |
- | cesta := za--zb; | + | cesta := za--zb; |
- | ss := (origin for t=1 upto 360 turns: -- dir t scaled t endfor) scaled (radius/ | + | ss := (origin for t=1 upto 360 turns: -- dir t scaled t endfor) scaled (radius/ |
- | thdraw ss withcolor (0.3); | + | thdraw ss withcolor (0.3); |
- | thdraw (cesta cutbefore ss) withcolor (0.3); | + | thdraw (cesta cutbefore ss) withcolor (0.3); |
- | enddef; | + | enddef; |
| | ||
- | {{: | + | {{: |