struct CP::Transform

Overview

Column major 2x3 affine transform.

Defined in:

chipmunk/vector.cr

Constant Summary

IDENTITY = new

Identity transform matrix.

Constructors

Instance Method Summary

Constructor Detail

def self.axial_scale(axis : Vect, pivot : Vect, scale : Number) : self #

[View source]
def self.bone_scale(v0 : Vect, v1 : Vect) : self #

[View source]
def self.new(a : Number = 1, b : Number = 0, c : Number = 0, d : Number = 1, tx : Number = 0, ty : Number = 0) #

Construct a new transform matrix.

  • (a, b) is the x basis vector.
  • (c, d) is the y basis vector.
  • (tx, ty) is the translation.

[View source]
def self.new_transpose(a : Number, c : Number, tx : Number, b : Number, d : Number, ty : Number) : self #

Construct a new transform matrix in transposed order.


[View source]
def self.ortho(bb : BB) : self #

[View source]
def self.rigid(translate : Vect, radians : Number) : Transform #

Create a rigid transformation matrix. (translation + rotation)


[View source]
def self.rigid_inverse : Transform #

Fast inverse of a rigid transformation matrix.


[View source]
def self.rotate(radians : Number) : self #

Create a rotation matrix.


[View source]
def self.scale(scale_x : Number, scale_y : Number) : self #

Create a scale matrix.


[View source]
def self.translate(translate : Vect) : self #

Create a translation matrix.


[View source]

Instance Method Detail

def *(t2 : Transform) : Transform #

Multiply two transformation matrices.


[View source]
def a : Float64 #

[View source]
def a=(a : Float64) #

[View source]
def b : Float64 #

[View source]
def b=(b : Float64) #

[View source]
def c : Float64 #

[View source]
def c=(c : Float64) #

[View source]
def d : Float64 #

[View source]
def d=(d : Float64) #

[View source]
def inverse : Transform #

Get the inverse of a transform matrix.


[View source]
def transform(bb : BB) : BB #

Transform a BB.


[View source]
def transform_point(p : Vect) : Vect #

Transform an absolute point. (i.e. a vertex)


[View source]
def transform_vect(v : Vect) : Vect #

Transform a vector (i.e. a normal)


[View source]
def tx : Float64 #

[View source]
def tx=(tx : Float64) #

[View source]
def ty : Float64 #

[View source]
def ty=(ty : Float64) #

[View source]
def wrap(inner : Transform) : Transform #

[View source]
def wrap_inverse(inner : Transform) : Transform #

[View source]