summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/m-three.mkiv
blob: c8ff2167a81a5a073f7004e33c785286291cec3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%D \module
%D   [       file=m-three,
%D        version=2017.11.08,
%D          title=\CONTEXT\ Extra Modules,
%D       subtitle=\METAPOST\ pseudo-3D module support,
%D         author=Hans Hagen and Alan Braslau,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\unprotect

\defineMPinstance
  [three]
  [\s!format=metafun,
   \s!extensions=\v!yes,
   \s!initializations=\v!yes,
   \c!method=\s!double]

\startMPdefinitions{three}
    loadmodule "tres" ;
\stopMPdefinitions

\protect

\continueifinputfile{m-three.mkiv}

%D We put this test here as in \type {meta-tex.mkiv} it would abort due to redefinition
%D of namespaces.

\starttext

%D Alan: we need to make a fill example:

\startMPpage[instance=three]
    path f ; f := (
        projection Origin  --
        projection (1,0,0) --
        projection (1,1,0) --
        projection (0,1,0) --
        projection (0,1,1) --
        projection (1,1,1) --
        projection (1,0,1) --
        projection (0,0,1) --
        cycle
    ) scaled 5cm ;

    fill f withcolor "darkred"  ;

    path p ; p := (
        projection Origin  --
        projection (1,0,0) --
        projection (1,1,0) --
        projection (0,1,0) --
        projection (0,1,1) --
        projection (1,1,1) --
        projection (1,0,1) --
        projection (0,0,1) --
        cycle
    ) scaled 5cm ;

    draw p withcolor .5white  ;

    for i=0 upto length p :
        draw point i of p withpen currentpen scaled 2mm withcolor "lightblue" ;
    endfor ;
\stopMPpage

\stoptext