r - 如何将矢量几何对叠加成一对?
问题描述
我随机生成包含在矩形中的点集(我也想做其他形状)。这是一个例子:
#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) 将所有点绘制到一个正方形上。
我很难过我将如何做到这一点。(我的目标是为任何几何形状做两个以上的集合。)
解决方案
推荐阅读
- javascript - 使用 javascript 删除 django formset
- typescript - 编译打字稿时找不到名称“符号”
- android - 搜索栏进度动画?
- ios - 调用 invalidateLayout() 或 reloadData() 以在设备旋转后重新加载从情节提要创建的 UICollectionView
- haskell - 通过过滤每两个数字的序列,使用推导在 Haskell 中生成一个列表
- c# - C# 删除 flowLayoutPanel 中动态创建的控件
- c# - 删除后如何从选定行datagridview中删除记录并更新数据库?
- aws-lambda - 如何使用 lambda-maven-plugin 将函数上传到 AWS Lambda?
- python - 替换文件中的特殊字符串而不删除其他内容
- javascript - 在 javascript 中释放未使用的共享对象的最佳方法是什么?