I have a class called Scanner which casts rays into a 3d scene and records the resulting intersections. It has the following type of properties:
Location (a 3d point)
Forward (a 3d vector)
Up (a 3d vector)
min/max angle (the bounds of where to cast rays)
theta/phi step (the directions of the rays)
I've been saving the results in a class called Scan. But I'd like for a Scan object to know everything about the Scanner that created it. So this doesn't fit the "is a" paradigm of OOP inheritance - so these classes are not related in my current setup. How would you structure these? It doesn't really make sense for a Scan to exist without having come from a Scanner, so my first thought was just to make
class Scanner
{
Scan TheScan;
};
But then for some functions it doesn't make sense to pass only TheScan to them because it needs some info from the Scanner, but it also doesn't make intuitive sense to pass the whole Scanner object:
double ComputeAverageDistance(const Scan &TheScan)
{
//for each intersection, find the distance to the scanner
}
In that example - the location of the scanner would need to be known to compute the distance. Passing the whole scanner seems weird: ComputeAverageDistance(const Scanner &TheScanner)
.
Have I explained my concern well at all?
Thanks,
Dave