Your question is not so much about PCA,
as about how to handle points and lines in the plane:
shifting points, and projecting points to a line.
(For basics of this, look through
SO questions/tagged/2d+geometry,
or ask a new question with those tags.)
Without those basics, and a little Python or Matlab,
this little Python program will make no sense,
but here it is anyway:
from __future__ import division
import numpy as np # http://www.numpy.org/
def pcabox( Pointcloud, Pca1, Pca2 ):
""" Lo1, Hi1, Lo2, Hi2 = pcabox( Pointcloud, Pca1, Pca2 )
In: Pointcloud: an N x 2 array of points
In: Pca1, Pca2: unit vectors at right angles, from PCA
Out: Lo1, Hi1, Lo2, Hi2: midpoints of the sides of a bounding box
"""
# convert inputs to numpy arrays (if they aren't already) --
Pointcloud = np.asarray(Pointcloud)
Pca1 = np.asarray(pca1)
Pca2 = np.asarray(pca2)
# check N x 2 --
assert Pointcloud.ndim == 2 and Pointcloud.shape[1] == 2, Pointcloud.shape
C = np.mean( Pointcloud, axis=0 ) # the centre of all the points
Pointcloud = Pointcloud - C # shift the cloud to be centred at [0 0]
# distances along the long axis t * Pca1 --
Dist1 = np.dot( Pointcloud, Pca1 )
Lo1 = Dist1.min() * Pca1
Hi1 = Dist1.max() * Pca1
# and along the short axis t * Pca2 --
Dist2 = np.dot( Pointcloud, Pca2 )
Lo2 = Dist2.min() * Pca2
Hi2 = Dist2.max() * Pca2
return [Lo1, Hi1, Lo2, Hi2] + C # 4 points