pose_estimation/gramian/trajectories.py
def semicircle(rad, n_coord, ang_x, ang_z, xyz_offset):
    '''
    create a semi-circular curve
    '''

    # coordinates of the points which define the curve
    theta = np.linspace(0, math.pi, n_coord)
    coord = np.full((3, n_coord), np.nan)
 
    # camera
    # rotation matrix for camera when ang_x = ang_z = 0
    # blender frame to default frame (y forward, x right, z up)
    R_def = tm.R_x(math.pi/2)
    R_semi = tm.R_z(-math.pi/2) # default frame to frame of 1st semicircle
    cam_quat = np.full((4, n_coord), np.nan) # to be filled

    # calcuate each coordinate
    for i in range(n_coord):
        # coordinates of semicircle, negative-to-positive in x-direction
        coord[:,i] = [-rad*math.cos(theta[i]), 0, rad*math.sin(theta[i])]

        # rotation matrix from camera frame to default Blender camera
        R_ij = tm.R_z(ang_z) @ tm.R_x(ang_x) @ tm.R_y(theta[i]) @ R_semi \
               @ R_def

        cam_quat[:,i] = t3d.quaternions.mat2quat(R_ij)

    # rotate all coordinates
    coord = tm.R_z(ang_z) @ tm.R_x(ang_x) @ coord
    coord += np.tile(xyz_offset, n_coord)

    return coord, cam_quat

    create a semi-circular curve
    
create a semi-circular curve
create a semi - circular curve
def semicircle(rad, n_coord, ang_x, ang_z, xyz_offset):
    theta = np.linspace(0, math.pi, n_coord)
    coord = np.full((3, n_coord), np.nan)
    R_def = tm.R_x(math.pi/2)
    R_semi = tm.R_z(-math.pi/2) 
    cam_quat = np.full((4, n_coord), np.nan) 
    for i in range(n_coord):
        coord[:,i] = [-rad*math.cos(theta[i]), 0, rad*math.sin(theta[i])]
        R_ij = tm.R_z(ang_z) @ tm.R_x(ang_x) @ tm.R_y(theta[i]) @ R_semi \
               @ R_def
        cam_quat[:,i] = t3d.quaternions.mat2quat(R_ij)
    coord = tm.R_z(ang_z) @ tm.R_x(ang_x) @ coord
    coord += np.tile(xyz_offset, n_coord)
    return coord, cam_quat
def semicircle ( rad , n_coord , ang_x , ang_z , xyz_offset ) : theta = np . linspace ( 0 , math . pi , n_coord ) coord = np . full ( ( 3 , n_coord ) , np . nan ) R_def = tm . R_x ( math . pi / 2 ) R_semi = tm . R_z ( - math . pi / 2 ) cam_quat = np . full ( ( 4 , n_coord ) , np . nan ) for i in range ( n_coord ) : coord [ : , i ] = [ - rad * math . cos ( theta [ i ] ) , 0 , rad * math . sin ( theta [ i ] ) ] R_ij = tm . R_z ( ang_z ) @ tm . R_x ( ang_x ) @ tm . R_y ( theta [ i ] ) @ R_semi @ R_def cam_quat [ : , i ] = t3d . quaternions . mat2quat ( R_ij ) coord = tm . R_z ( ang_z ) @ tm . R_x ( ang_x ) @ coord coord += np . tile ( xyz_offset , n_coord ) return coord , cam_quat
create a semi-circular curve
create a semi - circular curve
'''
    create a semi-circular curve
    ''' # coordinates of the points which define the curve # camera # rotation matrix for camera when ang_x = ang_z = 0 # blender frame to default frame (y forward, x right, z up) # default frame to frame of 1st semicircle # to be filled # calcuate each coordinate # coordinates of semicircle, negative-to-positive in x-direction # rotation matrix from camera frame to default Blender camera # rotate all coordinates
rad
n_coord
ang_x
ang_z
xyz_offset