Displaying 3 results from an estimated 3 matches for "dxyz".
Did you mean:
dxy
2025 May 31
1
constructing a matrix for rgl plots
...ar interpolation within each triangle:
x <- runif(100, 0, 10) # 100 random points from 0 to 10
y <- runif(100, 0, 20) # 100 random points from 0 to 20
z <- x^2 + y^2 # z as a function of x and y
library(deldir) # need this to triangulate the x, y values
dxyz <- deldir(x, y, z = z)
library(rgl)
plot3d(dxyz, col = "red")
Use plot3d(dxyz, col = "red", front = "lines") to see the triangulation
more clearly.
Duncan Murdoch
2025 May 31
1
constructing a matrix for rgl plots
...le:
>
> ?? x <- runif(100, 0, 10)?? # 100 random points from 0 to 10
> ?? y <- runif(100, 0, 20)?? # 100 random points from 0 to 20
> ?? z <- x^2 + y^2?????????? # z as a function of x and y
>
> ?? library(deldir)? # need this to triangulate the x, y values
> ?? dxyz <- deldir(x, y, z = z)
>
> ?? library(rgl)
> ?? plot3d(dxyz, col = "red")
>
>
> Use plot3d(dxyz, col = "red", front = "lines") to see the triangulation
> more clearly.
>
> Duncan Murdoch
>
> __________________________________...
2025 May 31
2
constructing a matrix for rgl plots
Hi,
rgl plots seem to require the z object in the form of a matrix. I would like some help in constructing this matrix when I cannot use the outer function. Let me explain.
library(rgl)
library(plot3D)
x <- 1:10
y <- 1:20
fun1 <- function (x,y) {x^2+y^2}
z <- outer(x,y, fun1)
open3d()
surface3d(x,y,z,col="red",theta=50, phi=20)
This works fine. However, when I have a data