[R-SIG-Mac] [R-sig-mac] trouble with point in polyhedron computation
Don McKenzie
dmck at u.washington.edu
Thu Apr 3 15:54:39 CEST 2014
Thanks Augustin. I will give that a try.
Don
On Apr 3, 2014, at 2:25 AM, Agustin Angel Diez Castillo <agustin.diez at uv.es> wrote:
> Hi,
> If i got it right, the original question can be addressed somewhat with inashape3d (alphashape3d package), something like:
> library(alphashape3d)
> set1 <- matrix(rnorm(333)/2,ncol=3)
> plot3d(set1)
> ashape3d.obj <- ashape3d(set1, alpha = 2)
> set2 <- matrix(rnorm(33)/2,ncol=3)
> in3d <- inashape3d(ashape3d.obj, points = set2)
> plot(ashape3d.obj, transparency = 0.2)
> rgl.points(points[in3d,], col ="blue")
>
> On Thursday, April 3, 2014 07:38 CEST, Don McKenzie <dmck at u.washington.edu> wrote:
>
>> Thank you for the pointer. That’s quite a list, and I expect I will have to concede defeat, lacking the skill set to adapt my use of the package.
>>
>> On Apr 2, 2014, at 9:11 PM, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>>
>>> Package ptinpoly has generated hangs/segfaults in its checks for years, across platforms. That is why there are all the exclusions at http://cran.r-project.org/web/checks/check_results_ptinpoly.html .
>>>
>>> On 03/04/2014 01:48, Don McKenzie wrote:
>>>> I have a 3D ordination with two groups, and want to identify the points in one group that lie within the 3D convex hull of the other. I would appreciate any enlightenment about why the command at the end (below in a toy example) crashes R when I try to ID the points in the hull using pip3d(), from package ptinpoly. convhulln() is from package geometry. Have I not supplied the right “Faces” argument to pip3d()?
>>>>
>>>> The objects are not large and are reproduced at the bottom of this message.
>>>>
>>>> Thanks
>>>>
>>>> ------------------------
>>>>> sessionInfo()
>>>> R version 3.0.3 (2014-03-06)
>>>> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>>>>
>>>> locale:
>>>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>>>
>>>> attached base packages:
>>>> [1] stats graphics grDevices utils datasets methods base
>>>>
>>>> other attached packages:
>>>> [1] ptinpoly_2.0 misc3d_0.8-4 geometry_0.3-4 magic_1.5-6 abind_1.4-0
>>>>
>>>> loaded via a namespace (and not attached):
>>>> [1] tools_3.0.3
>>>>
>>>> ——
>>>>
>>>>> set1 <- matrix(rnorm(99),ncol=3)
>>>>> ch1 <- convhulln(set1)
>>>>
>>>> Output completed. Verifying that all points are below outer planes of
>>>> all facets. Will make 594 distance computations.
>>>>
>>>>> set2 <- matrix(rnorm(33)/2,ncol=3)
>>>>
>>>>> temp.out <- pip3d(set1,ch1,set2)
>>>>
>>>> R CRASHES HERE
>>>>
>>>> ----------------------------------
>>>>
>>>>
>>>> Don McKenzie
>>>> Research Ecologist
>>>> Pacific Wildland Fire Sciences Lab
>>>> US Forest Service
>>>>
>>>> Affiliate Professor
>>>> School of Environmental and Forest Sciences
>>>> University of Washington
>>>> dmck at uw.edu
>>>>
>>>>
>>>>
>>>> ————————————————
>>>>
>>>> set1
>>>> [,1] [,2] [,3]
>>>> [1,] -0.36381788 0.96624676 -1.09251167
>>>> [2,] -1.09242946 -0.82002293 0.42005666
>>>> [3,] 0.93852498 1.18059117 -0.34816811
>>>> [4,] -0.77413132 1.06018374 -0.37589340
>>>> [5,] -1.67759103 -1.52469985 0.85310979
>>>> [6,] 0.81729494 -0.18900503 0.83172169
>>>> [7,] 0.30546957 0.97549183 -1.30815121
>>>> [8,] 0.22201517 -0.38260850 -0.05412764
>>>> [9,] 0.48817331 1.30314678 0.19143994
>>>> [10,] 1.89836307 -0.34575059 0.55599170
>>>> [11,] 0.20776401 0.04977816 -0.78034565
>>>> [12,] -0.76819740 0.24554574 0.40398017
>>>> [13,] 0.38369531 1.07688341 -0.22686023
>>>> [14,] 0.31806928 1.15482656 -0.99259846
>>>> [15,] 1.07142182 -1.03495199 -0.15650968
>>>> [16,] -1.24667302 -0.35217160 0.71090188
>>>> [17,] -0.92079326 -1.44075490 -0.42838857
>>>> [18,] 0.16907840 0.37587569 1.34994069
>>>> [19,] 0.50947015 1.81852997 -1.83315646
>>>> [20,] 0.52015187 1.56904146 0.90679914
>>>> [21,] -0.04261864 -1.22145642 0.51953397
>>>> [22,] -0.86611946 -1.21106313 -0.86571463
>>>> [23,] -0.13147715 0.07893287 0.83513033
>>>> [24,] -0.63488792 -0.89396994 0.70103420
>>>> [25,] -0.11370015 2.00351619 -0.17652412
>>>> [26,] -1.04527261 -0.14570830 1.64893662
>>>> [27,] 0.46238598 -0.07990767 0.16431874
>>>> [28,] -0.72396505 1.45081393 -0.91068823
>>>> [29,] -0.48892499 -1.05289633 1.36531224
>>>> [30,] 1.83781721 1.50964339 1.85100986
>>>> [31,] 1.00023790 -0.92779325 -2.16783507
>>>> [32,] -0.51429532 -1.44766548 -1.41456589
>>>> [33,] -0.93249545 -0.21845332 0.75023990
>>>>
>>>>> ch1
>>>> [,1] [,2] [,3]
>>>> [1,] 15 31 10
>>>> [2,] 29 30 10
>>>> [3,] 29 15 10
>>>> [4,] 26 28 25
>>>> [5,] 26 29 5
>>>> [6,] 26 29 30
>>>> [7,] 32 15 31
>>>> [8,] 19 28 25
>>>> [9,] 19 32 31
>>>> [10,] 19 32 28
>>>> [11,] 19 30 25
>>>> [12,] 19 31 10
>>>> [13,] 19 30 10
>>>> [14,] 21 29 5
>>>> [15,] 21 29 15
>>>> [16,] 21 32 5
>>>> [17,] 21 32 15
>>>> [18,] 20 30 25
>>>> [19,] 20 26 25
>>>> [20,] 20 26 30
>>>> [21,] 16 28 5
>>>> [22,] 16 26 5
>>>> [23,] 16 26 28
>>>> [24,] 22 28 5
>>>> [25,] 22 32 5
>>>> [26,] 22 32 28
>>>>
>>>>> set2
>>>> [,1] [,2] [,3]
>>>> [1,] 0.061298933 0.561676607 -0.29029312
>>>> [2,] -0.227292687 0.980185118 0.21751216
>>>> [3,] 0.182482967 0.913803801 -0.08308208
>>>> [4,] -0.143596376 -0.007469921 -0.33050543
>>>> [5,] -0.354096826 0.023132113 0.45463150
>>>> [6,] 0.006247011 0.183155253 0.97496500
>>>> [7,] 0.128600720 -0.249603537 -0.24710206
>>>> [8,] -0.418782299 -0.325201099 0.28908138
>>>> [9,] 0.231829464 0.343250895 0.65134735
>>>> [10,] -0.392597726 0.126741875 0.21411363
>>>> [11,] -0.051290704 -1.007826669 0.92808143
>>>>
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>
>>>
>>>
>>> --
>>> Brian D. Ripley, ripley at stats.ox.ac.uk
>>> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
>>> University of Oxford, Tel: +44 1865 272861 (self)
>>> 1 South Parks Road, +44 1865 272866 (PA)
>>> Oxford OX1 3TG, UK Fax: +44 1865 272595
>>
>> Don McKenzie
>> Research Ecologist
>> Pacific Wildland Fire Sciences Lab
>> US Forest Service
>>
>> Affiliate Professor
>> School of Environmental and Forest Sciences
>> University of Washington
>> dmck at uw.edu
>>
>>
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Don McKenzie
Research Ecologist
Pacific Wildland Fire Sciences Lab
US Forest Service
Affiliate Professor
School of Environmental and Forest Sciences
University of Washington
dmck at uw.edu
More information about the R-SIG-Mac
mailing list