Learn R Programming

trifield (version 1.0)

abc2xy: Project unity-summed triples (a, b, c) to unit-square doubles (x, y)

Description

Given a matrix of ternary values, this function will compute their x, y coordinates.

Usage

abc2xy(abc)

Arguments

abc
A 3-column matrix containing unity-summed triples

Value

  • A matrix of x, y values, one per row

Details

The x, y coordinates are scaled such that the altitude of the equilateral triangle defining the ternary space is equal to one.

See Also

xy2abc

Examples

Run this code
## The function is currently defined as
function(abc)
{
	tmat = c(1 / sqrt(3), 0, 2 / sqrt(3), 1, 0, 0)
	dim(tmat) = c(3, 2)
	res = as.matrix(abc) %*% tmat
	colnames(res) = c("x", "y")
	res
  }

Run the code above in your browser using DataLab