testing plotting in PDF's
This commit is contained in:
parent
33a1f2c776
commit
baeb341aa8
|
|
@ -1,4 +1,6 @@
|
|||
#import "../template/lib.typ" : *
|
||||
#import "@preview/cetz:0.4.2"
|
||||
#import "@preview/cetz-plot:0.1.3"
|
||||
#set page(paper: "a4")
|
||||
|
||||
#show: notes.with(
|
||||
|
|
@ -53,6 +55,52 @@ are referred to as *grid curves*.
|
|||
r(theta,r) &= chevron.l r cos(theta), r sin(theta), sqrt(1-r^2) chevron.r "with" 0 <= r <= 1, 0<=theta<= 2 pi\
|
||||
r(theta,phi,rho) &= chevron.l rho cos(theta) sin(phi), rho sin(theta) sin(phi), rho cos(phi) chevron.r "with" 0 <= rho <= 1, 0 <= phi <= pi/2, 0 <= theta <= 2 pi
|
||||
$
|
||||
|
||||
#cetz.canvas({
|
||||
import cetz.draw: *
|
||||
import cetz-plot: *
|
||||
|
||||
plot.plot(
|
||||
size: (2,2),
|
||||
x-min: -1,
|
||||
x-max: 1,
|
||||
y-min: -1,
|
||||
y-max: 1,
|
||||
x-ticks: (1,),
|
||||
y-ticks: (1,),
|
||||
x-tick-step: none,
|
||||
y-tick-step: none,
|
||||
axis-style: "school-book",
|
||||
{
|
||||
plot.add(
|
||||
domain: (0, 2*calc.pi),
|
||||
t => (calc.cos(t), calc.sin(t))
|
||||
)
|
||||
|
||||
let reso(n) = {
|
||||
range(2*n + 1)
|
||||
}
|
||||
|
||||
let res = reso(4)
|
||||
|
||||
for x-loc in res {
|
||||
let act_loc = (2/(res.len()-1)) * x-loc - 1
|
||||
plot.add(style: (stroke: black), (
|
||||
(act_loc, -calc.sqrt(1-act_loc*act_loc)),
|
||||
(act_loc, calc.sqrt(1-act_loc*act_loc))
|
||||
))
|
||||
}
|
||||
|
||||
for y-loc in res {
|
||||
let act_loc = (2/(res.len()-1)) * y-loc - 1
|
||||
plot.add(style: (stroke: black), (
|
||||
(-calc.sqrt(1-act_loc*act_loc), act_loc),
|
||||
(calc.sqrt(1-act_loc*act_loc), act_loc)
|
||||
))
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
]
|
||||
|
||||
#definition[
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user