views:

96

answers:

5

Hello,

EDIT

I don't know is it important, but destination triangle angles may be different than these of source. Does that fact makes transformation non-affine ? (i'm not sure)

alt text

I have two triangles in 3D space. Given that i know (x,y,z) of point in first triangle and i know vectors V1,V2,V3. I need to find point (x',y',z'). What transformation i should do to point (x,y,z) with vectors V1,V2,V3 to get that transformed point in the second triangle ?

Thanks for help !!!

A: 

Simply add the vectors to each point. Point + Vector == new Point. This is basically the opposite of creating the Vector in the first place: V1 == (x1'-x1, y1'-y1, z1'-z1), so (x1', y1', z1') == (x1+V1x, y1+v1y, z1+V1z).

KeithS
I don't think this answers the question. I think the OP means that (x, y, z) is an arbitrary point in the triangle.
Colin Fine
Yep i feel too that this is not solution, because point should be affected by ALL three vectors V1,V2,V3 (because all vertices changes), not by just one V1.
0x69
A: 

Let

 x = αx1 + βx2 + γx3 

Then x' = αx1' + βx2' + γx3' So

x' = α(x1+V1) + β(x2+V2) + γ(x3+V3)
Colin Fine
This is a 3-D linear transformation. The problem requires a 3-D affine transformation.
andand
I don't exactly understood. Did you mean: x' = α(x1+V1.x) + β(x2+V2.x) + γ(x3+V3.x) ?? Also How to calculate α,β,γ ?
0x69
+1  A: 
andand
Thanks for deep analysis of the problem.
0x69
+1  A: 

You want a matrix transformation T such that T X = X', where X is the matrix whose columns are the co-ordinates of the vertexes of the first triangle and X' is the same for the second triangle. Multiplying each side by the inverse of X yields T = X' X-1.

Steve Emmerson
That's what I was thinking at first, but as I looked at it, it became clear that the problem as presented is underconstrained. I believe a unique solution is possible once the distance constraints are included, but finding that unique solution requires convex programming and can't be solved using the linear method you outlined.
andand
@andand The matrix transformation takes all three vertexes to their counterparts. It is also a linear transformation; therefore, any point in the interior of the first triangle will be transformed into the interior of the second in a way that maintains proportional distance from the vertexes.
Steve Emmerson
@Steve Emmerson: Suppose the origin is one of the points interior to the first triangle, but it is not a point interior to the second. This can't happen using linear transformations; the origin is always mapped to the origin. The problem as stated requires an affine (vice linear) transformation, so that the origin in the domain can be mapped to something other than the origin in the range.
andand
@andand You're right. The X and X' in my answer should be constituted from the vectors from each triangle's center of mass (COM) to it's vertexes. Transforming a point in triangle 1 then comprises 1) subtracting the COM of the first triangle; 2) applying T; and 3) adding the displacement vector from triangle 1 COM to triangle 2 COM.
Steve Emmerson
+2  A: 

I think you might be looking for barycentric coordinates?

tfinniga
+1 yes. Find the barycentric coordinates of a point on the source triangle and then locate those barycentric coordinates on the destination triangle.
phkahler