> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Bryan Hanson
> Sent: Wednesday, February 02, 2011 5:23 AM
> To: Petr Savicky
> Cc: r-help@r-project.org
> Subject: Re: [R] Function to locate points in 3d octants or points on
> twoaxes
> 
> Thanks Petr, the sign function will be of help.  I was not aware of
> it.  Bryan
> 
> On Feb 2, 2011, at 3:21 AM, Petr Savicky wrote:
> 
> > On Tue, Feb 01, 2011 at 08:30:22PM -0500, Bryan Hanson wrote:
> >> [Sorry, resending with a proper subject line!]
> >>
> >> 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.
> >

For a general solution you also need to consider how you want to deal with 
"boundary" conditions.  For example, if the x and y coordinates are zero for 
both points then the points lie in both the xz and yz planes.  And if one of 
the coordinates of a point is zero, then how do you decide which quadrant it is 
in?

Dan

Daniel Nordlund
Bothell, WA USA

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to