.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/04_demos/viz_line_projections.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_04_demos_viz_line_projections.py: ============================= Line Projection Visualization ============================= This tutorial demonstrates how to use FURY's `actor.line_projection` to visualize the planar projection of 3D lines onto a specified plane. This is useful for understanding how streamlines or trajectories intersect or relate to a given plane in 3D space. We will create a scene with several colored lines, a square plane, and their projections onto the plane. The projected lines are rendered with customizable thickness, opacity, and outline for better visualization. .. GENERATED FROM PYTHON SOURCE LINES 14-18 .. code-block:: Python import numpy as np from fury import actor, window .. GENERATED FROM PYTHON SOURCE LINES 19-21 Define 3D lines and their colors. Each line is represented by two endpoints in 3D space. .. GENERATED FROM PYTHON SOURCE LINES 21-34 .. code-block:: Python lines = [ np.asarray([[20, 20, -2], [20, 0, 3]]), np.asarray([[10, 0, -2], [0, 0, 3]]), np.asarray([[0, -20, -2], [0, -20, 3]]), ] colors = [ (1, 0, 0), # Red (0, 1, 0), # Green (0, 0, 1), # Blue ] .. GENERATED FROM PYTHON SOURCE LINES 35-37 Create a square plane actor. The plane will serve as the target for projecting the lines. .. GENERATED FROM PYTHON SOURCE LINES 37-44 .. code-block:: Python plane = actor.square( np.zeros((1, 3)), directions=(1, 0, 0), scales=(50, 50, 1), ) .. GENERATED FROM PYTHON SOURCE LINES 45-47 Create the original line actor and the projected line actor. The projected lines are visualized using `actor.line_projection`. .. GENERATED FROM PYTHON SOURCE LINES 47-59 .. code-block:: Python line_actor = actor.streamlines(lines, colors=colors, thickness=10, opacity=0.25) projection = actor.line_projection( lines, plane="XY", colors=colors, thickness=10, outline_thickness=3, outline_color=(0, 0, 0), ) .. GENERATED FROM PYTHON SOURCE LINES 60-62 Create a scene and add the actors. The scene will display the plane, the original lines, and their projections. .. GENERATED FROM PYTHON SOURCE LINES 62-68 .. code-block:: Python scene = window.Scene() scene.add(projection) scene.add(plane) scene.add(line_actor) .. GENERATED FROM PYTHON SOURCE LINES 69-70 Start the ShowManager to render the scene and allow interaction. .. GENERATED FROM PYTHON SOURCE LINES 70-74 .. code-block:: Python show_m = window.ShowManager(scene=scene, title="FURY Line Projection Example") window.update_camera(show_m.screens[0].camera, None, scene) show_m.start() .. _sphx_glr_download_auto_examples_04_demos_viz_line_projections.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: viz_line_projections.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: viz_line_projections.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: viz_line_projections.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_