# Examples from pyvista.Text3D
# ============================

# Create 3D text.
import pyvista as pv
text_mesh = pv.Text3D('PyVista')
text_mesh.plot(cpos='xy', show_bounds=True)

# Create planar text.
text_mesh = pv.Text3D('PyVista', depth=0)
text_mesh.plot(cpos='xy', show_bounds=True)

# Set the depth explicitly.
text_mesh = pv.Text3D('PyVista', depth=5)
text_mesh.plot(cpos='xy', show_bounds=True)

# Set the width explicitly. The height and depth are automatically scaled proportionally.
text_mesh = pv.Text3D('PyVista', width=10)
text_mesh.plot(cpos='xy', show_bounds=True)

# Set the height explicitly. The width and depth are automatically scaled proportionally.
text_mesh = pv.Text3D('PyVista', height=10)
text_mesh.plot(cpos='xy', show_bounds=True)

# Set the height and width. The depth is automatically scaled proportional to height.
text_mesh = pv.Text3D('PyVista', height=10, width=10)
text_mesh.plot(cpos='xy', show_bounds=True)

# Set the height, width, and depth independently, and adjust the center.
text_mesh = pv.Text3D(
    'PyVista', height=10, width=10, depth=0, center=(5, 5, 0)
)
text_mesh.plot(cpos='xy', show_bounds=True)

# Control the full orientation with an explicit transform. Create planar
# text with the default normal: it lies in the xy plane, reads along +x,
# and extends upward along +y. Rotate it 30 degrees about z, then 90 degrees
# about x, and finally translate it. The default post-multiplication mode
# applies these operations in the order shown.
text_mesh = pv.Text3D('PyVista', depth=0)
transform = pv.Transform().rotate_z(30).rotate_x(90).translate((1, 2, 3))
oriented_text = text_mesh.transform(transform, inplace=False)

# The transformed normal points along -y. Changing the first rotation
# changes the text's rotation about that normal without changing the
# normal itself. The original `text_mesh` is unchanged.

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code
