Skip to main content
n-1
Source Link
Gareth McCaughan
  • 122.1k
  • 7
  • 320
  • 464

[Note: OP has revised the question with a slightly different barycentric indexing scheme, which makes the following no longer quite right. I'll fix it up in a minute.]

Barycentric coordinates describe points rather than triangles. So let's identify each triangle by its "top centre" point. That's its top vertex for an upward-pointing triangle, and the centre of its top edge for a downward-pointing one.

Number the rows of triangles from 0. If the big triangle has $n$ little triangles on each side, then row $k$ contains the triangles whose reference points have barycentric coords $(n-k,b,c)$$(n-1-k,b,c)$ for some $b,c$. And it begins with triangle number $k^2$. (Rows have 1,3,5,... triangles; sums of odd numbers are squares.)

Then the reference points are spaced evenly(0-based) position within its row of the triangle with distancebarycentric indices $(a,b,c)$ is $2c+\varepsilon$ where $\varepsilon$ is 0 for upward-pointing triangles and 1/2 along each row for downward-pointing ones; we can distinguish these because the sum of all the barycentric indices is $n-1$ for upward triangles and $n-2$ for downward. In other words, $\varepsilon=n-1-(a+b+c)$.

Therefore, the triangle whose reference point haswith barycentric coordsindices $(a,b,c)$ is in row $n-a$$n-1-a$ which begins with triangle $(n-a)^2$$(n-1-a)^2$; within that row it's inits (0-based) position is $2c$$2c+n-1-(a+b+c)=n-1-a-b+c$; so its index number is $(n-a)^2+2c$$(n-1-a)^2+n-1-a-b+c$.

Let's sanity-check this by looking at the first triangle whose number isn't given in the diagram abovedo a spot check. Its reference point is atTriangle 7 has (6,3/2,1/2)$(a,b,c)=(0,0,1)$ and $n=8$ so its$n-1=2$. So the index should benumber is $(8-6)^2+2\cdot\frac12=5$,$(2-0)^2+2-0-0+1$ which is correctindeed 7. Looks like it works!.

(Remark: $n-1$ is probably a nicer parameter to work with than $n$ itself.)

[Note: OP has revised the question with a slightly different barycentric indexing scheme, which makes the following no longer quite right. I'll fix it up in a minute.]

Barycentric coordinates describe points rather than triangles. So let's identify each triangle by its "top centre" point. That's its top vertex for an upward-pointing triangle, and the centre of its top edge for a downward-pointing one.

Number the rows of triangles from 0. If the big triangle has $n$ little triangles on each side, then row $k$ contains the triangles whose reference points have barycentric coords $(n-k,b,c)$ for some $b,c$. And it begins with triangle number $k^2$. (Rows have 1,3,5,... triangles; sums of odd numbers are squares.)

Then the reference points are spaced evenly with distance 1/2 along each row.

Therefore, the triangle whose reference point has barycentric coords $(a,b,c)$ is in row $n-a$ which begins with triangle $(n-a)^2$; within that row it's in (0-based) position $2c$; so its index number is $(n-a)^2+2c$.

Let's sanity-check this by looking at the first triangle whose number isn't given in the diagram above. Its reference point is at (6,3/2,1/2) and $n=8$ so its index should be $(8-6)^2+2\cdot\frac12=5$, which is correct. Looks like it works!

[Note: OP has revised the question with a slightly different barycentric indexing scheme, which makes the following no longer quite right. I'll fix it up in a minute.]

Number the rows of triangles from 0. If the big triangle has $n$ little triangles on each side, then row $k$ contains the triangles whose reference points have barycentric coords $(n-1-k,b,c)$ for some $b,c$. And it begins with triangle number $k^2$. (Rows have 1,3,5,... triangles; sums of odd numbers are squares.)

Then the (0-based) position within its row of the triangle with barycentric indices $(a,b,c)$ is $2c+\varepsilon$ where $\varepsilon$ is 0 for upward-pointing triangles and 1 for downward-pointing ones; we can distinguish these because the sum of all the barycentric indices is $n-1$ for upward triangles and $n-2$ for downward. In other words, $\varepsilon=n-1-(a+b+c)$.

Therefore, the triangle with barycentric indices $(a,b,c)$ is in row $n-1-a$ which begins with triangle $(n-1-a)^2$; within that row its (0-based) position is $2c+n-1-(a+b+c)=n-1-a-b+c$; so its index number is $(n-1-a)^2+n-1-a-b+c$.

Let's do a spot check. Triangle 7 has $(a,b,c)=(0,0,1)$ and $n-1=2$. So the index number is $(2-0)^2+2-0-0+1$ which is indeed 7. Looks like it works.

(Remark: $n-1$ is probably a nicer parameter to work with than $n$ itself.)

question has changed
Source Link
Gareth McCaughan
  • 122.1k
  • 7
  • 320
  • 464

[Note: OP has revised the question with a slightly different barycentric indexing scheme, which makes the following no longer quite right. I'll fix it up in a minute.]

Barycentric coordinates describe points rather than triangles. So let's identify each triangle by its "top centre" point. That's its top vertex for an upward-pointing triangle, and the centre of its top edge for a downward-pointing one.

Number the rows of triangles from 0. If the big triangle has $n$ little triangles on each side, then row $k$ contains the triangles whose reference points have barycentric coords $(n-k,b,c)$ for some $b,c$. And it begins with triangle number $k^2$. (Rows have 1,3,5,... triangles; sums of odd numbers are squares.)

Then the reference points are spaced evenly with distance 1/2 along each row.

Therefore, the triangle whose reference point has barycentric coords $(a,b,c)$ is in row $n-a$ which begins with triangle $(n-a)^2$; within that row it's in (0-based) position $2c$; so its index number is $(n-a)^2+2c$.

Let's sanity-check this by looking at the first triangle whose number isn't given in the diagram above. Its reference point is at (6,3/2,1/2) and $n=8$ so its index should be $(8-6)^2+2\cdot\frac12=5$, which is correct. Looks like it works!

Barycentric coordinates describe points rather than triangles. So let's identify each triangle by its "top centre" point. That's its top vertex for an upward-pointing triangle, and the centre of its top edge for a downward-pointing one.

Number the rows of triangles from 0. If the big triangle has $n$ little triangles on each side, then row $k$ contains the triangles whose reference points have barycentric coords $(n-k,b,c)$ for some $b,c$. And it begins with triangle number $k^2$.

Then the reference points are spaced evenly with distance 1/2 along each row.

Therefore, the triangle whose reference point has barycentric coords $(a,b,c)$ is in row $n-a$ which begins with triangle $(n-a)^2$; within that row it's in (0-based) position $2c$; so its index number is $(n-a)^2+2c$.

Let's sanity-check this by looking at the first triangle whose number isn't given in the diagram above. Its reference point is at (6,3/2,1/2) and $n=8$ so its index should be $(8-6)^2+2\cdot\frac12=5$, which is correct. Looks like it works!

[Note: OP has revised the question with a slightly different barycentric indexing scheme, which makes the following no longer quite right. I'll fix it up in a minute.]

Barycentric coordinates describe points rather than triangles. So let's identify each triangle by its "top centre" point. That's its top vertex for an upward-pointing triangle, and the centre of its top edge for a downward-pointing one.

Number the rows of triangles from 0. If the big triangle has $n$ little triangles on each side, then row $k$ contains the triangles whose reference points have barycentric coords $(n-k,b,c)$ for some $b,c$. And it begins with triangle number $k^2$. (Rows have 1,3,5,... triangles; sums of odd numbers are squares.)

Then the reference points are spaced evenly with distance 1/2 along each row.

Therefore, the triangle whose reference point has barycentric coords $(a,b,c)$ is in row $n-a$ which begins with triangle $(n-a)^2$; within that row it's in (0-based) position $2c$; so its index number is $(n-a)^2+2c$.

Let's sanity-check this by looking at the first triangle whose number isn't given in the diagram above. Its reference point is at (6,3/2,1/2) and $n=8$ so its index should be $(8-6)^2+2\cdot\frac12=5$, which is correct. Looks like it works!

Source Link
Gareth McCaughan
  • 122.1k
  • 7
  • 320
  • 464

Barycentric coordinates describe points rather than triangles. So let's identify each triangle by its "top centre" point. That's its top vertex for an upward-pointing triangle, and the centre of its top edge for a downward-pointing one.

Number the rows of triangles from 0. If the big triangle has $n$ little triangles on each side, then row $k$ contains the triangles whose reference points have barycentric coords $(n-k,b,c)$ for some $b,c$. And it begins with triangle number $k^2$.

Then the reference points are spaced evenly with distance 1/2 along each row.

Therefore, the triangle whose reference point has barycentric coords $(a,b,c)$ is in row $n-a$ which begins with triangle $(n-a)^2$; within that row it's in (0-based) position $2c$; so its index number is $(n-a)^2+2c$.

Let's sanity-check this by looking at the first triangle whose number isn't given in the diagram above. Its reference point is at (6,3/2,1/2) and $n=8$ so its index should be $(8-6)^2+2\cdot\frac12=5$, which is correct. Looks like it works!