python xyz2d平面图_将xyz给出的平面转换为R中的xy坐标(3D到2D)

所以你现在拥有的是共面点3D的坐标(你可以通过计算矩阵的等级my.plain [,c(“x”,“y”,“z”)来确认你的点是共面的] ,这是2).

您希望新的“框架”由点A定义为原点和矢量(A-> B)/ | A-> B | ^ 2和(A-> D)/ | A-> D | ^ 2.

要将xyz坐标转换为新“框架”中的坐标,您需要将以前坐标(乘以A的坐标)乘以从旧框架到新框架的转换矩阵.

所以,在R代码中,这给出了:

# Get a matrix out of your data.frame

row.names(my.plain)

my.plain

# compute the matrix of transformation

require(Matrix)

AB

AD

tr_mat

# compute the new coordinates

my.plain.2D

# plot the 2D data

plot(my.plain.2D, pch=19, las=1, xlab="x", ylab="y")

# and the plot with the letters, the polygon and the color:

plot(my.plain.2D, pch=3, las=1, xlab="x", ylab="y")

polygon(my.plain.2D[c("A", "B", "C", "F", "H", "G", "D"), ], col="magenta")

points(my.plain.2D, pch=3, lwd=2)

text(my.plain.2D[, 1], my.plain.2D[, 2], row.names(my.plain.2D), pos=2, font=2)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值