How this calculation works
Assemble a triangle mesh’s cotangent stiffness matrix, lumped area mass and mass-normalized operator. The page states its positive-stiffness sign convention explicitly because geometry libraries often expose the negative of the same matrix under the Laplacian name. Triangle validation and boundary information accompany the numeric rows.
K_ij=−(cot alpha+cot beta)/2; M_ii=Σ_incident area/3.A worked example
The unit right triangle has area 1/2. Its lumped mass entries are all 1/6, and the stiffness matrix is [[1,−1/2,−1/2],[−1/2,1/2,0],[−1/2,0,1/2]]. Every stiffness row sums to 0, so a constant vertex function has zero discrete Laplacian.
Good to know
≤60vertices/100triangles, positive-stiffness sign convention, lumped area mass. Rejects degenerate/duplicate faces, isolated listed vertices and nonmanifold edges; no boundary conditions imposed.
Reference: Method reference: Cotangent Laplacian calculator from a triangle mesh (opens in a new tab) ↗
Separate mesh geometry from topology alone
Vertex rows contain three-dimensional coordinates, while face rows contain three zero-based vertex indices. Edge lengths and angles determine cotangent weights, so changing coordinates without changing connectivity can change the operator. An Euler characteristic or homology calculation uses different information and cannot supply these matrix entries by itself.
The face list must reference every listed vertex and contain distinct nondegenerate triangles. Repeating a face would double-count its energy and mass, so duplicates are rejected. An edge incident to more than two faces is also rejected by this small manifold-edge input contract.
The Mean value polygon coordinates calculator for an interior point interpolates a query point using a planar boundary. Cotangent stiffness instead assembles triangular-mesh edge weights and lumped surface masses; its row-sum identity concerns constant functions on vertices.
Derive one local edge weight
For an edge in a triangle, the angle opposite that edge contributes cotangent of that angle divided by two. If two triangles share an interior edge, both opposite-angle contributions are added. Boundary edges receive only the contribution from their single incident triangle.
The stiffness off-diagonal is minus this summed weight, and each diagonal is chosen so its row sums to zero. Obtuse angles can give negative cotangents, so one negative individual weight is not automatically a mesh error. The assembled finite-element stiffness still has the relevant energy interpretation for valid triangles.
Read the sign convention before comparing libraries
This page returns positive-semidefinite stiffness K, with the usual negative off-diagonals for acute local contributions. Some geometry packages name the negative-semidefinite matrix L the cotangent Laplacian. Their entries can therefore be exact sign reversals without either implementation being wrong.
The mass-normalized operator returned here is M inverse K, not K itself and not a symmetrically normalized matrix. It can be nonsymmetric in ordinary coordinates when vertex masses differ, although it has the corresponding weighted structure. Match sign and normalization before comparing eigenvalues or diffusion equations.
Verify the unit right triangle
Vertices (0,0,0),(1,0,0),(0,1,0) form area one half. The right angle contributes cotangent zero across the hypotenuse, while the two acute angles contribute one half each across the legs. Stiffness rows are (1,−1/2,−1/2), (−1/2,1/2,0), and (−1/2,0,1/2).
Every lumped mass is one sixth because each vertex receives one third of the triangle area. The masses sum to one half, and each stiffness row sums to zero. Multiplying K by a constant vector therefore gives zero, a useful independent check that the diagonal assembly matches the off-diagonal weights.
Understand lumped area mass
The mass assigned to a vertex is the sum of one third of each incident triangle area. This diagonal lumping differs from a full consistent finite-element mass matrix, which has off-diagonal contributions. The choice affects normalized operators and numerical evolution, so the page labels it rather than presenting every mass convention as equivalent.
Uniformly scaling mesh coordinates by s multiplies areas and lumped masses by s squared, while cotangent stiffness weights remain unchanged. The normalized operator consequently scales by one over s squared. This provides a useful unit-sensitivity check and explains why raw stiffness entries alone do not encode a physical length scale.
Keep boundary conditions separate from assembly
The returned boundary edges identify where only one face contributes. No Dirichlet rows are replaced and no boundary values are imposed. Assembled stiffness with its unmodified row sums corresponds to the natural weak-form boundary structure, but solving a particular PDE requires its own boundary specification.
Do not invert K blindly: a constant nullspace is expected on each connected component before suitable constraints. A singular matrix is not necessarily an assembly failure. The calculator does not solve diffusion, Poisson equations or harmonic interpolation under a hidden fixed-boundary rule; it provides the operator ingredients for those tasks.
Respect mesh-quality and numerical limitations
The form supports at most sixty vertices and one hundred faces and rejects zero-area faces, unreferenced vertices and nonmanifold edges. These checks do not prove global non-self-intersection, orientation consistency for every geometric use or high-quality triangle shapes. Very skinny accepted triangles can still yield large cotangent weights.
Use consistent coordinates and inspect mesh quality before interpreting an operator as an accurate approximation to a smooth surface differential equation. The primary reference describes a broader geometry-processing workflow, while this page implements matrix assembly only. Retain the sign, lumping and boundary conventions with any exported rows.
A few questions, answered
Why are my entries the negative of another library?
That library may expose negative-semidefinite L while this page returns positive stiffness K=−L.
Does the page impose fixed boundary values?
No. It assembles operators and identifies boundary edges without imposing a PDE boundary condition.
Should constant vectors be in the nullspace?
Yes. Stiffness rows sum to zero before external constraints are imposed.
Is this the full consistent mass matrix?
No. It returns diagonal lumped area mass, with one third of each incident triangle’s area per vertex.