def cropToBox(polyData, transform, dimensions):
    '''
    dimensions is length 3 describing box dimensions
    '''
    origin = np.array(transform.GetPosition())
    axes = transformUtils.getAxesFromTransform(transform)

    for axis, length in zip(axes, dimensions):
        cropAxis = np.array(axis)*(length/2.0)
        polyData = cropToLineSegment(polyData, origin - cropAxis, origin + cropAxis)

    return polyData
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/cropToBox/original