Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Prepare NURBS Curves Net" node #5148

Merged
merged 14 commits into from
Oct 7, 2024
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/nodes/analyzer/bbox_aligned.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Examples
.. image:: https://github.com/nortikin/sverchok/assets/14288520/84588685-1360-4029-b8de-5346008b982b
:target: https://github.com/nortikin/sverchok/assets/14288520/84588685-1360-4029-b8de-5346008b982b

* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* Spatial-> :doc:`Voronoi on Mesh </nodes/spatial/voronoi_on_mesh>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`
* Scene-> :doc:`Get Objects Data </nodes/scene/get_objects_data>`
Expand All @@ -61,4 +61,4 @@ Examples
<video width="700" controls>
<source src="https://github.com/nortikin/sverchok/assets/14288520/0b14d7d1-6b8b-4901-b8f5-a55177658e09" type="video/mp4">
Your browser does not support the video tag.
</video>
</video>
146 changes: 146 additions & 0 deletions docs/nodes/curve/prepare_curves_net.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
Prepare NURBS Curves Net
========================

Dependencies
------------

This node requires SciPy_ library for some of it's functions.

.. _SciPy: https://scipy.org/

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

Suppose you want to build a Gordon surface (by use of "Surface from NURBS
Curves Net" node). For that, you have to have two series of curves, and each
curve from first series has to exactly intersect each curve from the second
series. If you are creating curves manually (and introduce them into Sverchok
by use of "Bezier Input" or "NURBS Input" nodes), it can be very hard to adjust
curves manually so that they would intersect exactly.

With "Prepare NURBS Curves Net" node, you may define that, for example, first
series of curves ("U Curves") are primary, so that the surace must follow them
exactly; while the second series of curves ("V Curves") are "secondary", so
that they provide only approximate shape of surface. Then the node will
slightly adjust curves from the second series in such a way, that they would
exactly intersect curves from the first series. Or vice versa, you may define
that curves from the second series are "primary".

Also, if your initial curves intersect only approximately, then it is possible
that there are "tails", "leftovers" of curves at their ends, sticking out
outside of all intersection points. Probably you do not need these leftovers.
This node can cut them for you.

Inputs
------

This node has the following inputs:

* **Curve1**. The first series of curves. This input is mandatory.
* **Curve2**. The second series of curves. This input is mandatory.
* **T1**. This input is available and mandatory when **Curve 1 parameters**
parameter is set to **Explicit**. Curve T parameter values for first series
of curves, where curves from the first series intersect should curves from the
second series.
* **T2**. This input is available and mandatory when **Curve 2 parameters**
parameter is set to **Explicit**. Curve T parameter values for second series
of curves, where curves from the second series should intersect curves from
the first series.

Parameters
----------

This node has the following parameters:

* **Primary curves**. This defines which series of curves must be taken as
"primary", i.e. followed exactly; another series will be adjusted in order to
intersect primary curves exactly. The available options are **Curve 1**,
**Curve 2**. The default option is **Curve 1**.
* **Curve 1 parameters**, **Curve 2 parameters**. This defines how the node
should define T parameters of curves from the first and the second series, at
which the curves must intersect. The available options are:

* **Uniform**. Distribute intersection T parameter values uniformly in curve
T space, according to number of curves in the second series. For example,
if first series contains 3 curves, the second series contains 4 curves, and
**Curve 1 parameters** is set to **Uniform**, then the node will assume
that curves of the first series intersect curves from the second series at
parameter values equal to 0, 1/3, 2/3 and 1.
* **By Curves Location**. Calculate best T values for intersection, based on
location of curves from the second series. This uses numeric algorithm to
find the nearest point on the curve from one series to the point on curve
from another series.
* **Explicit**. Use explicit T values for intersection points, provided in
**T1** / **T2** inputs.

It is not supported to set both these parameters to **By Curves Location**.
However, to achieve best results, you usually need to set one of them to **By
Curves Location**. The default option for both parameters is **Uniform**.

* **Preserve tangents**. If checked, then, when adjusting curves, the node will
try to preserve curve tangents direction. Note that with this parameter
checked, the node can throw an error, if there are too few control points on
the curves being adjusted. If you encounter such an error, you may have to
add control points to curves (you may use "Refine Curve" node to do so). By
default this parameter is not checked.
* **Crop Curves 1**, **Crop Curves 2**. If checked, cut off "leftovers" of
curves from first / second series, which stick out outside of all
intersection points. Not checked by default.
* **Fit Samples**. This parameter is available in the N panel only. Defines
initial number of subdivisions for search of nearest points for "by curve
location" options. The default value of 50 should be good enough for most
cases; but in some cases you may want to increase this number for better
precision, or reduce it for better performance.

Outputs
-------

This node has the following outputs:

* **Curve1**. Adjusted (or original) curves from the first series.
* **Curve2**. Adjusted (or original) curves from the second series.
* **Intersections**. Curve intersection points.
* **T1**. For each curve from the first series, this output contains a list of
T parameter values, at which this curve intersects curves from the second
series.
* **T2**. For each curve from the second series, this output contains a list of
T parameter values, at which this curve intersects curves from the first
series.

Examples of Usage
-----------------

Let's say you have the following net of curves. Note that the curves do not
exactly intersect each other.

.. image:: ../../../docs/assets/nodes/curve/prepare_curves_net_original.png
:target: ../../../docs/assets/nodes/curve/prepare_curves_net_original.png

Here we say that curves from the first series (along the construction) are
primary. Black curves are original; red and blue curves are result of
adjustment by this node. Note that now red and blue curves intersect exactly.

.. image:: ../../../docs/assets/nodes/curve/prepare_curves_net_curve1_nodes.png
:target: ../../../docs/assets/nodes/curve/prepare_curves_net_curve1_nodes.png

.. image:: ../../../docs/assets/nodes/curve/prepare_curves_net_curve1_result.png
:target: ../../../docs/assets/nodes/curve/prepare_curves_net_curve1_result.png

Here we say that curves from the second series (across the construction) are primary:

.. image:: ../../../docs/assets/nodes/curve/prepare_curves_net_curve2_nodes.png
:target: ../../../docs/assets/nodes/curve/prepare_curves_net_curve2_nodes.png

.. image:: ../../../docs/assets/nodes/curve/prepare_curves_net_curve2_result.png
:target: ../../../docs/assets/nodes/curve/prepare_curves_net_curve2_result.png

Simple example with "crop" flags disabled:

.. image:: ../../../docs/assets/nodes/curve/prepare_curves_net_crop_off.png
:target: ../../../docs/assets/nodes/curve/prepare_curves_net_crop_off.png

And the same with "crop" enabled:

.. image:: ../../../docs/assets/nodes/curve/prepare_curves_net_crop_on.png
:target: ../../../docs/assets/nodes/curve/prepare_curves_net_crop_on.png

4 changes: 2 additions & 2 deletions docs/nodes/pulga_physics/pulga_springs_force.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Example in description:
:target: https://github.com/nortikin/sverchok/assets/14288520/e8c76f03-518a-458d-a2d5-3f7edf8ffb77

* Generator-> :doc:`Cylinder </nodes/generator/cylinder_mk2>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* Spatial-> :doc:`Voronoi on Mesh </nodes/spatial/voronoi_on_mesh>`
* Modifiers->Modifier Change-> :doc:`Mesh Join </nodes/modifier_change/mesh_join_mk2>`
* Modifiers->Modifier Change-> :doc:`Merge by Distance </nodes/modifier_change/merge_by_distance>`
Expand Down Expand Up @@ -106,4 +106,4 @@ Example with Torus:
* Pulga Physics-> :doc:`Pulga Pin Force </nodes/pulga_physics/pulga_pin_force>`

.. image:: https://github.com/nortikin/sverchok/assets/14288520/16dd65d0-b235-4a76-aa14-69cc6aff0273
:target: https://github.com/nortikin/sverchok/assets/14288520/16dd65d0-b235-4a76-aa14-69cc6aff0273
:target: https://github.com/nortikin/sverchok/assets/14288520/16dd65d0-b235-4a76-aa14-69cc6aff0273
4 changes: 2 additions & 2 deletions docs/nodes/spatial/concave_hull.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Examples of Usage
:target: https://user-images.githubusercontent.com/14288520/202860801-f540fe36-6332-4575-bba1-705ae288fb46.png

* Generator-> :doc:`Suzanne </nodes/generator/suzanne>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* Spatial-> :doc:`Lloyd on Mesh </nodes/spatial/lloyd_on_mesh>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`

Expand All @@ -86,4 +86,4 @@ Examples of Usage
* Solids-> :doc:`Torus (Solid) </nodes/solid/torus_solid>`
* Spatial-> :doc:`Populate Solid </nodes/spatial/populate_solid>`
* Modifiers->Modifier Make-> :doc:`Dual Mesh </nodes/modifier_make/dual_mesh>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`
4 changes: 2 additions & 2 deletions docs/nodes/spatial/convex_hull_mk2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Examples
.. image:: https://user-images.githubusercontent.com/14288520/202849248-6c2d96c3-cbaa-4f38-88a5-b6ae16feb4fc.png
:target: https://user-images.githubusercontent.com/14288520/202849248-6c2d96c3-cbaa-4f38-88a5-b6ae16feb4fc.png

* Generator-> :doc:`Random Vector </nodes/generator/random_vector_mk3>`
* Generator-> :doc:`Random Vector </nodes/spatial/populate_mesh_mk2>`
* Transform-> :doc:`Noise Displace </nodes/transforms/noise_displace>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`

Expand Down Expand Up @@ -59,7 +59,7 @@ Examples

* Generator-> :doc:`Plane </nodes/generator/plane_mk3>`
* Generator-> :doc:`NGon </nodes/generator/ngon>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* Transform-> :doc:`Noise Displace </nodes/transforms/noise_displace>`
* Modifiers->Modifier Change-> :doc:`Mesh Join </nodes/modifier_change/mesh_join_mk2>`
* List->List Main-> :doc:`List Join </nodes/list_main/join>`
Expand Down
8 changes: 4 additions & 4 deletions docs/nodes/spatial/delaunay_2d_cdt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Examples
:target: https://user-images.githubusercontent.com/14288520/202162212-a0b731ea-0afa-4c23-bbf2-c646090fd805.png

* Generator-> :doc:`Segment </nodes/generator/segment>`
* Generator-> :doc:`Random Vector </nodes/generator/random_vector_mk3>`
* Generator-> :doc:`Random Vector </nodes/spatial/populate_mesh_mk2>`
* List->List Main-> :doc:`List Join </nodes/list_main/join>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`

Expand All @@ -85,7 +85,7 @@ Examples
:target: https://user-images.githubusercontent.com/14288520/202170634-f26119f8-bf1c-41a6-881e-cf1d4fdf3739.png

* Scene-> :doc:`Get Objects Data </nodes/scene/get_objects_data>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* List->List Main-> :doc:`List Join </nodes/list_main/join>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`

Expand All @@ -97,10 +97,10 @@ Examples
:target: https://user-images.githubusercontent.com/14288520/202174338-9f178515-36eb-4110-b851-35f9b6e29471.png

* Generator-> :doc:`Plane </nodes/generator/plane_mk3>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* Number-> :doc:`Random Num Gen </nodes/number/random_num_gen>`
* List->List Main-> :doc:`List Length </nodes/list_main/length>`
* Color-> :doc:`Color In </nodes/color/color_in_mk1>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`
* Viz-> :doc:`Mesh Viewer </nodes/viz/mesh_viewer>`
* BPY Date-> Vertex Color MK3 (No docs)
* BPY Date-> Vertex Color MK3 (No docs)
6 changes: 3 additions & 3 deletions docs/nodes/spatial/lloyd_on_mesh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Example of Usage
:target: https://user-images.githubusercontent.com/14288520/202814364-f58907d3-67a4-467e-93e7-44acbe22be2b.png

* Generator-> :doc:`Suzanne </nodes/generator/suzanne>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`

---------
Expand All @@ -68,8 +68,8 @@ Example of Usage
:target: https://user-images.githubusercontent.com/14288520/202815217-e3ce3c1c-1855-46b3-ae01-af3d36433fa9.png

* Generator-> :doc:`Suzanne </nodes/generator/suzanne>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* Viz-> :doc:`Viewer Draw </nodes/viz/viewer_draw_mk4>`

.. image:: https://user-images.githubusercontent.com/14288520/202814946-ae47a3b1-3063-4254-aec2-f404327a590f.gif
:target: https://user-images.githubusercontent.com/14288520/202814946-ae47a3b1-3063-4254-aec2-f404327a590f.gif
:target: https://user-images.githubusercontent.com/14288520/202814946-ae47a3b1-3063-4254-aec2-f404327a590f.gif
4 changes: 2 additions & 2 deletions docs/nodes/spatial/voronoi_on_mesh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Example of usage
:target: https://user-images.githubusercontent.com/14288520/202578440-c713aac3-c787-456a-b796-190204bf297a.png

* Generator-> :doc:`Box </nodes/generator/box_mk2>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/random_points_on_mesh>`
* Spatial-> :doc:`Populate Mesh </nodes/spatial/populate_mesh_mk2>`
* Modifiers->Modifier Change-> :doc:`Inset Faces </nodes/modifier_change/inset_faces>`
* Modifiers->Modifier Make-> :doc:`Subdivide </nodes/modifier_change/subdivide_mk2>`
* Matrix-> :doc:`Matrix In </nodes/matrix/matrix_in_mk4>`
Expand Down Expand Up @@ -231,4 +231,4 @@ blend file: https://github.com/nortikin/sverchok/files/12342712/Voronoi.Tower.00
See also example
----------------

* Pulga Physics-> :ref:`Pulga Springs Force <PULGA_SPRINGS_FORCE_EXAMPLES>`
* Pulga Physics-> :ref:`Pulga Springs Force <PULGA_SPRINGS_FORCE_EXAMPLES>`
2 changes: 2 additions & 0 deletions docs/old/nodes/random_points_on_mesh.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:orphan:

Populate Mesh (Random points on mesh)
=====================================

Expand Down
1 change: 1 addition & 0 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
- SvExSurfaceBoundaryNode
- ---
- SvIntersectNurbsCurvesNode
- SvPrepareCurvesNetNode
- SvExNearestPointOnCurveNode
- SvExOrthoProjectCurveNode
- SvExCurveEndpointsNode
Expand Down
1 change: 1 addition & 0 deletions menus/full_by_data_type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
- Analyze NURBS Curve:
- icon_name: VIEWZOOM
- SvIntersectNurbsCurvesNode
- SvPrepareCurvesNetNode
- SvNurbsCurveNodesNode
- SvDeconstructCurveNode
- SvExMarchingSquaresNode
Expand Down
1 change: 1 addition & 0 deletions menus/full_nortikin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@
- icon_name: OUTLINER_OB_CURVE
- extra_menu: AdvancedObjectsPartialMenu
- SvIntersectNurbsCurvesNode
- SvPrepareCurvesNetNode
- SvExCastCurveNode
- SvProjectCurveSurfaceNode
- SvOffsetCurveMk2Node
Expand Down
Loading
Loading