Location of connected points in space

ABCD - 4 points. Let's define r = length (BC), angle, ang1 = (ABC) and angle ang2 = (BCD) and torsion angle tors1 = (ABCD). I actually need to find the C and D coordinates, assuming I have new r, ang1, ang2 and tors1 values. The fact is that points A and B are rigidly connected to each other, and points C and D are also connected to each other by a rigid connector. This distance (CD) remains fixed and the AB distance remains fixed. There is no such rigid connection between points B and C.

We have old coordinates of 4 points for some other set (r, ang1, ang2, tors1) and we need to find new coordinates when this defining set of variables changes to some arbitrary value.

Any helpful comments would be grateful. Many thanks.

I am not allowed to post a picture because I am a new user :(

Additional info: An iterative solution won't be helpful because I need to do it in a simulation "many times O (10 ^ 6)".

+2


source to share


5 answers


I think the best way to approach this problem is to think in terms of analytic geometry . Each point A, B, C, D has some 3D coordinates (x, y, z) and you have some relationship between them (for example, the distance BC is r means that

r = sqrt[ (x_b - x_c)^2 + (y_b - y_c)^2 + (z_b - z_c)^2 ]

      



Once you determine such a relationship, it remains to solve the resulting system of equations for the unknown values ​​of the coordinates of the points that you need to determine.

This is a general approach, if you describe the problem better (maybe an image?) It might be easy to find efficient ways to solve such systems because of some special properties your problem has.

+1


source


You didn't mention the coordinate system. Even if (r, a1, a2, t) do not change, the "coordinates" will change if the entire structure can be sent whirling into space. Therefore, I will make some assumptions:

Put B at the origin, C on the positive X-axis, and A in the XY plane with y & gt. If you don't know the AB distance, calculate it from the old coordinates. Also CD.



A: (-AB cos (a1), AB sin (a1), 0)
B: (0, 0, 0)
C: (r, 0, 0)
D: (r + CD cos (a2), CD sin (a2) cos (t), CD sin (a2) sin (t))

(Just follow the legend in the corners.)

+1


source


you describe a set of constraints.

what you need to do is check all the constraints if they are still satisfied and if not deduce the most efficient way to get it back again.

for example, in the case of length bc = r, if bc is no longer r, make it r again by moving both b and c to or from eachother so that the constraint is met again.

for each constraint one by one do it. Then repeat several times until the system stabilizes again (for example, all restrictions are met).

what he

0


source


You are asking for a solution to a nonlinear system of equations. For mathematically inclined, I'll write the constraint equations:

Suppose you have the positions of the points A, B, C, D. Define vectors AB = AB, etc. And also, we use the notation nAB to denote the normalized vector AB / | AB |. In these designations we have:

AB.AB = fixed
CD.CD = fixed
CB.CB = r*r
nAB.nCB = cos(ang1)
nDC.nBC = cos(ang2)
Let E = D - DC.(nCB x nAB) // projection of D onto plane defined by ABC
nEC.nDC = cos(tors1)
nEC x nDC = sin(tors1) // not sure if your torsion angle is signed (if not, delete this)

      

where the dot (.) denotes the dot product and cross (x) denotes the cross product. Each point is defined by three coordinates, so there are 12 unknowns and 6 constraint equations, leaving 6 degrees of freedom unrestricted. These are 6-degree DOFs from the translational and rotational invariance of space.

Assuming you have old positions of positions A ', B', C 'and D', and you want to find a new solution that is "closest" (in a sense defined by me) to those old positions, then you are a solution optimization problems:

minimize: AA'.AA' + BB'.BB' + CC'.CC' + DD'.DD'
subject to the 4-5 constraints above.

      

This optimization problem does not have good properties, so you will want to use something like Conjugate Gradient descent to find the locally optimal solution, with the initial assumption being the old point position. This is an iterative solution that you said is not acceptable, but there is no direct solution unless you clarify your problem.

If this sounds good to you, I can go into detail about performing numerical optimization.

0


source


This is a different solution than the one I gave. Here I am assuming that positions A and B cannot swap (i.e. Positions A and B are constants), similar to Beta solution. Note that there is still an infinite number of solutions, as we can rotate the structure around the axis defined by AB and all your constraints still hold.

Let the coordinates of A be A [0], A [1] and A [2], and also for B. You need explicit equations for C and D as you mentioned in your answer to Beta's solution, so here they are:

Find position C first. As mentioned earlier, there are endless possibilities, so I'll pick a good one for you.

Vector AB = A-B
Normalize(AB)

int best_i = 0;
for i = 1 to 2
    if AB[i] < AB[best_i]
       best_i = i
// best_i contains dimension in which AB is smallest

Vector N = Cross(AB, unit_vec[best_i]) // A good normal vector to AB
Normalize(N)

Vector T = Cross(N, AB) // AB, N, and T form an orthonormal frame
Normalize(T) // redundant, but just in case

C = B + r*AB*cos(ang1) + r*N*sin(ang1)

// Assume s is the known, fixed distance between C and D
// Update the frame
Vector BC = B-C, Normalize(BC)
N = Cross(BC, T), Normalize(N)

D = C + s*cos(tors1)*BC*cos(ang2) + s*cos(tors1)*N*sin(ang1) +/- s*sin(tors1)*T

      

This last plus or minus depends on how you define the orthonormal frame. Try one and see if you want, otherwise it will be a different sign. The notation above is rather informal, but it gives a definite recipe for how to generate C and D from A, B and your parameters. It also picks good C (which depends on good, non-degenerate N). unit_vec[i]

refers to the vector of all zeros except the 1 at the index i

. As usual, I haven't tested the pseudocode above :)

0


source







All Articles