user: Provide the full official documentation entry for Mathutils, preserving all code examples.

assistant:  rotation component of mathutils value rotation_difference ( other , / ) ¶ Returns a quaternion representing the rotational difference. Parameters : other ( Quaternion ) – second quaternion. Returns : the rotational difference between the two quat rotations. Return type : Quaternion slerp ( other , factor , / ) ¶ Returns the interpolation of two quaternions. Parameters : other ( Quaternion ) – value to interpolate with. factor ( float ) – The interpolation value in [0.0, 1.0]. Returns : The interpolated rotation. Return type : Quaternion to_axis_angle ( ) ¶ Return the axis, angle representation of the quaternion. Returns : Axis, angle. Return type : tuple[ Vector , float] to_euler ( order = 'XYZ' , euler_compat = None , / ) ¶ Return Euler representation of the quaternion. Parameters : order ( Literal [ 'XYZ' , 'XZY' , 'YXZ' , 'YZX' , 'ZXY' , 'ZYX' ] ) – Rotation order. euler_compat ( Euler ) – Optional euler argument the new euler will be made compatible with (no axis flipping between them). Useful for converting a series of matrices to animation curves. Returns : Euler representation of the quaternion. Return type : Euler to_exponential_map ( ) ¶ Return the exponential map representation of the quaternion. This representation consist of the rotation axis multiplied by the rotation angle. Such a representation is useful for interpolation between multiple orientations. Returns : exponential map. Return type : Vector of size 3 To convert back to a quaternion, pass it to the Quaternion constructor. to_matrix ( ) ¶ Return a matrix representation of the quaternion. Returns : A 3x3 rotation matrix representation of the quaternion. Return type : Matrix to_swing_twist ( axis , / ) ¶ Split the rotation into a swing quaternion with the specified axis fixed at zero, and the remaining twist rotation angle. Parameters : axis ( Literal [ 'X' , 'Y' , 'Z' ] ) – Twist axis as a string. Returns : Swing, twist angle. Return type : tuple[ Quaternion , float] angle ¶ Angle of the quaternion. Type : float axis ¶ Quaternion axis as a vector. Type : Vector is_frozen ¶ True when this object has been frozen (read-only). Type : bool is_valid ¶ True when the owner of this data is valid. Type : bool is_wrapped ¶ True when this object wraps external data (read-only). Type : bool magnitude ¶ Size of the quaternion (read-only). Type : float owner ¶ The item this is wrapping or None (read-only). w ¶ Quaternion axis value. Type : float x ¶ Quaternion axis value. Type : float y ¶ Quaternion axis value. Type : float z ¶ Quaternion axis value. Type : float class mathutils. Vector ( seq = (0.0, 0.0, 0.0) , / ) ¶ This object gives access to Vectors in Blender. Parameters : seq ( Sequence [ float ] ) – Components of the vector, must be a sequence of at least two. import mathutils # Zero length vector. vec = mathutils . Vector (( 0.0 , 0.0 , 1.0 )) # Unit length vector. vec_a = vec . normalized () vec_b = mathutils . Vector (( 0.0 , 1.0 , 2.0 )) vec2d = mathutils . Vector (( 1.0 , 2.0 )) vec3d = mathutils . Vector (( 1.0 , 0.0 , 0.0 )) vec4d = vec_a . to_4d () # Other `mathutils` types. quat = mathutils . Quaternion () matrix = mathutils . Matrix () # Comparison operators can be done on Vector classes: # (In)equality operators == and != test component values, e.g. 1,2,3 != 3,2,1 vec_a == vec_b vec_a != vec_b # Ordering operators >, >=, > and vec_a > vec_b vec_a >= vec_b vec_a vec_b vec_a vec_b # Math can be performed on Vector classes. vec_a + vec_b vec_a - vec_b vec_a @ vec_b vec_a * 10.0 matrix @ vec_a quat @ vec_a - vec_a # You can access a vector object like a sequence. x = vec_a [ 0 ] len ( vec ) vec_a [:] = vec_b vec_a [:] = 1.0 , 2.0 , 3.0 vec2d [:] = vec3d [: 2 ] # Vectors support &#39;swizzle&#39; operations. # See https://en.wikipedia.org/wiki/Swizzling_(computer_graphics) vec . xyz = vec . zyx vec . xy = vec4d . zw vec . xyz = vec4d . wzz vec4d . wxyz = vec . yxyx # Direct buffer access is supported. raw_data = memoryview ( vec ) . tobytes () classmethod Fill ( size , fill = 0.0 , / ) ¶ Create a vector of length size with all values set to fill. Parameters : size ( int ) – The length of the vector to be created. fill ( float ) – The value used to fill the vector. classmethod Linspace ( start , stop , size , / ) ¶ Create a vector of the specified size which is filled with linearly spaced values between start and stop values. Parameters : start ( int ) – The start of the range used to fill the vector. stop ( int ) – The end of the range used to fill the vector. size ( int ) – The size of the vector to be created. classmethod Range ( start , stop , step = 1 , / ) ¶ Create a filled with a range of values. This method can also be called with a single argument, in which case the argument is interpreted as stop and start defaults to 0. Parameters : start ( int ) – The start of the range used to fill the vector. stop ( int ) – The end of the range used to fill the vector. step ( int ) – The step between successive values in the vector. classmethod Repeat ( vector , size , / ) ¶ Create a vector by repeating the values in vector until the required size is reached. Parameters : vector ( mathutils.Vector ) – The vector to draw values from. size ( int ) – The size of the vector to be created. angle ( other , fallback = None , / ) ¶ Return the angle between two vectors. Parameters : other ( Vector ) – another vector to compare the angle with fallback ( Any ) – return this when the angle can’t be calculated (zero length vector), (instead of raising a ValueError ). Returns : angle in radians or fallback when given Return type : float | Any angle_signed ( other , fallback = None , / ) ¶ Return the signed angle between two 2D vectors (clockwise is positive). Parameters : other ( Vector ) – another vector to compare the angle with fallback ( Any ) – return this when the angle can’t be calculated (zero length vector), (instead of raising a ValueError ). Returns : angle in radians or fallback when given Return type : float | Any copy ( ) ¶ Returns a copy of this vector. Returns : A copy of the vector. Return type : Vector Note use this to get a copy of a wrapped vector with no reference to the original data. cross ( other , / ) ¶ Return the cross product of this vector and another. Parameters : other ( Vector ) – The other vector to perform the cross product with. Returns : The cross product as a vector or a float when 2D vectors are used. Return type : Vector | float Note both vectors must be 2D or 3D dot ( other , / ) ¶ Return the dot product of this vector and another. Parameters : other ( Vector ) – The other vector to perform the dot product with. Returns : The dot product. Return type : float freeze ( ) ¶ Make this object immutable. After this the object can be hashed, used in dictionaries & sets. Returns : An instance of this object. lerp ( other , factor , / ) ¶ Returns the interpolation of two vectors. Parameters : other ( Vector ) – value to interpolate with. factor ( float ) – The interpolation value in [0.0, 1.0]. Returns : The interpolated vector. Return type : Vector negate ( ) ¶ Set all values to their negative. normalize ( ) ¶ Normalize the vector, making the length of the vector always 1.0. Warning Normalizing a vector where all values are zero has no effect. Note Normalize works for vectors of all sizes, however 4D Vectors w axis is left untouched. normalized ( ) ¶ Return a new, normalized vector. Returns : a normalized copy of the vector Return type : Vector orthogonal ( ) ¶ Return a perpendicular vector. Returns : a new vector 90 degrees from this vector. Return type : Vector Note the axis is undefined, only use when any orthogonal vector is acceptable. project ( other , / ) ¶ Return the projection of this vector onto the other . Parameters : other ( Vector ) – second vector. Returns : the parallel projection vector Return type : Vector reflect ( mirror , / ) ¶ Return the reflection vector from the mirror argument. Parameters : mirror ( Vector ) – This vector could be a normal from the reflecting surface. Returns : The reflected vector matching the size of this vector. Return type : Vector resize ( size , / ) ¶ Resize the vector to have size number of elements. resize_2d ( ) ¶ Resize the vector to 2D (x, y). resize_3d ( ) ¶ Resize the vector to 3D (x, y, z). resize_4d ( ) ¶ Resize the vector to 4D (x, y, z, w). resized ( size , / ) ¶ Return a resized copy of the vector with size number of elements. Returns : a new vector Return type : Vector rotate ( other , / ) ¶ Rotate the vector by a rotation value. Note 2D vectors are a special case that can only be rotated by a 2x2 matrix. Parameters : other ( Euler | Quaternion | Matrix ) – rotation component of mathutils value rotation_difference ( other , / ) ¶ Returns a quaternion representing the rotational difference between this vector and another. Parameters : other ( Vector ) – second vector. Returns : the rotational difference between the two vectors. Return type : Quaternion Note 2D vectors raise an AttributeError . slerp ( other , factor , fallback = None , / ) ¶ Returns the interpolation of two non-zero vectors (spherical coordinates). Parameters : other ( Vector ) – value to interpolate with. factor ( float ) – The interpolation value typically in [0.0, 1.0]. fallback ( Any ) – return this when the vector can’t be calculated (zero length vector or direct opposites), (instead of raising a ValueError ). Returns : The interpolated vector. Return type : Vector to_2d ( ) ¶ Return a 2d copy of the vector. Returns : a new vector Return type : Vector to_3d ( ) ¶ Return a 3d copy of the vector. Returns : a new vector Return type : Vector to_4d ( ) ¶ Return a 4d copy of the vector. Returns : a new vector Return type : Vector to_track_quat ( track = 'Z' , up = 'Y' , / ) ¶ Return a quaternion rotation from the vector and the track and up axis. Parameters : track ( Literal [ '-' , 'X' , 'Y' , 'Z' , '-X' , '-Y' , '-Z' ] ) – Track axis string. up ( Literal [ 'X' , 'Y' , 'Z' ] ) – Up axis string. Returns : rotation from the vector and the track and up axis. Return type : Quaternion to_tuple ( precision = -1 , / ) ¶ Return this vector as a tuple with a given precision. Parameters : precision ( int ) – The number to round the value to in [-1, 21]. Returns : the values of the vector rounded by precision Return type : tuple[float, …] zero ( ) ¶ Set all values to zero. is_frozen ¶ True when this object has been frozen (read-only). Type : bool is_valid ¶ True when the owner of this data is valid. Type : bool is_wrapped ¶ True when this object wraps external data (read-only). Type : bool length ¶ Vector Length. Type : float length_squared ¶ Vector length squared (v.dot(v)). Type : float magnitude ¶ Vector Length. Type : float owner ¶ The item this is wrapping or None (read-only). w ¶ Vector W axis (4D Vectors only). Type : float ww ¶ Type : Vector www ¶ Type : Vector wwww ¶ Type : Vector wwwx ¶ Type : Vector wwwy ¶ Type : Vector wwwz ¶ Type : Vector wwx ¶ Type : Vector wwxw ¶ Type : Vector wwxx ¶ Type : Vector wwxy ¶ Type : Vector wwxz ¶ Type : Vector wwy ¶ Type : Vector wwyw ¶ Type : Vector wwyx ¶ Type : Vector wwyy ¶ Type : Vector wwyz ¶ Type : Vector wwz ¶ Type : Vector wwzw ¶ Type : Vector wwzx ¶ Type : Vector wwzy ¶ Type : Vector wwzz ¶ Type : Vector wx ¶ Type : Vector wxw ¶ Type : Vector wxww ¶ Type : Vector wxwx ¶ Type : Vector wxwy ¶ Type : Vector wxwz ¶ Type : Vector wxx ¶ Type : Vector wxxw ¶ Type : Vector wxxx ¶ Type : Vector wxxy ¶ Type : Vector wxxz ¶ Type : Vector wxy ¶ Type : Vector wxyw ¶ Type : Vector wxyx ¶ Type : Vector wxyy ¶ Type : Vector wxyz ¶ Type : Vector wxz ¶ Type : Vector wxzw ¶ Type : Vector wxzx ¶ Type : Vector wxzy ¶ Type : Vector wxzz ¶ Type : Vector wy ¶ Type : Vector wyw ¶ Type : Vector wyww ¶ Type : Vector wywx ¶ Type : Vector wywy ¶ Type : Vector wywz ¶ Type : Vector wyx ¶ Type : Vector wyxw ¶ Type : Vector wyxx ¶ Type : Vector wyxy ¶ Type : Vector wyxz ¶ Type : Vector wyy ¶ Type : Vector wyyw ¶ Type : Vector wyyx ¶ Type : Vector wyyy ¶ Type : Vector wyyz ¶ Type : Vector wyz ¶ Type : Vector wyzw ¶ Type : Vector wyzx ¶ Type : Vector wyzy ¶ Type : Vector wyzz ¶ Type : Vector wz ¶ Type : Vector wzw ¶ Type : Vector wzww ¶ Type : Vector wzwx ¶ Type : Vector wzwy ¶ Type : Vector wzwz ¶ Type : Vector wzx ¶ Type : Vector wzxw ¶ Type : Vector wzxx ¶ Type : Vector wzxy ¶ Type : Vector wzxz ¶ Type : Vector wzy ¶ Type : Vector wzyw ¶ Type : Vector wzyx ¶ Type : Vector wzyy ¶ Type : Vector wzyz ¶ Type : Vector wzz ¶ Type : Vector wzzw ¶ Type : Vector wzzx ¶ Type : Vector wzzy ¶ Type : Vector wzzz ¶ Type : Vector x ¶ Vector X axis. Type : float xw ¶ Type : Vector xww ¶ Type : Vector xwww ¶ Type : Vector xwwx ¶ Type : Vector xwwy ¶ Type : Vector xwwz ¶ Type : Vector xwx ¶ Type : Vector xwxw ¶ Type : Vector xwxx ¶ Type : Vector xwxy ¶ Type : Vector xwxz ¶ Type : Vector xwy ¶ Type : Vector xwyw ¶ Type : Vector xwyx ¶ Type : Vector xwyy ¶ Type : Vector xwyz ¶ Type : Vector xwz ¶ Type : Vector xwzw ¶ Type : Vector xwzx ¶ Type : Vector xwzy ¶ Type : Vector xwzz ¶ Type : Vector xx ¶ Type : Vector xxw ¶ Type : Vector xxww ¶ Type : Vector xxwx ¶ Type : Vector xxwy ¶ Type : Vector xxwz ¶ Type : Vector xxx ¶ Type : Vector xxxw ¶ Type : Vector xxxx ¶ Type : Vector xxxy ¶ Type : Vector xxxz ¶ Type : Vector xxy ¶ Type : Vector xxyw ¶ Type : Vector xxyx ¶ Type : Vector xxyy ¶ Type : Vector xxyz ¶ Type : Vector xxz ¶ Type : Vector xxzw ¶ Type : Vector xxzx ¶ Type : Vector xxzy ¶ Type : Vector xxzz ¶ Type : Vector xy ¶ Type : Vector xyw ¶ Type : Vector xyww ¶ Type : Vector xywx ¶ Type : Vector xywy ¶ Type : Vector xywz ¶ Type : Vector xyx ¶ Type : Vector xyxw ¶ Type : Vector xyxx ¶ Type : Vector xyxy ¶ Type : Vector xyxz ¶ Type : Vector xyy ¶ Type : Vector xyyw ¶ Type : Vector xyyx ¶ Type : Vector xyyy ¶ Type : Vector xyyz ¶ Type : Vector xyz ¶ Type : Vector xyzw ¶ Type : Vector xyzx ¶ Type : Vector xyzy ¶ Type : Vector xyzz ¶ Type : Vector xz ¶ Type : Vector xzw ¶ Type : Vector xzww ¶ Type : Vector xzwx ¶ Type : Vector xzwy ¶ Type : Vector xzwz ¶ Type : Vector xzx ¶ Type : Vector xzxw ¶ Type : Vector xzxx ¶ Type : Vector xzxy ¶ Type : Vector xzxz ¶ Type : Vector xzy ¶ Type : Vector xzyw ¶ Type : Vector xzyx ¶ Type : Vector xzyy ¶ Type : Vector xzyz ¶ Type : Vector xzz ¶ Type : Vector xzzw ¶ Type : Vector xzzx ¶ Type : Vector xzzy ¶ Type : Vector xzzz ¶ Type : Vector y ¶ Vector Y axis. Type : float yw ¶ Type : Vector yww ¶ Type : Vector ywww ¶ Type : Vector ywwx ¶ Type : Vector ywwy ¶ Type : Vector ywwz ¶ Type : Vector ywx ¶ Type : Vector ywxw ¶ Type : Vector ywxx ¶ Type : Vector ywxy ¶ Type : Vector ywxz ¶ Type : Vector ywy ¶ Type : Vector ywyw ¶ Type : Vector ywyx ¶ Type : Vector ywyy ¶ Type : Vector ywyz ¶ Type : Vector ywz ¶ Type : Vector ywzw ¶ Type : Vector ywzx ¶ Type : Vector ywzy ¶ Type : Vector ywzz ¶ Type : Vector yx ¶ Type : Vector yxw ¶ Type : Vector yxww ¶ Type : Vector yxwx ¶ Type : Vector yxwy ¶ Type : Vector yxwz ¶ Type : Vector yxx ¶ Type : Vector yxxw ¶ Type : Vector yxxx ¶ Type : Vector yxxy ¶ Type : Vector yxxz ¶ Type : Vector yxy ¶ Type : Vector yxyw ¶ Type : Vector yxyx ¶ Type : Vector yxyy ¶ Type : Vector yxyz ¶ Type : Vector yxz ¶ Type : Vector yxzw ¶ Type : Vector yxzx ¶ Type : Vector yxzy ¶ Type : Vector yxzz ¶ Type : Vector yy ¶ Type : Vector yyw ¶ Type : Vector yyww ¶ Type : Vector yywx ¶ Type : Vector yywy ¶ Type : Vector yywz ¶ Type : Vector yyx ¶ Type : Vector yyxw ¶ Type : Vector yyxx ¶ Type : Vector yyxy ¶ Type : Vector yyxz ¶ Type : Vector yyy ¶ Type : Vector yyyw ¶ Type : Vector yyyx ¶ Type : Vector yyyy ¶ Type : Vector yyyz ¶ Type : Vector yyz ¶ Type : Vector yyzw ¶ Type : Vector yyzx ¶ Type : Vector yyzy ¶ Type : Vector yyzz ¶ Type : Vector yz ¶ Type : Vector yzw ¶ Type : Vector yzww ¶ Type : Vector yzwx ¶ Type : Vector yzwy ¶ Type : Vector yzwz ¶ Type : Vector yzx ¶ Type : Vector yzxw ¶ Type : Vector yzxx ¶ Type : Vector yzxy ¶ Type : Vector yzxz ¶ Type : Vector yzy ¶ Type : Vector yzyw ¶ Type : Vector yzyx ¶ Type : Vector yzyy ¶ Type : Vector yzyz ¶ Type : Vector yzz ¶ Type : Vector yzzw ¶ Type : Vector yzzx ¶ Type : Vector yzzy ¶ Type : Vector yzzz ¶ Type : Vector z ¶ Vector Z axis (3D Vectors only). Type : float zw ¶ Type : Vector zww ¶ Type : Vector zwww ¶ Type : Vector zwwx ¶ Type : Vector zwwy ¶ Type : Vector zwwz ¶ Type : Vector zwx ¶ Type : Vector zwxw ¶ Type : Vector zwxx ¶ Type : Vector zwxy ¶ Type : Vector zwxz ¶ Type : Vector zwy ¶ Type : Vector zwyw ¶ Type : Vector zwyx ¶ Type : Vector zwyy ¶ Type : Vector zwyz ¶ Type : Vector zwz ¶ Type : Vector zwzw ¶ Type : Vector zwzx ¶ Type : Vector zwzy ¶ Type : Vector zwzz ¶ Type : Vector zx ¶ Type : Vector zxw ¶ Type : Vector zxww ¶ Type : Vector zxwx ¶ Type : Vector zxwy ¶ Type : Vector zxwz ¶ Type : Vector zxx ¶ Type : Vector zxxw ¶ Type : Vector zxxx ¶ Type : Vector zxxy ¶ Type : Vector zxxz ¶ Type : Vector zxy ¶ Type : Vector zxyw ¶ Type : Vector zxyx ¶ Type : Vector zxyy ¶ Type : Vector zxyz ¶ Type : Vector zxz ¶ Type : Vector zxzw ¶ Type : Vector zxzx ¶ Type : Vector zxzy ¶ Type : Vector zxzz ¶ Type : Vector zy ¶ Type : Vector zyw ¶ Type : Vector zyww ¶ Type : Vector zywx ¶ Type : Vector zywy ¶ Type : Vector zywz ¶ Type : Vector zyx ¶ Type : Vector zyxw ¶ Type : Vector zyxx ¶ Type : Vector zyxy ¶ Type : Vector zyxz ¶ Type : Vector zyy ¶ Type : Vector zyyw ¶ Type : Vector zyyx ¶ Type : Vector zyyy ¶ Type : Vector zyyz ¶ Type : Vector zyz ¶ Type : Vector zyzw ¶ Type : Vector zyzx ¶ Type : Vector zyzy ¶ Type : Vector zyzz ¶ Type : Vector zz ¶ Type : Vector zzw ¶ Type : Vector zzww ¶ Type : Vector zzwx ¶ Type : Vector zzwy ¶ Type : Vector zzwz ¶ Type : Vector zzx ¶ Type : Vector zzxw ¶ Type : Vector zzxx ¶ Type : Vector zzxy ¶ Type : Vector zzxz ¶ Type : Vector zzy ¶ Type : Vector zzyw ¶ Type : Vector zzyx ¶ Type : Vector zzyy ¶ Type : Vector zzyz ¶ Type : Vector zzz ¶ Type : Vector zzzw ¶ Type : Vector zzzx ¶ Type : Vector zzzy ¶ Type : Vector zzzz ¶ Type : Vector Next Geometry Utilities (mathutils.geometry) Previous Image Buffer Types (imbuf.types) Cop