INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Normalizes the input knot vector to [0, 1] domain.
:param knot_vector: knot vector to be normalized
:type knot_vector: list, tuple
:param decimals: rounding number
:type decimals: int
:return: normalized knot vector
:rtype: list | def normalize(knot_vector, decimals=18):
""" Normalizes the input knot vector to [0, 1] domain.
:param knot_vector: knot vector to be normalized
:type knot_vector: list, tuple
:param decimals: rounding number
:type decimals: int
:return: normalized knot vector
:rtype: list
"""
try:
... |
Checks the validity of the input knot vector.
Please refer to The NURBS Book (2nd Edition), p.50 for details.
:param degree: degree of the curve or the surface
:type degree: int
:param knot_vector: knot vector to be checked
:type knot_vector: list, tuple
:param num_ctrlpts: number of control p... | def check(degree, knot_vector, num_ctrlpts):
""" Checks the validity of the input knot vector.
Please refer to The NURBS Book (2nd Edition), p.50 for details.
:param degree: degree of the curve or the surface
:type degree: int
:param knot_vector: knot vector to be checked
:type knot_vector: li... |
Curve interpolation through the data points.
Please refer to Algorithm A9.1 on The NURBS Book (2nd Edition), pp.369-370 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Default: False*
:param points: data points
:type points: list, tuple
:p... | def interpolate_curve(points, degree, **kwargs):
""" Curve interpolation through the data points.
Please refer to Algorithm A9.1 on The NURBS Book (2nd Edition), pp.369-370 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Default: False*
:param... |
Surface interpolation through the data points.
Please refer to the Algorithm A9.4 on The NURBS Book (2nd Edition), pp.380 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Default: False*
:param points: data points
:type points: list, tuple
... | def interpolate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs):
""" Surface interpolation through the data points.
Please refer to the Algorithm A9.4 on The NURBS Book (2nd Edition), pp.380 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization meth... |
Curve approximation using least squares method with fixed number of control points.
Please refer to The NURBS Book (2nd Edition), pp.410-413 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Default: False*
* ``ctrlpts_size``: number of control p... | def approximate_curve(points, degree, **kwargs):
""" Curve approximation using least squares method with fixed number of control points.
Please refer to The NURBS Book (2nd Edition), pp.410-413 for details.
Keyword Arguments:
* ``centripetal``: activates centripetal parametrization method. *Defaul... |
Surface approximation using least squares method with fixed number of control points.
This algorithm interpolates the corner control points and approximates the remaining control points. Please refer to
Algorithm A9.7 of The NURBS Book (2nd Edition), pp.422-423 for details.
Keyword Arguments:
* ``... | def approximate_surface(points, size_u, size_v, degree_u, degree_v, **kwargs):
""" Surface approximation using least squares method with fixed number of control points.
This algorithm interpolates the corner control points and approximates the remaining control points. Please refer to
Algorithm A9.7 of The... |
Computes a knot vector from the parameter list using averaging method.
Please refer to the Equation 9.8 on The NURBS Book (2nd Edition), pp.365 for details.
:param degree: degree
:type degree: int
:param num_points: number of data points
:type num_points: int
:param params: list of parameters,... | def compute_knot_vector(degree, num_points, params):
""" Computes a knot vector from the parameter list using averaging method.
Please refer to the Equation 9.8 on The NURBS Book (2nd Edition), pp.365 for details.
:param degree: degree
:type degree: int
:param num_points: number of data points
... |
Computes a knot vector ensuring that every knot span has at least one :math:`\\overline{u}_{k}`.
Please refer to the Equations 9.68 and 9.69 on The NURBS Book (2nd Edition), p.412 for details.
:param degree: degree
:type degree: int
:param num_dpts: number of data points
:type num_dpts: int
:p... | def compute_knot_vector2(degree, num_dpts, num_cpts, params):
""" Computes a knot vector ensuring that every knot span has at least one :math:`\\overline{u}_{k}`.
Please refer to the Equations 9.68 and 9.69 on The NURBS Book (2nd Edition), p.412 for details.
:param degree: degree
:type degree: int
... |
Computes :math:`\\overline{u}_{k}` for curves.
Please refer to the Equations 9.4 and 9.5 for chord length parametrization, and Equation 9.6 for centripetal method
on The NURBS Book (2nd Edition), pp.364-365.
:param points: data points
:type points: list, tuple
:param centripetal: activates centrip... | def compute_params_curve(points, centripetal=False):
""" Computes :math:`\\overline{u}_{k}` for curves.
Please refer to the Equations 9.4 and 9.5 for chord length parametrization, and Equation 9.6 for centripetal method
on The NURBS Book (2nd Edition), pp.364-365.
:param points: data points
:type ... |
Computes :math:`\\overline{u}_{k}` and :math:`\\overline{u}_{l}` for surfaces.
The data points array has a row size of ``size_v`` and column size of ``size_u`` and it is 1-dimensional. Please
refer to The NURBS Book (2nd Edition), pp.366-367 for details on how to compute :math:`\\overline{u}_{k}` and
:math... | def compute_params_surface(points, size_u, size_v, centripetal=False):
""" Computes :math:`\\overline{u}_{k}` and :math:`\\overline{u}_{l}` for surfaces.
The data points array has a row size of ``size_v`` and column size of ``size_u`` and it is 1-dimensional. Please
refer to The NURBS Book (2nd Edition), p... |
Applies global interpolation to the set of data points to find control points.
:param coeff_matrix: coefficient matrix
:type coeff_matrix: list, tuple
:param points: data points
:type points: list, tuple
:return: control points
:rtype: list | def ginterp(coeff_matrix, points):
""" Applies global interpolation to the set of data points to find control points.
:param coeff_matrix: coefficient matrix
:type coeff_matrix: list, tuple
:param points: data points
:type points: list, tuple
:return: control points
:rtype: list
"""
... |
Builds the coefficient matrix for global interpolation.
This function only uses data points to build the coefficient matrix. Please refer to The NURBS Book (2nd Edition),
pp364-370 for details.
:param degree: degree
:type degree: int
:param knotvector: knot vector
:type knotvector: list, tuple... | def _build_coeff_matrix(degree, knotvector, params, points):
""" Builds the coefficient matrix for global interpolation.
This function only uses data points to build the coefficient matrix. Please refer to The NURBS Book (2nd Edition),
pp364-370 for details.
:param degree: degree
:type degree: int... |
Creates VTK render window with an interactor.
:param actors: list of VTK actors
:type actors: list, tuple
:param callbacks: callback functions for registering custom events
:type callbacks: dict | def create_render_window(actors, callbacks, **kwargs):
""" Creates VTK render window with an interactor.
:param actors: list of VTK actors
:type actors: list, tuple
:param callbacks: callback functions for registering custom events
:type callbacks: dict
"""
# Get keyword arguments
figur... |
Creates VTK-compatible RGB color from a color string.
:param color: color
:type color: str
:return: RGB color values
:rtype: list | def create_color(color):
""" Creates VTK-compatible RGB color from a color string.
:param color: color
:type color: str
:return: RGB color values
:rtype: list
"""
if color[0] == "#":
# Convert hex string to RGB
return [int(color[i:i + 2], 16) / 255 for i in range(1, 7, 2)]
... |
Creates a VTK actor for rendering scatter plots.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | def create_actor_pts(pts, color, **kwargs):
""" Creates a VTK actor for rendering scatter plots.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name = kwargs.get('name', ... |
Creates a VTK actor for rendering polygons.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | def create_actor_polygon(pts, color, **kwargs):
""" Creates a VTK actor for rendering polygons.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name = kwargs.get('name', "... |
Creates a VTK actor for rendering quadrilateral plots.
:param pts: points
:type pts: vtkFloatArray
:param lines: point connectivity information
:type lines: vtkIntArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | def create_actor_mesh(pts, lines, color, **kwargs):
""" Creates a VTK actor for rendering quadrilateral plots.
:param pts: points
:type pts: vtkFloatArray
:param lines: point connectivity information
:type lines: vtkIntArray
:param color: actor color
:type color: list
:return: a VTK act... |
Creates a VTK actor for rendering triangulated surface plots.
:param pts: points
:type pts: vtkFloatArray
:param tris: list of triangle indices
:type tris: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | def create_actor_tri(pts, tris, color, **kwargs):
""" Creates a VTK actor for rendering triangulated surface plots.
:param pts: points
:type pts: vtkFloatArray
:param tris: list of triangle indices
:type tris: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
... |
Creates a VTK actor for rendering voxels using hexahedron elements.
:param grid: grid
:type grid: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor | def create_actor_hexahedron(grid, color, **kwargs):
""" Creates a VTK actor for rendering voxels using hexahedron elements.
:param grid: grid
:type grid: ndarray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name ... |
Creates a VTK actor for rendering triangulated plots using Delaunay triangulation.
Keyword Arguments:
* ``d3d``: flag to choose between Delaunay2D (``False``) and Delaunay3D (``True``). *Default: False*
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list... | def create_actor_delaunay(pts, color, **kwargs):
""" Creates a VTK actor for rendering triangulated plots using Delaunay triangulation.
Keyword Arguments:
* ``d3d``: flag to choose between Delaunay2D (``False``) and Delaunay3D (``True``). *Default: False*
:param pts: points
:type pts: vtkFloat... |
Flips a list of 1-dimensional control points from u-row order to v-row order.
**u-row order**: each row corresponds to a list of u values
**v-row order**: each row corresponds to a list of v values
:param ctrlpts: control points in u-row order
:type ctrlpts: list, tuple
:param size_u: size in u-d... | def flip_ctrlpts_u(ctrlpts, size_u, size_v):
""" Flips a list of 1-dimensional control points from u-row order to v-row order.
**u-row order**: each row corresponds to a list of u values
**v-row order**: each row corresponds to a list of v values
:param ctrlpts: control points in u-row order
:typ... |
Flips a list of surface 2-D control points from *[u][v]* to *[v][u]* order.
:param ctrlpts2d: 2-D control points
:type ctrlpts2d: list, tuple
:param size_u: size in U-direction (row length)
:type size_u: int
:param size_v: size in V-direction (column length)
:type size_v: int
:return: flipp... | def flip_ctrlpts2d(ctrlpts2d, size_u=0, size_v=0):
""" Flips a list of surface 2-D control points from *[u][v]* to *[v][u]* order.
:param ctrlpts2d: 2-D control points
:type ctrlpts2d: list, tuple
:param size_u: size in U-direction (row length)
:type size_u: int
:param size_v: size in V-directi... |
Generates weighted control points from unweighted ones in 1-D.
This function
#. Takes in a 1-D control points list whose coordinates are organized in (x, y, z, w) format
#. converts into (x*w, y*w, z*w, w) format
#. Returns the result
:param ctrlpts: 1-D control points (P)
:type ctrlpts: list... | def generate_ctrlptsw(ctrlpts):
""" Generates weighted control points from unweighted ones in 1-D.
This function
#. Takes in a 1-D control points list whose coordinates are organized in (x, y, z, w) format
#. converts into (x*w, y*w, z*w, w) format
#. Returns the result
:param ctrlpts: 1-D co... |
Generates unweighted control points from weighted ones in 1-D.
This function
#. Takes in 1-D control points list whose coordinates are organized in (x*w, y*w, z*w, w) format
#. Converts the input control points list into (x, y, z, w) format
#. Returns the result
:param ctrlpts: 1-D control points... | def generate_ctrlpts_weights(ctrlpts):
""" Generates unweighted control points from weighted ones in 1-D.
This function
#. Takes in 1-D control points list whose coordinates are organized in (x*w, y*w, z*w, w) format
#. Converts the input control points list into (x, y, z, w) format
#. Returns the... |
Generates unweighted control points from weighted ones in 2-D.
This function
#. Takes in 2-D control points list whose coordinates are organized like (x*w, y*w, z*w, w)
#. Converts the input control points list into (x, y, z, w) format
#. Returns the result
:param ctrlpts2d: 2-D control points (P... | def generate_ctrlpts2d_weights(ctrlpts2d):
""" Generates unweighted control points from weighted ones in 2-D.
This function
#. Takes in 2-D control points list whose coordinates are organized like (x*w, y*w, z*w, w)
#. Converts the input control points list into (x, y, z, w) format
#. Returns the ... |
Multiplies control points by the weights to generate weighted control points.
This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
The ``weights`` function parameter can be set to None to let the function generate a weights vector composed of
1.0 value... | def combine_ctrlpts_weights(ctrlpts, weights=None):
""" Multiplies control points by the weights to generate weighted control points.
This function is dimension agnostic, i.e. control points can be in any dimension but weights should be 1D.
The ``weights`` function parameter can be set to None to let the ... |
Divides weighted control points by weights to generate unweighted control points and weights vector.
This function is dimension agnostic, i.e. control points can be in any dimension but the last element of the array
should indicate the weight.
:param ctrlptsw: weighted control points
:type ctrlptsw: l... | def separate_ctrlpts_weights(ctrlptsw):
""" Divides weighted control points by weights to generate unweighted control points and weights vector.
This function is dimension agnostic, i.e. control points can be in any dimension but the last element of the array
should indicate the weight.
:param ctrlpts... |
Flips u and v directions of a 2D control points file and saves flipped coordinates to a file.
:param file_in: name of the input file (to be read)
:type file_in: str
:param file_out: name of the output file (to be saved)
:type file_out: str
:raises IOError: an error occurred reading or writing the f... | def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'):
""" Flips u and v directions of a 2D control points file and saves flipped coordinates to a file.
:param file_in: name of the input file (to be read)
:type file_in: str
:param file_out: name of the output file (to be saved)
:type fil... |
Generates unweighted control points from weighted ones in 2-D.
#. Takes in 2-D control points list whose coordinates are organized like (x*w, y*w, z*w, w)
#. Converts the input control points list into (x, y, z, w) format
#. Saves the result to a file
:param file_in: name of the input file (to be read... | def generate_ctrlpts2d_weights_file(file_in='', file_out='ctrlpts_weights.txt'):
""" Generates unweighted control points from weighted ones in 2-D.
#. Takes in 2-D control points list whose coordinates are organized like (x*w, y*w, z*w, w)
#. Converts the input control points list into (x, y, z, w) format
... |
VTK callback for keypress events.
Keypress events:
* ``e``: exit the application
* ``p``: pick object (hover the mouse and then press to pick)
* ``f``: fly to point (click somewhere in the window and press to fly)
* ``r``: reset the camera
* ``s`` and... | def keypress_callback(self, obj, ev):
""" VTK callback for keypress events.
Keypress events:
* ``e``: exit the application
* ``p``: pick object (hover the mouse and then press to pick)
* ``f``: fly to point (click somewhere in the window and press to fly)
... |
Plots the curve and the control points polygon. | def render(self, **kwargs):
""" Plots the curve and the control points polygon. """
# Calling parent function
super(VisCurve3D, self).render(**kwargs)
# Initialize a list to store VTK actors
vtk_actors = []
# Start plotting
for plot in self._plots:
#... |
Plots the surface and the control points grid. | def render(self, **kwargs):
""" Plots the surface and the control points grid. """
# Calling parent function
super(VisSurface, self).render(**kwargs)
# Initialize a list to store VTK actors
vtk_actors = []
# Start plotting
for plot in self._plots:
# ... |
Plots the volume and the control points. | def render(self, **kwargs):
""" Plots the volume and the control points. """
# Calling parent function
super(VisVoxel, self).render(**kwargs)
# Initialize a list to store VTK actors
vtk_actors = []
# Start plotting
for plot in self._plots:
# Plot con... |
Single-threaded ins and outs finding (default)
:param voxel_grid: voxel grid
:param datapts: data points
:return: in-outs | def find_inouts_st(voxel_grid, datapts, **kwargs):
""" Single-threaded ins and outs finding (default)
:param voxel_grid: voxel grid
:param datapts: data points
:return: in-outs
"""
tol = kwargs.get('tol', 10e-8)
filled = [0 for _ in range(len(voxel_grid))]
for idx, bb in enumerate(voxel... |
Multi-threaded ins and outs finding (using multiprocessing)
:param voxel_grid: voxel grid
:param datapts: data points
:return: in-outs | def find_inouts_mp(voxel_grid, datapts, **kwargs):
""" Multi-threaded ins and outs finding (using multiprocessing)
:param voxel_grid: voxel grid
:param datapts: data points
:return: in-outs
"""
tol = kwargs.get('tol', 10e-8)
num_procs = kwargs.get('num_procs', 4)
with pool_context(proce... |
Generates the voxel grid with the desired size.
:param bbox: bounding box
:type bbox: list, tuple
:param szval: size in x-, y-, z-directions
:type szval: list, tuple
:param use_cubes: use cube voxels instead of cuboid ones
:type use_cubes: bool
:return: voxel grid
:rtype: list | def generate_voxel_grid(bbox, szval, use_cubes=False):
""" Generates the voxel grid with the desired size.
:param bbox: bounding box
:type bbox: list, tuple
:param szval: size in x-, y-, z-directions
:type szval: list, tuple
:param use_cubes: use cube voxels instead of cuboid ones
:type use... |
Finds if any point is contained inside the voxel boundaries (inouts array).
Ref: https://math.stackexchange.com/a/1552579
:param bbox: bounding box of the voxel
:type bbox: list, tuple
:param ptsarr: points to be checked
:type ptsarr: list, tuple
:return: list of ins and outs
:rtype: list | def is_point_inside_voxel(bbox, ptsarr, **kwargs):
""" Finds if any point is contained inside the voxel boundaries (inouts array).
Ref: https://math.stackexchange.com/a/1552579
:param bbox: bounding box of the voxel
:type bbox: list, tuple
:param ptsarr: points to be checked
:type ptsarr: list... |
Process Jinja2 template input
:param file_src: file contents
:type file_src: str | def process_template(file_src):
""" Process Jinja2 template input
:param file_src: file contents
:type file_src: str
"""
def tmpl_sqrt(x):
""" Square-root of 'x' """
return math.sqrt(x)
def tmpl_cubert(x):
""" Cube-root of 'x' """
return x ** (1.0 / 3.0) if x >=... |
Generates a NURBS surface object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS surface
:rtype: NURBS.Surface | def import_surf_mesh(file_name):
""" Generates a NURBS surface object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS surface
:rtype: NURBS.Surface
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
... |
Generates a NURBS volume object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS volume
:rtype: NURBS.Volume | def import_vol_mesh(file_name):
""" Generates a NURBS volume object from a mesh file.
:param file_name: input mesh file
:type file_name: str
:return: a NURBS volume
:rtype: NURBS.Volume
"""
raw_content = read_file(file_name)
raw_content = raw_content.split("\n")
content = []
for... |
Reads control points from a text file and generates a 1-dimensional list of control points.
The following code examples illustrate importing different types of text files for curves and surfaces:
.. code-block:: python
:linenos:
# Import curve control points from a text file
curve_ctr... | def import_txt(file_name, two_dimensional=False, **kwargs):
""" Reads control points from a text file and generates a 1-dimensional list of control points.
The following code examples illustrate importing different types of text files for curves and surfaces:
.. code-block:: python
:linenos:
... |
Exports control points as a text file.
For curves the output is always a list of control points. For surfaces, it is possible to generate a 2-dimensional
control point output file using ``two_dimensional``.
Please see :py:func:`.exchange.import_txt()` for detailed description of the keyword arguments.
... | def export_txt(obj, file_name, two_dimensional=False, **kwargs):
""" Exports control points as a text file.
For curves the output is always a list of control points. For surfaces, it is possible to generate a 2-dimensional
control point output file using ``two_dimensional``.
Please see :py:func:`.exch... |
Reads control points from a CSV file and generates a 1-dimensional list of control points.
It is possible to use a different value separator via ``separator`` keyword argument. The following code segment
illustrates the usage of ``separator`` keyword argument.
.. code-block:: python
:linenos:
... | def import_csv(file_name, **kwargs):
""" Reads control points from a CSV file and generates a 1-dimensional list of control points.
It is possible to use a different value separator via ``separator`` keyword argument. The following code segment
illustrates the usage of ``separator`` keyword argument.
... |
Exports control points or evaluated points as a CSV file.
:param obj: a spline geometry object
:type obj: abstract.SplineGeometry
:param file_name: output file name
:type file_name: str
:param point_type: ``ctrlpts`` for control points or ``evalpts`` for evaluated points
:type point_type: str
... | def export_csv(obj, file_name, point_type='evalpts', **kwargs):
""" Exports control points or evaluated points as a CSV file.
:param obj: a spline geometry object
:type obj: abstract.SplineGeometry
:param file_name: output file name
:type file_name: str
:param point_type: ``ctrlpts`` for contro... |
Imports curves and surfaces from files in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type fil... | def import_cfg(file_name, **kwargs):
""" Imports curves and surfaces from files in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param fi... |
Exports curves and surfaces in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Libconfig format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:pa... | def export_cfg(obj, file_name):
""" Exports curves and surfaces in libconfig format.
.. note::
Requires `libconf <https://pypi.org/project/libconf/>`_ package.
Libconfig format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sh... |
Imports curves and surfaces from files in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type ... | def import_yaml(file_name, **kwargs):
""" Imports curves and surfaces from files in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:para... |
Exports curves and surfaces in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
YAML format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:para... | def export_yaml(obj, file_name):
""" Exports curves and surfaces in YAML format.
.. note::
Requires `ruamel.yaml <https://pypi.org/project/ruamel.yaml/>`_ package.
YAML format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input sha... |
Imports curves and surfaces from files in JSON format.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type file_name: str
:return: a list of rational spline geometries
:rtype: list
:raises Geo... | def import_json(file_name, **kwargs):
""" Imports curves and surfaces from files in JSON format.
Use ``jinja2=True`` to activate Jinja2 template processing. Please refer to the documentation for details.
:param file_name: name of the input file
:type file_name: str
:return: a list of rational spli... |
Exports curves and surfaces in JSON format.
JSON format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:param obj: input geometry
:type obj: abstract.SplineGeometry, multi.AbstractContainer
:param ... | def export_json(obj, file_name):
""" Exports curves and surfaces in JSON format.
JSON format is also used by the `geomdl command-line application <https://github.com/orbingol/geomdl-cli>`_
as a way to input shape data from the command line.
:param obj: input geometry
:type obj: abstract.SplineGeom... |
Reads .obj files and generates faces.
Keyword Arguments:
* ``callback``: reference to the function that processes the faces for customized output
The structure of the callback function is shown below:
.. code-block:: python
def my_callback_function(face_list):
# "face_list" w... | def import_obj(file_name, **kwargs):
""" Reads .obj files and generates faces.
Keyword Arguments:
* ``callback``: reference to the function that processes the faces for customized output
The structure of the callback function is shown below:
.. code-block:: python
def my_callback_fun... |
Exports surface(s) as a .obj file.
Keyword Arguments:
* ``vertex_spacing``: size of the triangle edge in terms of surface points sampled. *Default: 2*
* ``vertex_normals``: if True, then computes vertex normals. *Default: False*
* ``parametric_vertices``: if True, then adds parameter space ... | def export_obj(surface, file_name, **kwargs):
""" Exports surface(s) as a .obj file.
Keyword Arguments:
* ``vertex_spacing``: size of the triangle edge in terms of surface points sampled. *Default: 2*
* ``vertex_normals``: if True, then computes vertex normals. *Default: False*
* ``para... |
Exports surface(s) as a .obj file (string).
Keyword Arguments:
* ``vertex_spacing``: size of the triangle edge in terms of surface points sampled. *Default: 2*
* ``vertex_normals``: if True, then computes vertex normals. *Default: False*
* ``parametric_vertices``: if True, then adds paramet... | def export_obj_str(surface, **kwargs):
""" Exports surface(s) as a .obj file (string).
Keyword Arguments:
* ``vertex_spacing``: size of the triangle edge in terms of surface points sampled. *Default: 2*
* ``vertex_normals``: if True, then computes vertex normals. *Default: False*
* ``pa... |
Exports surface(s) as a .stl file in plain text or binary format.
Keyword Arguments:
* ``binary``: flag to generate a binary STL file. *Default: True*
* ``vertex_spacing``: size of the triangle edge in terms of points sampled on the surface. *Default: 1*
* ``update_delta``: use multi-surfac... | def export_stl(surface, file_name, **kwargs):
""" Exports surface(s) as a .stl file in plain text or binary format.
Keyword Arguments:
* ``binary``: flag to generate a binary STL file. *Default: True*
* ``vertex_spacing``: size of the triangle edge in terms of points sampled on the surface. *De... |
Exports surface(s) as a .stl file in plain text or binary format (string).
Keyword Arguments:
* ``binary``: flag to generate a binary STL file. *Default: False*
* ``vertex_spacing``: size of the triangle edge in terms of points sampled on the surface. *Default: 1*
* ``update_delta``: use mu... | def export_stl_str(surface, **kwargs):
""" Exports surface(s) as a .stl file in plain text or binary format (string).
Keyword Arguments:
* ``binary``: flag to generate a binary STL file. *Default: False*
* ``vertex_spacing``: size of the triangle edge in terms of points sampled on the surface. ... |
Exports surface(s) as a .off file.
Keyword Arguments:
* ``vertex_spacing``: size of the triangle edge in terms of points sampled on the surface. *Default: 1*
* ``update_delta``: use multi-surface evaluation delta for all surfaces. *Default: True*
:param surface: surface or surfaces to be saved... | def export_off(surface, file_name, **kwargs):
""" Exports surface(s) as a .off file.
Keyword Arguments:
* ``vertex_spacing``: size of the triangle edge in terms of points sampled on the surface. *Default: 1*
* ``update_delta``: use multi-surface evaluation delta for all surfaces. *Default: True... |
Exports surface(s) as a .off file (string).
Keyword Arguments:
* ``vertex_spacing``: size of the triangle edge in terms of points sampled on the surface. *Default: 1*
* ``update_delta``: use multi-surface evaluation delta for all surfaces. *Default: True*
:param surface: surface or surfaces to... | def export_off_str(surface, **kwargs):
""" Exports surface(s) as a .off file (string).
Keyword Arguments:
* ``vertex_spacing``: size of the triangle edge in terms of points sampled on the surface. *Default: 1*
* ``update_delta``: use multi-surface evaluation delta for all surfaces. *Default: Tr... |
Generates NURBS surface(s) from surface mesh (smesh) file(s).
*smesh* files are some text files which contain a set of NURBS surfaces. Each file in the set corresponds to one
NURBS surface. Most of the time, you receive multiple *smesh* files corresponding to an complete object composed of
several NURBS su... | def import_smesh(file):
""" Generates NURBS surface(s) from surface mesh (smesh) file(s).
*smesh* files are some text files which contain a set of NURBS surfaces. Each file in the set corresponds to one
NURBS surface. Most of the time, you receive multiple *smesh* files corresponding to an complete object ... |
Exports surface(s) as surface mesh (smesh) files.
Please see :py:func:`.import_smesh()` for details on the file format.
:param surface: surface(s) to be exported
:type surface: abstract.Surface or multi.SurfaceContainer
:param file_name: name of the output file
:type file_name: str
:raises Geo... | def export_smesh(surface, file_name, **kwargs):
""" Exports surface(s) as surface mesh (smesh) files.
Please see :py:func:`.import_smesh()` for details on the file format.
:param surface: surface(s) to be exported
:type surface: abstract.Surface or multi.SurfaceContainer
:param file_name: name of ... |
Imports NURBS volume(s) from volume mesh (vmesh) file(s).
:param file: path to a directory containing mesh files or a single mesh file
:type file: str
:return: list of NURBS volumes
:rtype: list
:raises GeomdlException: an error occurred reading the file | def import_vmesh(file):
""" Imports NURBS volume(s) from volume mesh (vmesh) file(s).
:param file: path to a directory containing mesh files or a single mesh file
:type file: str
:return: list of NURBS volumes
:rtype: list
:raises GeomdlException: an error occurred reading the file
"""
... |
Exports volume(s) as volume mesh (vmesh) files.
:param volume: volume(s) to be exported
:type volume: abstract.Volume
:param file_name: name of the output file
:type file_name: str
:raises GeomdlException: an error occurred writing the file | def export_vmesh(volume, file_name, **kwargs):
""" Exports volume(s) as volume mesh (vmesh) files.
:param volume: volume(s) to be exported
:type volume: abstract.Volume
:param file_name: name of the output file
:type file_name: str
:raises GeomdlException: an error occurred writing the file
... |
Plots the curve and the control points polygon. | def render(self, **kwargs):
""" Plots the curve and the control points polygon. """
# Calling parent function
super(VisCurve2D, self).render(**kwargs)
# Initialize variables
plot_data = []
for plot in self._plots:
pts = np.array(plot['ptsarr'], dtype=self.vc... |
Selects item color for plotting.
:param cpcolor: color for control points grid item
:type cpcolor: str, list, tuple
:param evalcolor: color for evaluated points grid item
:type evalcolor: str, list, tuple
:param idx: index of the current geometry object
:type idx: int
:return: a list of col... | def select_color(cpcolor, evalcolor, idx=0):
""" Selects item color for plotting.
:param cpcolor: color for control points grid item
:type cpcolor: str, list, tuple
:param evalcolor: color for evaluated points grid item
:type evalcolor: str, list, tuple
:param idx: index of the current geometry... |
Tessellates surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param update_delta: flag to control evaluation delta updates
:type update_delta: bool
:param delta: evaluation delta
:type delta: list, tuple
:return: upd... | def process_tessellate(elem, update_delta, delta, **kwargs):
""" Tessellates surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param update_delta: flag to control evaluation delta updates
:type update_delta: bool
:param ... |
Processes visualization elements for surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param mconf: visualization module configuration
:type mconf: dict
:param colorval: color values
:type colorval: tuple
:param idx:... | def process_elements_surface(elem, mconf, colorval, idx, force_tsl, update_delta, delta, reset_names):
""" Processes visualization elements for surfaces.
.. note:: Helper function required for ``multiprocessing``
:param elem: surface
:type elem: abstract.Surface
:param mconf: visualization module ... |
Finds the span of the knot over the input knot vector using binary search.
Implementation of Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
The NURBS Book states that the knot span index always starts from zero, i.e. for a knot vector [0, 0, 1, 1];
if FindSpan returns 1, then the knot is between th... | def find_span_binsearch(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of the knot over the input knot vector using binary search.
Implementation of Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
The NURBS Book states that the knot span index always starts from zero, i.e. for... |
Finds the span of a single knot over the knot vector using linear search.
Alternative implementation for the Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param... | def find_span_linear(degree, knot_vector, num_ctrlpts, knot, **kwargs):
""" Finds the span of a single knot over the knot vector using linear search.
Alternative implementation for the Algorithm A2.1 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param k... |
Finds spans of a list of knots over the knot vector.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param num_ctrlpts: number of control points, :math:`n + 1`
:type num_ctrlpts: int
:param knots: list of knots or... | def find_spans(degree, knot_vector, num_ctrlpts, knots, func=find_span_linear):
""" Finds spans of a list of knots over the knot vector.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param num_ctrlpts: number of con... |
Finds knot multiplicity over the knot vector.
Keyword Arguments:
* ``tol``: tolerance (delta) value for equality checking
:param knot: knot or parameter, :math:`u`
:type knot: float
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:return: knot multiplicity, :m... | def find_multiplicity(knot, knot_vector, **kwargs):
""" Finds knot multiplicity over the knot vector.
Keyword Arguments:
* ``tol``: tolerance (delta) value for equality checking
:param knot: knot or parameter, :math:`u`
:type knot: float
:param knot_vector: knot vector, :math:`U`
:type... |
Computes the non-vanishing basis functions for a single parameter.
Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param span: knot span, :math:... | def basis_function(degree, knot_vector, span, knot):
""" Computes the non-vanishing basis functions for a single parameter.
Implementation of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:typ... |
Computes the non-vanishing basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:type spans: list, tuple
:param knots: list of knots or paramet... | def basis_functions(degree, knot_vector, spans, knots):
""" Computes the non-vanishing basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:typ... |
Computes all non-zero basis functions of all degrees from 0 up to the input degree for a single parameter.
A slightly modified version of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_... | def basis_function_all(degree, knot_vector, span, knot):
""" Computes all non-zero basis functions of all degrees from 0 up to the input degree for a single parameter.
A slightly modified version of Algorithm A2.2 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: in... |
Computes derivatives of the basis functions for a single parameter.
Implementation of Algorithm A2.3 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param span: knot span, :math... | def basis_function_ders(degree, knot_vector, span, knot, order):
""" Computes derivatives of the basis functions for a single parameter.
Implementation of Algorithm A2.3 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math... |
Computes derivatives of the basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot spans
:type spans: list, tuple
:param knots: list of knots or parame... | def basis_functions_ders(degree, knot_vector, spans, knots, order):
""" Computes derivatives of the basis functions for a list of parameters.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector, :math:`U`
:type knot_vector: list, tuple
:param spans: list of knot s... |
Computes the value of a basis function for a single parameter.
Implementation of Algorithm 2.4 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector
:type knot_vector: list, tuple
:param span: knot span, :math:`i`
:type sp... | def basis_function_one(degree, knot_vector, span, knot):
""" Computes the value of a basis function for a single parameter.
Implementation of Algorithm 2.4 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot vector
:type knot_vecto... |
Computes the derivative of one basis functions for a single parameter.
Implementation of Algorithm A2.5 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot_vector, :math:`U`
:type knot_vector: list, tuple
:param span: knot span, :m... | def basis_function_ders_one(degree, knot_vector, span, knot, order):
""" Computes the derivative of one basis functions for a single parameter.
Implementation of Algorithm A2.5 from The NURBS Book by Piegl & Tiller.
:param degree: degree, :math:`p`
:type degree: int
:param knot_vector: knot_vector... |
Computes the control points of the rational/non-rational spline after knot insertion.
Part of Algorithm A5.1 of The NURBS Book by Piegl & Tiller, 2nd Edition.
Keyword Arguments:
* ``num``: number of knot insertions. *Default: 1*
* ``s``: multiplicity of the knot. *Default: computed via :func:`... | def knot_insertion(degree, knotvector, ctrlpts, u, **kwargs):
""" Computes the control points of the rational/non-rational spline after knot insertion.
Part of Algorithm A5.1 of The NURBS Book by Piegl & Tiller, 2nd Edition.
Keyword Arguments:
* ``num``: number of knot insertions. *Default: 1*
... |
Computes :math:`\\alpha` coefficient for knot insertion algorithm.
:param u: knot
:type u: float
:param knotvector: knot vector
:type knotvector: tuple
:param span: knot span
:type span: int
:param idx: index value (degree-dependent)
:type idx: int
:param leg: i-th leg of the contro... | def knot_insertion_alpha(u, knotvector, span, idx, leg):
""" Computes :math:`\\alpha` coefficient for knot insertion algorithm.
:param u: knot
:type u: float
:param knotvector: knot vector
:type knotvector: tuple
:param span: knot span
:type span: int
:param idx: index value (degree-dep... |
Computes the knot vector of the rational/non-rational spline after knot insertion.
Part of Algorithm A5.1 of The NURBS Book by Piegl & Tiller, 2nd Edition.
:param knotvector: knot vector
:type knotvector: list, tuple
:param u: knot
:type u: float
:param span: knot span
:type span: int
... | def knot_insertion_kv(knotvector, u, span, r):
""" Computes the knot vector of the rational/non-rational spline after knot insertion.
Part of Algorithm A5.1 of The NURBS Book by Piegl & Tiller, 2nd Edition.
:param knotvector: knot vector
:type knotvector: list, tuple
:param u: knot
:type u: fl... |
Computes the control points of the rational/non-rational spline after knot removal.
Implementation based on Algorithm A5.8 and Equation 5.28 of The NURBS Book by Piegl & Tiller
Keyword Arguments:
* ``num``: number of knot removals
:param degree: degree
:type degree: int
:param knotvector:... | def knot_removal(degree, knotvector, ctrlpts, u, **kwargs):
""" Computes the control points of the rational/non-rational spline after knot removal.
Implementation based on Algorithm A5.8 and Equation 5.28 of The NURBS Book by Piegl & Tiller
Keyword Arguments:
* ``num``: number of knot removals
... |
Computes :math:`\\alpha_{i}` coefficient for knot removal algorithm.
Please refer to Eq. 5.29 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.184 for details.
:param u: knot
:type u: float
:param degree: degree
:type degree: int
:param knotvector: knot vector
:type knotvector: tuple
... | def knot_removal_alpha_i(u, degree, knotvector, num, idx):
""" Computes :math:`\\alpha_{i}` coefficient for knot removal algorithm.
Please refer to Eq. 5.29 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.184 for details.
:param u: knot
:type u: float
:param degree: degree
:type degree: in... |
Computes :math:`\\alpha_{j}` coefficient for knot removal algorithm.
Please refer to Eq. 5.29 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.184 for details.
:param u: knot
:type u: float
:param degree: degree
:type degree: int
:param knotvector: knot vector
:type knotvector: tuple
... | def knot_removal_alpha_j(u, degree, knotvector, num, idx):
""" Computes :math:`\\alpha_{j}` coefficient for knot removal algorithm.
Please refer to Eq. 5.29 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.184 for details.
:param u: knot
:type u: float
:param degree: degree
:type degree: in... |
Computes the knot vector of the rational/non-rational spline after knot removal.
Part of Algorithm A5.8 of The NURBS Book by Piegl & Tiller, 2nd Edition.
:param knotvector: knot vector
:type knotvector: list, tuple
:param span: knot span
:type span: int
:param r: number of knot removals
:t... | def knot_removal_kv(knotvector, span, r):
""" Computes the knot vector of the rational/non-rational spline after knot removal.
Part of Algorithm A5.8 of The NURBS Book by Piegl & Tiller, 2nd Edition.
:param knotvector: knot vector
:type knotvector: list, tuple
:param span: knot span
:type span... |
Computes the knot vector and the control points of the rational/non-rational spline after knot refinement.
Implementation of Algorithm A5.4 of The NURBS Book by Piegl & Tiller, 2nd Edition.
The algorithm automatically find the knots to be refined, i.e. the middle knots in the knot vector, and their
multip... | def knot_refinement(degree, knotvector, ctrlpts, **kwargs):
""" Computes the knot vector and the control points of the rational/non-rational spline after knot refinement.
Implementation of Algorithm A5.4 of The NURBS Book by Piegl & Tiller, 2nd Edition.
The algorithm automatically find the knots to be ref... |
Computes the control points of the rational/non-rational spline after degree elevation.
Implementation of Eq. 5.36 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.205
Keyword Arguments:
* ``num``: number of degree elevations
Please note that degree elevation algorithm can only operate on Bezi... | def degree_elevation(degree, ctrlpts, **kwargs):
""" Computes the control points of the rational/non-rational spline after degree elevation.
Implementation of Eq. 5.36 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.205
Keyword Arguments:
* ``num``: number of degree elevations
Please note... |
Computes the control points of the rational/non-rational spline after degree reduction.
Implementation of Eqs. 5.41 and 5.42 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.220
Please note that degree reduction algorithm can only operate on Bezier shapes, i.e. curves, surfaces, volumes and
this implem... | def degree_reduction(degree, ctrlpts, **kwargs):
""" Computes the control points of the rational/non-rational spline after degree reduction.
Implementation of Eqs. 5.41 and 5.42 of The NURBS Book by Piegl & Tiller, 2nd Edition, p.220
Please note that degree reduction algorithm can only operate on Bezier s... |
Computes the control points of all derivative curves up to and including the {degree}-th derivative.
Implementation of Algorithm A3.3 from The NURBS Book by Piegl & Tiller.
Output is PK[k][i], i-th control point of the k-th derivative curve where 0 <= k <= degree and r1 <= i <= r2-k. | def derivatives_ctrlpts(**kwargs):
""" Computes the control points of all derivative curves up to and including the {degree}-th derivative.
Implementation of Algorithm A3.3 from The NURBS Book by Piegl & Tiller.
Output is PK[k][i], i-th control point of the k-th derivative curve where 0 <= k <... |
Evaluates the derivatives at the input parameter. | def derivatives(self, **kwargs):
""" Evaluates the derivatives at the input parameter. """
# Call parent method
super(CurveEvaluator2, self).derivatives(**kwargs)
param = kwargs.get('parameter')
deriv_order = kwargs.get('deriv_order', 0)
degree = kwargs.get('degree')
... |
Computes the control points of all derivative surfaces up to and including the {degree}-th derivative.
Output is PKL[k][l][i][j], i,j-th control point of the surface differentiated k times w.r.t to u and
l times w.r.t v. | def derivatives_ctrlpts(**kwargs):
""" Computes the control points of all derivative surfaces up to and including the {degree}-th derivative.
Output is PKL[k][l][i][j], i,j-th control point of the surface differentiated k times w.r.t to u and
l times w.r.t v.
"""
r1 = kwargs.get... |
Evaluates the derivatives at the input parameter. | def derivatives(self, **kwargs):
""" Evaluates the derivatives at the input parameter. """
deriv_order = kwargs.get('deriv_order')
param = kwargs.get('parameter')
degree = kwargs.get('degree')
knotvector = kwargs.get('knotvector')
ctrlpts_size = kwargs.get('ctrlpts_size')... |
Sets equal aspect ratio across the three axes of a 3D plot.
Contributed by Xuefeng Zhao.
:param ax: a Matplotlib axis, e.g., as output from plt.gca(). | def set_axes_equal(ax):
""" Sets equal aspect ratio across the three axes of a 3D plot.
Contributed by Xuefeng Zhao.
:param ax: a Matplotlib axis, e.g., as output from plt.gca().
"""
bounds = [ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()]
ranges = [abs(bound[1] - b... |
Plots the 2D curve and the control points polygon. | def render(self, **kwargs):
""" Plots the 2D curve and the control points polygon. """
# Calling parent function
super(VisCurve2D, self).render(**kwargs)
# Initialize variables
legend_proxy = []
legend_names = []
# Draw control points polygon and the curve
... |
Animates the surface.
This function only animates the triangulated surface. There will be no other elements, such as control points
grid or bounding box.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps are a visualization feature of Matplotlib.... | def animate(self, **kwargs):
""" Animates the surface.
This function only animates the triangulated surface. There will be no other elements, such as control points
grid or bounding box.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps a... |
Plots the surface and the control points grid.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps are a visualization feature of Matplotlib. They can be used for several types of surface plots via
the following import statement: ``from matplotlib import cm... | def render(self, **kwargs):
""" Plots the surface and the control points grid.
Keyword arguments:
* ``colormap``: applies colormap to the surface
Colormaps are a visualization feature of Matplotlib. They can be used for several types of surface plots via
the following impor... |
Plots the volume and the control points. | def render(self, **kwargs):
""" Plots the volume and the control points. """
# Calling parent function
super(VisVolume, self).render(**kwargs)
# Initialize variables
legend_proxy = []
legend_names = []
# Start plotting of the surface and the control points grid
... |
Displays the voxels and the control points. | def render(self, **kwargs):
""" Displays the voxels and the control points. """
# Calling parent function
super(VisVoxel, self).render(**kwargs)
# Initialize variables
legend_proxy = []
legend_names = []
# Start plotting of the surface and the control points gri... |
Evaluates the curve tangent vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
:... | def tangent_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve tangent vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned v... |
Evaluates the curve normal vector at the input parameter, u.
Curve normal is calculated from the 2nd derivative of the curve at the input parameter, u.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param obj: input curve
:type obj: abstract... | def normal_curve_single(obj, u, normalize):
""" Evaluates the curve normal vector at the input parameter, u.
Curve normal is calculated from the 2nd derivative of the curve at the input parameter, u.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
... |
Evaluates the curve normal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vector is converted to a unit vector
:type normalize: bool
:r... | def normal_curve_single_list(obj, param_list, normalize):
""" Evaluates the curve normal vectors at the given list of parameter values.
:param obj: input curve
:type obj: abstract.Curve
:param param_list: parameter list
:type param_list: list or tuple
:param normalize: if True, the returned vec... |
Evaluates the curve binormal vector at the given u parameter.
Curve binormal is the cross product of the normal and the tangent vectors.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param obj: input curve
:type obj: abstract.Curve
:par... | def binormal_curve_single(obj, u, normalize):
""" Evaluates the curve binormal vector at the given u parameter.
Curve binormal is the cross product of the normal and the tangent vectors.
The output returns a list containing the starting point (i.e. origin) of the vector and the vector itself.
:param o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.