hull - build convex hulls from lines or surfaces
This module provides functions to compute convex hulls
(See https://en.wikipedia.org/wiki/Convex_hull)
and other hull-related operations for Mesh
and Web
Those can be very helpful to complete sketches or parts by adding the missing surface portions. Also very helpful to sort a set of directions.
-
convexhull
(source: [vec3]) Mesh [source] compute the convex hull of the input container
Parameters: source (typedlist/Web/Mesh) – the input container, if it is a Web or Mesh, their groups are kept in the output data Example
>>> m = convexhull(mesh([ ... uvsphere(O, 1, alignment=X), ... uvsphere(4*X, 2, alignment=X), ... ]))
-
convexoutline
(source: [vec3], normal: dvec3 = None, flatten: bool = False) Web [source] based on
convexhull()
but will extract the loop formed by the edges in the biggest planar projection of the convex hullParameters: - source (typedlist/Web/Mesh) – the input container, if it is a Web or Mesh, their groups are kept in the output data
- normal – the projection normal to retreive the outline using
horizon()
, if None is given it will default to the direction in which the outlien surface is the biggest - flatten – whether to project the outline points in its mean plane
Example
>>> convexoutline(web([ ... Circle(Axis(O,Z), 1), ... Circle(Axis(4*X,Z), 2), ... ]))
-
simple_convexhull
(points: [vec3]) [uvec3] [source] Just like
convexhull()
but minimalist. It does not take care of groups crossing. It doesn’t return a new Mesh but a buffer of triangles indices
-
horizon
(mesh, direction: dvec3) Web [source] Return a Web of the ORIENTED edges of the given mesh that lay between triangles that are oriented either sides of
direction
-
restore_groups
(source, indices) Mesh [source] Create a mesh contaning the given simplices, associated with groups created from group crossing from the source mesh. The simplices must refer to points in
source
. The created groups are tuples of indices of the groups touched by each simplex.Parameters: - source (Mesh/Web) – the mesh containing reference triangles and groups
- indices – a buffer of simplices indices (depending on the dimensionnality of
source
) we want to find groups for