Inlining SQL functions in PostGIS
I think you may be making this more complex then need be, two alternative methods of storing trajectories.


Suggested method: create a LINESTRING M with each POINT M's M dimension representing the offset since t0. This is the method that PostGIS standardizes around with ST_IsValidTrajectory, ST_DistanceCPA, and ST_AddMeasure
Normalize to a time interval with a LINESTRING: every POINT on the LINESTRING represents t0 + numpoints-1


Both of those scheme can be indexed simply and easily.