<jupyter_start><jupyter_text>TextThere are three kinds of text objects: - on the 3D scene `k3d.text`, renders in canvas - on the 2D canvas `k3d.text2d`, renders in canvas - `k3d.texture_text` renders as texture in WebGL<jupyter_code>import k3d
import numpy as np 


g = 9.81
v0 = 24
alpha = np.radians(45)

plot = k3d.plot()

for alpha in np.linspace(1,89,15):
    alpha = np.radians(alpha)
    t_end = 2*v0*np.sin(alpha)/g
    t = np.linspace(0,t_end,100) 

    
    # note .T at the end, k3d takes data (x1,y1,z1),(x2,y2,z2)...
    traj3d = np.stack([ v0*t*np.cos(alpha), \
                        20*alpha+np.zeros_like(t), \
                        v0*t*np.sin(alpha)-g*t**2/2 ]).T.astype(np.float32)

    plt_traj = k3d.line(traj3d) 
    plt_text = k3d.text('h_{max}', \
                        position=[np.cos(alpha)*t_end*v0/2, 20*alpha, (v0*np.sin(alpha))**2/(2*g)],\
                        color=0xff0000, size=1)
    plt_text2d = k3d.text2d(r'\text{ballistic trajectory: } h=v_0 t \sin \alpha - \frac{g t^2}{2}', \
                            position=[0.0, 0.0], color=0x0000ff, size=1)
    plt_texture_text = k3d.texture_text('START', position=[0, 0, 0],\
                                        font_face='Calibri', color=255, size=2)

    plot += plt_text 
    plot += plt_text2d 
    plot += plt_texture_text
    plot += plt_traj

plot.display()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15517241379310345, 'fraction_numerical': 0.0603448275862069, 'mean_word_length': 2.3566265060240963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '622888', 'license': 'MIT', 'n_tokens_mistral': 594, 'n_tokens_neox': 552, 'n_words': 106, 'path': 'docs/source/basic_functionality/Text.ipynb', 'repo_name': 'pevers/K3D-jupyter', 'size': '1392'}