cShape = {}

function cShape:GetIndexOfWorldTransform(shape, tr, info)
    local size = info and info.size or { GetShapeSize(shape) }
    local h, closest = GetShapeClosestPoint(shape, tr.pos)
    if h then tr.pos = closest end
    local world_tr = info and info.world_tr or GetShapeWorldTransform(shape)
    local local_tr = TransformToLocalTransform(world_tr, tr)
    local index = VecScale(local_tr.pos, 1/(math.floor(size[4]*100)/100))
    for i = 1, 3 do index[i] = math.floor(index[i]) end
    return index
end

function cShape:RemoveVoxelsAtoB(shape, a, b, brush_info, info)
    local ax, ay, az = unpack(a.pos and self:GetIndexOfWorldTransform(shape, TransformCopy(a), info) or a)
    local bx, by, bz = unpack(b.pos and self:GetIndexOfWorldTransform(shape, TransformCopy(b), info) or b)
    local typ = brush_info and brush_info.type or "sphere"
    SetBrush(typ, brush_info and brush_info.size or 1, 0)
    DrawShapeLine(shape, ax, ay, az, bx, by, bz, true)

    local ret
    if typ ~= "noise" then
        TrimShape(shape)
        if brush_info.split then
            ret = SplitShape(shape, true)
        end
        -- MergeShape(shape)
    end

    if brush_info and brush_info.restore_brush then
        SetBrush(unpack(brush_info.restore_brush))
    end

    return ret
end
