def point_to_pixel(point, camera, pix=True):
    """ Function to compute the pixel coordinates of a given
        point in world space for a given camera.

        args:
            point  : vector 1x3 (list or numpy) [X, Y, Z]
            camera : CameraObject class
            pix    : Bool
                        Return measurement in pixel coordinates
        returns:
            list : [x, y]
                Returns None if point is not visible in camera
        """
    p = point
    c = [camera.x, camera.y, camera.z]
    r = camera.rotation_matrix
    if pix == True:
        assert camera.resolution is not None, '[error] resolution must be available to return in pixel coordinates'
    x_ = (r[0, 0] * (p[0] - c[0]) + r[1, 0] * (p[1] - c[1]) + r[2, 0] * (p[
        2] - c[2])) / (r[0, 2] * (p[0] - c[0]) + r[1, 2] * (p[1] - c[1]) + 
        r[2, 2] * (p[2] - c[2]))
    y_ = (r[0, 1] * (p[0] - c[0]) + r[1, 1] * (p[1] - c[1]) + r[2, 1] * (p[
        2] - c[2])) / (r[0, 2] * (p[0] - c[0]) + r[1, 2] * (p[1] - c[1]) + 
        r[2, 2] * (p[2] - c[2]))
    x_ = camera.principle_point[0] + -camera.focal_length * x_
    y_ = camera.principle_point[1] + -camera.focal_length * y_
    if abs(x_) > camera.sensor_size[0] / 2 or abs(y_) > camera.sensor_size[1
        ] / 2:
        return [None, None]
    if pix == True:
        x_ = (x_ + camera.sensor_size[0] / 2) / (camera.sensor_size[0] /
            camera.resolution[0])
        y_ = (y_ + camera.sensor_size[1] / 2) / (camera.sensor_size[1] /
            camera.resolution[1])
    return [x_, y_]
