Platform
Resources
Pricing
Sign in
Get started
Renato Mauro
Workspace
Fork
Published
By
Renato Mauro
Edited
Apr 27, 2021
1 fork
1 star
Insert cell
md
`# Combinação Convexa`
Insert cell
Insert cell
canvas
=
{
const
ctx
=
DOM
.
context2d
(
width
,
height
)
;
ctx
.
canvas
.
onmousedown
=
function
(
e
)
{
mutable
P
=
(
{
x
:
e
.
offsetX
,
y
:
e
.
offsetY
}
)
;
}
drawTriangle
(
ctx
,
A
,
B
,
C
)
;
while
(
true
)
{
drawPoint
(
ctx
,
P
)
;
yield
ctx
.
canvas
;
}
}
Insert cell
Insert cell
mutable
P
=
(
{
x
:
width
/
2
,
y
:
300
/
2
}
)
Insert cell
A
=
(
{
x
:
width
/
2
,
y
:
10
}
)
Insert cell
B
=
(
{
x
:
width
/
2
-
width
/
8
,
y
:
height
-
20
}
)
Insert cell
C
=
(
{
x
:
width
/
2
+
width
/
8
,
y
:
height
-
20
}
)
Insert cell
drawPoint
=
function
(
ctx
,
p
)
{
ctx
.
beginPath
(
)
;
ctx
.
arc
(
p
.
x
,
p
.
y
,
5
,
0
,
2
*
Math
.
PI
)
;
ctx
.
fill
(
)
;
}
Insert cell
drawTriangle
=
function
(
ctx
,
p1
,
p2
,
p3
)
{
ctx
.
beginPath
(
)
;
ctx
.
moveTo
(
p1
.
x
,
p1
.
y
)
;
ctx
.
lineTo
(
p2
.
x
,
p2
.
y
)
;
ctx
.
lineTo
(
p3
.
x
,
p3
.
y
)
;
ctx
.
closePath
(
)
;
ctx
.
stroke
(
)
;
drawPoint
(
ctx
,
p1
)
;
drawPoint
(
ctx
,
p2
)
;
drawPoint
(
ctx
,
p3
)
;
}
Insert cell
tex
.
block
`
\begin{cases}
\alpha_1 + \alpha_2 + \alpha_3 &= 1 \\
\alpha_1 A_x + \alpha_2 B_x + \alpha_3 C_x &= P_x \\
\alpha_1 A_y + \alpha_2 B_y + \alpha_3 C_y &= P_y \\
\end{cases}
`
Insert cell
tex
.
block
`
\alpha_3 = \frac{(B_x-A_x)(P_y-A_y)-(B_y-A_y)(P_x-A_x)}{(B_x-A_x)(C_y-A_y)-(B_y-A_y)(C_x-A_x)}
`
Insert cell
alfa3
=
(
(
B
.
x
-
A
.
x
)
*
(
P
.
y
-
A
.
y
)
-
(
B
.
y
-
A
.
y
)
*
(
P
.
x
-
A
.
x
)
)
/
(
(
B
.
x
-
A
.
x
)
*
(
C
.
y
-
A
.
y
)
-
(
B
.
y
-
A
.
y
)
*
(
C
.
x
-
A
.
x
)
)
Insert cell
tex
.
block
`
\alpha_2 = \frac{(P_x-A_x)}{(B_x-A_x)}-\alpha_3\frac{(C_x-A_x)}{(B_x-A_x)}
`
Insert cell
alfa2
=
(
(
P
.
x
-
A
.
x
)
/
(
B
.
x
-
A
.
x
)
)
-
alfa3
*
(
(
C
.
x
-
A
.
x
)
/
(
B
.
x
-
A
.
x
)
)
Insert cell
tex
.
block
`
\alpha_1 = 1-(\alpha_2+\alpha_3)
`
Insert cell
alfa1
=
1
-
(
alfa2
+
alfa3
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
canvas
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
height
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
P
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
A
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
B
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
C
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
drawPoint
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
drawTriangle
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
alfa3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
alfa2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
alfa1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML