Easy3D 2.5.3
easy3d::geom Namespace Reference

Functions for basic geometric computations. More...

Classes

struct  VertexCurvature
 discrete curvature information for a vertex. used for vertex_curvature()
More...
 

Functions

float triangle_area (const SurfaceMesh *mesh, SurfaceMesh::Face f)
 compute area of triangle f

 
float surface_area (const SurfaceMesh *mesh)
 surface area of the mesh (assumes triangular faces)

 
float volume (const SurfaceMesh &mesh)
 
vec3 centroid (const SurfaceMesh *mesh, SurfaceMesh::Face f)
 barycenter/centroid of a face

 
vec3 centroid (const SurfaceMesh *mesh)
 barycenter/centroid of mesh, computed as area-weighted mean of vertices.
More...
 
void dual (SurfaceMesh *mesh)
 Compute dual of a mesh. More...
 
double cotan_weight (const SurfaceMesh *mesh, SurfaceMesh::Edge e)
 compute the cotangent weight for edge e

 
double voronoi_area (const SurfaceMesh *mesh, SurfaceMesh::Vertex v)
 compute (mixed) Voronoi area of vertex v

 
double voronoi_area_barycentric (const SurfaceMesh *mesh, SurfaceMesh::Vertex v)
 compute barycentric Voronoi area of vertex v

 
vec3 laplace (const SurfaceMesh *mesh, SurfaceMesh::Vertex v)
 compute Laplace vector for vertex v (normalized by Voronoi area)

 
double angle_sum (const SurfaceMesh *mesh, SurfaceMesh::Vertex v)
 compute the sum of angles around vertex v (used for Gaussian curvature)

 
VertexCurvature vertex_curvature (const SurfaceMesh *mesh, SurfaceMesh::Vertex v)
 compute min, max, mean, and Gaussian curvature for vertex v. More...
 
float volume (const SurfaceMesh *mesh)
 Compute the volume of a mesh. More...
 
template<int DIM, typename FT >
GenericBox< DIM, FT > box_union (GenericBox< DIM, FT > const &a, GenericBox< DIM, FT > const &b)
 
template<int DIM, typename FT >
GenericBox< DIM, FT > box_intersection (GenericBox< DIM, FT > const &a, GenericBox< DIM, FT > const &b)
 
template<typename FT >
bool intersect (const GenericPlane< FT > &plane1, const GenericPlane< FT > &plane2, const GenericPlane< FT > &plane3, typename GenericPlane< FT >::Point3 &point)
 
vec3 orthogonal (const vec3 &v)
 Returns a vector orthogonal to v. Its norm() depends on v, but is zero only for a null v.
 
template<typename Box , typename Container >
Box bounding_box (const Container &points)
 Computes the bounding box of a set of points.
 
template<typename Vec , typename Container >
Vec centroid (const Container &points)
 Computes the centroid of a set of points.
 
template<typename Vec >
Vec barycenter (const Vec &p1, const Vec &p2)
 Computes the barycenter of two points.
 
template<typename Vec >
Vec barycenter (const Vec &p1, const Vec &p2, const Vec &p3)
 Computes the barycenter of three points.
 
template<typename Vec >
Vec barycenter (const Vec &p1, const Vec &p2, const Vec &p3, const Vec &p4)
 Computes the barycenter of four points.
 
template<typename FT >
Vec< 3, FT > barycentric_coordinates (const Vec< 3, FT > &p, const Vec< 3, FT > &u, const Vec< 3, FT > &v, const Vec< 3, FT > &w)
 Computes the barycentric coordinates of a point p with respect to three points u, v, and w.
 
bool point_in_polygon (const vec2 &p, const std::vector< vec2 > &polygon)
 Tests if a point p lies inside or outside of a polygon. This function is robust to handle general polygons (no matter convex or concave).
 
double clamp_cot (const double v)
 Clamps cotangent values as if angles are in [1, 179]

 
double clamp_cos (const double v)
 Clamps cosine values as if angles are in [1, 179]

 
template<typename Vec >
double cos_angle (const Vec &a, const Vec &b)
 Computes cosine of angle between two (un-normalized) vectors.
 
template<typename Vec >
double sin_angle (const Vec &a, const Vec &b)
 Computes sine of angle between two (un-normalized) vectors.
 
template<typename Vec >
Vec::FT cotan_angle (const Vec &a, const Vec &b)
 Computes cotangent of angle between two (un-normalized) vectors.
 
template<typename Vec >
double angle (const Vec &a, const Vec &b)
 Computes angle between two (un-normalized) vectors.
 
template<typename FT >
FT to_radians (FT degrees)
 Converts an angle from degrees to radians.
 
template<typename FT >
FT to_degrees (FT radians)
 Converts an angle from radians to degrees.
 
float triangle_area (const vec3 &p1, const vec3 &p2, const vec3 &p3)
 Computes area of a triangle given by three points.
 
float triangle_signed_area (const vec2 &p1, const vec2 &p2, const vec2 &p3)
 Computes signed area of a triangle given by three points.
 
vec3 triangle_normal (const vec3 &p1, const vec3 &p2, const vec3 &p3)
 Computes the normal vector of a triangle given by three points.
 
float dist_point_line_segment (const vec3 &p, const vec3 &v0, const vec3 &v1, vec3 &nearest_point)
 Computes the distance of a point p to a line segment given by vec3s (v0,v1).
 
float dist_point_triangle (const vec3 &p, const vec3 &v0, const vec3 &v1, const vec3 &v2, vec3 &nearest_point)
 Computes the distance of a point p to the triangle given by vec3s (v0, v1, v2).
 
vec3 tetra_circum_center (const vec3 &p, const vec3 &q, const vec3 &r, const vec3 &s)
 Computes the circum center of a tetrahedron.
 

Detailed Description

Functions for basic geometric computations.

Function Documentation

◆ centroid()

vec3 centroid ( const SurfaceMesh mesh)

barycenter/centroid of mesh, computed as area-weighted mean of vertices.

Note
assumes triangular faces.

◆ dual()

void dual ( SurfaceMesh mesh)

Compute dual of a mesh.

Warning
Changes the mesh in place. All properties are cleared.

◆ intersect()

bool easy3d::geom::intersect ( const GenericPlane< FT > &  plane1,
const GenericPlane< FT > &  plane2,
const GenericPlane< FT > &  plane3,
typename GenericPlane< FT >::Point3 &  point 
)
inline

Check if three planes intersect. Returns false if one of the planes is parallel to any of the others.

Parameters
plane1The first plane.
plane2The second plane.
plane3The third plane.
pointThe intersecting point.
Note
The intersecting point is valid only if the function returns true.
Returns
true if the three planes intersect at a point.

◆ vertex_curvature()

VertexCurvature vertex_curvature ( const SurfaceMesh mesh,
SurfaceMesh::Vertex  v 
)

compute min, max, mean, and Gaussian curvature for vertex v.

Attention
This will not give reliable values for boundary vertices.

◆ volume()

float easy3d::geom::volume ( const SurfaceMesh mesh)

Compute the volume of a mesh.

See [zhang_2002_efficient] for details.

Precondition
Input mesh needs to be a pure triangle mesh.