Dim Shared s
, L
, B
, w
, D
, sw
, sh
, xx
, x
, a
, y
, aa
sw = 800
sh = 600
InitControls
DrawEgg
s = ctlS.value
L = ctlL.value / 10
B = ctlB.value / 10
w = ctlW.value / 10
D = ctlD.value / 10
For xx
= -0.5 * L
* s
To 0.5 * L
* s
x = xx / s
a = (L * L - 4 * x * x) / (L * L + 8 * w * x + 4 * w * w)
'you can stop here for p(x) = x
a
= Sqr(5.5 * L
* L
+ 11 * L
* w
+ 4 * w
* w
) a
= a
* (Sqr(3) * B
* L
- 2 * D
* Sqr(L
* L
+ 2 * w
* L
+ 4 * w
* w
)) a
= a
/ (Sqr(3) * B
* L
* (Sqr(5.5 * L
* L
+ 11 * L
* w
+ 4 * w
* w
) - 2 * Sqr(L
* L
+ 2 * w
* L
+ 4 * w
* w
)))
aa = L * (L * L + 8 * w * x + 4 * w * w)
aa = aa / (2 * (L - 2 * w) * x * x + (L * L + 8 * L * w - 4 * w * w) * x + 2 * L * w * w + L * L * w + L * L * L)
aa = 1 - aa
y = y * (1 - a * aa)
Line (sw
/ 2 + xx
, sh
/ 2 - s
* y
)-(sw
/ 2 + xx
, sh
/ 2 + s
* y
)
Dim c: c
= DomCreate
("div") c.style.padding = "20px"
DomCreate "span", c, "s: "
Dim e: e
= DomCreate
("input", c
) e.style.verticalAlign = "middle"
e.min = 1
e.max = 100
e.value = 80
ctlS = e
e = DomCreate("span", c, "L: ")
e.style.marginLeft = "20px"
e = DomCreate("input", c)
e.style.verticalAlign = "middle"
e.min = 1
e.max = 100
e.value = 54
ctlL = e
e = DomCreate("span", c, "B: ")
e.style.marginLeft = "20px"
e = DomCreate("input", c)
e.style.verticalAlign = "middle"
e.min = 1
e.max = 100
e.value = 41
ctlB = e
e = DomCreate("span", c, "w: ")
e.style.marginLeft = "20px"
e = DomCreate("input", c)
e.style.verticalAlign = "middle"
e.min = 1
e.max = 20
e.value = 4
ctlW = e
e = DomCreate("span", c, "D: ")
e.style.marginLeft = "20px"
e = DomCreate("input", c)
e.style.verticalAlign = "middle"
e.min = 1
e.max = 100
e.value = 32
ctlD = e
DomEvent ctlS, "input", sub_DrawEgg
DomEvent ctlL, "input", sub_DrawEgg
DomEvent ctlB, "input", sub_DrawEgg
DomEvent ctlW, "input", sub_DrawEgg
DomEvent ctlD, "input", sub_DrawEgg