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