Skip to content

Instantly share code, notes, and snippets.

@gocarlos
gocarlos / Eigen Cheat sheet
Last active Oct 20, 2020
Cheat sheet for the linear algebra library Eigen: http://eigen.tuxfamily.org/
View Eigen Cheat sheet
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.
@nicolov
nicolov / tilt_torsion.py
Created Aug 9, 2016
Tilt-torsion decomposition for rotation matrices
View tilt_torsion.py
import numpy as np
from tf.transformations import *
def tilt_torsion_decomposition(R):
z_axis = [0, 0, 1]
target_z = np.dot(R.T, z_axis)
axis = np.cross(z_axis, target_z)
angle = np.arctan2(np.linalg.norm(axis), np.dot(z_axis, target_z))
R_tilt = quaternion_matrix(quaternion_about_axis(angle, axis))[:3, :3]
R_torsion = np.dot(R, R_tilt.T)
@rbabich
rbabich / levmarq - Levenberg-Marquardt in plain C
Last active Apr 6, 2020
A simple implementation of the Levenberg-Marquardt algorithm in plain C
View levmarq - Levenberg-Marquardt in plain C
This file (with a leading space) exists so that the gist has a sensible name, rather than "LICENSE."
@inspirit
inspirit / HomographyDecomposition.as
Created Dec 14, 2010
Decompose Homography into Rotation matrix & Translation vector
View HomographyDecomposition.as
var intrinsic:Vector.<Number> = new Vector.<Number>(9, true);
var intrinsicInverse:Vector.<Number> = new Vector.<Number>(9, true);
var R:Vector.<Number> = new Vector.<Number>( 9, true );
var t:Vector.<Number> = new Vector.<Number>( 3, true );
// SVD routine
var svd:SVD = new SVD();
// input homography[9] - 3x3 Matrix
You can’t perform that action at this time.