Created
April 24, 2012 08:14
-
-
Save pcote/2477782 to your computer and use it in GitHub Desktop.
Sample Mesh Generation using Quaternions and BMesh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bmesh | |
import bpy | |
from mathutils import Quaternion, Vector | |
bm = bmesh.new() | |
axis = (0,0,-1) | |
quats = [Quaternion(axis,x) for x in range(1,11)] | |
vecs = [quat * Vector((1,0,0)) for quat in quats] | |
for vec in vecs: | |
bm.verts.new([vec.x, vec.y, vec.z]) | |
me = bpy.data.meshes.new("quat_mesh") | |
bm.to_mesh(me) | |
ob = bpy.data.objects.new("quat", me) | |
scn = bpy.context.scene | |
scn.objects.link(ob) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment