Hi all!
I really really need your advice here! So please do reply me. Your help is greatly appreciated!!


I need to do a translation here:


X Y Z
-3.621 15.574 14.908 (file1 - 2nd row)

-3.441 15.678 14.859 (file2 - 2nd row)

I need to move file 2 coordinates right 'on top of' of file 1.
So is it posible if I find the difference between each of the X,Y,Z coordinates and move them by the difference? And I store this difference in a matrix and move the rest of the coordinates in my matrix? How do I go about doing that? Like, do i store the difference in a variable or a matrix?

//file1

		coordinates1[i][0]= Double.parseDouble(text1.substring(30,38));//X
			coordinates1[i][1]= Double.parseDouble(text1.substring(38,46));//Y
			coordinates1[i][2]= Double.parseDouble(text1.substring(46,56));//Z

//file2
coordinates2[i][0]= Double.parseDouble(text2.substring(30,38));//X
			coordinates2[i][1]= Double.parseDouble(text2.substring(38,46));//Y
			coordinates2[i][2]= Double.parseDouble(text2.substring(46,56));//Z

When you say 'on top of' can you provide a small example.
For example if the file1 is:
(X,Y,Z) = (10,2,5) and file2 is:
(X,Y,Z) = (1,1,2).

What do you want your program to do?
You can create an new array: coordinatesDiff, and do this:

coordinatesDiff[i][0] = coordinates1[i][0] - coordinates2[i][0];
coordinatesDiff[i][1] = coordinates1[i][1] - coordinates2[i][1];
coordinatesDiff[i][2] = coordinates1[i][2] - coordinates2[i][2];

The result would be:
(X,Y,Z) = (9,1,3)

Is this what you want?

When you say 'on top of' can you provide a small example.
For example if the file1 is:
(X,Y,Z) = (10,2,5) and file2 is:
(X,Y,Z) = (1,1,2).

What do you want your program to do?
You can create an new array: coordinatesDiff, and do this:

coordinatesDiff[i][0] = coordinates1[i][0] - coordinates2[i][0];
coordinatesDiff[i][1] = coordinates1[i][1] - coordinates2[i][1];
coordinatesDiff[i][2] = coordinates1[i][2] - coordinates2[i][2];

The result would be:
(X,Y,Z) = (9,1,3)

Is this what you want?

Thank you! Yes, I did what the above, exccept, I did it this way:

coordinatesDiff[1][0] = coordinates1[1][0] - coordinates2[1][0]; //X
coordinatesDiff[1][1] = coordinates1[1][1] - coordinates2[1][1]; //Y
coordinatesDiff[1][2] = coordinates1[1][2] - coordinates2[1][2]; //Z

but how do i get the array of (9,1,3)? Please advice. Thank you!

'On top', it means when I integrate my visualizer with my java codes, I can actually see my protein structure on top of one another.

Thank you! Yes, I did what the above, exccept, I did it this way:

coordinatesDiff[1][0] = coordinates1[1][0] - coordinates2[1][0]; //X
coordinatesDiff[1][1] = coordinates1[1][1] - coordinates2[1][1]; //Y
coordinatesDiff[1][2] = coordinates1[1][2] - coordinates2[1][2]; //Z

but how do i get the array of (9,1,3)? Please advice. Thank you!

'On top', it means when I integrate my visualizer with my java codes, I can actually see my protein structure on top of one another.

You already have that array:
coordinatesDiff[0] (X)
coordinatesDiff[1] (Y)
coordinatesDiff[2] (Z)

coordinatesDiff=
i | X Y Z
0 | 1 2 3
1 | 5 6 7
2 | 9 1 5

Example for i=1
coordinatesDiff[0] = 5 (X)
coordinatesDiff[1] = 6 (Y)
coordinatesDiff[2] = 7 (Z)

Now that you have the data in those arrays, do whatever calculation you see fit.

Be a part of the DaniWeb community

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