Easy3D 2.5.0
easy3d Namespace Reference

Namespaces

namespace  buffers
 Functions for updating render buffers.
 
namespace  console
 Defines the styles for output to the console window.
 
namespace  curve
 Algorithms for evaluating curves.
 
namespace  file_system
 A very basic filesystem implementation.
 
namespace  geom
 Functions for basic geometric computations.
 
namespace  io
 File input/output functionalities.
 
namespace  logging
 The logging mechanism.
 
namespace  resource
 Resources used in Easy3D.
 
namespace  setting
 Default parameters used for initializing rendering and UI.
 
namespace  shapes
 A collection of functions for rendering basic shapes.
 
namespace  string
 String manipulation utilities.
 

Classes

class  AmbientOcclusion
 Traditional Screen Space Ambient Occlusion (SSAO) technique. More...
 
class  AverageColorBlending
 Transparency effect using average color blending. More...
 
class  AxisPlaneConstraint
 An abstract class for Frame Constraints defined by an axis or a plane. More...
 
class  BandMatrix
 A band matrix representation that is capable of solving linear systems. More...
 
class  BasePropertyArray
 Base class for a property array. More...
 
class  Bezier
 Class for Bezier curve fitting. Works for both 2D and 3D. Example: More...
 
class  BSpline
 Class for BSpline curve fitting. Works for both 2D and 3D. Example: More...
 
class  Camera
 A perspective or orthographic camera. More...
 
class  CameraConstraint
 An AxisPlaneConstraint defined in the camera coordinate system. More...
 
class  CatmullRom
 Class for CatmullRom curve interpolation. Works for both 2D and 3D. Example: More...
 
class  ClippingPlane
 An implementation of a manipulable clipping plane for visualization of model interiors and cross sections. More...
 
class  CompViewer
 A composite viewer, which supports multiple views (arranged in a grid layout) in the same viewer. More...
 
class  Constraint
 An interface class for Frame constraints. More...
 
class  ConvexHull
 
class  Curve
 Base class for curve fitting/interpolation. More...
 
class  Delaunay
 Base class for Delaunay triangulation. More...
 
class  Delaunay2
 2D Delaunay triangulation, using Jonathan Richard Shewchuk's "triangle" implementation. More...
 
class  Delaunay3
 3D Delaunay triangulation, using Hang Si's tetgen. More...
 
class  Drawable
 The base class for drawable objects. A drawable represent a set of points, line segments, or triangles. More...
 
class  DualDepthPeeling
 Transparency effect using dual depth peeling. More...
 
class  EigenSolver
 An easy-to-use eigen solver. More...
 
class  EyeDomeLighting
 An implementation of the Eye Dome Lighting (EDL) technique. More...
 
class  Frame
 The Frame class represents a coordinate system, defined by a position and an orientation. More...
 
class  FramebufferObject
 An implementation of framebuffer object (FBO). More...
 
class  Frustum
 A Frustum description for perspective projection. More...
 
class  GaussianNoise
 Add Gaussian noise to 3D models. More...
 
class  GenericBox
 GenericBox represents the bounding box of shapes. More...
 
class  GenericLine
 A generic line representation, which supports both 2D and 3D lines. More...
 
class  GenericOrientedLine
 OrientedLine implements plucker coordinates, which enables oriented lines to be compared. More...
 
class  GenericPlane
 A 3D Plane of equation a*x + b*y + c*z + d = 0. More...
 
class  GenericPolygon
 A 2D polygon representation. More...
 
class  GenericRect
 The GenericRect class defines a rectangle in the 2D space. More...
 
class  GenericSegment
 A generic segmentation representation, which supports both 2D and 3D line segments. More...
 
class  Graph
 A Graph data structure with easy property management. More...
 
class  GraphIO
 Implementation of file input/output operations for Graph (Currently only PLY format is supported). More...
 
class  Heap
 A class implementing a heap. More...
 
class  ImageIO
 Implementation of file input/output operations for images. More...
 
class  KdTreeSearch
 Base class for nearest neighbor search using KdTree. More...
 
class  KdTreeSearch_ANN
 KdTree implementation based on ANN. More...
 
class  KdTreeSearch_ETH
 KdTree implementation based on Richard Keiser's KdTree code. More...
 
class  KdTreeSearch_FLANN
 KdTree implementation based on FLANN. More...
 
class  KdTreeSearch_NanoFLANN
 KdTree implementation based on NanoFLANN. More...
 
class  KeyFrameInterpolator
 A keyframe interpolator for animation generation. More...
 
class  LinesDrawable
 The drawable for rendering a set of line segments, e.g., edges of a mesh, vector fields. More...
 
class  LocalConstraint
 An AxisPlaneConstraint defined in the Frame local coordinate system. More...
 
class  ManipulatedCameraFrame
 A manipulated frame with camera specific mouse bindings. More...
 
class  ManipulatedFrame
 A Frame that can be rotated and translated using the mouse. More...
 
class  Manipulator
 A manipulator is for manipulation of an object. More...
 
class  Mat
 Base class for matrix types. More...
 
class  Mat2
 2 by 2 matrix. Extends Mat with 2D-specific functionality and constructors. More...
 
class  Mat3
 3x3 matrix. Extends Mat with 3D-specific functionality and constructors. More...
 
class  Mat4
 4x4 matrix. Extends Mat with 4D-specific functionality and constructors. More...
 
class  Matrix
 A matrix representation, which supports dynamic sizes. More...
 
class  Model
 The base class of renderable 3D models. More...
 
class  ModelPicker
 Implementation of picking mechanism for set of models. More...
 
class  NormalCone
 A class implementing a normal cone. More...
 
class  OpenGLTimer
 Accurate timing of GPU operations. More...
 
class  OpenglUtil
 Utilities for OpenGL initialization and states query. More...
 
class  OverlappingFaces
 Detects/Removes duplicate and folding faces for a triangle mesh. More...
 
class  Picker
 Base class for picking mechanism. More...
 
class  PointCloud
 A data structure for point clouds. More...
 
class  PointCloudIO
 Implementation of file input/output operations for PointCloud. More...
 
class  PointCloudNormals
 Estimate point cloud normals. It also allows to reorients the point cloud normals based on a minimum spanning tree algorithm. More...
 
class  PointCloudPicker
 Implementation of picking points from a point cloud. More...
 
class  PointCloudSimplification
 PointCloudSimplification provides various point cloud simplification algorithms. More...
 
class  PointsDrawable
 The drawable for rendering a set of points, e.g., point clouds, vertices of a mesh. More...
 
class  PoissonReconstruction
 Poisson surface reconstruction. More...
 
class  PolyMesh
 Data structure representing a polyhedral mesh. More...
 
class  PolyMeshIO
 Implementation of file input/output operations for PolyMesh. More...
 
class  PrimitivesRansac
 Extract primitives from point clouds using RANSAC.Usage example: More...
 
class  PrincipalAxes
 Computes the center and inertia axes of a set of 2D or 3D points. More...
 
class  ProgressClient
 The based class of GUI element reporting the progress. More...
 
class  ProgressLogger
 An implementation of progress logging mechanism. More...
 
class  Property
 Implementation of a generic property. More...
 
class  PropertyArray
 Implementation of a generic property array. More...
 
class  PropertyContainer
 Implementation of generic property container. More...
 
class  Quadric
 A quadric as a symmetrix 4x4 matrix. Used by the error quadric mesh decimation algorithms. More...
 
class  Quat
 The Quaternion class represents 3D rotations and orientations. More...
 
class  Renderer
 A Renderer manages the drawables (and thus the rendering) of a model. More...
 
class  SelfIntersection
 Detects and resolves self-intersection for surface mesh. More...
 
class  ShaderManager
 Management of shader programs. More...
 
class  ShaderProgram
 OpenGL Shader Compilation. More...
 
class  Shadow
 Shadow implements the standard shadow map (hard shadow) algorithm. More...
 
class  Signal
 A light-weight implementation of the simple signal-slot mechanism. More...
 
class  SoftShadow
 An implementation of the Percentage-Closer Soft Shadows. More...
 
class  SplineCurveFitting
 Spline curve fitting for arbitrary dimensions. More...
 
class  SplineCurveInterpolation
 Cubic spline curve interpolation for arbitrary dimensions. More...
 
class  SplineInterpolation
 Cubic spline interpolation. More...
 
class  StackTracer
 Tracks stack frames.Read recent stack activities example: More...
 
class  State
 Class representing the rendering state of a drawable. More...
 
class  StopWatch
 A high resolution stop watch/timer. More...
 
class  SurfaceMesh
 A halfedge data structure for polygonal meshes of 2-manifold. More...
 
class  SurfaceMeshBuilder
 A helper class for constructing manifold surface mesh models. More...
 
class  SurfaceMeshComponent
 A connected component of a SurfaceMesh. More...
 
class  SurfaceMeshCurvature
 Compute per-vertex curvatures, i.e., principle (min, max), mean, Gaussian. More...
 
class  SurfaceMeshEnumerator
 Enumerates connected components for a surface mesh. More...
 
class  SurfaceMeshFactory
 Factory class to generate different types of basic shapes. More...
 
class  SurfaceMeshFairing
 A class for implicitly fairing a surface mesh.See the following paper for more details: More...
 
class  SurfaceMeshFeatures
 Detect and mark feature edges based on boundary or dihedral angle. More...
 
class  SurfaceMeshGeodesic
 This class computes geodesic distance from a set of seed vertices. More...
 
class  SurfaceMeshHoleFilling
 This class closes simple holes in a surface mesh. More...
 
class  SurfaceMeshIO
 Implementation of file input/output operations for SurfaceMesh. More...
 
class  SurfaceMeshParameterization
 A class for surface parameterization. More...
 
class  SurfaceMeshPicker
 Implementation of picking elements (i.e, vertices, faces, edges) from a surface mesh. More...
 
class  SurfaceMeshPolygonization
 Merge connected coplanar faces into a general polygon face. More...
 
class  SurfaceMeshRemeshing
 A class for uniform and adaptive surface remeshing. More...
 
class  SurfaceMeshSampler
 Sample a surface mesh (near uniformly) into a point cloud. More...
 
class  SurfaceMeshSimplification
 Surface mesh simplification based on approximation error and fairness criteria. More...
 
class  SurfaceMeshSmoothing
 A class for Laplacian smoothing.See the following papers for more details: More...
 
class  SurfaceMeshStitching
 Stitch coincident border edges of a surface mesh. More...
 
class  SurfaceMeshSubdivision
 SurfaceMeshSubdivision implement several well-known subdivision algorithms. More...
 
class  SurfaceMeshTetrehedralization
 Generate quality tetrahedralization from closed shells. More...
 
class  SurfaceMeshTopology
 Compute various topological characteristics of a surface mesh component. More...
 
class  SurfaceMeshTriangulation
 Triangulate a polygonal mesh into a pure triangle mesh. More...
 
class  Surfacer
 A collection of mesh (and polygon soup) processing functions. More...
 
class  Tessellator
 Tessellator subdivides concave planar polygons, polygons with holes, or polygons with intersecting edges into triangles or simple contours. More...
 
class  TextMesher
 Generate a 3D surface mesh from a text string. More...
 
class  TextRenderer
 TextRenderer enables quick and easy string rendering in OpenGL applications. More...
 
class  Texture
 OpenGL texture. More...
 
class  TextureManager
 Management of OpenGL textures. More...
 
class  Timer
 A light-weight implementation of the timer mechanism. More...
 
class  Tokenizer
 A class for tokenizing input character streams. More...
 
class  Translator
 Manages the translation of all the models during the file IO. More...
 
class  Transparency
 Base class for rendering with transparency. More...
 
class  TriangleMeshKdTree
 A k-d tree for triangular surface meshes. More...
 
class  TrianglesDrawable
 The drawable for rendering a set of triangles, e.g., the surface of a triangular mesh. More...
 
class  Vec
 Base class for vector types. It provides generic functionality for N dimensional vectors. More...
 
class  Vec< 2, T >
 A 2D vector (used for representing 2D points or vectors). More...
 
class  Vec< 3, T >
 A 3D vector (used for representing 3D points or vectors). More...
 
class  Vec< 4, T >
 A 4D vector (used for representing 3D points or vectors in homogeneous coordinates). More...
 
class  VertexArrayObject
 A thin wrapper around an OpenGL Vertex Array Object (VAO). More...
 
class  Viewer
 The built-in Easy3D Viewer. More...
 
class  VoronoiCell3d
 A data structure for 3D Voronoi cells. More...
 
class  WorldConstraint
 An AxisPlaneConstraint defined in the world coordinate system. More...
 

Typedefs

typedef Vec< 2, float > vec2
 A 2D point/vector of float type.
 
typedef Vec< 3, float > vec3
 A 3D point/vector of float type.
 
typedef Vec< 4, float > vec4
 A 4D point/vector of float type.
 
typedef Vec< 2, double > dvec2
 A 2D point/vector of double type.
 
typedef Vec< 3, double > dvec3
 A 3D point/vector of double type.
 
typedef Vec< 4, double > dvec4
 A 4D point/vector of double type.
 
typedef Vec< 2, int32_t > ivec2
 A 2D point/vector of int32_t type.
 
typedef Vec< 3, int32_t > ivec3
 A 3D point/vector of int32_t type.
 
typedef Vec< 4, int32_t > ivec4
 A 4D point/vector of int32_t type.
 
typedef Mat2< float > mat2
 A 2 by 2 matrix of float type.
 
typedef Mat3< float > mat3
 A 3 by 3 matrix of float type.
 
typedef Mat4< float > mat4
 A 4 by 4 matrix of float type.
 
typedef Mat< 3, 4, float > mat34
 A 3 by 4 matrix of float type.
 
typedef Mat< 4, 3, float > mat43
 A 4 by 3 matrix of float type.
 
typedef Mat2< double > dmat2
 A 2 by 2 matrix of double type.
 
typedef Mat3< double > dmat3
 A 3 by 3 matrix of double type.
 
typedef Mat4< double > dmat4
 A 4 by 4 matrix of double type.
 
typedef Mat< 3, 4, double > dmat34
 A 3 by 4 matrix of double type.
 
typedef Mat< 4, 3, double > dmat43
 A 4 by 3 matrix of double type.
 
typedef Quat< float > quat
 A quaternion of float type.
 
typedef Quat< double > dquat
 A quaternion of double type.
 
typedef GenericLine< 2, float > Line2
 A 2D line of float type.
 
typedef GenericLine< 3, float > Line3
 A 3D line of float type.
 
typedef GenericOrientedLine< float > OrientedLine3
 A 3D oriented line of float type.
 
typedef GenericSegment< 2, float > Segment2
 A 2D line segment of float type.
 
typedef GenericSegment< 3, float > Segment3
 A 3D line segment of float type.
 
typedef GenericPlane< float > Plane3
 A 3D plane of float type.
 
typedef GenericBox< 2, float > Box2
 A 2D axis-aligned bounding box of float type.
 
typedef GenericBox< 3, float > Box3
 A 3D axis-aligned bounding box of float type.
 
typedef GenericRect< float > Rect
 A 2D axis-aligned rectangle of float type.
 
typedef GenericRect< int32_t > iRect
 A 2D axis-aligned rectangle of int32_t type.
 
typedef GenericPolygon< float > Polygon2
 A 2D polygon of float type.
 

Enumerations

enum  Sign { NEGATIVE = -1 , ZERO = 0 , POSITIVE = 1 }
 The sign.
 

Functions

bool extrude (SurfaceMesh *mesh, const std::vector< Polygon2 > &contours, float height)
 Extrudes a 3D surface mesh from a set of simple contours. More...
 
SurfaceMeshextrude (const std::vector< Polygon2 > &contours, float height)
 Extrudes a 3D surface mesh from a set of simple contours. More...
 
void project_to_unit_sphere (SurfaceMesh &mesh)
 
template<int DIM, typename FT >
bool has_nan (const GenericBox< DIM, FT > &box)
 
template<typename FT >
FT min ()
 Function returning minimum representable value for a given type.
 
template<typename FT >
FT max ()
 Function returning maximum representable value for a given type.
 
template<>
int min< int > ()
 Function returning min for int type numbers.
 
template<>
int max< int > ()
 Function returning max for int type numbers.
 
template<>
float min< float > ()
 Function returning min for float type numbers.
 
template<>
float max< float > ()
 Function returning max for float type numbers.
 
template<>
double min< double > ()
 Function returning min for double type numbers.
 
template<>
double max< double > ()
 Function returning max for double type numbers.
 
template<typename FT >
FT epsilon ()
 Function returning the epsilon value for a given type.
 
template<typename FT >
FT epsilon_sqr ()
 Function returning the squared epsilon value for a given type.
 
template<>
float epsilon< float > ()
 Function returning epsilon for float type numbers.
 
template<>
float epsilon_sqr< float > ()
 Function returning squared epsilon for float type numbers.
 
template<>
double epsilon< double > ()
 Function returning epsilon for double type numbers.
 
template<>
double epsilon_sqr< double > ()
 Function returning squared epsilon for double type numbers.
 
template<typename FT >
bool epsilon_equal (FT const &x, FT const &y, FT const &eps)
 Tests if two values are Epsilon equal.
 
template<typename FT >
bool epsilon_not_equal (FT const &x, FT const &y, FT const &eps)
 Tests if two values are not Epsilon equal.
 
std::ostream & operator<< (std::ostream &os, Graph::Vertex v)
 
std::ostream & operator<< (std::ostream &os, Graph::Edge e)
 
template<typename T >
void hash_combine (uint64_t &seed, T const &value)
 std::size_t has 64 bits on most systems, but 32 bits on 32-bit Windows. To make the same code robustly run on both 32-bit and 64-bit systems, Easy3D uses 64-bit integer for hash values. This function implements the 64-bit hash combine algorithm (inspired by the Hash128to64 function in CityHash).
 
template<typename FT >
uint64_t hash (const Vec< 2, FT > &value)
 Computes the hash value of a 2D vector.
 
template<typename FT >
uint64_t hash (const Vec< 3, FT > &value)
 Computes the hash value of a 3D vector.
 
template<int DIM, typename FT >
uint64_t hash (const Vec< DIM, FT > &value)
 Computes the hash value of a DIM dimensional vector.
 
template<typename Iterator >
uint64_t hash (Iterator first, Iterator last)
 Computes the hash value of a 1D array.
 
template<typename Iterator >
void hash (uint64_t &seed, Iterator first, Iterator last)
 Computes the hash value of a 1D array with a given seed value.
 
template<int DIM, typename FT >
std::ostream & operator<< (std::ostream &os, const GenericLine< DIM, FT > &line)
 
template<int DIM, typename FT >
std::istream & operator>> (std::istream &is, GenericLine< DIM, FT > &line)
 
template<size_t N, size_t M, typename T >
Mat< N, M, T > operator* (T lhs, const Mat< N, M, T > &rhs)
 Component-wise scalar-matrix multiplication.
 
template<typename T >
Mat2< T > operator* (const Mat2< T > &lhs, const Mat2< T > &rhs)
 Specialized matrix-matrix multiplication for 2x2 matrices.
 
template<typename T >
Mat3< T > operator* (const Mat3< T > &lhs, const Mat3< T > &rhs)
 Specialized matrix-matrix multiplication for 3x3 matrices.
 
template<typename T >
Mat4< T > operator* (const Mat4< T > &lhs, const Mat4< T > &rhs)
 Specialized matrix-matrix multiplication for 4x4 matrices.
 
template<typename T >
Vec< 3, T > operator* (const Mat4< T > &lhs, const Vec< 3, T > &rhs)
 Specialized matrix-vector multiplication for 4x4 matrices and 3D vectors. rhs is treated as an homogeneous vector (with w = 1).
 
template<typename T >
Vec< 2, T > operator* (const Mat3< T > &lhs, const Vec< 2, T > &rhs)
 Specialized matrix-vector multiplication for 3x3 matrices and 2D vectors. rhs is treated as an homogeneous vector (with z = 1).
 
template<typename T >
Vec< 2, T > operator* (const Mat2< T > &lhs, const Vec< 2, T > &rhs)
 
template<typename T >
Vec< 3, T > operator* (const Mat3< T > &lhs, const Vec< 3, T > &rhs)
 
template<typename T >
Vec< 4, T > operator* (const Mat4< T > &lhs, const Vec< 4, T > &rhs)
 
template<size_t N, typename T >
trace (const Mat< N, N, T > &m)
 Return the trace (sum of elements on the main diagonal) of N by N (square) matrix m.
 
template<size_t N, typename T , size_t A>
determinant (const Mat< N, N, T > &m)
 Return the determinant of N x N (square) matrix m. More...
 
template<size_t N, size_t M, typename T >
Mat< M, N, T > transpose (const Mat< N, M, T > &m)
 Transpose m.
 
template<size_t N, typename T >
Mat< N, N, T > inverse (const Mat< N, N, T > &m)
 Return the inverse of N x N (square) matrix m. More...
 
template<size_t M, size_t N, typename T >
Mat< N, M, T > tensor (const Vec< M, T > &u, const Vec< N, T > &v)
 
template<size_t N, size_t M, typename T >
bool gauss_jordan_elimination (const Mat< N, N, T > &a, const Mat< N, M, T > &b, Mat< N, N, T > *ainv, Mat< N, M, T > *x)
 Perform Gauss-Jordan elimination to solve a set of linear equations and additionally compute the inverse of the input coefficient matrix. More...
 
template<size_t N, typename T >
bool lu_decomposition (const Mat< N, N, T > &a, Mat< N, N, T > *alu, Vec< N, T > *rowp, T *d)
 Perform LU decomposition of a square matrix. More...
 
template<size_t N, typename T >
void lu_back_substitution (const Mat< N, N, T > &alu, const Vec< N, T > &rowp, const Vec< N, T > &b, Vec< N, T > *x)
 Solve a set of linear equations using outputs from lu_decomposition() as inputs. More...
 
template<size_t N, typename FT >
bool cholesky_decompose (const Mat< N, N, FT > &A, Mat< N, N, FT > &L)
 Cholesky decomposition of a symmetric, positive definite matrix. More...
 
template<size_t N, typename FT >
void cholesky_solve (const Mat< N, N, FT > &L, const Vec< N, FT > &b, Vec< N, FT > &x)
 
template<size_t N, size_t M, typename T >
void cholesky_solve (const Mat< N, N, T > &L, const Mat< N, M, T > &B, Mat< N, M, T > &X)
 
template<size_t N, size_t M, typename T >
std::ostream & operator<< (std::ostream &output, const Mat< N, M, T > &m)
 
template<size_t N, size_t M, typename T >
std::istream & operator>> (std::istream &input, Mat< N, M, T > &m)
 
template<size_t D, typename T >
trace (const Mat< D, D, T > &m)
 
template<size_t N, typename T >
determinant (const Mat< N, N, T > &m)
 
template<typename T >
determinant (const Mat2< T > &m)
 
template<typename T >
determinant (const Mat3< T > &m)
 
template<typename T >
determinant (const Mat4< T > &m)
 
template<typename T >
Mat2< T > inverse (const Mat2< T > &m)
 
template<typename T >
Mat3< T > inverse (const Mat3< T > &m)
 
template<typename T >
Mat4< T > inverse (const Mat4< T > &m)
 
template<size_t N, typename FT >
Mat< N, 1, FT > to_matrix (const Vec< N, FT > &v)
 Convert a N-dimensional vector into a N by 1 matrix.
 
template<size_t N, typename FT >
Mat< 1, N, FT > transpose (const Vec< N, FT > &v)
 Construct a 1 by N matrix from a N-dimensional vector.
 
template<size_t N, size_t M, typename T >
bool has_nan (const Mat< N, M, T > &m)
 Test if a matrix has NaN entry.
 
template<typename FT >
std::ostream & operator<< (std::ostream &, const Matrix< FT > &)
 input and output More...
 
template<typename FT >
std::istream & operator>> (std::istream &, Matrix< FT > &)
 
template<typename FT >
Matrix< FT > operator- (const Matrix< FT > &)
 arithmetic operators More...
 
template<typename FT >
Matrix< FT > operator+ (const Matrix< FT > &, const FT &)
 
template<typename FT >
Matrix< FT > operator+ (const FT &, const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > operator+ (const Matrix< FT > &, const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > operator- (const Matrix< FT > &, const FT &)
 
template<typename FT >
Matrix< FT > operator- (const FT &, const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > operator- (const Matrix< FT > &, const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > operator* (const Matrix< FT > &, const Matrix< FT > &)
 
template<typename FT >
std::vector< FT > operator* (const Matrix< FT > &, const std::vector< FT > &)
 
template<typename FT1 , typename FT2 >
Matrix< FT1 > operator* (const Matrix< FT1 > &A, const FT2 &s)
 matrix-scalar multiplication
 
template<typename FT1 , typename FT2 >
Matrix< FT1 > operator* (const FT2 &, const Matrix< FT1 > &)
 
template<typename FT1 , typename FT2 >
Matrix< FT1 > operator/ (const Matrix< FT1 > &, const FT2 &)
 
template<typename FT1 , typename FT2 >
Matrix< FT1 > operator/ (const FT2 &, const Matrix< FT1 > &)
 
template<typename FT >
void mult (const Matrix< FT > &, const Matrix< FT > &, Matrix< FT > &)
 multiplication More...
 
template<typename FT >
void mult (const Matrix< FT > &, const std::vector< FT > &, std::vector< FT > &)
 
template<typename FT >
Matrix< FT > mult (const Matrix< FT > &, const Matrix< FT > &)
 
template<typename FT >
std::vector< FT > mult (const Matrix< FT > &, const std::vector< FT > &)
 
template<typename FT >
Matrix< FT > elem_mult (const Matrix< FT > &, const Matrix< FT > &)
 element-wise multiplication / division More...
 
template<typename FT >
Matrix< FT > elem_divd (const Matrix< FT > &, const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > & elem_mult_eq (Matrix< FT > &, const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > & elem_divd_eq (Matrix< FT > &, const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > transpose (const Matrix< FT > &)
 transpose and conjugate transpose More...
 
template<typename FT >
Matrix< FT > conjugate_transpose (const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > transpose_mult (const Matrix< FT > &, const Matrix< FT > &)
 transpose multiplication More...
 
template<typename FT >
std::vector< FT > transpose_mult (const Matrix< FT > &, const std::vector< FT > &)
 
template<typename FT >
Matrix< FT > mult_transpose (const Matrix< FT > &, const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > mult_transpose (const std::vector< FT > &, const std::vector< FT > &)
 
template<typename FT >
Matrix< FT > identity (int, const FT &)
 unit and diagonal matrix More...
 
template<typename FT >
Matrix< FT > diagonal (const std::vector< FT > &)
 
template<typename FT >
std::vector< FT > diagonal (const Matrix< FT > &)
 
template<typename FT >
FT trace (const Matrix< FT > &)
 
template<typename FT >
FT norm (const Matrix< FT > &)
 utilities More...
 
template<typename FT >
void swap (Matrix< FT > &, Matrix< FT > &)
 
template<typename FT >
std::vector< FT > sum (const Matrix< FT > &)
 
template<typename FT >
std::vector< FT > min (const Matrix< FT > &)
 
template<typename FT >
std::vector< FT > max (const Matrix< FT > &)
 
template<typename FT >
std::vector< FT > mean (const Matrix< FT > &)
 
template<typename FT >
Matrix< FT > abs (const Matrix< std::complex< FT > > &A)
 Get magnitude of a std::complex matrix.
 
template<typename FT >
Matrix< FT > arg (const Matrix< std::complex< FT > > &A)
 Get angle of a std::complex matrix.
 
template<typename FT >
Matrix< FT > real (const Matrix< std::complex< FT > > &A)
 Get real part of a std::complex matrix.
 
template<typename FT >
Matrix< FT > imag (const Matrix< std::complex< FT > > &A)
 Get imaginary part of a std::complex matrix.
 
template<typename FT >
Matrix< std::complex< FT > > complex_matrix (const Matrix< FT > &)
 Convert real matrix to complex matrix. More...
 
template<typename FT >
Matrix< std::complex< FT > > complex_matrix (const Matrix< FT > &mR, const Matrix< FT > &mI)
 Convert real matrix to std::complex matrix (A for real, B for imaginary)
 
template<typename FT >
std::ostream & operator<< (std::ostream &, const std::vector< FT > &)
 input and output
 
template<typename FT >
std::istream & operator>> (std::istream &in, std::vector< FT > &A)
 Overload the input stream function.
 
template<typename FT >
std::vector< FT > operator- (const std::vector< FT > &)
 arithmetic operators More...
 
template<typename FT >
std::vector< FT > operator+ (const std::vector< FT > &A, const std::vector< FT > &B)
 vector-vector addition
 
template<typename FT >
std::vector< FT > operator+ (const std::vector< FT > &A, const FT &s)
 vector-scalar addition.
 
template<typename FT >
std::vector< FT > operator+ (const FT &s, const std::vector< FT > &A)
 scalar-vector addition.
 
template<typename FT >
std::vector< FT > operator- (const std::vector< FT > &A, const std::vector< FT > &B)
 vector-vector subtraction
 
template<typename FT >
std::vector< FT > operator- (const std::vector< FT > &A, const FT &s)
 vector-scalar subtraction.
 
template<typename FT >
std::vector< FT > operator- (const FT &s, const std::vector< FT > &A)
 scalar-vector subtraction.
 
template<typename FT1 , typename FT2 >
std::vector< FT1 > operator* (const std::vector< FT1 > &A, const FT2 &s)
 vector-scalar multiplication
 
template<typename FT1 , typename FT2 >
std::vector< FT1 > operator* (const FT2 &s, const std::vector< FT1 > &A)
 vector-scalar multiplication
 
template<typename FT1 , typename FT2 >
std::vector< FT1 > operator/ (const std::vector< FT1 > &A, const FT2 &s)
 vector-scalar division
 
template<typename FT1 , typename FT2 >
std::vector< FT1 > operator/ (const FT2 &s, const std::vector< FT1 > &A)
 vector-scalar division
 
template<typename FT >
std::vector< FT > elem_mult (const std::vector< FT > &, const std::vector< FT > &)
 element-wise multiplication / division More...
 
template<typename FT >
std::vector< FT > elem_divd (const std::vector< FT > &v1, const std::vector< FT > &v2)
 vector-vector element-wise division
 
template<typename FT >
std::vector< FT > & elem_mult_eq (std::vector< FT > &, const std::vector< FT > &)
 
template<typename FT >
std::vector< FT > & elem_divd_eq (std::vector< FT > &, const std::vector< FT > &)
 
template<typename FT >
FT operator* (const std::vector< FT > &, const std::vector< FT > &)
 dot product More...
 
template<typename FT >
FT dot (const std::vector< FT > &v1, const std::vector< FT > &v2)
 Inner product for vectors.
 
template<typename FT >
FT norm (const std::vector< FT > &)
 utilities More...
 
template<typename FT >
FT norm (const std::vector< std::complex< FT > > &v)
 std::vector's norm in Euclidean space.
 
template<typename FT >
void swap (std::vector< FT > &lhs, std::vector< FT > &rhs)
 Swap two vectors.
 
template<typename FT >
std::vector< FT > linspace (FT a, FT b, int n)
 Generates a vector of n points linearly spaced between and including a and b.
 
template<typename FT >
FT sum (const std::vector< FT > &v)
 std::vector's sum.
 
template<typename FT >
FT min (const std::vector< FT > &v)
 Minimum value of vector.
 
template<typename FT >
FT max (const std::vector< FT > &v)
 Maximum value of vector.
 
template<typename FT >
FT mean (const std::vector< FT > &v)
 std::vector's mean.
 
template<typename FT >
std::vector< FT > abs (const std::vector< std::complex< FT > > &v)
 Get magnitude of a complex vector.
 
template<typename FT >
std::vector< FT > arg (const std::vector< std::complex< FT > > &v)
 Get angle of a complex vector.
 
template<typename FT >
std::vector< FT > real (const std::vector< std::complex< FT > > &v)
 Get real part of a complex vector.
 
template<typename FT >
std::vector< FT > imag (const std::vector< std::complex< FT > > &v)
 Get imaginary part of a complex vector.
 
template<typename FT >
std::vector< std::complex< FT > > complex_vector (const std::vector< FT > &)
 Convert real vector to complex vector.
 
template<typename FT >
std::vector< std::complex< FT > > complex_vector (const std::vector< FT > &vR, const std::vector< FT > &vI)
 Convert real vector to complex vector (A for real, B for imaginary)
 
template<class T >
Sign sign (T x)
 returns the sign of a value.
 
template<typename FT >
std::ostream & operator<< (std::ostream &os, const GenericPlane< FT > &plane)
 
template<typename FT >
std::istream & operator>> (std::istream &is, GenericPlane< FT > &plane)
 
template<typename FT >
bool intersect (const GenericPlane< FT > &plane1, const GenericPlane< FT > &plane2, const GenericPlane< FT > &plane3, typename GenericPlane< FT >::Point3 &point)
 
std::ostream & operator<< (std::ostream &os, PointCloud::Vertex v)
 
std::ostream & operator<< (std::ostream &os, PolyMesh::Vertex v)
 
std::ostream & operator<< (std::ostream &os, PolyMesh::Edge e)
 
std::ostream & operator<< (std::ostream &os, PolyMesh::HalfFace h)
 
std::ostream & operator<< (std::ostream &os, PolyMesh::Face f)
 
std::ostream & operator<< (std::ostream &os, PolyMesh::Cell c)
 
template<typename FT >
std::ostream & operator<< (std::ostream &os, const Quat< FT > &q)
 
template<typename FT >
std::istream & operator>> (std::istream &is, Quat< FT > &q)
 
template<class FT >
bool has_nan (const Quat< FT > &Q)
 
float random_float ()
 Random real in [0, 1].
 
float random_float (float min, float max)
 Random real number in the range [min, max].
 
vec3 random_color (bool allow_dark=false)
 Generates a random color. The parameter allow_dark controls if too dark colors are allowed.
 
std::ostream & operator<< (std::ostream &os, SurfaceMesh::Vertex v)
 
std::ostream & operator<< (std::ostream &os, SurfaceMesh::Halfedge h)
 
std::ostream & operator<< (std::ostream &os, SurfaceMesh::Edge e)
 
std::ostream & operator<< (std::ostream &os, SurfaceMesh::Face f)
 
template<typename FT >
bool is_nan (FT v)
 
template<class T >
clamp (T x, T lower, T upper)
 Clamps a num to be within a given range.
 
int next_pow2 (int a)
 Calculates the next larger power of 2. If the input is already a power of 2, it will return itself. More...
 
template<class T >
truncate_digits (const T &v, int num)
 Rounds the given floating point number v to have num digits.
 
template<size_t N, class T >
dot (const Vec< N, T > &v1, const Vec< N, T > &v2)
 Computes the dot product of two vectors.
 
template<size_t N, class T >
Vec< N, T > operator- (const Vec< N, T > &v1)
 Computes the 'negative' vector.
 
template<class T2 , size_t N, class T >
Vec< N, T > operator* (T2 s, const Vec< N, T > &v)
 Computes the scalar-vector product.
 
template<size_t N, class T >
Vec< N, T > operator+ (const Vec< N, T > &v1, const Vec< N, T > &v2)
 Computes the addition of two vectors.
 
template<size_t N, class T >
Vec< N, T > operator- (const Vec< N, T > &v1, const Vec< N, T > &v2)
 Computes the subtraction of two vectors.
 
template<size_t N, class T >
length (const Vec< N, T > &v)
 Computes the length/magnitude of a vector.
 
template<size_t N, class T >
norm (const Vec< N, T > &v)
 Computes the length/magnitude of a vector.
 
template<size_t N, class T >
length2 (const Vec< N, T > &v)
 Computes the squared length/magnitude of a vector.
 
template<size_t N, class T >
distance (const Vec< N, T > &v1, const Vec< N, T > &v2)
 Computes the distance between two vectors/points.
 
template<size_t N, class T >
distance2 (const Vec< N, T > &v1, const Vec< N, T > &v2)
 Computes the squared distance between two vectors/points.
 
template<size_t N, class T >
Vec< N, T > normalize (const Vec< N, T > &v)
 Computes and returns the normalized vector (Note: the input vector is not modified).
 
template<size_t N, class T >
Vec< N, T > mix (const Vec< N, T > &v1, const Vec< N, T > &v2, T w)
 
template<class T >
dot (const Vec< 2, T > &v1, const Vec< 2, T > &v2)
 
template<class T >
det (const Vec< 2, T > &v1, const Vec< 2, T > &v2)
 
template<class T >
Vec< 2, T > operator- (const Vec< 2, T > &v1)
 
template<class T2 , class T >
Vec< 2, T > operator* (T2 s, const Vec< 2, T > &v)
 
template<class T >
Vec< 2, T > operator+ (const Vec< 2, T > &v1, const Vec< 2, T > &v2)
 
template<class T >
Vec< 2, T > operator- (const Vec< 2, T > &v1, const Vec< 2, T > &v2)
 
template<class T >
dot (const Vec< 3, T > &v1, const Vec< 3, T > &v2)
 
template<class T >
Vec< 3, T > cross (const Vec< 3, T > &v1, const Vec< 3, T > &v2)
 
template<class T >
Vec< 3, T > operator- (const Vec< 3, T > &v1)
 
template<class T2 , class T >
Vec< 3, T > operator* (T2 s, const Vec< 3, T > &v)
 
template<class T >
Vec< 3, T > operator+ (const Vec< 3, T > &v1, const Vec< 3, T > &v2)
 
template<class T >
Vec< 3, T > operator- (const Vec< 3, T > &v1, const Vec< 3, T > &v2)
 
template<class T >
Vec< 3, T > orthogonal (const Vec< 3, T > &v)
 
template<class T >
dot (const Vec< 4, T > &v1, const Vec< 4, T > &v2)
 
template<class T >
Vec< 4, T > operator- (const Vec< 4, T > &v1)
 
template<class T2 , class T >
Vec< 4, T > operator* (T2 s, const Vec< 4, T > &v)
 
template<class T >
Vec< 4, T > operator+ (const Vec< 4, T > &v1, const Vec< 4, T > &v2)
 
template<class T >
Vec< 4, T > operator- (const Vec< 4, T > &v1, const Vec< 4, T > &v2)
 
template<size_t N, class T >
std::ostream & operator<< (std::ostream &out, const Vec< N, T > &v)
 
template<size_t N, class T >
std::istream & operator>> (std::istream &in, Vec< N, T > &v)
 
template<class T >
std::ostream & operator<< (std::ostream &out, const Vec< 2, T > &v)
 
template<class T >
std::istream & operator>> (std::istream &in, Vec< 2, T > &v)
 
template<class T >
std::ostream & operator<< (std::ostream &out, const Vec< 3, T > &v)
 
template<class T >
std::istream & operator>> (std::istream &in, Vec< 3, T > &v)
 
template<class T >
std::ostream & operator<< (std::ostream &out, const Vec< 4, T > &v)
 
template<class T >
std::istream & operator>> (std::istream &in, Vec< 4, T > &v)
 
template<size_t N, class T >
bool has_nan (const Vec< N, T > &v)
 
template<size_t N, class T >
bool operator== (const Vec< N, T > &a, const Vec< N, T > &b)
 
template<size_t N, class T >
bool operator!= (const Vec< N, T > &a, const Vec< N, T > &b)
 
template<size_t N, class T >
bool operator< (const Vec< N, T > &a, const Vec< N, T > &b)
 
template<size_t N, class T >
Vec< N, T > comp_product (const Vec< N, T > &v1, const Vec< N, T > &v2)
 return component-wise product
 
template<size_t N, class T >
Vec< N, T > comp_min (const Vec< N, T > &v1, const Vec< N, T > &v2)
 return component-wise minimum
 
template<size_t N, class T >
Vec< N, T > comp_max (const Vec< N, T > &v1, const Vec< N, T > &v2)
 return component-wise maximum
 
template<size_t N, class T >
min_coord (const Vec< N, T > &a)
 return the minimum coordinate of all vector elements
 
template<size_t N, class T >
max_coord (const Vec< N, T > &a)
 return the maximum coordinate of all vector elements
 
template<size_t N, class T >
Vec< N, T > clamp (const Vec< N, T > &a, const Vec< N, T > &lower, const Vec< N, T > &upper)
 component-wise clamp
 
int version_major ()
 returns the major version number of Easy3D
 
int version_minor ()
 returns the major version number of Easy3D
 
int version_patch ()
 returns the minor version number of Easy3D
 
std::string version ()
 returns the version string of Easy3D
 
void discretize_image (std::vector< unsigned char > &data, int width, int height, int channels, int num_stripes)
 Discretize a gradually varying-color (from left to right) image into a set of uniform colored vertical stripes. More...
 
std::ostream & operator<< (std::ostream &s, console::Style style)
 
Global methods for connection and disconnection.
template<typename SIGNAL , typename FUNCTION >
int connect (SIGNAL *signal, FUNCTION const &slot)
 Connects a function to the signal. More...
 
template<typename SIGNAL , typename CLASS , typename FUNCTION >
int connect (SIGNAL *signal, CLASS *inst, FUNCTION const &slot)
 Connects a member function of an object to this Signal. More...
 
template<typename... Args>
int connect (Signal< Args... > *sender, Signal< Args... > *receiver)
 Connects this signal to another signal. More...
 
template<typename SIGNAL >
void disconnect (SIGNAL *signal, int id)
 Disconnects a previously connected function.
 
template<typename SIGNAL >
void disconnect_all (SIGNAL *signal)
 Disconnects all previously connected functions.
 
Helper functions for resolving overloaded functions.
template<typename... Args>
constexpr auto overload (void(*func)(Args...)) -> void(*)(Args...)
 Helper function for resolving overloaded non-member functions. More...
 
template<typename C , typename... Args>
constexpr auto overload (void(C::*func)(Args...)) -> void(C::*)(Args...)
 Helper function for resolving overloaded member functions. More...
 

Detailed Description


The code is adapted from libQGLViewer with modifications.

libQGLViewer is a C++ library based on Qt that eases the creation of OpenGL 3D viewers.


Gathers different basic types for geometric operations. Types defined here are points/vectors, lines, segments, planes, boxes and matrices in 2D and 3D.


the code is adapted from Surface_mesh with modifications and significant enhancement.

Surface_mesh is a halfedge-based mesh data structure for representing and processing 2-manifold polygonal surface meshes. It is implemented in C++ and designed with an emphasis on simplicity and efficiency.



the code is adapted from libQGLViewer with modifications.

libQGLViewer is a C++ library based on Qt that eases the creation of OpenGL 3D viewers.



The code in this file is adapted from libQGLViewer with significant modifications and enhancement.



the code is adapted from ShaderProgram with modifications.

This class allows to create programs, load shaders from files, associate vertex attribute names with locations, and work with uniforms, including blocks. It also provides access to the info logs, and many more useful functionalities.


Function Documentation

◆ cholesky_decompose()

bool cholesky_decompose ( const Mat< N, N, FT > &  A,
Mat< N, N, FT > &  L 
)

Cholesky decomposition of a symmetric, positive definite matrix.

For a symmetric, positive definite matrix A, this function computes the Cholesky factorization, i.e. it computes a lower triangular matrix L such that A = L*L'. If the matrix is not symmetric or positive definite, the function computes only a partial decomposition.

Returns
\true if the input matrix is symmetric, positive definite (and then the factorization was successful).

◆ cholesky_solve() [1/2]

void cholesky_solve ( const Mat< N, N, FT > &  L,
const Vec< N, FT > &  b,
Vec< N, FT > &  x 
)

Solve a linear system A*x = b, using the previously computed Cholesky factorization of A: L*L'.

Parameters
LN x N matrix, which is the result of a call to cholesky_decompose().
bN-dimensional input right-hand vector.
xOutput N-dimensional solution set.

◆ cholesky_solve() [2/2]

void cholesky_solve ( const Mat< N, N, T > &  L,
const Mat< N, M, T > &  B,
Mat< N, M, T > &  X 
)

Solve a set (i.e, M) of linear systems A*X = B, using the previously computed Cholesky factorization of A: L*L'. (this function can be used to solve for the inverse of a symmetric, positive definite matrix, by using B = I).

Parameters
LN x N matrix, which is the result of a call to cholesky_decompose().
BN x M right-hand matrix.
XOutput N x M solution matrix.

◆ complex_matrix()

Matrix< std::complex< FT > > complex_matrix ( const Matrix< FT > &  rA)

Convert real matrix to complex matrix.

Convert real matrix to std::complex matrix.

◆ conjugate_transpose()

Matrix< FT > conjugate_transpose ( const Matrix< FT > &  A)

matrix conjugate transpose

◆ connect() [1/3]

int easy3d::connect ( SIGNAL *  signal,
CLASS *  inst,
FUNCTION const &  slot 
)
inline

Connects a member function of an object to this Signal.

The returned value can be used to disconnect the function from this signal.

easy3d::connect(&kfi_->interpolation_stopped, viewer, &Viewer::update);
void update() const
Update the display (i.e., repaint).
Definition: viewer.cpp:577
int connect(SIGNAL *signal, FUNCTION const &slot)
Connects a function to the signal.
Definition: signal.h:202
Note
When a member function has overloads, explicitly cast the function to the right function type, e.g.,
static_cast<void (Viewer::*)(const std::string&, int)>(&Viewer::print)
The built-in Easy3D Viewer.
Definition: viewer.h:61
Or use the helper function overload for a lighter syntax.

◆ connect() [2/3]

int easy3d::connect ( SIGNAL *  signal,
FUNCTION const &  slot 
)
inline

Connects a function to the signal.

The returned value can be used to disconnect the function from this signal.

Note
When a function has overloads, explicitly cast the function to the right function type, e.g.,
static_cast<void (*)(const std::string&, int)>(&print)
Or use the helper function overload for a lighter syntax.
Examples
Test_Signal, Tutorial_203_Viewer_wxWidgets, Tutorial_204_Viewer_Qt, and Tutorial_206_CameraInterpolation.

◆ connect() [3/3]

int easy3d::connect ( Signal< Args... > *  sender,
Signal< Args... > *  receiver 
)

Connects this signal to another signal.

Upon return, the emission of this signal will trigger another to be emitted. The returned value can be used to disconnect the connected signal.

◆ determinant()

T easy3d::determinant ( const Mat< N, N, T > &  m)

Return the determinant of N x N (square) matrix m.

Note
This is specialized for matrices up to 4x4 in order to achieve better performance. The general case uses LU decomposition.

◆ diagonal() [1/2]

std::vector< FT > diagonal ( const Matrix< FT > &  A)

Get the diagonal entries of matrix.

◆ diagonal() [2/2]

Matrix< FT > diagonal ( const std::vector< FT > &  d)

Generate the diagonal of matrix by given its diagonal elements.

◆ discretize_image()

void discretize_image ( std::vector< unsigned char > &  data,
int  width,
int  height,
int  channels,
int  num_stripes 
)

Discretize a gradually varying-color (from left to right) image into a set of uniform colored vertical stripes.

Parameters
dataThe input data to be discretized.
widthThe width of the image (i.e., number of pixels in a row).
heightThe height of the image (i.e., number of pixels in a column).
channelsThe number or color component per pixel.
num_stripesThe number of stripes. The image will remain unmodified if num_stripes >= image width.

◆ elem_divd()

Matrix< FT > elem_divd ( const Matrix< FT > &  A1,
const Matrix< FT > &  A2 
)
inline

matrix-matrix element-wise division

◆ elem_mult() [1/2]

Matrix< FT > elem_mult ( const Matrix< FT > &  A1,
const Matrix< FT > &  A2 
)
inline

element-wise multiplication / division

matrix-matrix element-wise multiplication

◆ elem_mult() [2/2]

std::vector< FT > elem_mult ( const std::vector< FT > &  v1,
const std::vector< FT > &  v2 
)
inline

element-wise multiplication / division

vector-vector element-wise multiplication

◆ extrude() [1/2]

SurfaceMesh * extrude ( const std::vector< Polygon2 > &  contours,
float  height 
)

Extrudes a 3D surface mesh from a set of simple contours.

Parameters
contoursThe input contours, which must be simple, i.e.,
  • free of intersections,
  • CCW contours defining the outer boundary and CW contours defining holes. Simple contours can be obtained using the tessellator.
heightThe height (in the Z direction) of the extruded 3D model.
Returns
The extruded surface mesh model. NULL on failure.

◆ extrude() [2/2]

bool extrude ( SurfaceMesh mesh,
const std::vector< Polygon2 > &  contours,
float  height 
)

Extrudes a 3D surface mesh from a set of simple contours.

Parameters
meshThe output mesh model. Must be allocated before hand.
contoursThe input contours, which must be simple, i.e.,
  • free of intersections,
  • CCW contours defining the outer boundary and CW contours defining holes. Simple contours can be obtained using the tessellator.
heightThe height (in the Z direction) of the extruded 3D model.
Returns
True on success and false on failure.

◆ gauss_jordan_elimination()

bool gauss_jordan_elimination ( const Mat< N, N, T > &  a,
const Mat< N, M, T > &  b,
Mat< N, N, T > *  ainv,
Mat< N, M, T > *  x 
)
inline

Perform Gauss-Jordan elimination to solve a set of linear equations and additionally compute the inverse of the input coefficient matrix.

Parameters
aN x N input matrix.
bN x M input matrix containing right-hand vectors.
ainvOutput inverse of a. This may safely be the same location as a (a will be overwritten).
xOutput solution set. This may safely be the same location as b (b will be overwritten).
Returns
true on success, false if a is a singular matrix.

◆ identity()

Matrix< FT > identity ( int  N,
const FT &  x 
)

unit and diagonal matrix

Generate the identity matrix.

◆ inverse()

Mat< N, N, T > inverse ( const Mat< N, N, T > &  m)
inline

Return the inverse of N x N (square) matrix m.

Note
This is specialized for matrices up to 4x4 in order to achieve better performance. The general case uses Gauss-Jordan elimination (which uses less memory than the LU decomposition).
Examples
Tutorial_203_Viewer_wxWidgets, and Tutorial_204_Viewer_Qt.

◆ lu_back_substitution()

void lu_back_substitution ( const Mat< N, N, T > &  alu,
const Vec< N, T > &  rowp,
const Vec< N, T > &  b,
Vec< N, T > *  x 
)
inline

Solve a set of linear equations using outputs from lu_decomposition() as inputs.

Parameters
aluN x N matrix, which is the result of a call to lu_decomposition().
rowpRow permutation data for alu, which is the result of a call to lu_decomposition().
bN-dimensional input right-hand vector.
xOutput N-dimensional solution set.

Solve a linear system:

// inputs:
Mat<N, N, T> a; // input rhs matrix
Vec<N, T> b; // input lhs vector
// outputs:
Mat<N, N, T> alu; // result of LU decomposition
Vec<N, size_t> rowp; // result row permutation data for alu
T d; // sign of determinant
Vec<N, size_t> x; // result solution set
...
lu_decomposition(a, &alu, &rowp, &d); // get lu decomposition
lu_back_substitution(alu, rowp, b, &x); // get solution set
Base class for matrix types.
Definition: mat.h:66
Base class for vector types. It provides generic functionality for N dimensional vectors.
Definition: vec.h:34
void lu_back_substitution(const Mat< N, N, T > &alu, const Vec< N, T > &rowp, const Vec< N, T > &b, Vec< N, T > *x)
Solve a set of linear equations using outputs from lu_decomposition() as inputs.
Definition: mat.h:1268

The last line may be repeated for any number of b vectors using the same alu and rowp inputs.

Find the inverse of a matrix:

// inputs:
Mat<N, N, T> a; // input matrix
// outputs:
Mat<N, N, T> alu; // result of LU decomposition
Mat<N, N, T> ainv; // result of inversion
Vec<N, size_t> rowp; // result row permutation data for alu
T d; // sign of determinant
...
lu_decomposition(a, &alu, &rowp, &d); // get lu decomposition once
for (size_t i = 0; i < N; ++i) { // find inverse by columns
for (size_t j = 0; j < N; ++j)
b[j] = T(0);
b[i] = T(1);
lu_back_substitution(alu, rowp, b, &b);
ainv.set_col(i, b); // set ainv column
}
void set_col(size_t c, const Vec< vN, T > &v)
Set col c from vector v. This copies the first N components from v, so vN must be >= N....
Definition: mat.h:528

Find the determinant of a matrix:

// inputs:
Mat<N, N, T> a; // input matrix
// outpus:
Mat<N, N, T> alu; // result of LU decomposition
Vec<N, size_t> rowp; // result row permutation data for alu
T d; // output determinant
lu_decomposition(a, &alu, &rowp, &d);
for (size_t i = 0; i < N; ++i)
d *= alu(i, i);
bool lu_decomposition(const Mat< N, N, T > &a, Mat< N, N, T > *alu, Vec< N, T > *rowp, T *d)
Perform LU decomposition of a square matrix.
Definition: mat.h:1192

◆ lu_decomposition()

bool lu_decomposition ( const Mat< N, N, T > &  a,
Mat< N, N, T > *  alu,
Vec< N, T > *  rowp,
T *  d 
)
inline

Perform LU decomposition of a square matrix.

The outputs from this method can further be used for multiple purposes:

  • with lu_back_substitution() to solve a set of linear equations;
  • compute the inverse of the input matrix matrix;
  • compute the determinant of the input matrix matrix.
    Parameters
    aN x N input matrix.
    aluOutput N x N matrix, containing the LU decomposition of a row-wise permutation of a. This may safely be the same location as a (a will be overwritten).
    rowpOutput row permutation data for alu.
    Returns
    true on success, false if a is a singular matrix.

◆ max()

std::vector< FT > max ( const Matrix< FT > &  A)

Maximum of matrix's column vectors.

◆ mean()

std::vector< FT > mean ( const Matrix< FT > &  A)
inline

Matrix's column vectors mean.

◆ min()

std::vector< FT > min ( const Matrix< FT > &  A)

Minimum of matrix's column vectors.

◆ mix()

Vec< N, T > easy3d::mix ( const Vec< N, T > &  v1,
const Vec< N, T > &  v2,
w 
)
inline

linear interpolation between between two vectors (x and y). The return value is computed as (1 − w) * v1 + w * v2.

◆ mult() [1/4]

Matrix< FT > mult ( const Matrix< FT > &  A,
const Matrix< FT > &  B 
)

This is an optimized version of matrix multiplication, where the destination matrix has already been allocated.

◆ mult() [2/4]

void mult ( const Matrix< FT > &  A,
const Matrix< FT > &  B,
Matrix< FT > &  C 
)

multiplication

This is an optimized version of matrix multiplication, where the destination matrix has already been allocated.

◆ mult() [3/4]

std::vector< FT > mult ( const Matrix< FT > &  A,
const std::vector< FT > &  b 
)

This is an optimized version of matrix and vector multiplication, where the destination vector has already been allocated.

◆ mult() [4/4]

void mult ( const Matrix< FT > &  A,
const std::vector< FT > &  b,
std::vector< FT > &  c 
)

This is an optimized version of matrix and vector multiplication, where the destination vector has already been allocated.

◆ mult_transpose() [1/2]

Matrix< FT > mult_transpose ( const Matrix< FT > &  A1,
const Matrix< FT > &  A2 
)

matrix-matrix tranpose multiplication: A * B^T.

◆ mult_transpose() [2/2]

Matrix< FT > mult_transpose ( const std::vector< FT > &  a,
const std::vector< FT > &  b 
)

vector-vector tranpose multiplication: a * b^T.

◆ next_pow2()

int easy3d::next_pow2 ( int  a)
inline

Calculates the next larger power of 2. If the input is already a power of 2, it will return itself.

Parameters
aThe starting point for finding the next power of 2.
Returns
value^2. Example: next_pow2(50); // returns 64 next_pow2(64); // returns 64 next_pow2(401); // returns 512

◆ norm() [1/2]

FT norm ( const Matrix< FT > &  A)

utilities

Compute Frobenius norm of matrix.

◆ norm() [2/2]

FT norm ( const std::vector< FT > &  v)

utilities

std::vector's norm in Euclidean space.

◆ operator*() [1/4]

Vec< 2, T > operator* ( const Mat2< T > &  lhs,
const Vec< 2, T > &  rhs 
)
inline

non-homogeneous version

◆ operator*() [2/4]

Matrix< FT > operator* ( const Matrix< FT > &  A1,
const Matrix< FT > &  A2 
)

matrix-matrix multiplication

◆ operator*() [3/4]

std::vector< FT > operator* ( const Matrix< FT > &  A,
const std::vector< FT > &  b 
)

matrix-vector multiplication

◆ operator*() [4/4]

FT operator* ( const std::vector< FT > &  v1,
const std::vector< FT > &  v2 
)

dot product

Inner product for vectors.

◆ operator+() [1/2]

Matrix< FT > operator+ ( const Matrix< FT > &  A,
const FT &  x 
)
inline

matrix-scalar addition

◆ operator+() [2/2]

Matrix< FT > operator+ ( const Matrix< FT > &  A1,
const Matrix< FT > &  A2 
)
inline

matrix-matrix addition

◆ operator-() [1/4]

Matrix< FT > operator- ( const Matrix< FT > &  A)

arithmetic operators

get negative matrix

◆ operator-() [2/4]

Matrix< FT > operator- ( const Matrix< FT > &  A,
const FT &  x 
)
inline

matrix-scalar subtraction

◆ operator-() [3/4]

Matrix< FT > operator- ( const Matrix< FT > &  A1,
const Matrix< FT > &  A2 
)
inline

matrix-matrix subtraction

◆ operator-() [4/4]

std::vector< FT > operator- ( const std::vector< FT > &  A)

arithmetic operators

get negative vector

◆ operator<<()

std::ostream & operator<< ( std::ostream &  out,
const Matrix< FT > &  A 
)

input and output

Overload the output stream function.

◆ operator>>()

std::istream & operator>> ( std::istream &  in,
Matrix< FT > &  A 
)

Overload the input stream function.

◆ overload() [1/2]

constexpr auto easy3d::overload ( void(*)(Args...)  func) -> void (*)(Args...)
inlineconstexpr

Helper function for resolving overloaded non-member functions.

In case of overloading, the pointer to a function does not map to a unique symbol, so the compiler won't be able to pick the right symbol. One way of resolving the right symbol is to explicitly cast the function pointer to the right function type, e.g., static_cast<void (*)(const std::string&, int)>(func), which is a bit heavy syntax. This helper function does just that for a lighter syntax. Example usage:

void foo() {} // function #1
void foo(int) {} // function #2
sig_1.connect(overload<>(&foo)); // sig_1 connects to function #1
sig_2.connect(overload<int>(&foo)); // sig_2 connects to function #2
See also
overload(void (C::*func)(Args...))

◆ overload() [2/2]

constexpr auto easy3d::overload ( void(C::*)(Args...)  func) -> void (C::*)(Args...)
inlineconstexpr

Helper function for resolving overloaded member functions.

In case of overloading, the pointer to a member function does not map to a unique symbol, so the compiler won't be able to pick the right symbol. One way of resolving the right symbol is to explicitly cast the function pointer to the right function type, e.g., static_cast<void (Viewer::*)(const std::string&, int)>(&Viewer::print), which is a bit heave syntax. This helper function does just that for a lighter syntax. Example usage:

struct foo {
void bar() {} // function #1
void bar(int) {} // function #2
};
sig_1.connect(overload<>(&foo::bar)); // sig_1 connects to function #1
sig_2.connect(overload<int>(&foo::bar)); // sig_2 connects to function #2
See also
overload(void (*func)(Args...))

◆ sum()

std::vector< FT > sum ( const Matrix< FT > &  A)

Matrix's column vectors sum.

◆ swap()

void swap ( Matrix< FT > &  lhs,
Matrix< FT > &  rhs 
)

Swap two matrices.

◆ tensor()

Mat< N, M, T > tensor ( const Vec< M, T > &  u,
const Vec< N, T > &  v 
)
inline

Return the tensor product (outer product) of vectors u and v, where u is treated as a column vector and v is treated as a row vector.

◆ trace()

FT trace ( const Matrix< FT > &  A)

the trace of this matrix, i.e. the sum of the coefficients on the main diagonal. NOTE: the matrix can be any matrix, not necessarily square.

◆ transpose()

Matrix< FT > transpose ( const Matrix< FT > &  A)

transpose and conjugate transpose

matrix transpose

◆ transpose_mult() [1/2]

Matrix< FT > transpose_mult ( const Matrix< FT > &  A1,
const Matrix< FT > &  A2 
)

transpose multiplication

matrix-matrix tranpose multiplication: A^T * B.

◆ transpose_mult() [2/2]

std::vector< FT > transpose_mult ( const Matrix< FT > &  A,
const std::vector< FT > &  v 
)

matrix-vector tranpose multiplication: A^T * b.