متاپست (MetaPost)

METAPOST by Hooman Mesgary
SCALING
Same as PostScript
1 unit = 1/72 inch
Other units
 bp: Big Point
 pt: Printer’s Point
 in: Inches
 cm: Centimeters
 mm: Milimeters
COMMANDS
drawdot
 drawdot (10,2)
 drawdot origin
 drawdot (2cm, 13mm)
draw
 draw (0,0)—(0,1)
pickup
 pickup pencircle scaled 4pt
VARIABLES
u = 1cm;
drawdot (2u, 3u);
z0 = (2u, 3u);
z1 = (3u, 2u);
draw z0--z1;
LOOP
u = 1mm;
for i=0 upto 4:
drawdot (i*u,u);
endfor
PROGRAM
beginfig(1);
draw (1cm,0)--(0,1cm);
endfig;
end
CURVES
z0 = (0,0);
z1 = (60,40);
z2 = (40,90);
z3 = (10,70);
z4 = (30,50);
draw z0..z1..z2..z3..z4
draw z0..z1..z2..z3--z4--cycle
draw z0..z1..z2..z3..z4..cycle
DIRECTION
draw z0..z1..z2..z3..z4
draw z0..z1{up}..z2{left}..z3..z4
..{dir 60}(10,0){up}..
CONT.
beginfig(1)
for a=0 upto 9:
draw (0,0){dir 45}..{dir -10a}(6cm,0);
endfor
endfig;
beginfig(2)
for a=0 upto 9:
draw (0,0){dir 45}..{dir 10a}(6cm,0);
endfor
endfig;
INFELCTION
draw z0{up}..z1{right}..z2{down}
draw z0{up}...z1{right}...z2{down}
TENTION
draw z0..z1..z2..z3
draw z0..z1..tension 1.3..z2..z3
draw z0..z1..tension 1.3 and 1..z2..z3
CURL
draw z0{curl c}..z1..{curl c}z2
EQUATION
a+b=3; 2a=b+3;
a=2
b=1
a+b=2a-b=3
ASSIGNMENT
a=a+1
a:=a+1
EQU. & ASSIGN.
z1=-z2=(.2in,0);
x3=-x6=.3in;
x3+y3=x6+y6=1.1in;
z1=(.2in,0); z2=(-.2in,0);
z3=(.3in,.8in); z6=(-.3in,1.4in);
SOLVING
beginfig(13);
z1=-z2=(.2in,0); x3=-x6=.3in;
x3+y3=x6+y6=1.1in;
z4=1/3[z3,z6]; z5=2/3[z3,z6];
z20=whatever[z1,z3]=whatever[z2,z4];
z30=whatever[z1,z4]=whatever[z2,z5];
z40=whatever[z1,z5]=whatever[z2,z6];
draw z1--z20--z2--z30--z1--z40--z2;
pickup pencircle scaled 1pt;
draw z1--z2; draw z3--z6;
endfig;
TRANSFORM
p transformed T
( 𝑝𝑥, 𝑝𝑦) ( 𝑡𝑥, 𝑡𝑦, 𝑡𝑥𝑥, 𝑡𝑥𝑦, 𝑡𝑦𝑥, 𝑡𝑦𝑦)
( 𝑡𝑥 + 𝑡𝑥𝑥𝑝𝑥 + 𝑡𝑥𝑦𝑝𝑦, 𝑡𝑦 + 𝑡𝑦𝑥𝑝𝑥 + 𝑡𝑦𝑦𝑝𝑦)
MORE TRANSFORM
transform T;
T = identity xscaled -1 rotated 90 shifted (1,1);
reflectedabout( 𝑝, 𝑞)
rotatedaround( 𝑝, 𝜃)
𝑞𝑞 = 𝑝 transformed inverse 𝑇
FINDING TRANSFORMS
(0,1) transformed T’ = (3,4);
(1,1) transformed T’ = (7,1);
(1,0) transformed T’ = (4,-3);
COLORS
black, white, red, green, blue
(0,0,0) (1,1,1)
(.4,.4,.4) = 0.4white
OPERAND
- * /
**
+ -
++
+-+
sqrt
CONT.
and
or
z1 dotprod z2 = x1*x2 + y1*y2
length “abcde”
substring(2,4) of “abcde” = “cd”
abs
round
floor
ceiling
ORDERS
-1[a,b] = -b
(-1)[a,b] = 2a-b
sqrt 2/3
sqrt (1+1)/3
LABELS
beginfig(17);
a=.7in; b=.5in;
z0=(0,0);
z1=-z3=(a,0);
z2=-z4=(0,b);
draw z1..z2..z3..z4..cycle;
draw z1--z0--z2;
label.top("a", .5[z0,z1]);
label.lft("b", .5[z0,z2]);
dotlabel.bot("(0,0)", z0);
endfig;
CONT.
⟨label suffix⟩ → ⟨empty⟩ | lft | rt | top |
bot | ulft | urt | llft | lrt
label.lrt(btex $sqrt x$ etex, (3,sqrt 3)*u)
USING TEX
beginfig(18);
numeric u;
u = 1cm;
draw (0,2u)--(0,0)--(4u,0);
pickup pencircle scaled 1pt;
draw (0,0){up}
for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor;
label.lrt(btex $sqrt x$ etex, (3,sqrt 3)*u);
label.bot(btex $x$ etex, (2u,0));
label.lft(btex $y$ etex, (0,u));
endfig;
CONTINUES DRAWING
beginfig(19);
numeric ux, uy;
120ux=1.2in; 4uy=2.4in;
draw (0,4uy)--(0,0)--(120ux,0);
pickup pencircle scaled 1pt;
draw (0,uy){right}
for ix=1 upto 8:
..(15ix*ux, uy*2/(1+cosd 15ix))
endfor;
label.bot(btex $x$ axis etex,
(60ux,0));
label.lft(btex $y$ axis etex
rotated 90, (0,2uy));
label.lft(
btex $displaystyle
y={2over1+cos x}$ etex,
(120ux, 4uy));
endfig;
RESULT
FILL
beginfig(21);
path p;
p = (-1cm,0)..(0,-1cm)..(1cm,0);
fill p{up}..(0,0){-1,-2}..{up}cycle;
draw p..(0,1cm)..cycle;
endfig;
FILL WITH COLOR
PATH WORKING
a intersectiontimes b
point t of p
p1 cutbefore p2
p1 cutafter p2
DASHED LINES
ARROWS
drawarrow z1..z2
drawarrow reverse (z1..z2)
drawdblarrow z1..z2
CLIPPING
CONDITION
if 𝑒1: ... elseif 𝑒2: ... else: ... fi
def middlepoint(expr a) = if path a: (point
.5*length a of
else: .5(llcorner a + urcorner fi a) enddef;
LOOPS
for ⟨symbolic token⟩ = ⟨expression⟩ upto
⟨expression⟩ : ⟨loop text⟩ endfor
for ⟨symbolic token⟩ = ⟨expression⟩ downto
⟨expression⟩ : ⟨loop text⟩ endfor
for ⟨symbolic token⟩ = ⟨expression⟩ step
⟨expression⟩ until ⟨expression⟩ : ⟨loop text⟩
endfor
SAMPLE LOOP
for t=3.14, 2.78, (a,2a), "hello": show t; endfor
draw for p=(3,1),(6,2),(7,5),(4,6),(1,3): p-- endfor
cycle;
draw (3,1)--(6,2)--(7,5)--(4,6)--(1,3)--cycle;
1 of 37

Recommended

Gp by
GpGp
Gpkwek62
53 views1 slide
Inversa lu by
Inversa luInversa lu
Inversa luNatalia
501 views16 slides
10CSL67 CG LAB PROGRAM 1 by
10CSL67 CG LAB PROGRAM 110CSL67 CG LAB PROGRAM 1
10CSL67 CG LAB PROGRAM 1Vanishree Arun
305 views11 slides
Regula falsi MATLAB Code by
Regula falsi MATLAB CodeRegula falsi MATLAB Code
Regula falsi MATLAB CodeTaimoor Muzaffar Gondal
3.9K views1 slide
Newton's method for MATLAB Code by
Newton's method for MATLAB CodeNewton's method for MATLAB Code
Newton's method for MATLAB CodeTaimoor Muzaffar Gondal
889 views1 slide
Matlab code for Bisection Method by
Matlab code for Bisection MethodMatlab code for Bisection Method
Matlab code for Bisection MethodTaimoor Muzaffar Gondal
2.5K views2 slides

More Related Content

What's hot

Matlab Code for Bisection methode by
Matlab Code for Bisection methode Matlab Code for Bisection methode
Matlab Code for Bisection methode Taimoor Muzaffar Gondal
332 views1 slide
CRL 1.8 functions MrG 2011.0920 - sage by
CRL 1.8 functions MrG 2011.0920  - sageCRL 1.8 functions MrG 2011.0920  - sage
CRL 1.8 functions MrG 2011.0920 - sageA Jorge Garcia
82 views2 slides
CRL 1.8 Functions by
CRL 1.8 FunctionsCRL 1.8 Functions
CRL 1.8 FunctionsA Jorge Garcia
262 views4 slides
Trapezoidal log log by
Trapezoidal log logTrapezoidal log log
Trapezoidal log logPatrick Hui
89 views1 slide
Komputer Grafik by
Komputer GrafikKomputer Grafik
Komputer GrafikMuhammadAli2239
10 views3 slides
Darkonoid by
DarkonoidDarkonoid
Darkonoidgraphitech
313 views20 slides

What's hot(16)

CRL 1.8 functions MrG 2011.0920 - sage by A Jorge Garcia
CRL 1.8 functions MrG 2011.0920  - sageCRL 1.8 functions MrG 2011.0920  - sage
CRL 1.8 functions MrG 2011.0920 - sage
A Jorge Garcia82 views
Trapezoidal log log by Patrick Hui
Trapezoidal log logTrapezoidal log log
Trapezoidal log log
Patrick Hui89 views
Math 3-H6 by jjlendaya
Math 3-H6Math 3-H6
Math 3-H6
jjlendaya330 views
Fractal Rendering in Developer C++ - 2012-11-06 by Aritra Sarkar
Fractal Rendering in Developer C++ - 2012-11-06Fractal Rendering in Developer C++ - 2012-11-06
Fractal Rendering in Developer C++ - 2012-11-06
Aritra Sarkar102 views
The Moore-Spiegel Oscillator by Abhranil Das
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel Oscillator
Abhranil Das902 views
matlab code for channel estimation for ofdm by Gyana Ranjan Mati
matlab code for channel estimation for ofdmmatlab code for channel estimation for ofdm
matlab code for channel estimation for ofdm
Gyana Ranjan Mati12.1K views
Compte rendu com op touati by hamdinho
Compte rendu com op touatiCompte rendu com op touati
Compte rendu com op touati
hamdinho430 views

Viewers also liked

Euro Opener: Poland - Greece by
Euro Opener: Poland - GreeceEuro Opener: Poland - Greece
Euro Opener: Poland - GreecePat Nowak
105 views1 slide
Unidad 4 albadenis by
Unidad 4 albadenisUnidad 4 albadenis
Unidad 4 albadeniskelindasoy
199 views16 slides
Г. Кляўко by
Г. КляўкоГ. Кляўко
Г. КляўкоVictori_otd
442 views50 slides
Taw10 1 00 - 0 - introdução by
Taw10 1   00 - 0 - introduçãoTaw10 1   00 - 0 - introdução
Taw10 1 00 - 0 - introduçãoMarcelo Di Primio
339 views6 slides
Tribunal de cuenta sfinal by
Tribunal de cuenta sfinalTribunal de cuenta sfinal
Tribunal de cuenta sfinalaljumarang
850 views40 slides
Our engagement by
Our engagementOur engagement
Our engagementksap20
68 views1 slide

Similar to متاپست (MetaPost)

R meets Hadoop by
R meets HadoopR meets Hadoop
R meets HadoopHidekazu Tanaka
5.4K views28 slides
Calculus III by
Calculus IIICalculus III
Calculus IIILaurel Ayuyao
1.4K views69 slides
Cálculo ii howard anton - capítulo 16 [tópicos do cálculo vetorial] by
Cálculo ii   howard anton - capítulo 16 [tópicos do cálculo vetorial]Cálculo ii   howard anton - capítulo 16 [tópicos do cálculo vetorial]
Cálculo ii howard anton - capítulo 16 [tópicos do cálculo vetorial]Henrique Covatti
493 views34 slides
funwithalgorithms.pptx by
funwithalgorithms.pptxfunwithalgorithms.pptx
funwithalgorithms.pptxTess Ferrandez
48 views62 slides
プログラム実行の話と
OSとメモリの挙動の話 by
プログラム実行の話と
OSとメモリの挙動の話プログラム実行の話と
OSとメモリの挙動の話
プログラム実行の話と
OSとメモリの挙動の話tatsunori ishikawa
226 views65 slides
Trees And More With Postgre S Q L by
Trees And  More With  Postgre S Q LTrees And  More With  Postgre S Q L
Trees And More With Postgre S Q LPerconaPerformance
2.8K views34 slides

Similar to متاپست (MetaPost)(20)

Cálculo ii howard anton - capítulo 16 [tópicos do cálculo vetorial] by Henrique Covatti
Cálculo ii   howard anton - capítulo 16 [tópicos do cálculo vetorial]Cálculo ii   howard anton - capítulo 16 [tópicos do cálculo vetorial]
Cálculo ii howard anton - capítulo 16 [tópicos do cálculo vetorial]
Henrique Covatti493 views
プログラム実行の話と
OSとメモリの挙動の話 by tatsunori ishikawa
プログラム実行の話と
OSとメモリの挙動の話プログラム実行の話と
OSとメモリの挙動の話
プログラム実行の話と
OSとメモリの挙動の話
tatsunori ishikawa226 views
Solution Manual : Chapter - 01 Functions by Hareem Aslam
Solution Manual : Chapter - 01 FunctionsSolution Manual : Chapter - 01 Functions
Solution Manual : Chapter - 01 Functions
Hareem Aslam1.5K views
Graphics programs by NAVYA RAO
Graphics programsGraphics programs
Graphics programs
NAVYA RAO208 views
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docx by TashiBhutia12
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docxCOMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docx
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docx
TashiBhutia1230 views
Advanced Data Visualization Examples with R-Part II by Dr. Volkan OBAN
Advanced Data Visualization Examples with R-Part IIAdvanced Data Visualization Examples with R-Part II
Advanced Data Visualization Examples with R-Part II
Dr. Volkan OBAN669 views
7 Python udf.pptx by SUJALORAON
7 Python udf.pptx7 Python udf.pptx
7 Python udf.pptx
SUJALORAON10 views
Basic python programs by RaginiJain21
Basic python programsBasic python programs
Basic python programs
RaginiJain21297 views
Howard, anton calculo i- um novo horizonte - exercicio resolvidos v1 by cideni
Howard, anton   calculo i- um novo horizonte - exercicio resolvidos v1Howard, anton   calculo i- um novo horizonte - exercicio resolvidos v1
Howard, anton calculo i- um novo horizonte - exercicio resolvidos v1
cideni1.4K views
All VLSI programs by Gouthaman V
All VLSI programsAll VLSI programs
All VLSI programs
Gouthaman V29.6K views

More from جشنوارهٔ روز آزادی نرم‌افزار تهران

چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟ by
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟
چرا اکثر ابررایانه‌ها از گنو/لینوکس استفاده می‌کنند؟جشنوارهٔ روز آزادی نرم‌افزار تهران
467 views14 slides
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن by
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آنحرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آن
حرکت شتابدار به سوی دنیای Embedded System و نقش نرم‌افزارهای آزاد بر آنجشنوارهٔ روز آزادی نرم‌افزار تهران
552 views40 slides
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه by
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعهخلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعه
خلاقیت و دانش آزاد؛ ظهور طبقه‌ای جدید در جامعهجشنوارهٔ روز آزادی نرم‌افزار تهران
854 views9 slides

More from جشنوارهٔ روز آزادی نرم‌افزار تهران (20)

Recently uploaded

predicting-m3-devopsconMunich-2023.pptx by
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptxTier1 app
8 views24 slides
The Era of Large Language Models.pptx by
The Era of Large Language Models.pptxThe Era of Large Language Models.pptx
The Era of Large Language Models.pptxAbdulVahedShaik
7 views9 slides
aATP - New Correlation Confirmation Feature.pptx by
aATP - New Correlation Confirmation Feature.pptxaATP - New Correlation Confirmation Feature.pptx
aATP - New Correlation Confirmation Feature.pptxEsatEsenek1
146 views6 slides
Quality Engineer: A Day in the Life by
Quality Engineer: A Day in the LifeQuality Engineer: A Day in the Life
Quality Engineer: A Day in the LifeJohn Valentino
7 views18 slides
Introduction to Maven by
Introduction to MavenIntroduction to Maven
Introduction to MavenJohn Valentino
6 views10 slides
Airline Booking Software by
Airline Booking SoftwareAirline Booking Software
Airline Booking SoftwareSharmiMehta
9 views26 slides

Recently uploaded(20)

predicting-m3-devopsconMunich-2023.pptx by Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app8 views
aATP - New Correlation Confirmation Feature.pptx by EsatEsenek1
aATP - New Correlation Confirmation Feature.pptxaATP - New Correlation Confirmation Feature.pptx
aATP - New Correlation Confirmation Feature.pptx
EsatEsenek1146 views
Quality Engineer: A Day in the Life by John Valentino
Quality Engineer: A Day in the LifeQuality Engineer: A Day in the Life
Quality Engineer: A Day in the Life
John Valentino7 views
Airline Booking Software by SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta9 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi216 views
Ports-and-Adapters Architecture for Embedded HMI by Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert29 views
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... by TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 views
predicting-m3-devopsconMunich-2023-v2.pptx by Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app11 views
Automated Testing of Microsoft Power BI Reports by RTTS
Automated Testing of Microsoft Power BI ReportsAutomated Testing of Microsoft Power BI Reports
Automated Testing of Microsoft Power BI Reports
RTTS8 views
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation by HCLSoftware
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationDRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
HCLSoftware6 views
Bootstrapping vs Venture Capital.pptx by Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic15 views
Electronic AWB - Electronic Air Waybill by Freightoscope
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill
Freightoscope 5 views

متاپست (MetaPost)