computational geometry - python implementation of 3D rigid body translation and rotation -


i've been trying work out how solve following problem using python:

  1. we have points a, b, c, d form rigid body
  2. some unknown 3d translation , rotation applied rigid body
  3. we know coordinates a, b, c
  4. we want calculate coordinates d

what know far:

what can't work out how can calculate rotation , translation matrices given "new" coordinates of a, b, c.

i can see in general case (non-rigid body) rotation part of wahba's problem, think rigid bodies there should faster way of calculating directly working out set of orthogonal unit vectors using points.

for set of corresponding points you're trying match (with possible perturbation) i've used svd (singular value decomposition), appears exist in numpy.

an example of technique (in python even) can found here, haven't evaluated correctness.

what you're going "basis transform" or "change of basis" represented transformation matrix. assuming 3 known points not collinear, can create initial basis by:

  1. computing vectors: x=(b-a) , y=(c-a)
  2. normalize x (x = x / magnitude(x))
  3. project y onto x (proj_y = x dot y * x)
  4. subtract projection y (y = y - proj_y)
  5. normalize y
  6. compute z = x cross y

that gives initial x,y,z coordinate basis a. same new points, , second basis b. want find transform t take point in , convert b (change of basis). part easy. can invert transform points normal basis, use b transform second one. since orthonormal, can transpose inverse. "new d" equal d * inverse(a) * b. (though depending on representation, may need use b * inverse(a) * d.)

you need have familiarity matrices that. representation of vectors , matrices inform order multiply matrices t (t either inverse(a)*b or b*inverse(a)).

to compute basis matrix vectors x=(x1,x2,x3), y=(y1,y2,y3), z=(z1,z2,z3) populate as:

| x1 y1 z1 | | x2 y2 z2 | | x3 y3 z3 | 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -