首页 > 解决方案 > 如何将矢量几何对叠加成一对?

问题描述

我随机生成包含在矩形中的点集(我也想做其他形状)。这是一个例子:

#Simulation window parameters
xMin <- 0
xMax <- 1
yMin <- 0
yMax <- 1

xDelta <- xMax - xMin
yDelta <- yMax - yMin #rectangle dimensions
areaTotal <- xDelta*yDelta

#Point process parameters
lambda0 <- 1000 #intensity (ie mean density) of the Poisson process

#Simulate Poisson point process
numbPoints <- rpois(1,lambda0*areaTotal) #Poisson number of points
xx <- xDelta*runif(numbPoints,0,1) + xMin #x coordinates of Poisson points
yy <- yDelta*runif(numbPoints,0,1) + yMin #y coordinates of Poisson points
#Plotting
plot(xx,yy)

#Point process parameters for 2nd rectangle
lambda0 <- 100 #intensity (ie mean density) of the Poisson process

#Simulate Poisson point process for 2nd rectangle
numbPoints <- rpois(1,lambda0*areaTotal) #Poisson number of points
xx2 <- xDelta*runif(numbPoints,0,1) + xMin #x coordinates of Poisson points
yy2 <- yDelta*runif(numbPoints,0,1) + yMin #y coordinates of Poisson points
#Plotting
plot(xx2,yy2)

这两个图将在有界正方形上生成点。

我想创建一个新对,将其称为 (xxc, yyc) ,它将结合 (xx,yy) 和 (xx2,yy2) 以便 plot(xxc,yyc) 将所有点绘制到一个正方形上。

我很难过我将如何做到这一点。(我的目标是为任何几何形状做两个以上的集合。)

标签: rsortinggeometry

解决方案


推荐阅读