1
$\begingroup$

Does bmesh.ops.rotation() rotate the mesh about the current Local axis or the Global axis? Likewise is the center of rotation coordinates in the local or global axis position?

$\endgroup$
2
  • $\begingroup$ Either. See docs Depends on the setting for space matrix. Default is local space. Data objects, like a mesh or armature will always be accessed in terms of local coordinates by default. . $\endgroup$
    – batFINGER
    Sep 19, 2018 at 14:35
  • $\begingroup$ Docs wasn't every clear, I figured it out after messing with the values. Its the local space. Thanks $\endgroup$ Sep 19, 2018 at 15:06

1 Answer 1

2
$\begingroup$

bmesh.ops.rotation() by default rotates the mesh about objects the local axis and the default center of rotation is the object local axis origin.

Bmesh.ops.rotation() has five inputs bm, cent, matrix, verts and space. bm corresponds to the the mesh to rotate, the center of rotation which is a vector, matrix corresponds to the 3x3 rotation matrix by which you want the mesh to be rotated by and verts corresponds to the vertices in the mesh bm you want to apply the rotation. The space corresponds to the space in which the object is to be rotated in and is represented by the rotation matrix of that object with respect to the global. By default the space is set to local space or correspondingly the object's rotation matrix.

One can select an object, say a cube, and go to blender interactive console. Go to edit mode and then type in the console

mesh = bmesh.from_edit_mesh(bpy.context.active_object.data)

Which will store mesh data to 'mesh'. You can then go ahead and vary the parameters say if one types

bmesh.ops.rotate(mesh,matrix=M,verts=mesh.verts) 

for some rotation matrix M, then you can see the entire mesh rotated by the matrix M about the objects local axis after the view port updates. If you type in this code

bmesh.ops.rotate(
    mesh,
    verts=mesh.verts,
    cent=(0.0, 1.0, 0.0),
    matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))

Then it will rotate the vertices about the point (0,1,0) in local space and about the current local axis Z by 90 degree.

Other mesh operators and information can be found in BMesh Operators Documentation

$\endgroup$
1
  • $\begingroup$ I hope this is enough @batFINGER $\endgroup$ Sep 20, 2018 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .