Question on the first answer about collision detection How do I determine whether a 3D coordinate is located within the boundaries of a 3D object in BIM? I'm using Xbim working with IFC-files
In the answer is talked about (axis aligned) bounding box comparison, eventually with use of OctTree. What about a model with a duct system (flow elements 100 meter >) with a kind of elevation or not modeled following the axis XYZ? BB is unreliable in that case. In the second link, XbimSpatialAnalyser.cs, it is unclear for me howto finalize the search after a BB detection occurred. I can retrieve all kinds of info from the model like Matrix3D, faces, verticals but don't know how to use this to calculate distances from point to nearest duct for example. Some advise where to look for knowledge would be great.
I tried a lot of examples
Spatial partitioning is a complex area. The example of ducting is a good one - it's about efficiently decomposing the Flow element into its multiple constituent geometry primitives. In reality a 100m duct is going to be multiple distinct IFC elements (DuctSegments, DuctFittings, AirTerminals etc).
If we look at the attached Air Terminal it's made of two primitive shapes:

AABB OctTrees etc are often a data structure used to determine candidates for clash checking (which is an expensive operation if using the low level Boolean operations against these geometry primitives).
Advice for where to look for more knowledge:
This SE question references some useful research.
You can read up on Bounding Volume Hierarchies (BVH).
Here's a C# implementation of BVH and decent explanation. Github has some updated versions of this algorithm. e.g https://github.com/rossborchers/UnityBoundingVolumeHeirachy
If you want to do IFC clash detection with xbim I should say we have a private Clash library we offer as well as a cloud service that does clash (under a commercial licence). It turns clash into a simple call like this:
(along with some more sophisticated filtering overloads)
Go to https://xbim.net if that's appropriate.