Skip to content

A bug/error when "MaxArea" is small. #16

@shulele

Description

@shulele

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions