Commit ab969c98 authored by Philip Trettner's avatar Philip Trettner
Browse files

updated docs a bit

parent 5d67bbca
......@@ -25,7 +25,7 @@ for now the sphinx documentation must be built manually:
cd docs
pip install -r requirements.txt
pip3 install -r requirements.txt
make html
open _build/html/index.html
......@@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------
project = 'polymesh'
copyright = '2019, Philip Trettner'
copyright = '2020, Philip Trettner'
author = 'Philip Trettner'
# The full version, including alpha/beta/rc tags
Polymesh Cookbook
This chapter collects various simple recipes and samples that answer common "How do I do XYZ?" questions.
`Typed Geometry <>`_ is used as math library.
Loading a Mesh from a File
......@@ -2,5 +2,46 @@ Properties
Properties are the commonly used free functions found in ``<polymesh/properties.hh>``.
They are helpers for answering simple topological questions or computing basic geometric properties.
When they use geometric :doc:`attributes`, they are written using generic :doc:`vector-math` to transparently support different math libraries.
The properties interact well with :doc:`smart-ranges` and are commonly used together.
Some properties transform complete attributes, like ``pm::vertex_normals_by_area`` which computes vertex normals for the whole mesh.
Property functions live in the ``polymesh::`` namespace and can thus often be found via `argument-dependent lookup <>`_.
For example, ``valence(v)`` is the same as ``pm::valence(v)`` for ``pm::vertex_handle v``.
Motivating example: ::
#include <polymesh/properties.hh>
// load some mesh
pm::Mesh m;
auto pos = m.vertices().make_attribute<tg::pos3>();
load("/path/to/some/file.obj", m, pos);
// number of triangles
auto tri_count = m.faces().count(pm::is_triangle);
// remove isolated vertices
for (auto v : m.vertices())
if (is_isolated(v))
// compute total mesh area
// (requires a lambda because face_area needs to know which position attribute to use)
auto mesh_area = m.faces().sum([&](auto f) { return face_area(f, pos); });
// get vertex normals with uniform weighting
auto vnormals = vertex_normals_uniform(pos);
Topological Properties
Geometric Properties
......@@ -6,7 +6,6 @@ TODO
* simplify ``make_attribute`` variants and remove the one that is achieved via ``map``
* provide a ``span`` type
* remove ``std`` dependencies where appropriate to reduce compile times
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment