-
Notifications
You must be signed in to change notification settings - Fork 4
Documentation
There are three kinds of TSQX commands:
- Special commands
- Point declarations
- Drawing commands
End-of-line comments begin with #
.
A pair is a sequence of two real numbers, representing a point, written in the code as (x, y)
, where x and y are the x- and y-coordinates of the point respectively. Pairwise operations can be done on pairs, so the midpoint of segment AB would be (A+B)/2
and we can double the coordinates of P by writing 2*P
.
A path is any sequence of lines or curves. The segment joining two points A and B is written as A--B
. Segments can be chained, as in A--B--C
, which contains segments AB and BC, or A--B--C--cycle
which contains segments AB, BC, CA.
name [direction] [:|.|;|d?l?]= expression
Declares the point with the label name
as the pair expression
.
-
name
. Point name. -
direction
. Optional string for label direction, e.g.NE
for north-east of the point,150
fordir(150)
, or2S3E
for2*S + 3*E
. -
[:|.|;|d?l?]=
. Controls whether the point is dotted or labeled.d
makes the point dotted andl
makes it labeled. The other symbols are aliases; the default ones are
No dot | Has dot | |
---|---|---|
No label | := |
.= or d=
|
Has label |
;= or l=
|
= or ld=
|
-
expression
. An expression that returns a point.
expression [/ [fillpens /] outlinepens]
Draws the expression expression
.
-
expression
. An expression that returns a point. -
fillpens
. Pens that determine the fill, e.g.0.2 lightblue
becomesopacity(0.2)+lightblue
. -
outlinepens
. Pens that determine the opacity, e.g.dotted black
becomesdotted+black
.
Expressions in TSQX are written as in a Lisp. So for example, circumcircle A (foot B C D) E
produces circumcircle(A, foot(B, C, D), E)
. It's also possible to use comma-separated syntax, and to use space-separated syntax within it, e.g. circumcircle(A, (foot B C D), E)
also works.
For convenience, although TSQX supports all Asymptote functions, here are the functions you're likely to use most often.
Functions that return pairs:
-
dir A
returns the point on the unit circle A degrees from 0. -
midpoint P
returns the midpoint of path P. -
intersect P Q
returns the intersection of paths P and Q, if it exists. -
IP P Q
returns the first intersection of paths P and Q using cse5. With three arguments,IP P Q R
returns the Rth intersection of paths P and Q. -
OP P Q
returns the second intersection of paths P and Q using cse5. -
extension A B C D
returns the intersection of the lines AB and CD. - `foot A B C`` returns the foot of the perpendicular from A to line BC.
-
circumcenter A B C
returns the circumcenter of triangle ABC. -
orthocenter A B C
returns the orthocenter of triangle ABC. -
incenter A B C
returns the incenter of triangle ABC. -
centroid A B C
returns the centroid of triangle ABC. -
bisectorpoint A B
returns a point on the perpendicular bisector of segment AB a unit distance from AB. With three arguments,bisectorpoint A B C
returns a point on the angle bisector of angle ABC a unit distance from B. -
tangent A B C
returns the Cth tangent from A to circle B.
Functions that return paths:
-
incircle A B C
returns the incircle of triangle ABC. -
circumcircle A B C
returns the circumcircle of triangle ABC. -
CP A B
returns the circle with center A passing through B. -
CR A B
returns the circle with center A and radius B. -
Line A B
returns the line joining A and B. -
arc A B C D
returns the arc, centered at A through B, from C degrees to D degrees.
Functions for drawing:
-
anglemark A B C
draws an angle mark at angle ABC. With four arguments,anglemark A B C D
draws an angle mark of size D at angle ABC. -
rightanglemark A B C
draws a right angle mark at angle ABC. With four arguments,rightanglemark A B C D
draws a right angle mark of size D at angle ABC. -
pathticks A B
draws B tick marks on path A.
For now the only special commands are:
-
~triangle A B C
. Assign to ABC points of an acute triangle,A = dir 110
,B = dir 210
,C = dir 330
. -
~regular A B C ...
. Assigns to ABC... points of a regular polygon.
Command line arguments:
-
--pre
,-p
adds an Asymptote preamble. The preamble includes importing olympiad and cse5, both of which are important for lots of TSQX functions. -
--size
,-s
if provided, sets the image size in the preamble. Default size is 8cm. -
--soft-label
,-sl
regular=
does not dot points, only labels them. -
fname
if provided, reads from the designated file rather than stdin.