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


a surface or an outline (a loop) with associated exterior normals.


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.


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


>>> x,y,z = vec3(1,0,0), vec3(0,1,0), vec3(0,0,1)
>>> m = junction(
                # can pass a surface: the surface outlines and normals will be used as the generated surface tangents
                extrusion(2*z, web(Circle((vec3(0),z), 1))),
                # can pass wire or primitives: the wire loops are used and the approximate normal to the  wire plane
                Circle((2*x,x), 0.5),
                # more parameters when building directly the interfqce
                (Circle((2*y,y), 0.5), 'tangent', 2.),


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),

general mesh generation

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

join several outlines with a blended surface


‘straight’ no interpolation, straight lines ‘normal’ interpolated surface starts normal to the interfaces ‘tangent’ interpolated surface starts tangent to the interfaces


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])


‘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


position of the center of the junction node used to determine connexion between interfaces can be usefull for particularly weird and ambiguous interfaces


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) madcad.mesh.Mesh

blend inside a loop interface

see junction for the parameters.

blendpair(*interfaces, match='length', tangents='tangent', weight=1.0, resolution=None) madcad.mesh.Mesh

blend between a pair of interfaces


‘length’, ‘closest’ refer to match_* in this module

see junction for the other parameters.

blenditer(parameters, div, interpol) madcad.mesh.Mesh

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]

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

match_closest(line1, line2) [int, int]

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

small utilities

join(mesh, line1, line2)

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

trijoin(pts, ptgts, div)

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