R 基于方程在坐标系中求点

R 基于方程在坐标系中求点,r,3d,coordinate-systems,R,3d,Coordinate Systems,我有很多不等式,我想把它们转换成三维坐标系,x,y和z 我需要找到满足所有不等式的所有可能点,保存每个点,然后将其绘制为3d散点图 简化数据示例: #Inequalities (I have several more) df <- data.frame( x = c(0.5, 0.4, 0.1), y = c(0.7, 0.11, -0.25), z = c(-0.5, -0.02, 1), v = c(90, 2500, 350)) # Limits of th

我有很多不等式,我想把它们转换成三维坐标系,
x
y
z

我需要找到满足所有不等式的所有可能点,保存每个点,然后将其绘制为3d散点图

简化数据示例:

#Inequalities (I have several more)
df <- data.frame(
  x = c(0.5, 0.4, 0.1), 
  y = c(0.7, 0.11, -0.25), 
  z = c(-0.5, -0.02, 1),  
  v = c(90, 2500, 350))

# Limits of the coordinate system
x.lim <- seq(-100, 100, by = 1) 
y.lim <- seq(-100, 100, by = 1) 
z.lim <- seq(-50, 50, by = 1) 

# Basic check - must be true for all points: 
df$x + df$y + df$z < df$v

# Looping through all points of the coordinate system 
# no need to test row 2, # if the first row is false

df$x*-100 + df$y*-100 + df$z*-50 < df$v 
# if all conditions are true, save the point to a list/matrix to be able to plot it
df$x*-99 + df$y*-100 + df$z*-50 < df$v
#...
df$x*-100 + df$y*-99 + df$z*-50 < df$v
df$x*-99 + df$y*-98 + df$z*-50 < df$v
#...
df$x*100 + df$y*100 + df$z*50 < df$v
最终,我将能够将所有真实结果绘制成3d散点图,如:

plot3d(x = m[, 1], y = m[, 2], z = m[, 3], col = "blue", size = 4, 
       xlim = c(-100, 100), ylim = c(-100, 100), zlim = c(-50, 50))

我可能会有更多的方程和更大的坐标系,所以速度也是我正在考虑的一个问题。我的主要问题是如何编写条件循环,查看所有可用的不同值,然后将正确的值保存到矩阵中

protip:use
with
例如
with(df,-100*x-100*y-50*zprotip:use
with
例如
with(df,-100*x-100*y-50*z
plot3d(x = m[, 1], y = m[, 2], z = m[, 3], col = "blue", size = 4, 
       xlim = c(-100, 100), ylim = c(-100, 100), zlim = c(-50, 50))