Solved

# Calculate Transformation Matrix based on two 3D points

Posted on 2008-10-28
1,410 Views
Hello,
Is it possible to calculate the transformation matrix based on two 3d points and if so how? I am trying to place a tube part between these two 3d points and need the transformation matrix to position/place the part properly.

Thanks
0
Question by:toni_
• 2

LVL 27

Expert Comment

ID: 22828537
I cannot give you the code for whatever program you are using but it seems to me that a translation and a rotation ought to do it. Translate the center of the tube to the midpoint between your 3D points, Then rotate the axis of the tube to coincide with the line between the two points.
0

Author Comment

ID: 22828638
Thanks for the reply aburr,
It is this "rotate the axis of the tube to coincide with the line between the two points" that I am not sure how to do. I am using Solidworks and looking at the API I would need to just plug in the transformation matrix for that part to be positioned and rotated properly. It is the math that I am not sure how to calculate
0

LVL 27

Expert Comment

ID: 22828695
I am not familiar with Solidworks or the API so I will not be of much more help to you.
0

LVL 20

Accepted Solution

ikework earned 500 total points
ID: 22829275
hey toni_

well the translational part of the matrix is easy, just put the midpoint in the 4th row or col (depending on if you use column-major- or row-major-matrices) of the matrix. if p is the midpoint, then:

for column-major-matrix:

1    0    0    p.x
0    1    0    p.y
0    0    1    p.z
0    0    0    1

you need to tell us more about the desired rotation to help you making the rotational part of the matrix, but start with the translational part and check if it works ..

ike
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Title # Comments Views Activity
Formula to Randomize Data Set for Time Series Visual 1 96
scores100 challenge 3 110
Best, Average or Worst ? 12 89
Meaning of e^x sin(x) 2 27
Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

#### 785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.