Confusion about periodic BCs in NearestNeighbors.jl

Hi,

I’m trying to make a periodic tree in NearestNeigbors with a custom Distance metric

struct SegmentDistance <:Metric; end

function parameters(::SegmentDistance)
    nothing
end

The idea is to compute line segment distances inside a periodic cell. The line segments are encoded as SVector{6} with the first 3 elements the center (lies inside the cell) and the next 3 a direction → so the endpoints can be outside the cell.

I’m constructing the tree like this to make the tree periodic only in the first 3 elements:

    lower = [0.0, 0.0, 0.0, -Inf, -Inf, -Inf]
    upper = [volume..., Inf, Inf, Inf]
    tree = PeriodicTree(BallTree(segments, SegmentDistance()), lower, upper)

The problem is I get an error complaining about not finding the parameters function, even though it’s defined in the RVE module:

MethodError: no method matching parameters(::RVE.SegmentDistance)
The function `parameters` exists, but no method is defined for this combination of argument types.

How can I make this work? And why do I need the parameters function anyway?

Thanks.