improved intermediate values placement
This commit is contained in:
parent
a6500d51d0
commit
c8636c9dfd
Binary file not shown.
@ -26,7 +26,7 @@
|
||||
disc(center: ($0$, "bottom"), eod: true),
|
||||
disc(center: ($0$, "bottom")),
|
||||
val(asymp($y=1$), "top"),
|
||||
inter($y_0$, 2, 4, i: 2)
|
||||
inter($y_0$, 2, 3)
|
||||
)
|
||||
)
|
||||
convex-line(
|
||||
@ -68,7 +68,7 @@
|
||||
val($2$, "bottom"),
|
||||
none,
|
||||
val(asymp($2sqrt(2)$), "top"),
|
||||
inter($(2sqrt(1 + sqrt(5))) / sqrt(3)$, 3, 4, i: 5)
|
||||
inter($(2sqrt(1 + sqrt(5))) / sqrt(3)$, 3, 4)
|
||||
))
|
||||
|
||||
convex-line("concavité", (
|
||||
@ -118,7 +118,7 @@
|
||||
val([min], "bottom"),
|
||||
none,
|
||||
val(asymp($x = 0$), "top"),
|
||||
inter($0$, 0, 1, i: 1),
|
||||
inter($0$, 0, 1),
|
||||
inter($0$, 1, 2, i: 4)
|
||||
)
|
||||
)
|
||||
|
@ -41,10 +41,6 @@
|
||||
}
|
||||
|
||||
#let inter(value, start, end, i: auto) = {
|
||||
let i = i
|
||||
if i == auto {
|
||||
i = calc.floor( (start + end) / 2 )
|
||||
}
|
||||
return (
|
||||
type: "intermediate",
|
||||
value: value,
|
||||
|
@ -154,6 +154,7 @@
|
||||
let header = "header-" + str(line-i)
|
||||
let ood = line.start-ood
|
||||
let value-i = -1
|
||||
let values-anchors = (:)
|
||||
|
||||
if line.start-ood and line.values.len() != 0 {
|
||||
let first = line.values.first()
|
||||
@ -178,6 +179,7 @@
|
||||
if value.type == "value" {
|
||||
let pos = func.get-anchor(ctx, line-i, i, value.alignment, "center")
|
||||
value-i += 1
|
||||
values-anchors.insert(str(value-i), i)
|
||||
draw.content(
|
||||
name: "value-" + str(value-i),
|
||||
pos,
|
||||
@ -193,8 +195,14 @@
|
||||
} else if value.type == "intermediate" {
|
||||
let start = "value-" + str(value.start)
|
||||
let end = "value-" + str(value.end)
|
||||
let top = func.get-anchor(ctx, line-i, value.i, "top", "center", dy: 0)
|
||||
let bottom = func.get-anchor(ctx, line-i, value.i, "bottom", "center", dy: 0)
|
||||
let i = value.i
|
||||
if i == auto {
|
||||
let start-anchor = values-anchors.at(str(value.start))
|
||||
let end-anchor = values-anchors.at(str(value.end))
|
||||
i = calc.floor((start-anchor + end-anchor) / 2)
|
||||
}
|
||||
let top = func.get-anchor(ctx, line-i, i, "top", "center", dy: 0)
|
||||
let bottom = func.get-anchor(ctx, line-i, i, "bottom", "center", dy: 0)
|
||||
let inter-name = "inter-" + str(i)
|
||||
draw.intersections(inter-name, {
|
||||
draw.hide(draw.line(start, end))
|
||||
@ -257,6 +265,7 @@
|
||||
if value.left.value != none {
|
||||
let p = func.get-anchor(ctx, line-i, i, value.left.alignment, "left")
|
||||
value-i += 1
|
||||
values-anchors.insert(str(value-i), i)
|
||||
draw.content(
|
||||
name: "value-" + str(value-i),
|
||||
p,
|
||||
@ -274,6 +283,7 @@
|
||||
if value.center.value != none {
|
||||
let p = func.get-anchor(ctx, line-i, i, value.center.alignment, "center")
|
||||
value-i += 1
|
||||
values-anchors.insert(str(value-i), i)
|
||||
draw.content(
|
||||
name: "value-" + str(value-i),
|
||||
p,
|
||||
@ -291,6 +301,7 @@
|
||||
if value.right.value != none {
|
||||
let p = func.get-anchor(ctx, line-i, i, value.right.alignment, "right")
|
||||
value-i += 1
|
||||
values-anchors.insert(str(value-i), i)
|
||||
draw.content(
|
||||
name: "value-" + str(value-i),
|
||||
p,
|
||||
|
Loading…
Reference in New Issue
Block a user