----------------------- Tetrahedron Cross Ratio ----------------------- .. image:: render.png :width: 750px :align: center In this example we will showcase the geometric transformation and mathematical properties of stereographic projection in the context of a regular tetrahedron. You can see the full code at :download:`tetrahedron_cross_ratio.py <../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py>`. .. contents:: :local: :backlinks: none Setup ===== We start off by importing the necessary libraries. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [setup-1] :end-before: [setup-1] We are also going to clear the whole scene. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [setup-2] :end-before: [setup-2] Constants and Functions ======================= Now we are going to establish the essential constants and functions necessary for the subsequent computations and visualization. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [constants] :end-before: [constants] First we need to generate a regular tetrahedron inscribed within the unit sphere based on the position of a single vertex. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [functions-1] :end-before: [functions-1] Next we need to define a function which performs a stereographic projection of the tetrahedron onto the plane :math:`x_3 = 0`. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [functions-2] :end-before: [functions-2] Finally we need to project an edge of a halfedge object onto the unit sphere, ensuring it maintains its smoothness. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [functions-3] :end-before: [functions-3] Calculations ============ Now we are going to execute the mathematical computations required to achieve our visualization. We first construct an inscribed tetrahedron within the unit sphere based on a specified vertex and project the edges of the tetrahedron onto the unit sphere to create a list of curves on the sphere. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [calculations-1] :end-before: [calculations-1] Next, we stereographically project the entire tetrahedron onto the plane :math:`x_3 = 0`. With that we calculate the complex cross-ratio of the projected points and verifying whether it equals .. math:: e^{\pm i \frac{\pi}{3}} .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [calculations-2] :end-before: [calculations-2] Visualization ============= Finally we can bring it all together and visualize it. We start by defining some colors and setting up the camera. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [visualization-1] :end-before: [visualization-1] Next, we define materials and collections and also set the blend mode. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [visualization-2] :end-before: [visualization-2] Now we can visualize the objects in Blender. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [visualization-3] :end-before: [visualization-3] We are also going to create a plane in the xy-plane. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [visualization-4] :end-before: [visualization-4] Finally, we configure our Blender settings for rendering. .. literalinclude:: ../../../../../examples/blender/geometry/tetrahedron_cross_ratio.py :language: python :start-after: [visualization-5] :end-before: [visualization-5]