Import std.math.vector
Vec3
struct
Public Struct Vec3 Implements Numeric, Hashable, Printable, Defaultable
A point or direction in 3D.
Examples
Local right = Vec3(1, 0, 0)
Local up = Vec3(0, 1, 0)
Expect(Dot(right, up) == 0.0)
Expect(Cross(right, up) == Vec3(0, 0, 1))
Expect(Length(Vec3(3, 4, 0)) == 5.0)
Expect(Normalize(Vec3(0, 0, 9)) == Vec3(0, 0, 1))
Expect(Lerp(right, up, 0.5) == Vec3(0.5, 0.5, 0))
Expect(right * 2 + up == Vec3(2, 1, 0))-
Its x component.
-
Its y component.
-
Its z component.
-
The zero vector, (0, 0, 0).
-
The vector (1, 1, 1), which multiplying leaves alone.
-
The zero vector, (0, 0, 0).
-
Up: +Y.
-
Down: -Y.
-
Right: +X.
-
Left: -X.
-
-Z, where a camera with no rotation looks.
-
Back: +Z, toward the camera.
-
Its x and y, as a Vec2.
-
The components as Ints, toward 0, as As converts them: one outside an Int's range panics.
-
Its components, as "(1, 2, 3)".
-
The component at the index: x at 0, y at 1, and z at 2. Any other index panics.
-
aplusb, component by component. -
aminusb, component by component. -
atimesb, component by component. -
adivided byb, component by component. -
atimesscale. -
scaletimesa. -
adivided byscale. -
anegated.
Report an issue with this page or with FutureBlitz on GitHub.