Skip to content
CoreSource checked

Barycentric Coordinates

Represents a point inside a triangle as weights on the triangle's vertices.

Quick Facts

Compact metadata for implementation and discovery.

Category
Geometry
Difficulty
Intermediate
Family
Coordinate System
Tier
Core
Status
Verified
Review
Source Checked
Sources
2
Formulas
1
Relationships
4
Code example
Ready
Visualization
Ready

Overview

Barycentric coordinates are used for triangle interpolation, point-in-triangle tests, rasterization, and mesh processing.

Core Concepts

triangle weightsaffine combinationpoint containmentattribute interpolation

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(1)

Average

O(1)

Worst

O(1)

Space

O(1)

When to Use

  • Use when collision and intersection tests needs triangle weights.
  • Use when the input matches the assumptions behind coordinate System.

When Not to Use

  • Avoid when floating-point robustness is critical and no tolerance strategy is defined.
  • Avoid when a simpler algorithm gives the required result with less setup.

What It Does

  • Represents a point inside a triangle as weights on the triangle's vertices
  • Uses triangle weights and affine combination to guide the work.
  • Produces geometric relation, simplified shape, or constructed geometry.

Use Cases

  • Collision and intersection tests
  • Shape analysis
  • Geometry processing

Inputs

  • Points, segments, polygons, or meshes
  • Query shape or tolerance

Outputs

  • Geometric relation, simplified shape, or constructed geometry

Key Formulas (1)

Barycentric combination

p = u · a + v · b + w · c, with u + v + w = 1
p = u * a + v * b + w * c, with u + v + w = 1

Represents a point using triangle vertex weights.

Pseudocode

  1. 1.Prepare the inputs and state needed for Barycentric Coordinates.
  2. 2.Apply the triangle weights step while the stopping condition has not been met.
  3. 3.Update intermediate state and discard invalid candidates.
  4. 4.Return geometric relation, simplified shape, or constructed geometry.

Canonical Example

Input
Barycentric Coordinates with a minimal inspectable input
Output
Geometric relation, simplified shape, or constructed geometry
Explanation
Barycentric Coordinates applies triangle weights to produce geometric relation, simplified shape, or constructed geometry.

Implementation Notes

  • Use robust orientation and tolerance checks for boundary cases.
  • Keep the triangle weights step separate enough to test independently.

Common Pitfalls

  • Degenerate cases such as collinear points or shared edges often need explicit handling.
  • Forgetting to check edge cases can make Barycentric Coordinates look correct on only ideal inputs.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Draw the input shapes, active tests, and generated geometric result.

Barycentric Coordinates mechanism walkthrough step 1 of 4
Step 1 of 4: Prepare the inputs and state needed for Barycentric Coordinates.
geometry-mechanism

Notes

Barycentric Coordinates should be used with the assumptions and tradeoffs of coordinate System in mind.

Sources (2)

What each reference supports for this entry.

Computational Geometry: Algorithms and Applications

Book

Computational geometry textbook support for Barycentric Coordinates's geometric model, data structures, and robustness concerns.

Open source

The Algorithm Design Manual

Book

Algorithm catalog support for Barycentric Coordinates's problem context, known alternatives, and practical selection tradeoffs.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Triangulation and interpolation workflows commonly use barycentric coordinates.

Ray-triangle tests often compute barycentric coordinates for hit points.

Tags

Computational GeometryInterpolationTriangulationLinear Algebra