Difference between revisions of "AoPSWiki:Sandbox"
Aquadragon (talk | contribs) |
Aquadragon (talk | contribs) |
||
Line 1: | Line 1: | ||
− | <span style="font-size: | + | <span style="font-size: 200%; color: #27445C">'''Essential Reference for Using Asymptote in AoPS'''</span> |
+ | |||
+ | A focused asymptote reference with examples and short code | ||
---- | ---- | ||
− | == | + | ==Introduction== |
− | + | <br><dd> | |
− | < | + | === Why Asymptote is called Asymptote? === |
− | + | ||
− | |||
<blockquote>http://asymptote.sourceforge.net/FAQ/section1.html#whyasy | <blockquote>http://asymptote.sourceforge.net/FAQ/section1.html#whyasy | ||
− | Question 1.4. Why was the name Asymptote chosen? | + | <b>Question 1.4. Why was the name Asymptote chosen?</b> |
− | Well, it isn't the perfect graphics package, but we do think it is getting there asymptotically... | + | |
+ | <i>Well, it isn't the perfect graphics package, but we do think it is getting there asymptotically...</i> | ||
</blockquote> | </blockquote> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ==== | + | === Tips === |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* To see the asymptote code of any diagram made with asymptote, click on the diagram and it will come up. | * To see the asymptote code of any diagram made with asymptote, click on the diagram and it will come up. | ||
* If your code is not working check to make sure you have a semicolon after each line, no extra parentheses or brackets, and no open parentheses or brackets. | * If your code is not working check to make sure you have a semicolon after each line, no extra parentheses or brackets, and no open parentheses or brackets. | ||
* Another thing to check if your code is not working, is to make sure every variable you've used in your code is in the pair. | * Another thing to check if your code is not working, is to make sure every variable you've used in your code is in the pair. | ||
− | + | </dd><br> | |
− | + | == Beginning your code == | |
− | + | <dd> | |
− | |||
− | < | ||
To start your asymptote diagram you have to include [asy] at the beginning, and [/asy] at the ending. | To start your asymptote diagram you have to include [asy] at the beginning, and [/asy] at the ending. | ||
− | + | </dd><br> | |
− | + | == Setting points == | |
− | + | <dd> | |
− | |||
− | < | ||
To create points in your diagram you can use | To create points in your diagram you can use | ||
<code>A = (0,0);</code> | <code>A = (0,0);</code> | ||
Line 77: | Line 34: | ||
Note: You should not use E, S, N, or W as variables, instead you should use EE, SS, NN, and WW, but label them as E, S, N, W. This is because E, S, N, and W are used to indicate directions in asymptote. | Note: You should not use E, S, N, or W as variables, instead you should use EE, SS, NN, and WW, but label them as E, S, N, W. This is because E, S, N, and W are used to indicate directions in asymptote. | ||
− | <br></ | + | </dd><br> |
+ | |||
+ | == Pair part 1 == | ||
+ | <dd> | ||
+ | <asy> | ||
+ | draw((0,0)--(3,7),red); | ||
+ | dot((0,0)); | ||
+ | dot((3,7)); | ||
+ | label("Produced with Asymptote "+version.VERSION,point(S),2S); | ||
+ | </asy> | ||
+ | <nowiki>[asy]..[/asy]</nowiki> | ||
+ | <tt><nowiki>[asy] | ||
+ | draw((0,0)--(3,7),red); | ||
+ | dot((0,0)); | ||
+ | dot((3,7)); | ||
+ | label("Produced with Asymptote "+version.VERSION,point(S),2S); | ||
+ | [/asy]</nowiki></tt> | ||
− | |||
− | |||
− | |||
− | |||
If you include variables in your diagram you have to have <math>\verb#pair#</math> somewhere in your code. | If you include variables in your diagram you have to have <math>\verb#pair#</math> somewhere in your code. | ||
Example: You have two points <math>A</math> and <math>B</math>, and you're drawing a line connecting them, you need to include | Example: You have two points <math>A</math> and <math>B</math>, and you're drawing a line connecting them, you need to include | ||
− | + | <code> pair A,B; </code> | |
in your diagram to make it work. | in your diagram to make it work. | ||
− | + | </dd><br> | |
<div class="mw-collapsible mw-collapsed" style="width:100%"> | <div class="mw-collapsible mw-collapsed" style="width:100%"> | ||
Line 96: | Line 65: | ||
Once you have set variables <math>A</math> and <math>B</math>, you can connect them by writing | Once you have set variables <math>A</math> and <math>B</math>, you can connect them by writing | ||
− | < | + | <codeblock>draw(A--B);</codeblock> |
Example: | Example: | ||
Line 1,210: | Line 1,179: | ||
<br></div></div> | <br></div></div> | ||
</dd> | </dd> | ||
− | |||
− |
Revision as of 18:12, 3 June 2022
Essential Reference for Using Asymptote in AoPS
A focused asymptote reference with examples and short code
Contents
[hide]Introduction
Why Asymptote is called Asymptote?
http://asymptote.sourceforge.net/FAQ/section1.html#whyasy
Question 1.4. Why was the name Asymptote chosen?
Well, it isn't the perfect graphics package, but we do think it is getting there asymptotically...
Tips
- To see the asymptote code of any diagram made with asymptote, click on the diagram and it will come up.
- If your code is not working check to make sure you have a semicolon after each line, no extra parentheses or brackets, and no open parentheses or brackets.
- Another thing to check if your code is not working, is to make sure every variable you've used in your code is in the pair.
Beginning your code
Setting points
A = (0,0);
Say you want to have point units to the right of point , then you can use
B = (4,0);
Setting points on your diagram is like setting points on a graph. The first number is the -coordinate of the point and the second number is the -coordinate of the point.
Note: You should not use E, S, N, or W as variables, instead you should use EE, SS, NN, and WW, but label them as E, S, N, W. This is because E, S, N, and W are used to indicate directions in asymptote.
Pair part 1
If you include variables in your diagram you have to have somewhere in your code.
Example: You have two points and , and you're drawing a line connecting them, you need to include
pair A,B;
in your diagram to make it work.
#4 Connecting two points, coloring the line
#5 Labeling, Midpoint
#6 Angle Measures
#7 Distance Function
#8 Casting
#9 Right Angle Mark
#10 Intersection
#11 Filling
#12 Dot
#13 Size
#14 Tick Marks
#15 Arrows
#16 Shifting Coordinates
#17 Rotating
#18 Circles
#19 Dashed Lines
#20 Angle Mark
Expand
#21 "for" Command
Expand
#22 Extension
Expand
#23 How to draw an equilateral triangle
Expand
#24 How to draw an isosceles triangle
Expand
#25 How to draw a scalene triangle
Expand
#26 Labeling Angles
Expand
#27 Drawing triangles using SSS, SAS, AAS, and ASA
Expand
#28 Arcs
Expand
#29 The Nine Point Circle
Expand
#30 Pair Part 2
Expand
#31 Finding the midpoint
Expand
#32 Foot Command
Expand
#33 Introduction to 3D Geometry