pose_estimation/gramian/trajectories_plot.py
def create_curve(coord, mat):
    '''
    create a semi-circular curve with material mat
    '''

    # create curve
    curve_data = bpy.data.curves.new('myCurve', type='CURVE')
    curve_data.dimensions = '3D'
    curve_data.bevel_depth = .1
    curve_data.bevel_resolution = 50
    curve_data.fill_mode = 'FULL'

    # create polyline from coords
    n_coord = coord.shape[1]
    # POLY, BEZIER, BSPLINE, CARDINAL, NURBS
    polyline = curve_data.splines.new('POLY')
    polyline.points.add(n_coord-1)
    for i in range(n_coord):
        polyline.points[i].co = (coord[0,i], coord[1,i], coord[2,i], 1)

    # link scene to object
    curve_ob = bpy.data.objects.new('myCurve', curve_data)
    scn = bpy.context.scene
    scn.objects.link(curve_ob)
    scn.objects.active = curve_ob
    curve_ob.select = True
    curve_ob.color = [1,0,0,1]

    curve_ob.data.materials.append(mat)

    create a semi-circular curve with material mat
    
create a semi-circular curve with material mat
create a semi - circular curve with material mat
def create_curve(coord, mat):
    curve_data = bpy.data.curves.new('myCurve', type='CURVE')
    curve_data.dimensions = '3D'
    curve_data.bevel_depth = .1
    curve_data.bevel_resolution = 50
    curve_data.fill_mode = 'FULL'
    n_coord = coord.shape[1]
    polyline = curve_data.splines.new('POLY')
    polyline.points.add(n_coord-1)
    for i in range(n_coord):
        polyline.points[i].co = (coord[0,i], coord[1,i], coord[2,i], 1)
    curve_ob = bpy.data.objects.new('myCurve', curve_data)
    scn = bpy.context.scene
    scn.objects.link(curve_ob)
    scn.objects.active = curve_ob
    curve_ob.select = True
    curve_ob.color = [1,0,0,1]
    curve_ob.data.materials.append(mat)
def create_curve ( coord , mat ) : curve_data = bpy . data . curves . new ( 'myCurve' , type = 'CURVE' ) curve_data . dimensions = '3D' curve_data . bevel_depth = .1 curve_data . bevel_resolution = 50 curve_data . fill_mode = 'FULL' n_coord = coord . shape [ 1 ] polyline = curve_data . splines . new ( 'POLY' ) polyline . points . add ( n_coord - 1 ) for i in range ( n_coord ) : polyline . points [ i ] . co = ( coord [ 0 , i ] , coord [ 1 , i ] , coord [ 2 , i ] , 1 ) curve_ob = bpy . data . objects . new ( 'myCurve' , curve_data ) scn = bpy . context . scene scn . objects . link ( curve_ob ) scn . objects . active = curve_ob curve_ob . select = True curve_ob . color = [ 1 , 0 , 0 , 1 ] curve_ob . data . materials . append ( mat )
create a semi-circular curve with material mat
create a semi - circular curve with material mat
'''
    create a semi-circular curve with material mat
    ''' # create curve # create polyline from coords # POLY, BEZIER, BSPLINE, CARDINAL, NURBS # link scene to object
coord
mat