[R] Function to

Bryan Hanson hanson at depauw.edu
Wed Feb 2 02:16:47 CET 2011


Hi Guru's...

I have a set of points that may lie along any of the x, y and z axes  
in a Cartesian coordinate system.  I am hoping that a function exists  
which will determine if any two selected points are on different axes,  
i.e, if the one of the points is on x and the other on y or z, not  
elsewhere on the x axis.  Put another way, I need to determine if the  
triangle formed by the two points and the origin lies in the xy, xz or  
yz planes.  This might be as simple as testing if any particular value  
is zero, i.e. if the x coordinate is zero, then the points must be on  
the z and y axes and the triangle in the yz plane.  But, I'm looking  
for a fairly general solution, one that also returns the appropriate  
plane as the answer.  Very closely related to this, I could use a  
function that determines which of the 8 octants a point lies in. Seems  
like the cross product might be part of this, but I'm a little rusty  
on how to apply it.

  I hope this is clear enough, and someone has a suggestion to point  
me in the right direction.  Before writing my own klunky version, I  
thought I'd ask.

Thanks, Bryan
****************
Prof. Bryan Hanson
Dept of Chemistry & Biochemistry
DePauw University
602 S. College Ave
Greencastle IN 46135 USA



More information about the R-help mailing list