[R] Function to locate points in 3d octants or points on twoaxes

David Winsemius dwinsemius at comcast.net
Wed Feb 2 18:51:34 CET 2011


On Feb 2, 2011, at 12:28 PM, Bryan Hanson wrote:

> Thanks Dan for pointing that out.  My question really arose from the  
> need to draw splines between arbitrary 3d pairs of points, so I  
> posted a new question to the list addressing that more  
> specifically.  While the issue of 3d splines must have been dealt  
> with in graphics/animation oriented programs/languages, I think I  
> may have to "grow my own" and I'll need the suggestions offered by  
> you and Petr.  Thanks, Bryan

I fit crossed cubic regression splines using the rms package, which  
might provide this functionality. However, I get the idea you want an  
exact fit rather than a  fit that is constrained to a particular  
functional form with parameters determined by a minimization metric  
involving a large number of points.

-- 
David
>
> On Feb 2, 2011, at 11:55 AM, Daniel Nordlund wrote:
>
>>> -----Original Message-----
>>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org 
>>> ]
>>> On Behalf Of Bryan Hanson
>>> Sent: Wednesday, February 02, 2011 5:23 AM
>>> To: Petr Savicky
>>> Cc: r-help at 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 at 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.
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list