tiny.rig.Transform
Defined in tiny.rig.
A rigid transform.
API (7)
Actions
Public operations.
applyPointcomposeidentityinverse: The transform that undoes this one:compose(t.inverse(), t)is the identity up to rounding.inversePoint
Fields and members
Public fields and members.
Source
Source: fun/rig/src/transform.zig:19
zig
/// A rigid transform. Rig normalizes every rotation before it composes or/// applies one, so rotations read from specs and ABIs need not be unit length.pub const Transform = struct { translation: Vec3 = .{}, rotation: Quat = .{}, pub fn identity() Transform { return .{}; } pub fn compose(parent: Transform, child: Transform) Transform { return .{ .translation = parent.translation.add(rotate(parent.rotation, child.translation)), .rotation = unit(unit(parent.rotation).mul(unit(child.rotation))), }; } pub fn applyPoint(self: Transform, point: Vec3) Vec3 { return self.translation.add(rotate(self.rotation, point)); } pub fn inversePoint(self: Transform, point: Vec3) Vec3 { return rotate(unit(self.rotation).conjugate(), point.sub(self.translation)); } /// The transform that undoes this one: `compose(t.inverse(), t)` is the /// identity up to rounding. pub fn inverse(self: Transform) Transform { const rotation = unit(self.rotation).conjugate(); return .{ .translation = rotation.rotate(self.translation).scale(-1), .rotation = rotation, }; }};Source: fun/rig/src/root.zig:27
zig
pub const Transform = transform.Transform;Audit
| Definitions | 6 |
|---|---|
| Public names | 6 |
| Members | 2 |
| Version | 26.7.0 |
| Revision | daab053ee433 |