 # How to convert Normal Vector to Matrix?

I want to convert Normal Vector (-0.5000, 0.0000, 0.7983) to Matrix.

Hot to convert?

Thank you.

check the mathutil lib for matrix !

happy bl

A normal represents a direction in space. A matrix usually encodes translation, rotation, and scaling.

Do you want a matrix that translates along the normal? If that is the case then you can just use:

``````
mat = Matrix.Translation(normal)

``````

Thank you.

But i don’t know that how to extract a Rotation from normal vector?

maybe ?

mat = Matrix.Rotation(0,4,normal)

How to extract Rotation value from normal vector?

if it is a normal vector it doe not have a rotation only directions !

what do you want to extract ?
a face normal or the rotation of an object ?

the ob matrix has the location,rot and scale values!

happy bl

Thank you RickyBlender.

I want to know to extract a rotation matrix from normal vector Because i want to rotate a plane direction with absolute.

Blender support rotate object with relative.

But not support rotate object with absolute.

So, i want to know rotate object with absolute.

======== [ my script ] =======================

import bpy, bmesh, math, mathutils, os
from mathutils import Vector, Euler, Matrix
os.system(“cls”)
obj = bpy.context.object
me = obj.data
obj.update_from_editmode()
bpy.ops.object.mode_set(mode=“OBJECT”)
face = me.polygons[me.polygons.active]
cen = Vector(face.center[:])
n0 = Vector(face.normal[:])