cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

20-Turquoise

## How to plot a point in 3-D and Rotation of the point ?

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 ?
Regards.

118 REPLIES 118
25-Diamond I
(To:lvl107)

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/

20-Turquoise
(To:Werner_E)

I greatly appreciate your explanation, Werner.

Best Regards.

25-Diamond I
(To:lvl107)

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.

20-Turquoise
(To:Werner_E)

Many, many thanks again, Werner. Still have a very small query : How to correct it for cube ?

Best Regards.

Loi.

25-Diamond I
(To:lvl107)

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.

12-Amethyst
(To:Werner_E)

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.

20-Turquoise
(To:lvl107)

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.

20-Turquoise
(To:ttokoro)

20-Turquoise
(To:ttokoro)

25-Diamond I
(To:ttokoro)

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".

20-Turquoise
(To:ttokoro)

20-Turquoise
(To:ttokoro)

20-Turquoise
(To:ttokoro)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:lvl107)

20-Turquoise
(To:ttokoro)

20-Turquoise
(To:ttokoro)

20-Turquoise
(To:ttokoro)

20-Turquoise
(To:ttokoro)

Announcements

Top Tags