HI,
the imput of my algortihme is
C1,C2,C3,C4,C5,C6,C7, Target
where the aim is :
-C7 will be in target Position
-C1 d'ont change it's position
- keep the distance and the local position between
C7-C6,C6-C5,C3-C2,C2-C1
C7-C6= mena the posiiton of the C7 relative to C6 (we must keep it and distance too)
SO the algorithm is like that

``````Real  C1_Orig;
Ogre::Real  C7_Temp;
Tolerance=1;
while (Tolerance > 1.0E-5) {
for (i0 = 0; i0 < 3; i0++) {
C7_Temp[i0] = C7[i0];
}
for (i0 = 0; i0 < 3; i0++) {
C1_Orig[i0] = C1[i0];
}
k++;

for (i0 = 0; i0 < 3; i0++) {
C7[i0] = Target[i0];
}

maintain_relative_position(C7, pos66,dv0);
for (i0 = 0; i0 < 3; i0++) {
C6[i0] = dv0[i0];
}

maintain_relative_position(C6, pos55,dv0);
for (i0 = 0; i0 < 3; i0++) {
C5[i0] = dv0[i0];
}

maintain_relative_position(C5, pos44,dv0);

for (i0 = 0; i0 < 3; i0++) {
C4[i0] = dv0[i0];
}

maintain_relative_position(C4, pos33,dv0);
for (i0 = 0; i0 < 3; i0++) {
C3[i0] = dv0[i0];
}

maintain_relative_position(C3, pos22,dv0);

for (i0 = 0; i0 < 3; i0++) {
C2[i0] = dv0[i0];
}

maintain_relative_position(C2, pos11,dv0);

for (i0 = 0; i0 < 3; i0++) {
C1[i0] = dv0[i0];
}

Tolerance = b_VectorMagnitude(C1, C1_Orig);

if (Tolerance > 0.0) {
/*  cout<<"stage2222";
cout<<"\n";*/
for (i0 = 0; i0 < 3; i0++) {
C1[i0] = C1_Orig[i0];
}

maintain_relative_position(C1, pos2,dv0);
for (i0 = 0; i0 < 3; i0++) {
C2[i0] = dv0[i0];
}

maintain_relative_position(C2, pos3,dv0);
for (i0 = 0; i0 < 3; i0++) {
C3[i0] = dv0[i0];
}

maintain_relative_position(C3, pos4,dv0);
for (i0 = 0; i0 < 3; i0++) {
C4[i0] = dv0[i0];
}

maintain_relative_position(C4, pos5,dv0);
for (i0 = 0; i0 < 3; i0++) {
C5[i0] = dv0[i0];
}

maintain_relative_position(C5, pos6,dv0);
for (i0 = 0; i0 < 3; i0++) {
C6[i0] = dv0[i0];
}

maintain_relative_position(C6, pos7,dv0);
for (i0 = 0; i0 < 3; i0++) {
C7[i0] = dv0[i0];
}

Tolerance = b_VectorMagnitude(C7, Target);
if (abs(b_VectorMagnitude(C7_Temp, C7)) < 1.0E-5) {
Tolerance =  5.0E-6;
}
}
}
}
``````

and

``````void maintain_relative_position(Real base_point, Real relative_position, Real new_point) {
/* new_point is an output parameter whose value on return is the point that is relative_position away from base_point. */
int i;
for (i = 0; i < 3; i++) {
new_point[i] = base_point[i] + relative_position[i];
}
}
``````

BUt in the output , it's true that the distance between points are kept and the posiiton of C7 will be in Traget position and the C1 did not change it's posiiton
BUT for the local position ,was changed
note: i used your function "maintain_relative_position"
"b_VectorMagnitude(C7, Target)" is to calculate the distance between Target and C7

I have no idea what you are trying to do, or, what you are trying to convey in this post.

Are you trying to calculate the velocity, or change in time on 2 vectors (matrices)?

i am trying to calculate the enw C,C2,C3,C4,C5,C7 position in the aim
:
-C7 will be in target Position
-C1 d'ont change it's position
- keep the distance and the local position between
C7-C6,C6-C5,C3-C2,C2-C1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.