"""
    raytracing(fragments;args)

Returns a list of fragments and a list of rays.
The rays represent the fragments trajectories and can be used to intersect targets.
Optional argument is the v_threshold. Which is a threshold velocity used to discard fragments
for which the velocity is lower. The default value is 0.0.
"""
function raytracing(fragments::Vector;v_threshold=0.0)
    #v_threshold = 500.0
    fr =[]
    ray =[]
    for fragment in fragments
    #number=number + length(fragment)
        for f in fragment
            if norm(f.velocity) > v_threshold
                push!(fr,f)
                #r = Ray(Point(f.position),Point(f.velocity)-Point(0.0,0.0,0.0))
                r =OpticSim.Ray(OpticSim.Vec3(f.position),OpticSim.Vec3(f.velocity))
                push!(ray,r)

            end

        end
    end
    return fr,ray
end
