Skip to content

Commit

Permalink
Merge pull request #4651 from nortikin/nurbs_degree_nodes
Browse files Browse the repository at this point in the history
Nurbs degree elevation & reduction nodes
  • Loading branch information
portnov authored Sep 11, 2022
2 parents 492c836 + e3be1c8 commit 7c432f1
Show file tree
Hide file tree
Showing 26 changed files with 1,323 additions and 20 deletions.
2 changes: 2 additions & 0 deletions docs/nodes/curve/curve_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Curves
remove_knot
refine_nurbs_curve
remove_excessive_knots
elevate_degree
reduce_degree
adaptive_plot_nurbs
catenary_curve
bezier_fit
Expand Down
53 changes: 53 additions & 0 deletions docs/nodes/curve/elevate_degree.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Elevate Degree (NURBS Curve)
============================

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

This node elevates (increases) the degree of a NURBS curve.

The opposite action can be performed with "Reduce Degree (NURBS Curve)" node.

Curves of higher degrees have more control points, and so, with higher degree,
one control point controls smaller segment of the curve.

This node can work only with NURBS and NURBS-like curves.

Inputs
------

This node has the following inputs:

* **Curve**. The curve to perform operation on. This input is mandatory.
* **Degree**. In **Elevate by** mode, this is the delta to be added to curve's
degree. In **Set degree** mode, this is new curve degree to be set. New
degree can not be less than current degree of the curve. The default value is
1.

Parameters
----------

This node has the following parameter:

* **Mode**. This defines how the new degree of the curve is specified:

* In **Elevate by** mode, **Degree** input specifies the number to be added
to current degree of the curve.
* In **Set degree** mode, **Degree** input specifies the new degree of the
curve.

Outputs
-------

This node has the following output:

* **Curve**. The curve of elevated degree.

Example of Usage
----------------

Here orange is the original curve of 3rd degree, and green is it's control
polygon. Red is the control polygon of curve with elevated (4th) degree.

.. image:: https://user-images.githubusercontent.com/284644/189500544-0b0d70b0-f312-43b6-ac5a-b726bce6ccbd.png

68 changes: 68 additions & 0 deletions docs/nodes/curve/reduce_degree.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Reduce Degree (NURBS Curve)
===========================

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

This node reduces (decreases) the degree of a NURBS curve.

The action of this node is the opposite to the action of "Elevate Degree (NURBS Curve)" node.

Degree reduction is the process which can not be always performed exactly. Some
curves can not be degree reduced without visible deviation of curve's geometry.
For other, degree reduction produces only small error.

This node can work only with NURBS and NURBS-like curves.

Inputs
------

This node has the following inputs:

* **Curve**. The curve object to perform operation on. This input is mandatory.
* **Degree**. In **Reduce by** mode, this is the delta to be substracted from
curve's degree. In **Set degree** mode, this is new curve degree to be set.
New degree can not be greater than current degree of the curve. The default
value is 1.
* **Tolerance**. Maximum tolerable deviation of new curve from original. If
degree reduction process will have error estimation more than this tolerance,
then, depending on **Only if possible** parameter, the node will either fail or
return the curve untouched (or degree reduced by less than wanted value). The
default value is ``0.0001``.

Parameters
----------

This node has the following parameters:

* **Mode**. This defines how the new degree of the curve is specified:

* In **Reduce by** mode, **Degree** input specifies the number to be substracted
from current degree of the curve.
* In **Set degree** mode, **Degree** input specifies the new degree of the
curve.

* **Only if possible**. If this flag is checked, the node will try to degree
reduce the curve by requested amount; it it is not possible to do so without
deviation greater than the specified tolerance, the node will just degree
reduce the curve the number of times it can. If not checked, then the node
will fail (become red) in such a situation, and the processint will stop.
Unchecked by default.

Outputs
-------

This node has the following output:

* **Curve**. The resulting curve.

Example of Usage
----------------

Here, the initial curve of 3rd degree is reduced to degree of 2. Orange is the
original curve, blue is it's control polygon; green is the resulting curve, and
red is it's control polygon. As you can see, in this case the operation could
not be performed without visible deviation.

.. image:: https://user-images.githubusercontent.com/284644/189500535-3a126895-7a36-453d-af8a-ff4b0615836e.png

5 changes: 2 additions & 3 deletions docs/nodes/curve/remove_excessive_knots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ Parameters

This node has the following parameter:

* **Tolerance**. This parameter is available in the N panel only. This defines
how much is it allowed to change the shape of the curve by knot removal
procedure. The default value is ``10^-6``.
* **Tolerance**. This defines how much is it allowed to change the shape of the
curve by knot removal procedure. The default value is ``10^-6``.

Outputs
-------
Expand Down
61 changes: 61 additions & 0 deletions docs/nodes/surface/elevate_degree.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Elevate Degree (NURBS Surface)
==============================

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

This node elevates (increases) the degree of a NURBS surface.

The opposite action can be performed with "Reduce Degree (NURBS Surface)" node.

Surfaces of higher degrees have more control points, and so, with higher degree,
one control point controls smaller segment of the surface.

Remember that NURBS surface has two degrees, one along U parameter and one
along V. This node can elevate any of them.

This node can work only with NURBS and NURBS-like surfaces.

Inputs
------

This node has the following inputs:

* **Surface**. The surface to perform operation on. This input is mandatory.
* **Degree**. In **Elevate by** mode, this is the delta to be added to surface's
degree. In **Set degree** mode, this is new surface degree to be set. New
degree can not be less than current degree of the surface. The default value is
1.

Parameters
----------

This node has the following parameters:

* **Direction**. This specifies the parameter direction, degree along which is
to be increased. The available options are **U** and **V**. The default
option is **U**.
* **Mode**. This defines how the new degree of the surface is specified:

* In **Elevate by** mode, **Degree** input specifies the number to be added
to current degree of the surface.
* In **Set degree** mode, **Degree** input specifies the new degree of the
surface.

Outputs
-------

This node has the following output:

* **Surface**. The surface of elevated degree.

Example of Usage
----------------

Here the degree of the surface is increased by 1 along U and then reduced by 1
also along U, just to illustrate that degree elevation and reduction are the
opposite processes. Red is the control net of the original and the resulting
surfaces. Blue is the control polygon of degree elevated surface.

.. image:: https://user-images.githubusercontent.com/284644/189500531-e4354c9d-0dd4-4bc5-861d-43d9229c28e6.png

67 changes: 67 additions & 0 deletions docs/nodes/surface/reduce_degree.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Reduce Degree (NURBS Surface)
=============================

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

This node reduces (decreases) the degree of a NURBS surface.

The action of this node is the opposite to the action of "Elevate Degree (NURBS Surface)" node.

Degree reduction is the process which can not be always performed exactly. Some
surfaces can not be degree reduced without visible deviation of surface's geometry.
For other, degree reduction produces only small error.

Remember that NURBS surface has two degrees, one along U parameter and one
along V. This node can reduce any of them.

This node can work only with NURBS and NURBS-like surfaces.

Inputs
------

This node has the following inputs:

* **Surface**. The surface to perform operation on. This input is mandatory.
* **Degree**. In **Reduce by** mode, this is the delta to be substracted from
surface's degree. In **Set degree** mode, this is new surface degree to be
set. New degree can not be greater than current degree of the surface. The
default value is 1.
* **Tolerance**. Maximum tolerable deviation of new surface from original. If
degree reduction process will have error estimation more than this tolerance,
then, depending on **Only if possible** parameter, the node will either fail or
return the surface untouched (or degree reduced by less than wanted value). The
default value is ``0.0001``.

Parameters
----------

This node has the following parameters:

* **Direction**. This specifies the parameter direction, degree along which is
to be decreased. The available options are **U** and **V**. The default
option is **U**.
* **Mode**. This defines how the new degree of the surface is specified:

* In **Reduce by** mode, **Degree** input specifies the number to be
substracted from current degree of the surface.
* In **Set degree** mode, **Degree** input specifies the new degree of the
surface.

Outputs
-------

This node has the following output:

* **Surface**. The surface of a reduced degree.

Example of Usage
----------------

Here the degree of the surface is increased by 1 along U and then reduced by 1
also along U, just to illustrate that degree elevation and reduction are the
opposite processes. Red is the control net of the original and the resulting
surfaces. Blue is the control polygon of degree elevated surface.

.. image:: https://user-images.githubusercontent.com/284644/189500531-e4354c9d-0dd4-4bc5-861d-43d9229c28e6.png

5 changes: 2 additions & 3 deletions docs/nodes/surface/remove_excessive_knots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ This node has the following parameters:
* **Direction**. This defines, in which parametric directions should the knot
removal procedure be performed. The available options are **U+V** (both
directions), **U** and **V**. The default value is **U+V**.
* **Tolerance**. This parameter is available in the N panel only. This defines
how much is it allowed to change the shape of the surface by knot removal
procedure. The default value is ``10^-6``.
* **Tolerance**. This defines how much is it allowed to change the shape of the
surface by knot removal procedure. The default value is ``10^-6``.

Outputs
-------
Expand Down
2 changes: 2 additions & 0 deletions docs/nodes/surface/surface_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Surface
insert_knot
remove_knot
remove_excessive_knots
elevate_degree
reduce_degree
intersect_curve_surface
nearest_point
ortho_project
Expand Down
6 changes: 6 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
SvRefineNurbsCurveNode
SvCurveRemoveExcessiveKnotsNode
---
SvCurveElevateDegreeNode
SvCurveReduceDegreeNode
---
SvAdaptivePlotNurbsCurveNode

## Curves @ Bezier
Expand Down Expand Up @@ -151,6 +154,9 @@
SvSurfaceInsertKnotNode
SvSurfaceRemoveKnotNode
SvSurfaceRemoveExcessiveKnotsNode
---
SvSurfaceElevateDegreeNode
SvSurfaceReduceDegreeNode

## Surfaces
SvExPlaneSurfaceNode
Expand Down
Loading

0 comments on commit 7c432f1

Please sign in to comment.