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

                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)

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

blend inside a loop interface

see junction for the parameters.

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

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