aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/cell.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-10-15 18:51:16 +0200
committerThomas White <taw@physics.org>2012-10-15 18:51:16 +0200
commita9212e954c49c0c8e0227bf5309177b3aadbb8e1 (patch)
tree7902a8736faf4d9a850d5717c5271357923a1d2e /libcrystfel/src/cell.c
parent8912553f7b86e7bda6c8a576615807489d85bfc0 (diff)
Add tfn_from_intmat()
Diffstat (limited to 'libcrystfel/src/cell.c')
-rw-r--r--libcrystfel/src/cell.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libcrystfel/src/cell.c b/libcrystfel/src/cell.c
index e7c9dace..11aa83fa 100644
--- a/libcrystfel/src/cell.c
+++ b/libcrystfel/src/cell.c
@@ -784,6 +784,32 @@ UnitCellTransformation *tfn_identity()
}
+
+/**
+ * tfn_from_intmat:
+ * @m: An %IntegerMatrix
+ *
+ * Returns: A %UnitCellTransformation corresponding to @m.
+ *
+ */
+UnitCellTransformation *tfn_from_intmat(IntegerMatrix *m)
+{
+ UnitCellTransformation *tfn;
+ int i, j;
+
+ tfn = tfn_identity();
+ if ( tfn == NULL ) return NULL;
+
+ for ( i=0; i<3; i++ ) {
+ for ( j=0; j<3; j++ ) {
+ gsl_matrix_set(tfn->m, i, j, intmat_get(m, i, j));
+ }
+ }
+
+ return tfn;
+}
+
+
/**
* tfn_combine:
* @t: A %UnitCellTransformation