MCPcopy
hub / github.com/tdewolff/canvas / IsTranslation

Method IsTranslation

util.go:808–810  ·  view source on GitHub ↗

IsTranslation is true if the matrix consists of only translational components, i.e. no rotation, scaling, or skew transformations.

()

Source from the content-addressed store, hash-verified

806
807// IsTranslation is true if the matrix consists of only translational components, i.e. no rotation, scaling, or skew transformations.
808func (m Matrix) IsTranslation() bool {
809 return Equal(m[0][0], 1.0) && Equal(m[0][1], 0.0) && Equal(m[1][0], 0.0) && Equal(m[1][1], 1.0) && (!Equal(m[0][2], 0.0) || !Equal(m[1][2], 0.0))
810}
811
812// IsScaling is true if the matrix consists of only scaling components, i.e. no rotation, or skew transformations (but may translate).
813func (m Matrix) IsScaling() bool {

Callers 2

TestMatrixFunction · 0.80
RenderTextMethod · 0.80

Calls 1

EqualFunction · 0.85

Tested by 1

TestMatrixFunction · 0.64