volumetric modeling with signed distance functions
- compas_vol is an extension package built on top of compas core.
- To get started, I recommend you create a separate environment in an Anaconda Python 3.7 installation. The details are described here: https://compas-dev.github.io/main/gettingstarted/installation.html
- With the newly created environment active, make sure you have git installed. If not, in the terminal (Mac) or Anaconda Prompt (Win) run
conda install git
. - Then install
compas_vol
directly from source, runningpip install git+https://github.com/dbt-ethz/compas_vol
- The example notebooks use meshplot for isosurfacing and mesh display. Install it with
conda install meshplot
- Some also use ipyvolume. Install it with
conda install -c conda-forge ipyvolume
from compas.geometry import Box, Frame, Point
from compas_vol.primitives import VolBox
import numpy as np
box = Box(Frame(Point(0, 0, 0), [1, 0.2, 0], [-0.1, 1, 0]), 20, 15, 15)
vb = VolBox(box, 3.0)
x, y, z = np.ogrid[-15:15:60j, -15:15:60j, -15:15:60j]
d = vb.get_distance_numpy(x, y, z)
All the objects have a get_distance
function, a lot of them also have a faster get_distance_numpy
function. The following table gives an overview:
Folder | Class | Single point distance | Numpy available |
---|---|---|---|
Primitives | VolBox | β | β |
" | VolCapsule | β | β |
" | VolCone | β | X |
" | VolEllipsoid | β | β |
" | VolExtrusion | β | X |
" | Heart | β | X |
" | GDF | X | X |
" | VolPlane | β | β |
" | VolPolyhedron | β | β |
" | VolSphere | β | β |
" | VolTorus | β | β |
Combinations | Intersection | β | β |
" | Subtraction | β | β |
" | Union | β | β |
" | Morph | β | β |
" | SmoothIntersection | β | β |
" | SmoothSubtraction | β | β |
" | SmoothUnion | β | β |
Modifications | Blur | X | β |
" | Overlay | β | β (but missing import) |
" | MultiShell | β | β |
" | Shell | β | β |
" | Transformation | β | β |
" | Twist | β | β |
Microstructure | Lattice | β | β |
" | TPMS | β | β |
" | TPMSPolar | β | β |
" | Voronoi | β | X |
Meshing | Octree | β | X |
Analysis | Gradient | β | β |