Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Vec3

struct Vec3 { x: float, y: float, z: float }

A 3D vector with float components x, y, and z. Create one with vec3(x, y, z) or a struct literal such as Vec3 { x = 0.0, y = 1.0, z = 0.0 }.

Like Vec2, the components are stored as 32-bit floats.

Implementations

length

fn length(self) -> float

normalize

fn normalize(self) -> Vec3