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

more documentation

parent ab969c98
.wy-side-nav-search {
background-color: #F44336 !important;
}
\ No newline at end of file
}
dl.cpp a.reference {
margin-right: 4px;
}
FAQ
===
TODO
.. topic:: How do I get an existing halfedge from one vertex to another?
::
#include <polymesh/properties.hh>
pm::halfedge_handle h = pm::halfedge_from_to(v_from, v_to);
......@@ -6,6 +6,8 @@ Assertions
TODO
.. _simple-graphs-ref:
Simple Graphs
-------------
......
......@@ -38,10 +38,40 @@ Motivating example: ::
Topological Properties
----------------------
TODO
The topological are independent of the geometric interpretation of a mesh and thus also work for :ref:`simple-graphs-ref`.
Some of these properties are just free function versions of members available in :ref:`handles-ref` to make it slightly easier to use them with :doc:`smart-ranges`:
.. doxygenfunction:: polymesh::is_vertex_isolated
::
// number of isolated vertices
auto isolated_cnt = m.vertices().count(pm::is_vertex_isolated);
Other properties are helpful when checking if certain topological operations are allowed:
.. doxygenfunction:: polymesh::can_collapse
And some properties compute otherwise useful mesh information such as
.. doxygenfunction:: polymesh::euler_characteristic
All defined properties can be found in :ref:`topological-properties-ref` or directly in ``<polymesh/properties.hh>``.
Geometric Properties
--------------------
While topological properties can be computed directly ony a ``pm::Mesh``, geometric properties usually require at least one attribute, such as per-vertex positions.
These properties are written in a generic, sometimes peculiar way.
For example:
::
template <class Pos3, class Scalar = typename field3<Pos3>::scalar_t>
Scalar face_area(face_handle f, vertex_attribute<Pos3> const& position);
This ``pm::face_area`` function takes a ``face_handle`` and a 3D position attribute and compute the area of the polygonal face (assuming that it is planar).
The ``Scalar`` template parameter defaults to the scalar type of the position attribute but can be explicitly provided if the result is desired in a different type (e.g. a ``float`` based position but a ``double`` face area).
TODO
......@@ -7,6 +7,8 @@ Mesh
.. doxygenclass:: polymesh::Mesh
:members:
.. _handles-ref:
Handles and Indices
-------------------
......@@ -84,6 +86,60 @@ Attributes
.. doxygenstruct:: polymesh::primitive_attribute_base
:members:
.. _topological-properties-ref:
Topological Properties
----------------------
.. doxygenfunction:: polymesh::is_vertex_boundary
.. doxygenfunction:: polymesh::is_face_boundary
.. doxygenfunction:: polymesh::is_edge_boundary
.. doxygenfunction:: polymesh::is_halfedge_boundary
.. doxygenfunction:: polymesh::is_vertex_isolated
.. doxygenfunction:: polymesh::is_edge_isolated
.. doxygenfunction:: polymesh::valence
.. doxygenfunction:: polymesh::is_triangle
.. doxygenfunction:: polymesh::is_quad
.. doxygenfunction:: polymesh::edge_between
.. doxygenfunction:: polymesh::halfedge_from_to
.. doxygenfunction:: polymesh::are_adjacent
.. doxygenfunction:: polymesh::is_triangle_mesh
.. doxygenfunction:: polymesh::is_quad_mesh
.. doxygenfunction:: polymesh::euler_characteristic
.. doxygenfunction:: polymesh::is_closed_mesh
.. doxygenfunction:: polymesh::can_collapse
.. doxygenfunction:: polymesh::can_flip
.. doxygenfunction:: can_rotate_next(edge_handle)
.. doxygenfunction:: can_rotate_prev(edge_handle)
.. doxygenfunction:: can_rotate_next(halfedge_handle)
.. doxygenfunction:: can_rotate_prev(halfedge_handle)
.. doxygenfunction:: can_add_or_get_edge(vertex_handle, vertex_handle)
.. doxygenfunction:: can_add_or_get_edge(halfedge_handle, halfedge_handle)
Low-Level API
-------------
......
......@@ -17,3 +17,4 @@ Long Term
* add more objects
* re-add binary polymesh format with arbitrary attributes
* sparse attributes
* better support for 2D meshes
......@@ -19,24 +19,35 @@
// e.g. valence(v) is the same as v[valence]
namespace polymesh
{
//
// ------------ Topological Properties ------------
//
/// returns true if the vertex lies at a boundary
bool is_boundary(vertex_handle v);
/// returns true if the vertex lies at a boundary
bool is_vertex_boundary(vertex_handle v);
/// returns true if the face lies at a boundary
bool is_boundary(face_handle f);
/// returns true if the face lies at a boundary
bool is_face_boundary(face_handle f);
/// returns true if the edge lies at a boundary
bool is_boundary(edge_handle e);
/// returns true if the edge lies at a boundary
bool is_edge_boundary(edge_handle e);
/// returns true if the half-edge lies at a boundary (NOTE: a half-edge is boundary if it has no face)
bool is_boundary(halfedge_handle h);
/// returns true if the half-edge lies at a boundary (NOTE: a half-edge is boundary if it has no face)
bool is_halfedge_boundary(halfedge_handle h);
/// returns true if the vertex has no neighbors
bool is_isolated(vertex_handle v);
/// returns true if the vertex has no neighbors
bool is_vertex_isolated(vertex_handle v);
/// returns true if the edge has no neighboring faces
bool is_isolated(edge_handle e);
/// returns true if the edge has no neighboring faces
bool is_edge_isolated(edge_handle e);
/// returns the vertex valence (number of adjacent vertices)
......@@ -72,6 +83,35 @@ int euler_characteristic(Mesh const& m);
/// isolated vertices are ignored
bool is_closed_mesh(Mesh const& m);
/// returns true if m.halfedges().collapse(h) is possible topologically
/// NOTE: only works on triangles
bool can_collapse(halfedge_handle h);
/// returns true if m.edges().flip(e) would work
bool can_flip(edge_handle e);
/// returns true if m.edges().rotate_next(e) would work
bool can_rotate_next(edge_handle e);
/// returns true if m.edges().rotate_prev(e) would work
bool can_rotate_prev(edge_handle e);
/// returns true if m.halfedges().rotate_next(h) would work
bool can_rotate_next(halfedge_handle h);
/// returns true if m.halfedges().rotate_prev(h) would work
bool can_rotate_prev(halfedge_handle h);
/// returns true if m.edges().add_or_get(v_from, v_to) would work
bool can_add_or_get_edge(vertex_handle v_from, vertex_handle v_to);
/// returns true if m.edges().add_or_get(h_from, h_to) would work
bool can_add_or_get_edge(halfedge_handle h_from, halfedge_handle h_to);
//
// ------------ Geometrical Properties ------------
//
/// returns the area of the (flat) polygonal face
template <class Pos3, class Scalar = typename field3<Pos3>::scalar_t>
Scalar face_area(face_handle f, vertex_attribute<Pos3> const& position);
......@@ -184,37 +224,12 @@ halfedge_attribute<Pos3> barycentric_coordinates(Mesh const& m);
template <class Pos3>
bool is_delaunay(edge_handle e, vertex_attribute<Pos3> const& position);
/// returns true if m.halfedges().collapse(h) is possible topologically
/// NOTE: only works on triangles
bool can_collapse(halfedge_handle h);
/// returns true if m.halfedges().collapse(h) will not result in any flipped normals when h.vertex_to() is set to new_pos
/// NOTE: ALSO checks can_collapse(h)
/// NOTE: only works on triangles
template <class Pos3>
bool can_collapse_without_flips(halfedge_handle h, Pos3 new_pos, vertex_attribute<Pos3> const& position);
/// returns true if m.edges().flip(e) would work
bool can_flip(edge_handle e);
/// returns true if m.edges().rotate_next(e) would work
bool can_rotate_next(edge_handle e);
/// returns true if m.edges().rotate_prev(e) would work
bool can_rotate_prev(edge_handle e);
/// returns true if m.halfedges().rotate_next(h) would work
bool can_rotate_next(halfedge_handle h);
/// returns true if m.halfedges().rotate_prev(h) would work
bool can_rotate_prev(halfedge_handle h);
/// returns true if m.edges().add_or_get(v_from, v_to) would work
bool can_add_or_get_edge(vertex_handle v_from, vertex_handle v_to);
/// returns true if m.edges().add_or_get(h_from, h_to) would work
bool can_add_or_get_edge(halfedge_handle h_from, halfedge_handle h_to);
/// ======== IMPLEMENTATION ========
inline bool is_boundary(vertex_handle v) { return v.is_boundary(); }
......
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