Can an object be sampled to be in each of two overlapping regions?

Sorry Bruno, I think I may have misled you above! What you want is probably the following:

new TestCube in obstacle_region.footprint.intersect(ego_track)

This uses the footprint of the 2D CircularRegion, which is probably the desired behavior here. What I wrote up above actually checks the path intersecting the circle itself.

Just for context, what’s happening under the hood is that the intersection computation I first suggested above (non-footprint Circular Region and PathRegion) isn’t something Scenic knows how to do (we just haven’t added it yet since it seemed unlikely to be needed). Instead, Scenic returns an IntersectionRegion, which is essentially a region that will attempt to work around not having an explicit construction. In this case, it tries to sample by sampling a variety of points from both sub-regions and seeing if any of these points are contained in all regions. Unfortunately, since you have (presumably) a very long train track much of which does not overlap with obstacle_region, and obstacle_region is of higher dimensionality than ego_track (2D vs 1D), this procedure is not very likely to succeed. Thankfully the intersection of a PathRegion with the footprint of a PolygonalRegion is something Scenic can compute explicitly, and so hopefully this will work well for you. Please let me know if not: happy to troubleshoot further!