Originally posted by: TuxDave
How do you want the data to be returned to you? Given a list of (x,y,z) data points that represent the tube, return a list of (X,Y,Z) that should remain?
Originally posted by: Rowboat
Originally posted by: TuxDave
How do you want the data to be returned to you? Given a list of (x,y,z) data points that represent the tube, return a list of (X,Y,Z) that should remain?
Yes, the end result should be identical up until the last point.
Originally posted by: Gibson486
Originally posted by: Rowboat
Originally posted by: TuxDave
How do you want the data to be returned to you? Given a list of (x,y,z) data points that represent the tube, return a list of (X,Y,Z) that should remain?
Yes, the end result should be identical up until the last point.
then why don't you just do vector math? I mean, if z is the only change, why can't you just subtact from the z vector?
Originally posted by: TuxDave
Ok so I think I see what you're doing. So assuming that the tube isn't perfectly aligned in the X,Y or Z axis....
If you have two data points that represent the two end points of the tube and the first data point is the same and the 2nd data point is being moved. I would attempt to "scale the tube" rather than "subtract the tube" length.
1) Calculate the deltaX,deltaY,deltaZ of the two coordinates (subtraction)
2) Find the total length of the tube = sqrt(deltaX^2+deltaY^2+deltaZ^2)
3) Find the new length of the tube (#2 - 10mm)
4) Calculate the ratio of the two lengths (#3/#2)
5) Multiply the delta(X/Y/Z) against the ratio
6) Add back the delta to the first coordinate to get your new coordinates of your final point.
You can easily do this in excel
Originally posted by: AeroEngy
Originally posted by: TuxDave
Ok so I think I see what you're doing. So assuming that the tube isn't perfectly aligned in the X,Y or Z axis....
If you have two data points that represent the two end points of the tube and the first data point is the same and the 2nd data point is being moved. I would attempt to "scale the tube" rather than "subtract the tube" length.
1) Calculate the deltaX,deltaY,deltaZ of the two coordinates (subtraction)
2) Find the total length of the tube = sqrt(deltaX^2+deltaY^2+deltaZ^2)
3) Find the new length of the tube (#2 - 10mm)
4) Calculate the ratio of the two lengths (#3/#2)
5) Multiply the delta(X/Y/Z) against the ratio
6) Add back the delta to the first coordinate to get your new coordinates of your final point.
You can easily do this in excel
That should work just fine. I was thinking about suggesting something much more complicated because I was envisioning a large set of coordinates defining the 3-D surface of a "tube".
I was going to suggest taking the segment's coordinates apply translational and rotation matrices to align with a primary axis. Then scaling and reapplying the opposite translational and rotation matrices to put it back. Or some other matrix operations involving the unit vector along desired "shrinking" direction and some scale factor. But TuxDave's approach would be much easier for this case..