.. _envelope_evolute_involute: --------------------------------------------------------------- Envelope, Evolute, Orthogonal Trajectory and Involute of Curves --------------------------------------------------------------- .. image:: render.png :width: 750px :align: center In this example we will generate the following (from top to bottom in the above picture), a curve with its edge normals, a curve with its edge normals and its evolute, a curve with its tangent lines, a curve with its tangent lines and an involute. The left side shows a fine sampling of a smooth curve, the right side a sparse sampling. You can see the full code at :download:`involute_evolute_curve.py <../../../../../examples/blender/geometry/involute_evolute_curve.py>`. .. contents:: :local: :backlinks: none Setup ===== We start off by importing the necessary libraries. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [setup-1] :end-before: [setup-1] We are also going to clear the whole scene. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [setup-2] :end-before: [setup-2] General Functions ================= Now we are going to define functions that will generate edge tangent lines, vertex normal lines and edge normal lines for a discrete curve given by a function `fct`. .. image:: functions1.png :width: 750px :align: center .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [general-functions-1] :end-before: [general-functions-1] Next we define a function returning the envelope (as a function) for a given family of lines. The envelope is a new curve consisting on intersection points of successive lines. Also we define a function returning the orthogonal_trajectory (as a function) for a given family of lines and a starting point. The orthogonal trajectory is the iterative reflection of a starting point on the lines of the line family. .. image:: functions2.png :width: 750px :align: center .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [general-functions-2] :end-before: [general-functions-2] Example ======= Next we set values for the example images at the top. Feel free to experiment with this or change the curve we have chosen in this example. Choosing a starting point for the involute to look nice might be quite tricky. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [example-1] :end-before: [example-1] Then we define our parametrized curve. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [example-2] :end-before: [example-2] Now we can create a discrete net by sampling the smooth net. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [example-3] :end-before: [example-3] Now we can use the previously defined functions to create functions that generate edge tangent lines, vertex normal lines and edge normal lines for our curve. Further these can be used to create evolutes and involutes: The envelope of tangent lines of a curve is its evolute, the orthogonal trajectory of a starting point along normal lines of a curve forms an involute. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [example-4] :end-before: [example-4] We can compute the envelope of the normal lines of the involute, i.e. the evolute of the involute. This will yield the curve we have started with. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [example-5] :end-before: [example-5] Visualization ============= With all this setup done, we can now visualize this in Blender. We start by defining some colors and a helper function. For the normal or tangent line functions, and thus also the envelopes and orthogonal trajectories, the domain of the newly generated functions may be clipped at the start or at the end. For this we use this helper function. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [visualization-1] :end-before: [visualization-1] Next we will define helper functions for the visualization. The first function takes a function as an input that returns the 2d coordinates of a curve. The helper function converts the input to an actual curve and embeds it into 3d space, namely in the z=0 plane, such that it can be visualized in Blender. The second helper function takes a function as an input, that returns lines in 2d space, represented as subspaces. This helper function visualizes all the lines of the input function (in the given domain) by also embedding them into the z=0 plane. For nets and subspace the `embed` functions are different. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [visualization-2] :end-before: [visualization-2] Using the helper functions, we visualize the curves and lines in Blender. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [visualization-3] :end-before: [visualization-3] Finally we need to add a camera and a light to our scene and set the render mode. .. literalinclude:: ../../../../../examples/blender/geometry/involute_evolute_curve.py :language: python :start-after: [visualization-4] :end-before: [visualization-4]