Coder Social home page Coder Social logo

davidcsterratt / rtriangle Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 4.0 479 KB

Port of the Triangle Two-Dimensional Quality Mesh Generator and Delaunay Triangulator to R

Home Page: https://cran.r-project.org/package=RTriangle

Makefile 0.11% R 2.89% C 97.00%
r cran cran-r triangulation mesh-generation

rtriangle's Introduction

rtriangle's People

Contributors

davidcsterratt avatar epipping avatar mdsumner avatar shulele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rtriangle's Issues

is.na(PB) throws warning when valid PB supplied

The issue that PB is a numeric vector, which is.na() is vectorised over. So if() sees a vector of FALSE which rightly throws a warning in newer versions of R.

Here's a Reprex:

library(tidyverse)
library(magrittr)

structure(list(

P = structure(c(2, 3, 3, 2, 1, 1, 0, 0, 0, 1,
2, 2, 3, 3, 2.25, 2.75, 2.75, 2.25, 0.25, 0.75, 0.75, 0.25, 0.25,
0.75, 0.75, 0.25, 1.1, 1.1, 2, 2, 1, 0, 0, 1, 2, 2, 0, 1, 1,
0, 1.25, 1.25, 1.75, 1.75, 0.25, 0.25, 0.75, 0.75, 1.25, 1.25,
1.75, 1.75), .Dim = c(26L, 2L), .Dimnames = list(NULL, c("x",
"y"))),

PB = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 

S = structure(c(1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 2L, 3L, 4L, 1L, 6L, 7L,
8L, 9L, 10L, 5L, 12L, 13L, 14L, 11L, 16L, 17L, 18L, 15L, 20L,
21L, 22L, 19L, 24L, 25L, 26L, 23L), .Dim = c(26L, 2L), .Dimnames = list(
NULL, c("segment_start", "segment_end"))), 

SB = c(1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0), 

H = structure(c(2.5, 0.5, 0.5, 1.5, 0.5, 1.5), .Dim = c(3L,
2L))), .Names = c("P", "PB", "S", "SB", "H")) %>%
do.call(RTriangle::pslg, .) %>%
RTriangle::triangulate() 
#> Warning in if (is.na(PB)) {: the condition has length > 1 and only the
#> first element will be used

Function declaration without prototype is deprecated

The CRAN maintainers have let me know about the following warnings on:
https://cran.r-project.org/web/checks/check_results_RTriangle.html
They need to be fixed, otherwise RTriangle will be removed from CRAN.

Version: 1.6-0.10
Check: whether package can be installed
Result: WARN
    Found the following significant warnings:
     ./triangle.h:287:17: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
     ./triangle.h:288:13: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
     interface.c:28:6: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
     interface.c:249:14: warning: passing arguments to 'triangulate' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
     triangle.c:1372:5: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
     triangle.c:1419:6: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
     triangle.c:1434:7: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
     triangle.c:1455:6: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
     ./triangle.h:288:6: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a subsequent definition [-Wdeprecated-non-prototype]
     triangle.c:3284:19: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]

-Wformat= warnings

CRAN reports the following errors with the C compiler: 'gcc.exe (GCC) 12.3.0':

Version: 1.6-0.12
Check: whether package can be installed
Result: WARN
  Found the following significant warnings:
    triangle.c:1428:9: warning: too many arguments for format [-Wformat-extra-args]
    triangle.c:3699:23: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3705:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3712:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3719:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3727:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3734:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3741:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3748:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3753:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3758:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3793:25: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3799:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3806:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3814:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3821:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3829:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3836:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3844:41: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
    triangle.c:3851:41: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
  See 'd:/Rcompile/CRANpkg/local/4.4/RTriangle.Rcheck/00install.out' for details.
  * used C compiler: 'gcc.exe (GCC) 12.3.0'
triangle.c: In function 'printtriangle':
triangle.c:3699:23: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3699 |   printf("triangle x%lx with orientation %d:\n", (uintptr_t) t->tri,
      |                     ~~^                          ~~~~~~~~~~~~~~~~~~
      |                       |                          |
      |                       long unsigned int          long long unsigned int
      |                     %llx
triangle.c:3705:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3705 |     printf("    [0] = x%lx  %d\n", (uintptr_t) printtri.tri,
      |                        ~~^         ~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |         |
      |                          |         long long unsigned int
      |                          long unsigned int
      |                        %llx
triangle.c:3712:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3712 |     printf("    [1] = x%lx  %d\n", (uintptr_t) printtri.tri,
      |                        ~~^         ~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |         |
      |                          |         long long unsigned int
      |                          long unsigned int
      |                        %llx
triangle.c:3719:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3719 |     printf("    [2] = x%lx  %d\n", (uintptr_t) printtri.tri,
      |                        ~~^         ~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |         |
      |                          |         long long unsigned int
      |                          long unsigned int
      |                        %llx
triangle.c:3727:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
 3727 |     printf("    Origin[%d] = x%lx  (%.12g, %.12g)\n",
      |                               ~~^
      |                                 |
      |                                 long unsigned int
      |                               %llx
 3728 |            (t->orient + 1) % 3 + 3, (uintptr_t) printvertex,
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~
      |                                     |
      |                                     long long unsigned int
triangle.c:3734:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
 3734 |     printf("    Dest  [%d] = x%lx  (%.12g, %.12g)\n",
      |                               ~~^
      |                                 |
      |                                 long unsigned int
      |                               %llx
 3735 |            (t->orient + 2) % 3 + 3, (uintptr_t) printvertex,
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~
      |                                     |
      |                                     long long unsigned int
triangle.c:3741:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
 3741 |     printf("    Apex  [%d] = x%lx  (%.12g, %.12g)\n",
      |                               ~~^
      |                                 |
      |                                 long unsigned int
      |                               %llx
 3742 |            t->orient + 3, (uintptr_t) printvertex,
      |                           ~~~~~~~~~~~~~~~~~~~~~~~
      |                           |
      |                           long long unsigned int
triangle.c:3748:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3748 |       printf("    [6] = x%lx  %d\n", (uintptr_t) printsh.ss,
      |                          ~~^         ~~~~~~~~~~~~~~~~~~~~~~
      |                            |         |
      |                            |         long long unsigned int
      |                            long unsigned int
      |                          %llx
triangle.c:3753:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3753 |       printf("    [7] = x%lx  %d\n", (uintptr_t) printsh.ss,
      |                          ~~^         ~~~~~~~~~~~~~~~~~~~~~~
      |                            |         |
      |                            |         long long unsigned int
      |                            long unsigned int
      |                          %llx
triangle.c:3758:28: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3758 |       printf("    [8] = x%lx  %d\n", (uintptr_t) printsh.ss,
      |                          ~~^         ~~~~~~~~~~~~~~~~~~~~~~
      |                            |         |
      |                            |         long long unsigned int
      |                            long unsigned int
      |                          %llx
triangle.c: In function 'printsubseg':
triangle.c:3793:25: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3793 |   printf("subsegment x%lx with orientation %d and mark %d:\n",
      |                       ~~^
      |                         |
      |                         long unsigned int
      |                       %llx
 3794 |          (uintptr_t) s->ss, s->ssorient, mark(*s));
      |          ~~~~~~~~~~~~~~~~~
      |          |
      |          long long unsigned int
triangle.c:3799:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3799 |     printf("    [0] = x%lx  %d\n", (uintptr_t) printsh.ss,
      |                        ~~^         ~~~~~~~~~~~~~~~~~~~~~~
      |                          |         |
      |                          |         long long unsigned int
      |                          long unsigned int
      |                        %llx
triangle.c:3806:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3806 |     printf("    [1] = x%lx  %d\n", (uintptr_t) printsh.ss,
      |                        ~~^         ~~~~~~~~~~~~~~~~~~~~~~
      |                          |         |
      |                          |         long long unsigned int
      |                          long unsigned int
      |                        %llx
triangle.c:3814:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
 3814 |     printf("    Origin[%d] = x%lx  (%.12g, %.12g)\n",
      |                               ~~^
      |                                 |
      |                                 long unsigned int
      |                               %llx
 3815 |            2 + s->ssorient, (uintptr_t) printvertex,
      |                             ~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             long long unsigned int
triangle.c:3821:33: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
 3821 |     printf("    Dest  [%d] = x%lx  (%.12g, %.12g)\n",
      |                               ~~^
      |                                 |
      |                                 long unsigned int
      |                               %llx
 3822 |            3 - s->ssorient, (uintptr_t) printvertex,
      |                             ~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             long long unsigned int
triangle.c:3829:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3829 |     printf("    [6] = x%lx  %d\n", (uintptr_t) printtri.tri,
      |                        ~~^         ~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |         |
      |                          |         long long unsigned int
      |                          long unsigned int
      |                        %llx
triangle.c:3836:26: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
 3836 |     printf("    [7] = x%lx  %d\n", (uintptr_t) printtri.tri,
      |                        ~~^         ~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |         |
      |                          |         long long unsigned int
      |                          long unsigned int
      |                        %llx
triangle.c:3844:41: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
 3844 |     printf("    Segment origin[%d] = x%lx  (%.12g, %.12g)\n",
      |                                       ~~^
      |                                         |
      |                                         long unsigned int
      |                                       %llx
 3845 |            4 + s->ssorient, (uintptr_t) printvertex,
      |                             ~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             long long unsigned int
triangle.c:3851:41: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'long long unsigned int' [-Wformat=]
 3851 |     printf("    Segment dest  [%d] = x%lx  (%.12g, %.12g)\n",
      |                                       ~~^
      |                                         |
      |                                         long unsigned int
      |                                       %llx
 3852 |            5 - s->ssorient, (uintptr_t) printvertex,
      |                             ~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             long long unsigned int

plotting the voronoi tessellation

Wonder if RTriangle also provides information to plot the corresponding voronoi tessellation and if there is a simple way of generating these plots?

Array overruns

R-Triangle shows array overruns consistently with both gcc and clang's sanitizers. From https://www.stats.ox.ac.uk/pub/bdr/memtests/clang-ASAN/RTriangle/tests/testthat.Rout.fail:

R Under development (unstable) (2018-01-24 r74157) -- "Unsuffered Consequences"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> 
> test_check("RTriangle")
Loading required package: RTriangle
=================================================================
==34355==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe227a7a20 at pc 0x7fa825894cec bp 0x7ffe227a7920 sp 0x7ffe227a7918
READ of size 8 at 0x7ffe227a7a20 thread T0
    #0 0x7fa825894ceb in fast_expansion_sum_zeroelim /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:5022:16
    #1 0x7fa82589709f in counterclockwiseadapt /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:5237:14
    #2 0x7fa825900694 in mergehulls /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:9573:20
    #3 0x7fa8259097b1 in divconqrecurse /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:9921:5
    #4 0x7fa825909714 in divconqrecurse /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:9914:5
    #5 0x7fa825909714 in divconqrecurse /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:9914:5
    #6 0x7fa825909714 in divconqrecurse /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:9914:5
    #7 0x7fa825909691 in divconqrecurse /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:9913:5
    #8 0x7fa825914a71 in divconqdelaunay /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:10048:3
    #9 0x7fa82592d830 in delaunay /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:11068:17
    #10 0x7fa8259755de in triangulate /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:15766:18
    #11 0x7fa825873b5b in R_triangulate /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/interface.c:249:3
    #12 0x7e828a in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c
    #13 0x85a2fd in do_dotcall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:1252:11
    #14 0x9c4a16 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6766:14
    #15 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #16 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #17 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #18 0xa31c3c in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2774:8
    #19 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #20 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #21 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #22 0xa3b5ac in do_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3153:13
    #23 0x9c4a16 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6766:14
    #24 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #25 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #26 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #27 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #28 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #29 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #30 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #31 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #32 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #33 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #34 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #35 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #36 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #37 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #38 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #39 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #40 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #41 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #42 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #43 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #44 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #45 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #46 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #47 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #48 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #49 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #50 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #51 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #52 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #53 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #54 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #55 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #56 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #57 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #58 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #59 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #60 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #61 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #62 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #63 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #64 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #65 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #66 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #67 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #68 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #69 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #70 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #71 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #72 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #73 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #74 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #75 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #76 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #77 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #78 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #79 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #80 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #81 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #82 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #83 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #84 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #85 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #86 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #87 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #88 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #89 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #90 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #91 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #92 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #93 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #94 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #95 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #96 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #97 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #98 0xa3bf21 in do_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3177:9
    #99 0x9c4a16 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6766:14
    #100 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #101 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #102 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #103 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #104 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #105 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #106 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #107 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #108 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #109 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #110 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #111 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #112 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #113 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #114 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #115 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #116 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #117 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #118 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #119 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #120 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #121 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #122 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #123 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #124 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #125 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #126 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #127 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #128 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #129 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #130 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #131 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #132 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #133 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #134 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #135 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #136 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #137 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #138 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #139 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #140 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #141 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #142 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #143 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #144 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #145 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #146 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #147 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #148 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #149 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #150 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #151 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #152 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #153 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #154 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #155 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #156 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #157 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #158 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #159 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #160 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #161 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #162 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #163 0x9d4198 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12
    #164 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #165 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #166 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #167 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #168 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #169 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #170 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #171 0xa1c33f in Rf_evalList /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2873:12
    #172 0x9afcd3 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:718:6
    #173 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #174 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #175 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #176 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #177 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #178 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #179 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #180 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #181 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #182 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #183 0x9b0636 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:647:9
    #184 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #185 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #186 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #187 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #188 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #189 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #190 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #191 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #192 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #193 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #194 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #195 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #196 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #197 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #198 0xa24a31 in R_forceAndCall /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1827:8
    #199 0x585c60 in do_lapply /data/gannet/ripley/R/svn/R-devel/src/main/apply.c:70:8
    #200 0xb91869 in do_internal /data/gannet/ripley/R/svn/R-devel/src/main/names.c:1372:11
    #201 0x9c13bc in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6786:15
    #202 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #203 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #204 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #205 0xa31c3c in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2774:8
    #206 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #207 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #208 0x9b0636 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:647:9
    #209 0xa1ba3a in forcePromise /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:520:8
    #210 0xa63022 in FORCE_PROMISE /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:4966:15
    #211 0xa6346b in getvar /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:5008:10
    #212 0x9dcaa7 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6503:20
    #213 0x9af30d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8
    #214 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #215 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #216 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #217 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #218 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #219 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #220 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #221 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #222 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #223 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #224 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #225 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #226 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #227 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #228 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #229 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #230 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #231 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #232 0xa3015d in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2391:10
    #233 0x9aff1d in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12
    #234 0xa22c9b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c
    #235 0x9b04e4 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12
    #236 0xb1c6a3 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:258:2
    #237 0xb215a0 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:308:11
    #238 0xb21385 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1082:5
    #239 0x529e3a in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29:5
    #240 0x7fa833281889 in __libc_start_main (/lib64/libc.so.6+0x20889)
    #241 0x42d5d9 in _start (/data/gannet/ripley/R/R-clang-SAN/bin/exec/R+0x42d5d9)

Address 0x7ffe227a7a20 is located in stack of thread T0 at offset 64 in frame
    #0 0x7fa82589645f in counterclockwiseadapt /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:5175

  This frame has 5 object(s):
    [32, 64) 'B' (line 5181) <== Memory access at offset 64 overflows this variable
    [96, 160) 'C1' (line 5181)
    [192, 288) 'C2' (line 5181)
    [320, 448) 'D' (line 5181)
    [480, 512) 'u' (line 5184)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /data/gannet/ripley/R/packages/tests-clang-SAN/RTriangle/src/triangle.c:5022:16 in fast_expansion_sum_zeroelim
Shadow bytes around the buggy address:
  0x1000444ecef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000444ecf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000444ecf10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000444ecf20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000444ecf30: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
=>0x1000444ecf40: 00 00 00 00[f2]f2 f2 f2 00 00 00 00 00 00 00 00
  0x1000444ecf50: f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000444ecf60: f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000444ecf70: 00 00 00 00 f2 f2 f2 f2 00 00 00 00 f3 f3 f3 f3
  0x1000444ecf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000444ecf90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==34355==ABORTING

RTriangle runs out of memory

When triangulating certain PSLGs subject to area and angle quality constraints (a and q options), and with the insertion of Steiner points in the boundary suppressed (Y=TRUE), triangulate() can try to generate infinite numbers of internal Steiner points, leading to an out of memory error.

triangulate() does not triangulate a PSLG with two holes correctly

I've had a bug report from Paolo Piras:

With one hole pslg() and triangulate() properly triangulate the shape, with two holes it is not the case. Here below a fully reproducible example

library(RTriangle)
myshape<-matrix(c
(1507,1370,1470,1598,1685,1551,1470,1490,1779,2249,2517,2652,2598,2370,2209,2162,2323,2517,2611,2544,2370,2276,2081,2054,1994,1893,1745,1611,1605,1887,1794,1913,2226,2306,2140,1998,1851,1799,1856,2016,2081,1988,2333,2126,1938,1723,1515,1233,944,669,535,508,703,1025,1253,1381,1575,1703,1891,1944,2092,2179,2186,2112,2105,2280,2481,2374,2099,2206,2307,972,822,672,716,947,1009,1022,1909,1834,1681,1676,1787,1917),ncol
=2)
plot(myshape,asp=1)
text(myshape[,1],myshape[,2],c(1:nrow(myshape)))
links<-matrix(c
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,36,30,31,32,33,34,35,42,37,38,39,40,41,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,1,30,31,32,33,34,35,36,37,38,39,40,41,42),ncol
=2)
for(i in 1:nrow(links)){
  segments(myshape[links[i,1],1],myshape[links[i,1],2],myshape[links
[i,2],1],myshape[links[i,2],2])
}
#### Let's try with one hole structure
p<-pslg(myshape,S=links,H=rbind(apply(myshape[30:36,],2,mean)))
pt<-triangulate(p)
plot(pt,asp=1)#### with one hole it works
####  try with two holes
p<-pslg(myshape,S=links,H=rbind(apply(myshape[30:36,],2,mean),apply(myshape
[37:42,],2,mean)))
pt<-triangulate(p)
plot(pt,asp=1)####    why it does not work with two holes?

potential anyDuplicated speed-up for pslg

anyDuplicated.matrix is quite slow, as it uses apply(), which means pslg is a fair bit slower than the actual triangulate call. There's a substantial speed up in using the .data.frame method rather than .matrix, as in pslg2 below.

I think there are faster ways still to speed this up, and while it's easy enough to construct the pslg manually with my own validations, this might be a useful modification - thanks!

library(RTriangle)
set.seed(98)
xy <- matrix(rnorm(1e6), ncol = 2)
system.time(sl1 <- pslg(xy))  # 10s
system.time(sl2 <- pslg2(xy))  # 3s

system.time(triangulate(sl1)) # 2s

## simple modification for anyDuplicated at 1.
pslg2 <- 
function (P, PB = NA, PA = NA, S = NA, SB = NA, H = NA) {
  P <- as.matrix(P)
  PB <- as.integer(PB)
  PA <- as.matrix(PA)
  S <- as.matrix(S)
  SB <- as.integer(SB)
  H <- as.matrix(H)
  check.na.nan <- function(x) {
    if (!is.null(x)) {
      if (any(is.nan(x))) {
        stop(paste("NaN in", deparse(substitute(x))))
      }
      if (any(is.na(x))) {
        stop(paste("NA in", deparse(substitute(x))))
      }
    }
  }
  check.na.nan(P)
  if (ncol(P) != 2) {
    stop("Matrix of vertices P should have 2 columns")
  }
## 1. modification, anyDuplicated(data.frame) rather than matrix
  if (anyDuplicated(as.data.frame(P))) {
    stop("Duplicated vertices in P.")
  }
  if (any(is.na(PA))) {
    PA <- matrix(0, nrow(P), 0)
  }
  if (nrow(PA) != nrow(P)) {
    stop("Point attribute matrix PA does not have same number of rows the point matrix P")
  }
  if (is.na(PB)) {
    PB <- 0
  }
  PB <- rep(PB, length.out = nrow(P))
  if (any(is.na(S))) {
    S <- matrix(0, 0, 2)
  }
  else {
    if (ncol(S) != 2) {
      stop("Matrix of segments S should have 2 columns")
    }
  }
  if (any(is.na(SB))) {
    SB <- 0
  }
  SB <- rep(SB, length.out = nrow(S))
  if (any(is.na(H))) {
    H <- matrix(0, 0, 2)
  }
  else {
    if (ncol(H) != 2) {
      stop("Matrix of holes H should have 2 columns")
    }
  }
  storage.mode(P) <- "double"
  storage.mode(PA) <- "double"
  storage.mode(PB) <- "integer"
  storage.mode(S) <- "integer"
  storage.mode(SB) <- "integer"
  storage.mode(H) <- "double"
  ret <- list(P = P, PA = PA, PB = PB, S = S, SB = SB, H = H)
  class(ret) <- "pslg"
  return(ret)
}

Add Neighbour (NB) to output

As described in this PR #13

It is very useful to export the neighbor-relationship with the triangles.

I am trying to use the RTriangle Package in my PIHMgisR tool, that is a GIS-processing for Penn State Integrated Hydrologic Model (PIHM). After I build the triangle, it is necessary to define the neighbor-relationship among triangles for modeling.
I have my own code to build the topological relationship in R and C, but due to the algorithm, it is very time-consuming to build the relationship when the number of triangles become larger than larger. I notice the C version of the code already exports the neighbor-relationship, so it would be nice to update these two files and export the topological relationship explicitly.

-Wformat-extra-args warnings

CRAN have reported the following warning on various compilers:

Version: 1.6-0.12
Check: whether package can be installed
Result: WARN
  Found the following significant warnings:
    triangle.c:1428:35: warning: data argument not used by format string [-Wformat-extra-args]
  See ‘/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/RTriangle.Rcheck/00install.out’ for details.

A bug/error when "MaxArea" is small.

I noticed a bug or an error when I try to use small 'MaxArea' in the package.

I tested it with the following code:

library(RTriangle)
p <- pslg(P=rbind(c(0, 0), c(0, 1), c(0.5, 0.5), c(1, 1), c(1, 0)) * 1000,
          S=rbind(c(1, 2), c(2, 3), c(3, 4), c(4, 5), c(5, 1)))

ia <- 30 * (6:1)
nc <-ia * 0
nx <- length(ia)
par(mfrow=c(3,2))
for(i in 1:nx){
  ## Triangulate it
  tp <- triangulate(p, a=ia[i])
  plot(tp, type='n')
  nc[i] <- nrow(tp$T)
  mtext(paste('a= ', ia[i], ' n=', nc[i]))
}
print(nc)

Printed results are:

6549  7816  9788 11469 12597 10026

When the MaxArea is larger than 120, the results are correct.
When the MaxArea is less than 120, there are some triangles whose area is larger than the threshold.
The number of triangles should become more and more, along with the increasing MaxArea threshold.

I guess that is the issue from the size of 'int' in the code. But I cannot fix it yet.

Any thoughts or suggestions? Thank you.

triangulating a pslg with attributes

when I am triangulating a pslg object with attributes, the triangulate function seems to (kind of) transpose the attribute matrix.
in the example below i would expect PA to stay the same from the pslg object to the DT object. Am I misunderstanding the intended functionality?

sp_pts <- as.data.frame(matrix(nrow=4,ncol = 2))
colnames(sp_pts) <- c("latitude", "longitude")
sp_pts$latitude <- c(41,42,43,44)
sp_pts$longitude <- c(-120,-121,-122,-123)

att <- as.data.frame(matrix(nrow=4,ncol = 3))
colnames(att) <- c("att1", "att2", "att3")
att$att1 <- c(1, 1.1, 1.11, 1.111)
att$att2 <- c(2, 2.2, 2.22, 2.222)
att$att3 <- c(3, 3.3, 3.33, 3.333)

att
p <- pslg(P = sp_pts, PA = att)
p$PA[1,]

DT <- RTriangle::triangulate(p)
DT$PA[1,]

p$PA
DT$PA

Compiled code should not call sprintf

The latest R-devel gives the following warning

* checking compiled code ... WARNING
File ‘RTriangle/libs/RTriangle.so’:
  Found ‘sprintf’, possibly from ‘sprintf’ (C)
    Object: ‘interface.o’

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.