# PetscDTIndexToBary
convert an index into a barycentric coordinate. 
## Synopsis
```
#include "petscdt.h" 
PetscErrorCode PetscDTIndexToBary(PetscInt len, PetscInt sum, PetscInt index, PetscInt coord[])
```

## Input Parameters

- ***len -*** the desired length of the barycentric tuple (usually 1 more than the dimension it represents, so a barycentric coordinate in a triangle has length 3)
- ***sum -*** the value that the sum of the barycentric coordinates (which will be non-negative integers) should sum to
- ***index -*** the index to convert: should be >= 0 and < Binomial(len - 1 + sum, sum)



## Output Parameter

- ***coord -*** will be filled with the barycentric coordinate





## Note
The indices map to barycentric coordinates in lexicographic order, where the first index is the
least significant and the last index is the most significant.


## See Also
 `PetscDTBaryToIndex()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/dt/interface/dt.c.html#PetscDTIndexToBary">src/dm/dt/interface/dt.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/dt/interface/dt.c)


[Index of all DT routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
