Skip to documentation
SLOP

tiny.linear.Affine

Reference tiny.linear Affine

Defined in tiny.linear.

API (11)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

No direct callersNo direct callstiny.linearAffine
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/linear/src/affine.zig:15

zig
pub const Affine = extern struct {    linear: Mat3 = .{},    translation: Vec3 = .{},    pub const identity: Affine = .{};    pub fn fromTranslation(translation: Vec3) Affine {        return .{ .translation = translation };    }    /// Scale, then rotate by the unit quaternion `rotation`, then translate.    pub fn fromScaleRotationTranslation(s: Vec3, rotation: Quat, translation: Vec3) Affine {        return .{            .linear = Mat3.fromQuat(rotation).mul(Mat3.fromScale(s)),            .translation = translation,        };    }    /// `a b`: applying `b`, then `a`.    pub fn mul(a: Affine, b: Affine) Affine {        return .{            .linear = a.linear.mul(b.linear),            .translation = a.transformPoint(b.translation),        };    }    pub fn transformPoint(a: Affine, p: Vec3) Vec3 {        return a.linear.mulVec(p).add(a.translation);    }    pub fn transformVector(a: Affine, v: Vec3) Vec3 {        return a.linear.mulVec(v);    }    /// The matrix that carries surface normals through `a`, or null when the    /// linear part is singular. Transformed normals keep their direction but    /// not their length.    pub fn normalMatrix(a: Affine) ?Mat3 {        return a.linear.inverseTranspose();    }    /// The inverse transform, or null when the linear part is singular.    pub fn inverse(a: Affine) ?Affine {        const linear = a.linear.inverse() orelse return null;        return .{            .linear = linear,            .translation = linear.mulVec(a.translation).negate(),        };    }    pub fn toMat4(a: Affine) Mat4 {        return Mat4.fromLinearTranslation(a.linear, a.translation);    }};

Source: lib/linear/src/root.zig:14

zig
pub const Affine = affine.Affine;
Called byCallsprivate; no linkfun.rig.src.properties.testaffinetest sourcelib.linear.src.affinetest: product composes right to lefttest sourcelib.linear.src.affinetest: scale applies before rotation a...private sourcelib.linear.src.test.AffineInverseRoundTrippropertyprivate sourcelib.linear.src.testarithmeticDigestMat3fromQuatMat3fromScaleAffinefromScaleRotationTranslation
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.linear.src.affinetest: points translate and vectors do...AffinefromTranslation
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersMat4fromLinearTranslationAffinetoMat4
Static calls · unresolved targets: 0 · external targets: 0.

Audit

Definitions10
Public names10
Members2
Version26.7.0
Revisiondaab053ee433