Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hello Everyone.
From :
To : 1. How to plot a point in 3-D and :
2. Rotation of that point a angle t (say, = Pi/2) about X-axis ?
Thanks in advance for your time and help.
Regards.
1) Plotting points requires a 3x1 matrix and the three elements of that matrix are vectors, too, representing the x-, y- and z-coordinates of the points you'd like to plot. Mathcad accepts row AND column vectors in that 3x1 matrix. If you just want to plot one single point, your 3x1 matrix would consist of three 1x1 matrices!
Furthermore you have to change the plot type from surface plot to "Data Points/Scatter Plot". In case you still get an error (an old bug), change the plot style to vector plot and then back to scatter plot.
You may also demand to have the points connected with lines, but you must keep in mind, that they are just connected in the order they are defined! See the pic
2) Use the usual rotation matrices. See for example here: https://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations
It sure would help to write some utility functions to convert a normal 3x1 point vector to the data structure needed for the 3D-plot and maybe also the other way round.
To rotate around an arbitrary axis is far more complicated and is best done using homogenous coordinates (quaternions) - see here for example: http://paulbourke.net/geometry/rotate/
The attached sheet should help with converting vectors to data structure for plotting in 3D and vice versa and also with rotating a point around the x-axis.
Many, many thanks again, Werner. Still have a very small query : How to correct it for cube ?
Best Regards.
Loi.
The cube you defined is NOT just a number of points but a number of surface patches (quadrilateral).
You would have to write a function which extracts every point, rotates it and saves the result back to the very same position it came from - that means you have to preserve the data structure of the surface.
So you can't use vec2plot on this structure as the structure gets lost that way and can't be reconstructed.
I have a little helper function for that process: fInsOut.
That transforms the matrix to a single matrix consisting of xyz vectors. Then just loop through the rows and columns in the new matrix and do the transformation to each. After that run the above function again to get back to the original format. Adding the time dependence to that will complicate matters ... a lot.
With Prime 6 I can't use 3rd rotation angle. So set it to 0 for DataSPH. (45 degree rotation only)
Thereafter change the XYZ data to XZY and use second DataSPH. (210 degree rotation)
Then convert the data to original XYZ.
It is unclear to me to what extent you think that these little pictures you keep posting would be helpful or useful to the questioner? I may be blind, but I see no attempt to answer the questioner's questions ...
Perhaps you could explain the intent behind your posts in more detail as I don't want to assume that it's all about teasing or "showing off".