Adaptive Plot Curve
===================

.. image:: https://github.com/nortikin/sverchok/assets/14288520/b353ce32-325f-4db7-9fb8-2570d9dc8802
  :target: https://github.com/nortikin/sverchok/assets/14288520/b353ce32-325f-4db7-9fb8-2570d9dc8802

Functionality
-------------

Given a Curve object, this node generates a mesh representing the curve. This
way, it is similar to "Evaluate Curve" node with "Auto" mode. But, this node
tries to generate less points for more "straight" parts of the curve, and more
points for the most interesting parts of the curve. This way, the node is
similar to "Adaptive Tessellate Surface" node.

The following algorithm is used:

* The whole domain of curve's T parameters is subdivided into even parts.
* Then some points are added into "most interesting" intervals. "Interesting" can be defined as:

   * Having greater length;
   * Having bigger curvature value.

   Number of points to be added into each subdivision is calculated
   proportionally to this "subdivision factor".
   These additional points can be distributed either evenly (in terms of
   curve's T parameter), or randomly.

* Then all resulting points are connected to make a curve-like mesh object.

For NURBS and NURBS-like curves, consider use of "Adaptive Plot NURBS Curve" node.

.. image:: https://github.com/nortikin/sverchok/assets/14288520/165d83b8-6fbf-47f1-95eb-432917ef6961
  :target: https://github.com/nortikin/sverchok/assets/14288520/165d83b8-6fbf-47f1-95eb-432917ef6961

* Generator-> :doc:`Random Vector </nodes/generator/random_vector_mk3>`
* Curves-> :doc:`Cubic Spline </nodes/curve/cubic_spline>`
* Viz-> :doc:`Viewer Draw Curve </nodes/viz/viewer_draw_curve>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`

Inputs
------

This node has the following inputs:

* **Curve**. The curve to be plotted. This input is mandatory.
* **Segments**. Number of initial subdivisions. The default value is 25.
* **Min per segment**. This input is only available if **Points Count**
  parameter is set to **Per Segment**. Minimal number of additional points,
  which is to be added into intervals which have the least value of subdivision
  factor (length and/or curvature). The default value is 0 - do not add points
  to such intervals.
* **Max per segment**. This input is only available if **Points Count**
  parameter is set to **Per Segment**. Maximum number of additional points,
  which is to be added into intervals which have the greatest value of
  subdivision factor (length and/or curvature). The default value is 5.
* **Count**. This input is only available when **Points Count** parameter is
  set to **Total Count**. Total number of points to be generated. NOTE: when
  **Random** parameter is checked, actual number of points generated by this
  node can be less than the value provided in this input. The default value is
  50.
* **Seed**. Random seed value. This input is only available when the **Random**
  parameter is enabled. The default value is 0.

Parameters
----------

This node has the following parameters:

* **By Curvature**. Use curve curvature value to distribute additional points
  on the curve: places with greater curvature value will receive more points.
  Checked by default.
* **By Length**. Use segment lengths to distribute additional points on the
  curve: segments with greater length will receive more points. Unchecked by
  default.

    .. image:: https://github.com/nortikin/sverchok/assets/14288520/96b290d1-2154-48be-a874-d90443a33ec7
      :target: https://github.com/nortikin/sverchok/assets/14288520/96b290d1-2154-48be-a874-d90443a33ec7

* **Points Count**. This defines how number of points to be generated will be
  defined. Possible options are:

   * **Total Count**. Total number of points to be generated will be provided
     in the **Count** input.

      .. image:: https://github.com/nortikin/sverchok/assets/14288520/3e76982f-974e-4d28-9891-ede1463a2355
        :target: https://github.com/nortikin/sverchok/assets/14288520/3e76982f-974e-4d28-9891-ede1463a2355

   * **Per Segment**. Minimum and maximum number of points per initial
     subdivision segment will be provided in **Min per segment**, **Max per
     segment** inputs, correspondingly.

   The default option is **Total Count**.

      .. image:: https://github.com/nortikin/sverchok/assets/14288520/e5091c8d-0778-48e2-8d26-6bcdbdc03963
        :target: https://github.com/nortikin/sverchok/assets/14288520/e5091c8d-0778-48e2-8d26-6bcdbdc03963

* **Random**. If checked, then additional points will be distributed randomly.
  Otherwise, additional points will be distributed evenly inside each segment
  of initial subdivision. Unchecked by default.
* **Curvature Clip**. This parameter is available only in the N panel of the
  node, only when the **By Curvature** parameter is enabled. The calculated
  values of curve curvature will be restricted to do not exceed this number.
  This is used to ignore places on the curve where it has too high values of
  curvature (sharp points) - otherwise the algorithm would be placing all the
  additional points to such places. The default value is 100. Usually you do
  not have to change this value. Set the parameter to 0 (zero) to disable this
  part of the algorithm.

    .. image:: https://github.com/nortikin/sverchok/assets/14288520/92083c39-f8f5-46d1-8f9d-1b2e27ccd9e0
      :target: https://github.com/nortikin/sverchok/assets/14288520/92083c39-f8f5-46d1-8f9d-1b2e27ccd9e0

Outputs
-------

This node has the following outputs:

* **Vertices**. The vertices of the generated mesh.
* **Edges**. The edges of the generated mesh.
* **T**. Values of curve's T parameter for all generated points on the curve.

