Skip to content

Namespace uipc::geometry

Namespace List > uipc > geometry

Namespaces

Type Name
namespace affine_body

Classes

Type Name
class AbstractSimplicialComplex
Represents an abstract simplicial complex, containing vertices, edges, triangles, and tetrahedra.
class Attribute <typename T>
Template class to represent a geometries attribute of type T.
class AttributeCollection
A collection of geometries attributes.
class AttributeCopy
class AttributeFriend <typename T>
class AttributeIO
class AttributeIOError
class AttributeSlot <typename T>
Template class to represent a geometries attribute slot of type T in a geometries attribute collection.
class BVH
class Geometry
A base geometries class that contains the instance attributes and the meta attributes.
class GeometryAttributeError
class GeometryCollection
class GeometryFriend <typename T>
class GeometrySlot
class GeometrySlotT <GeometryT>
class GeometrySlotT< ImplicitGeometry > <>
class GeometrySlotT< SimplicialComplex > <>
class IAttribute
An abstract class to represent a geometries attribute.
class IAttributeSlot
An abstract class to represent a geometries attribute slot in a geometries attribute collection.
class IGeometry
An abstract class for geometries.
class IGeometryCollection
class ImplicitGeometry
class Octree
class SimplexUtils
class SimplicialComplex
A simplicial complex is a collection of simplices.
class SimplicialComplexAttributes <IsConst, N>
class SimplicialComplexIO
A class for reading and writing simplicial complex.
class SpreadSheetIO
A class for writing geometry spreadsheet.

Public Types

Type Name
enum GeometrySlotState
typedef GeometrySlotT< ImplicitGeometry > ImplicitGeometrySlot
typedef GeometrySlotT< SimplicialComplex > SimplicialComplexSlot

Public Functions

Type Name
UIPC_GEOMETRY_API vector< SimplicialComplex > apply_region (const SimplicialComplex & complex)
Take apart the simplicial complex by regions.
UIPC_GEOMETRY_API vector< SimplicialComplex > apply_transform (const SimplicialComplex & complex)
Apply the instance transform to the simplicial complex.
UIPC_GEOMETRY_API S< AttributeSlot< Float > > compute_instance_volume (SimplicialComplex & R)
Compute the volume of an instance in the simplicial complex. Attribute __volume <Float> will be created in the instance vertices.
UIPC_GEOMETRY_API S< AttributeSlot< Float > > compute_vertex_volume (SimplicialComplex & R)
Float UIPC_GEOMETRY_API edge_edge_squared_distance (const Vector3 & Ea0, const Vector3 & Ea1, const Vector3 & Eb0, const Vector3 & Eb1)
UIPC_GEOMETRY_API SimplicialComplex extract_surface (const SimplicialComplex & src)
Extract the surface of a tetrahedral mesh.
UIPC_GEOMETRY_API SimplicialComplex extract_surface (span< const SimplicialComplex * > complexes)
Extract the surface of a list of tetrahedral meshes and merge them into one.
UIPC_GEOMETRY_API SimplicialComplex facet_closure (const SimplicialComplex & complex)
Generate the closure from a collection of facet simplices, who only have the top dimension simplices.
UIPC_GEOMETRY_API SimplicialComplex flip_inward_triangles (const SimplicialComplex & sc)
Flip the orientation of the triangles in the simplicial complex.
UIPC_GEOMETRY_API ImplicitGeometry ground (Float height=0.0, const Vector3 & N=Vector3::UnitY())
Create a gound plane.
UIPC_GEOMETRY_API ImplicitGeometry halfplane (const Vector3 & P=Vector3::Zero(), const Vector3 & N=Vector3::UnitY())
Create a half-plane.
Float UIPC_GEOMETRY_API halfplane_vertex_signed_distance (const Vector3 & P, const Vector3 & N, const Vector3 & V, Float V_thickness=0.0)
Compute the distance between a half-plane (P, N) and a vertex V (with thickness V_thickness).
UIPC_GEOMETRY_API bool is_point_in_tet (const Vector3 & T0, const Vector3 & T1, const Vector3 & T2, const Vector3 & T3, const Vector3 & P, Vector4 & tuvw_in_tet)
Check if a point is in a tetrahedron.
UIPC_GEOMETRY_API bool is_trimesh_closed (const SimplicialComplex & R)
Check if a trimesh is closed.
UIPC_GEOMETRY_API S< AttributeSlot< IndexT > > label_connected_vertices (SimplicialComplex & complex)
Label the connected vertices of a simplicial complex (by edges).
UIPC_GEOMETRY_API void label_region (SimplicialComplex & complex)
Label the regions of a simplicial complex.
UIPC_GEOMETRY_API void label_surface (SimplicialComplex & R)
Label the surface of a simplicial complex.
UIPC_GEOMETRY_API S< AttributeSlot< IndexT > > label_triangle_orient (SimplicialComplex & sc)
Label the orientation of the triangles in the simplicial complex.
UIPC_GEOMETRY_API SimplicialComplex linemesh (span< const Vector3 > Vs, span< const Vector2i > Es)
Create a simplicial complex from a line mesh.
UIPC_GEOMETRY_API SimplicialComplex merge (span< const SimplicialComplex * > complexes)
Merge a list of simplicial complexes into one simplicial complex.
UIPC_GEOMETRY_API SimplicialComplex merge (std::initializer_list< const SimplicialComplex * > && complexes)
void UIPC_GEOMETRY_API mesh_partition (SimplicialComplex & sc, SizeT part_max_size)
partition the simplicial complex
UIPC_GEOMETRY_API Matrix4x4 optimal_transform (span< const Vector3 > S, span< const Vector3 > D)
Find out the optimal transformation matrix that maps the source points to the destination points.
UIPC_GEOMETRY_API Matrix4x4 optimal_transform (const SimplicialComplex & S, const SimplicialComplex & D)
Find out the optimal transformation matrix that maps the source simplicial complex to the destination simplicial complex.
Float UIPC_GEOMETRY_API point_edge_squared_distance (const Vector3 & P, const Vector3 & E0, const Vector3 & E1)
Float UIPC_GEOMETRY_API point_point_squared_distance (const Vector3 & P0, const Vector3 & P1)
Float UIPC_GEOMETRY_API point_triangle_squared_distance (const Vector3 & P, const Vector3 & T0, const Vector3 & T1, const Vector3 & T2)
UIPC_GEOMETRY_API SimplicialComplex pointcloud (span< const Vector3 > Vs)
Create a simplicial complex from a point cloud.
UIPC_GEOMETRY_API SimplicialComplex tetmesh (span< const Vector3 > Vs, span< const Vector4i > Ts)
Create a simplicial complex from a tetrahedral mesh.
UIPC_GEOMETRY_API SimplicialComplex tetrahedralize (const SimplicialComplex & sc, const Json & options=Json::object())
Tetrahedralize a 2D simplicial complex (trimesh).
UIPC_GEOMETRY_API bool tri_edge_intersect (const Vector3 & T0, const Vector3 & T1, const Vector3 & T2, const Vector3 & E0, const Vector3 & E1, bool & coplanar, Vector3 & uvw_in_tri, Vector2 & uv_in_edge)
Check if a triangle and an edge intersect.
UIPC_GEOMETRY_API SimplicialComplex trimesh (span< const Vector3 > Vs, span< const Vector3i > Fs)
Create a simplicial complex from a triangle mesh.

Public Types Documentation

enum GeometrySlotState

enum uipc::geometry::GeometrySlotState {
    Normal,
    PendingCreate,
    PendingDestroy
};

typedef ImplicitGeometrySlot

using uipc::geometry::ImplicitGeometrySlot = typedef GeometrySlotT<ImplicitGeometry>;

typedef SimplicialComplexSlot

using uipc::geometry::SimplicialComplexSlot = typedef GeometrySlotT<SimplicialComplex>;

Public Functions Documentation

function apply_region

Take apart the simplicial complex by regions.

UIPC_GEOMETRY_API vector< SimplicialComplex > uipc::geometry::apply_region (
    const SimplicialComplex & complex
) 

Returns:

vector<SimplicialComplex> The simplicial complexes by regions.


function apply_transform

Apply the instance transform to the simplicial complex.

UIPC_GEOMETRY_API vector< SimplicialComplex > uipc::geometry::apply_transform (
    const SimplicialComplex & complex
) 

1) Vertex position of the result simplicial complex will be transformed. 2) The rest meta/instance/vertex/edge/face/tetrahedron attributes will be kept.

Returns:

vector<SimplicialComplex> the transformed simplicial complexes.


function compute_instance_volume

Compute the volume of an instance in the simplicial complex. Attribute __volume <Float> will be created in the instance vertices.

UIPC_GEOMETRY_API S< AttributeSlot < Float > > uipc::geometry::compute_instance_volume (
    SimplicialComplex & R
) 

Only tetmesh and closed trimesh are supported.

Parameters:

  • R The simplicial complex.

Returns:

The attribute slot of the instance volume.


function compute_vertex_volume

UIPC_GEOMETRY_API S< AttributeSlot < Float > > uipc::geometry::compute_vertex_volume (
    SimplicialComplex & R
) 

function edge_edge_squared_distance

Float UIPC_GEOMETRY_API uipc::geometry::edge_edge_squared_distance (
    const Vector3 & Ea0,
    const Vector3 & Ea1,
    const Vector3 & Eb0,
    const Vector3 & Eb1
) 

function extract_surface

Extract the surface of a tetrahedral mesh.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::extract_surface (
    const SimplicialComplex & src
) 

Parameters:

  • src The tetrahedral mesh.

Returns:

SimplicialComplex The surface of the tetrahedral mesh.


function extract_surface

Extract the surface of a list of tetrahedral meshes and merge them into one.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::extract_surface (
    span< const SimplicialComplex * > complexes
) 

All the instances of the input tetrahedral meshes will be applied to the output surface.

Parameters:

  • complexes The list of tetrahedral meshes.

Returns:

SimplicialComplex The surface of the tetrahedral meshes.


function facet_closure

Generate the closure from a collection of facet simplices, who only have the top dimension simplices.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::facet_closure (
    const SimplicialComplex & complex
) 

E.g. 1) the input 3D tetmesh can only have tetrahedrons (no triangles, edges). 2) the input 2D trimesh can only have triangles (no edges). 3) the input 1D linemesh can only have edges. 4) the input 0D pointcloud can only have vertices.


function flip_inward_triangles

Flip the orientation of the triangles in the simplicial complex.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::flip_inward_triangles (
    const SimplicialComplex & sc
) 

The input simplicial complex should have the attribute slot 'orient':<Index> for each triangle. After the operation, the orientation of the triangles will be flipped, and the orient attribute will be updated.

Returns:

SimplicialComplex the simplicial complex with the orientation of the triangles flipped.


function ground

Create a gound plane.

UIPC_GEOMETRY_API ImplicitGeometry uipc::geometry::ground (
    Float height=0.0,
    const Vector3 & N=Vector3::UnitY()
) 

Parameters:

  • height The height of the ground plane

function halfplane

Create a half-plane.

UIPC_GEOMETRY_API ImplicitGeometry uipc::geometry::halfplane (
    const Vector3 & P=Vector3::Zero(),
    const Vector3 & N=Vector3::UnitY()
) 

Parameters:

  • height The height of the ground plane

function halfplane_vertex_signed_distance

Compute the distance between a half-plane (P, N) and a vertex V (with thickness V_thickness).

Float UIPC_GEOMETRY_API uipc::geometry::halfplane_vertex_signed_distance (
    const Vector3 & P,
    const Vector3 & N,
    const Vector3 & V,
    Float V_thickness=0.0
) 

Parameters:

  • P The Origin point of the half-plane.
  • N The Normal vector of the half-plane.
  • V The Vertex point.
  • V_thickness The thickness of the vertex.

function is_point_in_tet

Check if a point is in a tetrahedron.

UIPC_GEOMETRY_API bool uipc::geometry::is_point_in_tet (
    const Vector3 & T0,
    const Vector3 & T1,
    const Vector3 & T2,
    const Vector3 & T3,
    const Vector3 & P,
    Vector4 & tuvw_in_tet
) 

T0, T1, T2, T3 the vertices of the tetrahedron P is the point

Parameters:

  • tuvw_in_tet the barycentric coordinates of the intersection point in the tet. Even if the function return false, the barycentric coordinates are still calculated correctly.

Returns:

true if the point is in the tetrahedron


function is_trimesh_closed

Check if a trimesh is closed.

UIPC_GEOMETRY_API bool uipc::geometry::is_trimesh_closed (
    const SimplicialComplex & R
) 

Only 2D SimplicialComplex is supported.

Parameters:

  • R the simplicial complex to be checked.

Returns:

true if the trimesh is closed, false otherwise.


function label_connected_vertices

Label the connected vertices of a simplicial complex (by edges).

UIPC_GEOMETRY_API S< AttributeSlot < IndexT > > uipc::geometry::label_connected_vertices (
    SimplicialComplex & complex
) 
  • Create a region <IndexT> attribute on vertices to tell which region a vertex is belong to.
  • Create a region_count <IndexT> attribute on meta to tell how many regions are there.

Returns:

S<AttributeSlot<IndexT>> The region attribute slot.


function label_region

Label the regions of a simplicial complex.

UIPC_GEOMETRY_API void uipc::geometry::label_region (
    SimplicialComplex & complex
) 
  • Create a region <IndexT> attribute on edges to tell which region an edge is belong to.
  • Create a region <IndexT> attribute on triangles to tell which region a triangle is belong to. (if exists)
  • Create a region <IndexT> attribute on tetrahedra to tell which region a tetrahedron is belong to. (if exists)
  • Create a region_count <IndexT> attribute on meta to tell how many regions are there.

Returns:

S<AttributeSlot<IndexT>> The region attribute slot.


function label_surface

Label the surface of a simplicial complex.

UIPC_GEOMETRY_API void uipc::geometry::label_surface (
    SimplicialComplex & R
) 

1) label 'is_surf':<IndexT> on vertices/edges/triangles/tetrahedra 2) set 'parent_id':<IndexT> on triangles, indicating the parent tetrahedron

Parameters:

  • R the simplicial complex to be labeled.

function label_triangle_orient

Label the orientation of the triangles in the simplicial complex.

UIPC_GEOMETRY_API S< AttributeSlot < IndexT > > uipc::geometry::label_triangle_orient (
    SimplicialComplex & sc
) 

Set 'orient':<Index> for each triangle in the simplicial complex. 1) orient=1 means the triangle is oriented outward the tetrahedron. 2) orient=0 means the orientation is undetermined. 3) orient=-1 means the triangle is oriented inward the tetrahedron.

Returns:

P<AttributeSlot<IndexT>> the attribute slot of the triangle orientation.


function linemesh

Create a simplicial complex from a line mesh.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::linemesh (
    span< const Vector3 > Vs,
    span< const Vector2i > Es
) 

Parameters:

  • Vs The vertex positions of the line mesh
  • Es The edges of the line mesh

Returns:

SimplicialComplex


function merge

Merge a list of simplicial complexes into one simplicial complex.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::merge (
    span< const SimplicialComplex * > complexes
) 

All input simplicial complexes must have only one instance.

Returns:

SimplicialComplex the merged simplicial complex.


function merge

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::merge (
    std::initializer_list< const SimplicialComplex * > && complexes
) 

function mesh_partition

partition the simplicial complex

void UIPC_GEOMETRY_API uipc::geometry::mesh_partition (
    SimplicialComplex & sc,
    SizeT part_max_size
) 

create a mesh_part <IndexT> attribute on the simplicial complex' vertices

Parameters:

  • sc simplicial complex
  • part_max_size the vertex number in each partition <= part_max_size

function optimal_transform

Find out the optimal transformation matrix that maps the source points to the destination points.

UIPC_GEOMETRY_API Matrix4x4 uipc::geometry::optimal_transform (
    span< const Vector3 > S,
    span< const Vector3 > D
) 

Parameters:

  • S The source points.
  • D The destination points.

Returns:


function optimal_transform

Find out the optimal transformation matrix that maps the source simplicial complex to the destination simplicial complex.

UIPC_GEOMETRY_API Matrix4x4 uipc::geometry::optimal_transform (
    const SimplicialComplex & S,
    const SimplicialComplex & D
) 

Parameters:

  • S The source simplicial complex.
  • D The destination simplicial complex.

Returns:


function point_edge_squared_distance

Float UIPC_GEOMETRY_API uipc::geometry::point_edge_squared_distance (
    const Vector3 & P,
    const Vector3 & E0,
    const Vector3 & E1
) 

function point_point_squared_distance

Float UIPC_GEOMETRY_API uipc::geometry::point_point_squared_distance (
    const Vector3 & P0,
    const Vector3 & P1
) 

function point_triangle_squared_distance

Float UIPC_GEOMETRY_API uipc::geometry::point_triangle_squared_distance (
    const Vector3 & P,
    const Vector3 & T0,
    const Vector3 & T1,
    const Vector3 & T2
) 

function pointcloud

Create a simplicial complex from a point cloud.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::pointcloud (
    span< const Vector3 > Vs
) 

Parameters:

  • Vs The vertex positions of the point cloud

Returns:

SimplicialComplex


function tetmesh

Create a simplicial complex from a tetrahedral mesh.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::tetmesh (
    span< const Vector3 > Vs,
    span< const Vector4i > Ts
) 

Parameters:

  • Vs The vertex positions of the tetrahedral mesh
  • Ts The tetrahedra of the tetrahedral mesh

function tetrahedralize

Tetrahedralize a 2D simplicial complex (trimesh).

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::tetrahedralize (
    const SimplicialComplex & sc,
    const Json & options=Json::object()
) 

Returns:

SimplicialComplex The simplicial complexes by regions.


function tri_edge_intersect

Check if a triangle and an edge intersect.

UIPC_GEOMETRY_API bool uipc::geometry::tri_edge_intersect (
    const Vector3 & T0,
    const Vector3 & T1,
    const Vector3 & T2,
    const Vector3 & E0,
    const Vector3 & E1,
    bool & coplanar,
    Vector3 & uvw_in_tri,
    Vector2 & uv_in_edge
) 

T0, T1, T2 the vertices of the triangle E0, E1 the vertices of the edge

Parameters:

  • uvw_in_tri the barycentric coordinates of the intersection point in the triangle. Even if the function return false, the barycentric coordinates are still calculated correctly.
  • uv_in_edge the barycentric coordinates of the intersection point in the edge. Even if the function return false, the barycentric coordinates are still calculated correctly.

Returns:

true if the triangle and the edge intersect


function trimesh

Create a simplicial complex from a triangle mesh.

UIPC_GEOMETRY_API SimplicialComplex uipc::geometry::trimesh (
    span< const Vector3 > Vs,
    span< const Vector3i > Fs
) 

Parameters:

  • Vs The vertex positions of the triangle mesh
  • Fs The triangles of the triangle mesh

Returns:

SimplicialComplex



The documentation for this class was generated from the following file include/uipc/backend/visitors/geometry_visitor.h