PolyFEM
Loading...
Searching...
No Matches
GeometryUtils.cpp File Reference
#include "GeometryUtils.hpp"
#include <polyfem/utils/Logger.hpp>
#include <Eigen/Geometry>
#include <igl/barycentric_coordinates.h>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/point_triangle.hpp>
Include dependency graph for GeometryUtils.cpp:

Go to the source code of this file.

Namespaces

namespace  polyfem
 
namespace  polyfem::utils
 

Functions

double polyfem::utils::triangle_area_2D (const Eigen::Vector2d &a, const Eigen::Vector2d &b, const Eigen::Vector2d &c)
 Compute the signed area of a 2D triangle defined by three points.
 
double polyfem::utils::triangle_area_3D (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c)
 Compute the area of a 3D triangle defined by three points.
 
double polyfem::utils::triangle_area (const Eigen::MatrixXd V)
 Compute the signed area of a triangle defined by three points.
 
double polyfem::utils::tetrahedron_volume (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c, const Eigen::Vector3d &d)
 Compute the signed volume of a tetrahedron defined by four points.
 
double polyfem::utils::tetrahedron_volume (const Eigen::MatrixXd V)
 Compute the signed volume of a tetrahedron defined by four points.
 
Eigen::MatrixXd polyfem::utils::triangle_to_clockwise_order (const Eigen::MatrixXd &triangle)
 Reorder the vertices of a triangle so they are in clockwise order.
 
std::vector< Eigen::MatrixXd > polyfem::utils::triangle_fan (const Eigen::MatrixXd &convex_polygon)
 Convert a convex polygon to a list of triangles fanned around the first vertex.
 
Eigen::VectorXd polyfem::utils::barycentric_coordinates (const Eigen::VectorXd &p, const Eigen::MatrixXd &V)
 Compute barycentric coordinates for point p with respect to a simplex.
 
bool polyfem::utils::triangle_intersects_disk (const Eigen::Vector2d &t0, const Eigen::Vector2d &t1, const Eigen::Vector2d &t2, const Eigen::Vector2d &center, const double radius)
 Determine if a 2D triangle intersects a 2D disk.
 
bool polyfem::utils::tetrahedron_intersects_ball (const Eigen::Vector3d &t0, const Eigen::Vector3d &t1, const Eigen::Vector3d &t2, const Eigen::Vector3d &t3, const Eigen::Vector3d &center, const double radius)
 Determine if a 3D tetrahedron intersects a 3D ball.
 
bool polyfem::utils::are_edges_collinear (const VectorNd &ea0, const VectorNd &ea1, const VectorNd &eb0, const VectorNd &eb1, const double tol=1e-10)
 Determine if two edges are collinear.
 
bool polyfem::utils::are_triangles_coplanar (const Eigen::Vector3d &t00, const Eigen::Vector3d &t01, const Eigen::Vector3d &t02, const Eigen::Vector3d &t10, const Eigen::Vector3d &t11, const Eigen::Vector3d &t12, const double tol=1e-10)
 Determine if two triangles are coplanar.
 
bool polyfem::utils::are_aabbs_intersecting (const VectorNd &aabb0_min, const VectorNd &aabb0_max, const VectorNd &aabb1_min, const VectorNd &aabb1_max)
 Determine if two axis-aligned bounding boxes intersect.
 
void polyfem::utils::triangle_area_2D_gradient (double ax, double ay, double bx, double by, double cx, double cy, double g[6])
 Compute the gradient of the signed area of a 2D triangle defined by three points.
 
void polyfem::utils::triangle_area_2D_hessian (double ax, double ay, double bx, double by, double cx, double cy, double H[36])
 Compute the Hessian of the signed area of a 2D triangle defined by three points.
 
void polyfem::utils::tetrahedron_volume_gradient (double ax, double ay, double az, double bx, double by, double bz, double cx, double cy, double cz, double dx, double dy, double dz, double g[12])
 Compute the gradient of the signed volume of a tetrahedron defined by four points.
 
void polyfem::utils::tetrahedron_volume_hessian (double ax, double ay, double az, double bx, double by, double bz, double cx, double cy, double cz, double dx, double dy, double dz, double H[144])
 Compute the gradient of the signed area of a 2D triangle defined by three points.