ExamplePolarcircle

Example taken from asymptote gallery.

Drawj2d output

 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
#! drawj2d -T svg -r96 -W 150 -H 150  -X 10 -Y 75 ExamplePolarcircle.hcl

unitlength 50
font 6

# axis
pen 0.3
line -0.1 0  2.5 0
texlabel x SW
line 0 1  0 -1.2
texlabel y SW

# unit circle
pen 0.5
circle 1 0  1
fillcircle 1 0 [mm 1]
texlabel {(a,0)}
fillcircle 2 0 [mm 1]
texlabel {(2a,0)}

# xy
set theta 50
set XY "[expr 1 + cos(2* -$theta)] [expr sin(2* -$theta)]"
fillcircle $XY [mm 1]
texlabel {(x,y)} N

pen blue
arrow 0 0 $XY
texlabel r  0 0 $XY

pen red dotted
line 0 0  [X $XY] 0
lineto $XY
texlabel {r\,cos{\theta}} 0 [mm 8]  [X $XY] [mm 8]
m [geom.online "[X $XY] 0" $XY 0.5]
texlabel {r\,sin{\theta}} E

pen solid 0.3
m 0 0
texdimangle "0 0" $XY "1 0" {\theta}

Related

Wiki: Examples

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.