Re: [Algorithms] Projecting a point on a plane
Brought to you by:
vexxed72
From: Ron L. <ro...@do...> - 2000-09-01 18:30:38
|
Aldo Spanghero > > I can't remember how to project a point (p2) on a plane (n, p1). I need this > to finish the 3D sound system of my engine(this afternoon!) and my math book > is in my home! > > Someone could, please, help me? > > I don't wanna use DirectSound3D, for now. > > > Again, thanks in advance. > Why would you need your math book? Line through p2 perpendicular to plane is described parametrically by p2 + t n This hits plane when the vector from this point to p1 is perpendicular to n so ((p2 + tn) - p1) dot n = 0 Use elementary algebraic properties of dot product to rearrange terms and solve for t: t = (p1 - p2) dot n In which I also used the fact that n dot n = 1 (unit normal vector). So the projection is p2 + ((p1 - p2) dot n)n |