new_vector3 {ravetools}R Documentation

Create a Vector3 instance to store '3D' points

Description

Create instances that mimic the 'three.js' syntax.

Usage

new_vector3(x = 0, y = 0, z = 0)

as_vector3(v)

Arguments

x, y, z

numeric, must have the same length, 'xyz' positions

v

R object to be converted to Vector3 instance

Value

A Vector3 instance

See Also

new_matrix4, new_quaternion

Examples


vec3 <- new_vector3(
  x = 1:9,
  y = 9:1,
  z = rep(c(1,2,3), 3)
)

vec3[]

# transform
m <- new_matrix4()

# rotation xy plane by 30 degrees
m$make_rotation_z(pi / 6)

vec3$apply_matrix4(m)

vec3[]

as_vector3(c(1,2,3))


[Package ravetools version 0.1.7 Index]