Logo

MonoCalc

/

Barycentric Coordinate Calculator

Geometry

Calculation Mode

Reference Triangle

Vertex A

Vertex B

Vertex C

Query Point P

Triangle Center Presets

Decimal Precision (0–10)

Barycentric Coordinates (λ₁, λ₂, λ₃)

(0.3333, 0.3333, 0.3333)

Sum check: λ₁ + λ₂ + λ₃ = 1.0000

Point Location

Inside

Triangle Properties

Area6.0000 sq units
Side AB4.0000
Side BC3.6056
Side CA3.6056
ClassificationIsosceles Acute

Triangle Diagram

ABCP

About This Tool

Barycentric Coordinate Calculator – Triangle Weight Conversion

Barycentric coordinates describe the position of a point relative to a reference triangle instead of relative to a fixed origin. Any point P in the plane of a triangle with vertices A, B, and C can be written as a weighted combinationP = λ₁·A + λ₂·B + λ₃·C, where the three weights always sum to 1. This calculator converts freely between Cartesian (x, y) coordinates and barycentric weights, and classifies whether a point falls inside, on the edge of, or outside the triangle.

The Conversion Formula

Given triangle vertices A(x₁, y₁), B(x₂, y₂), C(x₃, y₃) and a query point P(px, py), the calculator first computes the signed area denominator:

T = (y₂ − y₃)(x₁ − x₃) + (x₃ − x₂)(y₁ − y₃)

The barycentric weights are then:

λ₁ = [(y₂ − y₃)(px − x₃) + (x₃ − x₂)(py − y₃)] / T

λ₂ = [(y₃ − y₁)(px − x₃) + (x₁ − x₃)(py − y₃)] / T

λ₃ = 1 − λ₁ − λ₂

For the reverse operation — reconstructing a Cartesian point from known barycentric weights — the calculator applies the affine combination directly:

x = λ₁·x₁ + λ₂·x₂ + λ₃·x₃

y = λ₁·y₁ + λ₂·y₂ + λ₃·y₃

Classifying a Point's Location

The sign of each barycentric weight reveals exactly where the point sits relative to the triangle:

  • Inside— all three weights are strictly positive (λ₁, λ₂, λ₃ > 0)
  • On boundary — one weight is (approximately) zero and the other two are non-negative, meaning the point lies on an edge or exactly at a vertex
  • Outside — at least one weight is negative

This makes barycentric coordinates one of the fastest and most numerically stable ways to perform point-in-triangle testing, widely used in rasterization and collision detection.

Worked Example

Consider triangle A(0, 0), B(4, 0), C(2, 3) with query point P(2, 1):

  • T = (0 − 3)(0 − 2) + (2 − 4)(0 − 3) = 6 + 6 = 12
  • λ₁ = [(0 − 3)(2 − 2) + (2 − 4)(1 − 3)] / 12 = 4 / 12 ≈ 0.3333
  • λ₂0.3333
  • λ₃ = 1 − 0.3333 − 0.3333 ≈ 0.3333

Since all three weights are equal and positive, P is exactly the centroid of the triangle — confirming the well-known result that the centroid always has barycentric coordinates (1/3, 1/3, 1/3).

Triangle Center Presets

The calculator includes one-click presets for four classic triangle centers:

  • Centroid — always (1/3, 1/3, 1/3), the average of the three vertices
  • Incenter — weights proportional to the opposite side lengths, a : b : c
  • Circumcenter — weights proportional to sin(2A) : sin(2B) : sin(2C)
  • Orthocenter — weights proportional to tan(A) : tan(B) : tan(C)

Degenerate Triangles

If the three vertices are collinear, the denominator T equals zero and barycentric coordinates are mathematically undefined. The calculator checks|T| < 1×10⁻¹⁰ and displays a clear warning instead of a misleading result whenever the triangle degenerates into a straight line.

Practical Applications

  • Computer graphics — GPU rasterizers use barycentric weights to interpolate colors, texture coordinates, and normals smoothly across a triangle
  • Finite element analysis — triangular mesh elements use barycentric (area) coordinates as shape functions for interpolating field values
  • Computational geometry — fast, numerically robust point-in-triangle and point-in-mesh testing
  • GIS and terrain modeling — elevation interpolation across triangulated irregular networks (TINs)

Adjustable Precision

All calculations use JavaScript's 64-bit double-precision floating-point arithmetic. You can control the number of displayed decimal places from 0 to 10 using the Decimal Precision field, which is useful for both quick estimates and high-precision engineering work.

Frequently Asked Questions

Is the Barycentric Coordinate Calculator free?

Yes, Barycentric Coordinate Calculator is totally free :)

Can I use the Barycentric Coordinate Calculator offline?

Yes, you can install the webapp as PWA.

Is it safe to use Barycentric Coordinate Calculator?

Yes, any data related to Barycentric Coordinate Calculator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What are barycentric coordinates?

Barycentric coordinates express any point P in a triangle's plane as a weighted combination of the triangle's three vertices A, B, and C: P = λ₁·A + λ₂·B + λ₃·C, where the weights λ₁, λ₂, λ₃ always sum to 1. They describe a point's position relative to the triangle rather than relative to a fixed coordinate origin.

How does this calculator work?

Enter the Cartesian coordinates of triangle vertices A, B, and C, then either a query point P (Cartesian → Barycentric mode) or a set of weights λ₁, λ₂, λ₃ (Barycentric → Cartesian mode). The calculator applies the standard determinant-based formula to convert between the two representations instantly, and also classifies whether the point lies inside, on the boundary of, or outside the triangle.

How can I tell if a point is inside the triangle?

A point lies strictly inside the triangle when all three barycentric weights are positive (λ₁, λ₂, λ₃ > 0). If any weight is exactly zero the point lies on an edge or at a vertex (on the boundary), and if any weight is negative the point lies outside the triangle. This calculator performs that classification automatically.

What happens if the triangle vertices are collinear?

If the three vertices lie on a straight line, the triangle has zero area and the barycentric coordinate formula divides by zero. The calculator detects this degenerate case (when the denominator's absolute value is below 1×10⁻¹⁰) and shows a warning instead of a meaningless result.

What are the centroid, incenter, and circumcenter presets?

These are one-click presets for common triangle centers expressed in barycentric form: the centroid is always (1/3, 1/3, 1/3); the incenter uses weights proportional to the opposite side lengths (a : b : c); and the circumcenter uses weights proportional to sin(2A) : sin(2B) : sin(2C) based on the triangle's interior angles.

Where are barycentric coordinates used in practice?

They are widely used in computer graphics for triangle rasterization and texture/color interpolation, in finite element analysis for interpolating values across triangular mesh elements, in GIS for terrain triangulation, and in computational geometry for fast point-in-triangle testing.