blending - Creation of surface between outlines

This module focuses on automated envelope generations, based on interface outlines.

The user has only to define the interface outlines or surfaces to join, and the algorithm makes the surface. No more pain to imagine some fancy geometries.

Formal definitions

interface:a surface or an outline (a loop) with associated exterior normals.
node:a group of interfaces meant to be attached together by a blended surface.

In order to generate envelopes, this module asks for cutting all the surfaces to join into ‘nodes’. The algorithm decides how to join shortly all the outlines in a node. Once splited in nodes, you only need to generate node junctions for each, and concatenate the resulting meshes.

Details

The blended surfaces are created between interfaces, linked as the points of a convex polyedron of the interfaces directions to the node center.

Example

>>> x, y, z = vec3(1, 0, 0), vec3(0, 1, 0), vec3(0, 0, 1)

>>> # 1. A surface can be passed: the surface outlines and
>>> # normals will be used as the generated surface tangents
>>> # 2. Wire or primitives can be passed: the wire loops are used
>>> # and the approximate normal to the  wire plane
>>> # 3. More parameters when building directly the interface
>>> m = junction(
...             extrusion(2 * z, web(Circle((vec3(0), z), 1))), # 1.
...             Circle((2 * x, x), 0.5),                        # 2.
...             (Circle((2 * y, y), 0.5), "tangent", 2.0),      # 3.
...             generate="normal",
... )

To come in a next version

>>> # create junction for each iterable of interface,
>>> # if some are not interfaces, they are used
>>> # as placeholder objects for auto-determined interfaces
>>> multijunction(
...             (surf1, surf2, 42, surf5),
...             (42, surf3, surf4),
...             generate='straight',
... )

General mesh generation

junction(*args, center=None, tangents='normal', weight=1.0, match='length', resolution=None)[source]

Join several outlines with a blended surface

tangents:
‘straight’ no interpolation, straight lines ‘normal’ interpolated surface starts normal to the interfaces ‘tangent’ interpolated surface starts tangent to the interfaces
weight:
factor applied on the tangents before passing to interpol2 or intri_smooth the resulting tangent is computed in point a as weight * distance(a,b) * normalize(tangent[a])
match:
‘length’ share the outline between 2 matched points to assign the same length to both sides ‘corner’ split the curve to share around a corner
center:
position of the center of the junction node used to determine connexion between interfaces can be usefull for particularly weird and ambiguous interfaces

Note

match method ‘corner’ is not yet implemented

../_images/junction-circles-prep.png ../_images/junction-circles.png
blendloop(interface, center=None, tangents='tangent', weight=1.0, resolution=None) Mesh[source]

Blend inside a loop interface

see junction for the parameters.

../_images/blendloop.png
blendpair(*interfaces, match='length', tangents='tangent', weight=1.0, resolution=None) Mesh[source]

Blend between a pair of interfaces

match:
'length', 'closest' refer to match_* in this module

see junction for the other parameters.

../_images/blendpair.png
blenditer(parameters, div, interpol) Mesh[source]

Create a blended surface using the matching parameters and the given interpolation parameters is an iterable of tuples of arguments for the interpolation function interpol receive the elements iterated and the interpolation position at the end

Misc tools

match_length(line1, line2) [int, int][source]

Yield couples of point indices where the curved absciss are the closest

match_closest(line1, line2) [int, int][source]

Yield couples of points by cutting each line at the curvilign absciss of the points of the other

Small utilities

join(mesh, line1, line2)[source]

Simple straight surface created from matching couples of line1 and line2 using mesh indices for lines

trijoin(pts, ptgts, div)[source]

Simple straight surface created between 3 points, interpolation is only on the sides