Saltar al contenido

¿Se puede dibujar una hipérbola con argumentos en TikZ?

Te traemos la solución a esta problema, o por lo menos eso creemos. Si presentas dudas puedes dejarlo en el apartado de preguntas, que sin dudarlo te responderemos

Solución:

Mire las secciones 19.5 y 19.6 en el pgf manual. Puede trazar curvas dadas por ecuaciones paramétricas simples, como

 draw[scale=0.5,domain=-3.141:3.141,smooth,variable=t] plot (t*sin(t r),t*cos(t r));

Entonces, si vas a encontrar ecuaciones paramétricas de tu hipérbola, deberías poder trazarlas.

Esto debería funcionar

draw plot[variable=t,samples=1000,domain=-35:35] (sec(t),tan(t));

Aquí, tome esta muestra de dibujo de hipérbola para jugar. La maquinaria es

%
% #1 optional parameters for draw
% #2 angle of rotation in degrees
% #3 offset of center as (pointx, pointy) or (name-o-coordinate)
% #4 length of plus (semi)axis, that is axis which hyperbola crosses
% #5 length of minus (semi)axis
% #6 how much of hyperbola to draw in degrees, with 90 you’d reach infinity
%
newcommandtikzhyperbola[6][thick]%
    draw [#1, rotate around=#2: (0, 0), shift=#3]
        plot [variable = t, samples=1000, domain=-#6:#6] (#4 / cos( t ), #5 * tan( t ));
    draw [#1, rotate around=#2: (0, 0), shift=#3]
        plot [variable = t, samples=1000, domain=-#6:#6] (-#4 / cos( t ), #5 * tan( t ));

imagen de muestra

documentclass[tikz, margin=10]standalone

usepackagebm

usepackagetikz
usetikzlibraryshapes.geometric % for shape=ellipse
usetikzlibrarycalc

begindocument

deftikzscale0.8
begintikzpicture[scale=tikzscale]

tikzset
    elli/.style args=#1:#2and#3
        draw,
        shape=ellipse,
        rotate=#1,
        minimum width=2*#2,
        minimum height=2*#3,
        outer sep=0pt,
    


%
% #1 optional parameters for draw
% #2 angle of rotation in degrees
% #3 offset of center as (pointx, pointy) or (name-o-coordinate)
% #4 length of plus (semi)axis, that is axis which hyperbola crosses
% #5 length of minus (semi)axis
% #6 how much of hyperbola to draw in degrees, with 90 you’d reach infinity
%
newcommandtikzhyperbola[6][thick]%
    draw [#1, rotate around=#2: (0, 0), shift=#3]
        plot [variable = t, samples=1000, domain=-#6:#6] (#4 / cos( t ), #5 * tan( t ));
    draw [#1, rotate around=#2: (0, 0), shift=#3]
        plot [variable = t, samples=1000, domain=-#6:#6] (-#4 / cos( t ), #5 * tan( t ));


defangle33
defbigaxis3.2cm
defsmallaxis1.5cm

draw [color=blue, line width = 0.4pt, dotted] (-7, 0) -- (7, 0) node [right] $x_1$;
draw [color=blue, line width = 0.4pt, dotted] (0, -5) -- (0, 5) node [above] $x_2$;

coordinate (center) at (-6, 2);

node [scale=tikzscale, elli=angle:bigaxis and smallaxis, line width = 1.2pt, color=black, dotted] at (center) (e) ;

draw [-stealth, line width = 1.2pt, color = orange] ([shift=(angle:-12)] e.center) -- ([shift=(angle:12)] e.center) node [above right] $bma_1$;
draw [-stealth, line width = 1.2pt, color = orange] ([shift=(90+angle:-8)] e.center) -- ([shift=(90+angle:8)] e.center) node [above left]  $bma_2$;

tikzhyperbola[line width = 1.2pt, color=blue!80!black]angle(center)bigaxissmallaxis77

pgfmathsetmacroaxisratiosmallaxis / bigaxis

% asymptotes
deflengthofasymptote15
draw [color=black!40, line width = 0.4pt, rotate around=angle + atan( axisratio ): (center)]
    ($ (-lengthofasymptote, 0) + (center) $) -- ++(2*lengthofasymptote, 0) ;
draw [color=black!40, line width = 0.4pt, rotate around=angle - atan( axisratio ): (center)]
    ($ (-lengthofasymptote, 0) + (center) $) -- ++(2*lengthofasymptote, 0) ;

tikzhyperbola[line width = 1.2pt, color=red!80!black]90+angle(center)smallaxisbigaxis76

endtikzpicture

enddocument

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)


Tags : /

Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *