Home
> Uncategorized > Triangles and Parabolas
Triangles and Parabolas
This post is motivated by this question on Mathematica Stackexchange.
cp = CirclePoints[3];
func[a_, b_] := Module[{v = b - a, m, xp},
m = #2/#1 & @@ v;
xp = y - a[[2]] - m (x - a[[1]]) // Expand;
x^2 + y^2 - xp^2/(m^2 + 1) // Expand]
pl1 = ContourPlot[
Evaluate@
Thread[(fs = func @@@ Partition[cp, 2, 1, 1]) == 0], {x, -1,
1}, {y, -1, 1},
Epilog -> {Red, Circle[], FaceForm[None], EdgeForm[Blue],
Triangle[cp], PointSize[0.02], Point[{{0, 0}}~Join~cp]}];
pl2 = RegionPlot[(And @@ Thread[fs <= 0] && x^2 + y^2 <= 1), {x, -1,
1}, {y, -1, 1}];
ir = ImplicitRegion[(And @@ Thread[fs <= 0] &&
x^2 + y^2 <= 1), {{x, -1, 1}, {y, -1, 1}}];
a1 = RegionMeasure[ir] // FullSimplify
a2 = RegionMeasure[Triangle[cp]]
a1/a2
Show[pl1, pl2]
The code uses side of triangle as directrix and centre as focus. Thereafter region functionality is used.
Categories: Uncategorized
Comments (0)
Trackbacks (0)
Leave a comment
Trackback