vedo icon indicating copy to clipboard operation
vedo copied to clipboard

How to move object or rotate the object interactively ?

Open OhmPuchiss opened this issue 10 months ago • 14 comments

I want to rotate and translate an object interactively.

OhmPuchiss avatar Apr 12 '24 06:04 OhmPuchiss

I figure it out. Just pressing button a. I have a second question how do we scale an object (i.e. similar to blender by pressing s and moving left or right).

OhmPuchiss avatar Apr 12 '24 07:04 OhmPuchiss

you right-click and drag the mouse.

marcomusy avatar Apr 12 '24 14:04 marcomusy

Dear Marco, Is there anyway we can access the axis of the object and its orientation ? I want to do thing similar to this post. However, I would like to define my own transformation matrix, button and much more. Therefore, is there anyway can I get the information about orientation and axis of the object ? image

OhmPuchiss avatar Apr 16 '24 18:04 OhmPuchiss

Sure you can access it by

myobj.transform

and

myobj.transform.matrix

To apply a trasformation to a specific object you can use

myobj.apply_transform(...)

marcomusy avatar Apr 16 '24 18:04 marcomusy

Hey Marco, Is there any way to make the line rotate or move together with the object (the purple one) when using mouse to move or rotate the object ? image image

OhmPuchiss avatar Apr 16 '24 19:04 OhmPuchiss

Yes you can create an Assembly:

assem = myline + myobj
show(assem)

marcomusy avatar Apr 16 '24 19:04 marcomusy

Did you manage to do it?

marcomusy avatar Apr 17 '24 15:04 marcomusy

Since vedo is made on VTK, Can you create a python code to make this function ? image

OhmPuchiss avatar Apr 27 '24 05:04 OhmPuchiss

I am not good at coding yet and I believe you could help me to create something like this in vedo.

OhmPuchiss avatar Apr 27 '24 05:04 OhmPuchiss

You can create a picture-in-picture rendering with any sort of 3d object or axes. This is a good example to start with https://github.com/marcomusy/vedo/blob/master/examples/other/inset.py https://github.com/marcomusy/vedo/tree/master/examples/other/icon.py https://github.com/marcomusy/vedo/tree/master/examples/volumetric/slicer1.py

marcomusy avatar Apr 28 '24 14:04 marcomusy

thank you for your assistance. I have one question. When we apply the transformation, the mesh.vertices still have the ols data from the dataset. How do we get the new coordinate information after transformation ?.

OhmPuchiss avatar Apr 28 '24 22:04 OhmPuchiss

*old

OhmPuchiss avatar Apr 28 '24 22:04 OhmPuchiss

No, mesh.vertices will hold the new coordinates after .apply_transform(T)

marcomusy avatar Apr 28 '24 22:04 marcomusy

I think I combine the mesh and other mesh into assembly and when I apply transformation matrix. The mesh.vertices inside the assembly data still hold the old data.

OhmPuchiss avatar Apr 28 '24 23:04 OhmPuchiss