MatrixTransform2x3.st
author Claus Gittinger <cg@exept.de>
Sat, 30 Mar 2013 01:54:53 +0100
changeset 3111 d4e7cc019d23
parent 1380 a999c793cd59
child 3425 ba8fa7476156
permissions -rw-r--r--
class: MatrixTransform2x3 added: #transformDirection: comment/format in: #setOffset: #setScale: #transformPoint:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
     1
"{ Package: 'stx:libview2' }"
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
     2
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
     3
DisplayTransform variableFloatSubclass:#MatrixTransform2x3
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	instanceVariableNames:''
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	classVariableNames:''
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	poolDictionaries:''
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	category:'Graphics-Transformations'
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
MatrixTransform2x3 comment:'This class represents a transformation for points, that is a combination of scale, offset, and rotation. It is implemented as a 2x3 matrix containing the transformation from the local coordinate system in the global coordinate system. Thus, transforming points from local to global coordinates is fast and cheap whereas transformations from global to local coordinate systems are relatively expensive.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    12
Implementation Note: It is assumed that the transformation deals with Integer points. All transformations will return Integer coordinates (even though float points may be passed in here).'
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    13
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
!MatrixTransform2x3 class methodsFor:'instance creation'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
identity
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    19
	^self new setScale: 1.0
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    20
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
new
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    23
	^self new: 6
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    24
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
transformFromLocal: localBounds toGlobal: globalBounds
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
	^((self withOffset: (globalBounds center)) composedWithLocal:
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
		(self withScale: (globalBounds extent / localBounds extent) asFloatPoint))
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
			composedWithLocal: (self withOffset: localBounds center negated)
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
"
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	^(self identity)
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
		setScale: (globalBounds extent / localBounds extent) asFloatPoint;
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
		setOffset: localBounds center negated asFloatPoint;
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
		composedWithGlobal:(self withOffset: globalBounds center asFloatPoint)
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    35
"
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    36
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
withAngle: angle
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    39
	^self new setAngle: angle
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    40
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
withOffset: aPoint
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    43
	^self identity setOffset: aPoint
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    44
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
withRotation: angle
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    47
	^self new setAngle: angle
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    48
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
withScale: aPoint
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    51
	^self new setScale: aPoint
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    52
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
!MatrixTransform2x3 methodsFor:'accessing'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
at: index
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    57
"/        <primitive: 'primitiveFloatArrayAt'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    58
"/        ^Float fromIEEE32Bit: (self basicAt: index)
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    59
          ^ self basicAt: index
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    60
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
at: index put: value
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    63
"/        <primitive: 'primitiveFloatArrayAtPut'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    64
"/        value isFloat 
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    65
"/                ifTrue:[self basicAt: index put: value asIEEE32BitWord]
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    66
"/                ifFalse:[self at: index put: value asFloat].
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    67
"/        ^value
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    68
        ^ self basicAt: index put:value
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    69
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
inverseTransformation
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
	"Return the inverse transformation of the receiver.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
	The inverse transformation is computed by first calculating
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
	the inverse offset and then computing transformations
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
	for the two identity vectors (1@0) and (0@1)"
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
	| r1 r2 r3 m |
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
	r3 _ self invertPoint: 0@0.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
	r1 _ (self invertPoint: 1@0) - r3.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
	r2 _ (self invertPoint: 0@1) - r3.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
	m _ self species new.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
	m
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
		a11: r1 x; a12: r2 x; a13: r3 x;
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
		a21: r1 y; a22: r2 y; a23: r3 y.
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    84
	^m
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    85
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
offset
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    88
	^self a13 @ self a23
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    89
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
offset: aPoint
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
	self a13: aPoint x asFloat.
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    93
	self a23: aPoint y asFloat.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
    94
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
!MatrixTransform2x3 methodsFor:'comparing'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
= MatrixTransform2x3
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
    99
        | length |
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   100
"/        <primitive:'primitiveFloatArrayEqual'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   101
        self class = MatrixTransform2x3 class ifFalse:[^false].
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   102
        length _ self size.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   103
        (length = MatrixTransform2x3 size) ifFalse:[^false].
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   104
        1 to: self size do:[:i| (self at: i) = (MatrixTransform2x3 at: i) ifFalse:[^false]].
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   105
        ^true
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   106
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
hash
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   109
        | result |
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   110
"/        <primitive:'primitiveFloatArrayHash'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   111
"/        result _ 0.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   112
"/        1 to: self size do:[:i| result _ result + (self basicAt: i) ].
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   113
"/        ^result bitAnd: 16r1FFFFFFF
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   114
        result _ 0.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   115
        1 to: self size do:[:i| result _ result + (self basicAt: i) hash ].
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   116
        ^result bitAnd: 16r1FFFFFFF
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   117
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
!MatrixTransform2x3 methodsFor:'composing'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
composedWithLocal: aTransformation
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
	"Return the composition of the receiver and the local transformation passed in"
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
	aTransformation isMatrixTransform2x3 ifFalse:[^super composedWith: aTransformation].
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   124
	^self composedWithLocal: aTransformation asMatrixTransform2x3 into: self class new
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   125
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
composedWithLocal: aTransformation into: result
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   128
        "Return the composition of the receiver and the local transformation passed in.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   129
        Store the composed matrix into result."
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   130
        | a11 a12 a13 a21 a22 a23 b11 b12 b13 b21 b22 b23 matrix |
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   131
"/        <primitive: 'm23PrimitiveComposeMatrix'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   132
        matrix _ aTransformation asMatrixTransform2x3.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   133
        a11 _ self a11.                 b11 _ matrix a11.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   134
        a12 _ self a12.                 b12 _ matrix a12.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   135
        a13 _ self a13.                 b13 _ matrix a13.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   136
        a21 _ self a21.                 b21 _ matrix a21.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   137
        a22 _ self a22.                 b22 _ matrix a22.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   138
        a23 _ self a23.                 b23 _ matrix a23.
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   139
        result a11: (a11 * b11) + (a12 * b21).
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   140
        result a12: (a11 * b12) + (a12 * b22).
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   141
        result a13: a13 + (a11 * b13) + (a12 * b23).
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   142
        result a21: (a21 * b11) + (a22 * b21).
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   143
        result a22: (a21 * b12) + (a22 * b22).
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   144
        result a23: a23 + (a21 * b13) + (a22 * b23).
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   145
        ^result
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   146
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
!MatrixTransform2x3 methodsFor:'converting'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
asMatrixTransform2x3
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   151
	^self
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   152
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
!MatrixTransform2x3 methodsFor:'element access'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
a11
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   157
	^self at: 1
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   158
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
a11: value
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   161
	 self at: 1 put: value
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   162
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
a12
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   165
	^self at: 2
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   166
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
a12: value
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   169
	 self at: 2 put: value
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   170
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
a13
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   173
	^self at: 3
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   174
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
a13: value
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   177
	 self at: 3 put: value
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   178
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
a21
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   181
	 ^self at: 4
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   182
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
a21: value
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   185
	 self at: 4 put: value
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   186
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
a22
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   189
	 ^self at: 5
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   190
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
a22: value
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   193
	 self at: 5 put: value
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   194
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
a23
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   197
	 ^self at: 6
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   198
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
a23: value
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   201
	 self at: 6 put: value
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   202
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
!MatrixTransform2x3 methodsFor:'initialize'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
setIdentiy
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
	"Initialize the receiver to the identity transformation (e.g., not affecting points)"
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
	self
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
		a11: 1.0; a12: 0.0; a13: 0.0;
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   210
		a21: 0.0; a22: 1.0; a23: 0.0.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   211
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
!MatrixTransform2x3 methodsFor:'printing'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
printOn: aStream
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
	aStream 
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
		nextPutAll: self class name;
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
		nextPut: $(;
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
		cr; print: self a11; tab; print: self a12; tab; print: self a13;
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
		cr; print: self a21; tab; print: self a22; tab; print: self a23;
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   221
		cr; nextPut:$).
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   222
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
!MatrixTransform2x3 methodsFor:'private'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
setAngle: angle
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
	"Set the raw rotation angle in the receiver"
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
	| rad s c |
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
	rad := angle degreesToRadians.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
	s := rad sin.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
	c := rad cos.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
	self a11: c.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
	self a12: s negated.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
	self a21: s.
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   235
	self a22: c.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   236
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
setOffset: aPoint
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   239
        "Set the raw offset in the receiver"
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   240
        | pt |
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   241
        pt := aPoint asPoint.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   242
        self a13: pt x asFloat.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   243
        self a23: pt y asFloat.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   244
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
setScale: aPoint
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   247
        "Set the raw scale in the receiver"
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   248
        | pt |
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   249
        pt := aPoint asPoint.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   250
        self a11: pt x asFloat.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   251
        self a22: pt y asFloat.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   252
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
!MatrixTransform2x3 methodsFor:'testing'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
isIdentity
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   257
        "Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself."
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   258
"/        <primitive: 'm23PrimitiveIsIdentity'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   259
        ^self isPureTranslation and:[self a13 = 0.0 and:[self a23 = 0.0]]
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   260
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
isMatrixTransform2x3
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
	"Return true if the receiver is 2x3 matrix transformation"
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   264
	^true
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   265
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
isPureTranslation
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   268
        "Return true if the receiver specifies no rotation or scaling."
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   269
"/        <primitive: 'm23PrimitiveIsPureTranslation'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   270
        ^self a11 = 1.0 and:[self a12 = 0.0 and:[self a22 = 0.0 and:[self a21 = 1.0]]]
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   271
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
!MatrixTransform2x3 methodsFor:'transforming points'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
globalPointToLocal: aPoint
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   276
        "Transform aPoint from global coordinates into local coordinates"
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   277
"/        <primitive: 'm23PrimitiveInvertPoint'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   278
        ^(self invertPoint: aPoint) rounded
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   279
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
invertPoint: aPoint
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
	"Transform aPoint from global coordinates into local coordinates"
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
	| x y det a11 a12 a21 a22 detX detY |
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
	x _ aPoint x asFloat - (self a13).
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
	y _ aPoint y asFloat - (self a23).
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
	a11 _ self a11.	a12 _ self a12.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
	a21 _ self a21.	a22 _ self a22.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
	det _ (a11 * a22) - (a12 * a21).
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
	det = 0.0 ifTrue:[^0@0]. "So we have at least a valid result"
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
	det _ 1.0 / det.
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
	detX _ (x * a22) - (a12 * y).
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
	detY _ (a11 * y) - (x * a21).
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   293
	^(detX * det) @ (detY * det)
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   294
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
localPointToGlobal: aPoint
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   297
        "Transform aPoint from local coordinates into global coordinates"
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   298
"/        <primitive: 'm23PrimitiveTransformPoint'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   299
        ^(self transformPoint: aPoint) rounded
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   300
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   302
transformDirection: aPoint
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   303
        "Transform aPoint from local coordinates into global coordinates;
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   304
         Ignores the offset."
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   305
        | x y |
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   306
        x := (aPoint x * self a11) + (aPoint y * self a12).
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   307
        y := (aPoint x * self a21) + (aPoint y * self a22).
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   308
        ^x @ y
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   309
!
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   310
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
transformPoint: aPoint
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   312
        "Transform aPoint from local coordinates into global coordinates"
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   313
        | x y |
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   314
        x := (aPoint x * self a11) + (aPoint y * self a12) + self a13.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   315
        y := (aPoint x * self a21) + (aPoint y * self a22) + self a23.
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   316
        ^x @ y
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   317
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
!MatrixTransform2x3 methodsFor:'transforming rects'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
globalBounds: srcRect toLocal: dstRect
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   322
        "Transform aRectangle from global coordinates into local coordinates"
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   323
"/        <primitive:'m23PrimitiveInvertRectInto'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   324
        ^super globalBoundsToLocal: srcRect
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   325
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
globalBoundsToLocal: aRectangle
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
	"Transform aRectangle from global coordinates into local coordinates"
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   329
	^self globalBounds: aRectangle toLocal: Rectangle new
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   330
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
localBounds: srcRect toGlobal: dstRect
1380
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   333
        "Transform aRectangle from local coordinates into global coordinates"
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   334
"/        <primitive:'m23PrimitiveTransformRectInto'>
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   335
        ^super localBoundsToGlobal: srcRect
a999c793cd59 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
   336
!
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
localBoundsToGlobal: aRectangle
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
	"Transform aRectangle from local coordinates into global coordinates"
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   340
	^self localBounds: aRectangle toGlobal: Rectangle new
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   341
! !
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
!MatrixTransform2x3 class methodsFor:'documentation'!
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
version
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   346
    ^ '$Header: /cvs/stx/stx/libview2/MatrixTransform2x3.st,v 1.3 2013-03-30 00:54:53 cg Exp $'
1250
76824ea90b46 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
! !
3111
d4e7cc019d23 class: MatrixTransform2x3
Claus Gittinger <cg@exept.de>
parents: 1380
diff changeset
   348