1

Does anybody know of an issue with either DSpat's create.lines or spatstat's rlinegrid? Whenever I use these functions on my Windows (owins), the output has far too many lines.

For example, if I run

DSpat::create.lines(owint, nlines=80, width = 1, spacing=NULL,angle=0)

The output has approx. 2000 lines.

If I do a bit of math so I can set the number of lines output from rlinegrid, based on window diameter:

  dot <- diameter.owin(owin)

  d8 <- (dot / 80)

  rlgt <- rlinegrid(angle = 0, spacing = d8, as.owin(owint))

The output also has approx. 2000 lines.

Simplifying the owin by converting to sp and using gSimplify, then running through the above functions works for the most part, but sometimes the functions still output too many lines.

The shape I am adding lines to is similar to this:

enter image description here

Am I misunderstanding how rlinegrid and create.lines work?

Note: The code to import the image and run through all the code previous to this issue is very long and arduous, but I can upload it if an example is needed.

1

I cannot reproduce this problem, and you have not provided a working example which demonstrates the problem.

My example:

 library(spatstat)
 dot <- diameter(letterR)
 d8 <- dot/80
 rl <- rlinegrid(angle=0, spacing=d8, win=letterR)
 rl

This gives a pattern of line segments (class psp) comprising about 100-130 segments, formed by intersecting a grid of about 80 equally-spaced straight lines with the non-convex window letterR.

You could check that your calculated value of d8 was sensible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.