Background. In VBA in Excel, I created a function that calculates the shortest distance between two lines (vectors). This function returns the visible intersection point and the actual distance between them. To make this work, I finished distributing the array, and then sorted out what happened next. It works, but it is inconvenient to read and work.
In C ++, I made a similar function that returns this point.
struct point3D
{
double x,y,z;
}
point3D findIntersect(const vec3& vector1, const vec3& vector2)
{
return point;
}
Problem: I want to return the length as well, since it uses parts of the original calculation. However, most of the time I want only a point.
Possible solutions that I have reviewed are as follows:
Write a separate function for the distance. A lot of extra work when I want both of them.
- Create your own structure for this function. It seems a bit overkill.
- , VBA. .
- . . .
- ,
function(const argin1, const argin2, argout&, argout2&). ! , , .
, , . a point3D a double.
- ?