Python Brasil 2025

Exploring 2D and 3D geometry libraries in Python
23/10/2025 , Impacta - Sala 203

This tutorial will explore the creation and manipulation of 2D and 3D geometric objects. Specifically, it will focus on the shapely and trimesh libraries in the context of creative coding using py5.


How can Python assist you with 2D and 3D geometry? What tools are available to create, transform, and manipulate such geometries? Can we use these tools to build creative visualizations?

Python has much to say about these questions. In this talk, we will explore the many features of the Python libraries shapely (for 2D geometries) and trimesh (for 3D geometries).

shapely and trimesh are industrial strength libraries used in general, geospatial, and scientific applications. shapely being a dependency of widely used GeoDataFrame library geopandas, and trimesh being used by Ultimaker-Cura, slicing models for 3D printing.

We will learn about 2D and 3D affine transformations, extrusions, boolean operations, and more. Through these lessons, you will see how these tools can be orchestrated to build arbitrarily complex 2D and 3D shapes. Once constructed, these 2D and 3D shapes can be visualized with the creative coding library py5.

In summary, this tutorial will teach you how shapely, trimesh, and py5 can work together to create beautiful visualizations of 2D and 3D geometry.


Quais conhecimentos prévios são necessários para que seja possível acompanhar bem a sua atividade?

Basic Python programming knowledge is expected, such as knowing how to define new functions, how to import modules, how to instantiate objects from a class imported from a library, and calling methods on objects.

O que as pessoas que participarem podem esperar aprender na sua atividade?
  • There are powerful libraries in the Python ecosystem for creating and manipulating 2D and 3D geometry, shapely and trimesh are robust and accessible options;
  • How to productively navigate the shapely and trimesh documentation websites;
  • How to use basic geometry functionality in the two libraries, including creating polygons, making offsets (buffers), holes and intersections, how to make extrusions and boolean operations;
  • How to visualize and interact with the resulting geometry using py5.
Escolha uma ou mais áreas em que essa proposta se encaixa

Creative Programming, Others

Professor e artista visual e entusiasta da programação criativa. Desenvolve material didático aberto, colabora com projetos de software livre e faz um desenho por dia com programação.

James Schmitz is a visual artist and creative technologist based in the United States. He is the author and maintainer of the open source library py5.

Esse palestrante também aparece em: