Skip to main content

vec3

Macro vec3 

Source
macro_rules! vec3 {
    ($($arg:expr),*$(,)?) => { ... };
}
Expand description

Constructs a 3-dimensional vector from the provided arguments.

The macro accepts scalars and vectors as arguments, as long as they can be combined to form a 3-component vector. If only a single scalar argument is provided, it is duplicated across all components.

ยงExamples

use ggmath::{Vec3, vec2, vec3};

let one_two_three: Vec3<f32> = vec3!(1.0, 2.0, 3.0);
let one_two_three: Vec3<f32> = vec3!(vec2!(1.0, 2.0), 3.0);
let one_two_three: Vec3<f32> = vec3!(vec3!(1.0, 2.0, 3.0));
let one_one_one: Vec3<f32> = vec3!(1.0);