I suspect this might not be considered a great question, but I've completely hit a wall with it and could use some help.
I'm trying to implement this code:
http://www.nathanieltroutman.net/content/calculating-minimum-volume-bounding-box
in C#, with the original being in Python.
This was going fine until I hit this section:
def calcProjections(points, *vectors):
"""Calculates the projection of points (NxD) onto the vectors
(MxD) and return the projections p which is a matrix sized (N, M)
where N is the number of points and M is the number of vectors.
p[i][j], is the projection of points[i] onto vectors[j] (which is
between 0 and 1)."""
u = np.array(vectors)
# project the points onto the vectors into on fell swoop
d = np.dot(points, u.T)
# this is the dot product of each vector with itself
v2 = np.diag(np.inner(u, u))
p = d / v2
return p
And I'm just struggling to decipher what is actually happening. I'm not sure what the author means by projecting onto specific vectors, or the format of the output (damn you duck typing). The descprition is a bit too vague for me too.
Does anyone have any suggestions or explanations as to what this is doing? Any help greatly appreciated.
Thanks.