Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r = 0.1;
- x0 = 0.7;
- y0 = 0.3;
- z0 = powierzchnia[x0, y0];
- listaKatow = Table[RandomReal[{0, 2 Pi}], {i, 100}];
- powierzchnia[x_, y_] = 2 x + 3 y^2;
- f[x_, y_, xp_, yp_,
- zp_] = (x - xp)^2 + (y - yp)^2 + (2 x + 3 y^2 - zp)^2 - r^2;
- alfa = listaKatow[[1]];
- Result = Solve[{x, y} \[Element]
- InfiniteLine[{{x0, y0}, {x0 + Cos[alfa], y0 + Sin[alfa]}}] &&
- f[x, y, x0, y0, z0] == 0, {x, y}];
- xPunktu = Result[[1, 1, 2]];
- yPunktu = Result[[1, 2, 2]];
- zPunktu = powierzchnia[xPunktu, yPunktu];
- xPunktu2 = Result[[2, 1, 2]];
- yPunktu2 = Result[[2, 2, 2]];
- zPunktu2 = powierzchnia[xPunktu2, yPunktu2];
- dlugosc = Sqrt[(xPunktu - x0)^2 + (yPunktu - y0)^2 + (zPunktu - z0)^2]
- dlugosc2 =
- Sqrt[(xPunktu2 - x0)^2 + (yPunktu2 - y0)^2 + (zPunktu2 - z0)^2]
- Show[
- ContourPlot[{y*Cos[alfa] - x*Sin[alfa],
- f[x, y, x0, y0, z0] == 0}, {x, -2., 2.}, {y, -2., 2.}],
- Graphics[{{Blue,
- InfiniteLine[{{x0, y0}, {x0 + Cos[alfa], y0 + Sin[alfa]}}]}, {Red,
- Point[{x, y}] /. Result}}]
- ]
- Show[
- Plot3D[{2 x + 3 y^2}, {x, -1, 1}, {y, -1, 1}, BoxRatios -> {1, 1, 1}],
- Graphics3D[{Red, PointSize[.02], Point[{x0, y0, z0}]}],
- Graphics3D[{Green, PointSize[.02],
- Point[{xPunktu, yPunktu, zPunktu}]}],
- Graphics3D[{Blue, PointSize[.02],
- Point[{xPunktu2, yPunktu2, zPunktu2}]}],
- Graphics3D[{Opacity[0.5], Sphere[{x0, y0, z0}, r]}]
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement