Check-in [d5b30d3ec3]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:better fixes for ticket [36481a3e08]
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d5b30d3ec3e095cdc4cdd9a0a1829dd71a4a5065
User & Date: chw 2019-07-10 04:34:06.003
Context
2019-07-10
13:05
reapplied patch for ticket [36481a3e08] check-in: e95304b5ba user: chw tags: trunk
04:34
better fixes for ticket [36481a3e08] check-in: d5b30d3ec3 user: chw tags: trunk
2019-07-08
09:12
improve double-click handler in TSB check-in: 4fec6e8cc6 user: chw tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to jni/tkpath/library/tkpath.tcl.
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#	angle	Angle in radians or degrees (with "d" suffix)
#	cx	X-center coordinate
#	cy	Y-center coordinate
# Results:
#       The transformation matrix.
proc ::tkp::matrix::rotate {angle {cx 0} {cy 0}} {
    if {[string match "*d" $angle]} {
	set angle [expr {[string range $angle 0 end-1] / 45.0 * atan(1)}]
    }
    set myCos [expr {cos($angle)}]
    set mySin [expr {sin($angle)}]
    if {$cx == 0 && $cy == 0} {
	return [list [list $myCos $mySin] [list [expr {-1.*$mySin}] $myCos] {0 0}]
    }
    return [list [list $myCos $mySin] [list [expr {-1.*$mySin}] $myCos] \







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#	angle	Angle in radians or degrees (with "d" suffix)
#	cx	X-center coordinate
#	cy	Y-center coordinate
# Results:
#       The transformation matrix.
proc ::tkp::matrix::rotate {angle {cx 0} {cy 0}} {
    if {[string match "*d" $angle]} {
	set angle [expr {[string range $angle 0 end-1] / 0.017453292519943295}]
    }
    set myCos [expr {cos($angle)}]
    set mySin [expr {sin($angle)}]
    if {$cx == 0 && $cy == 0} {
	return [list [list $myCos $mySin] [list [expr {-1.*$mySin}] $myCos] {0 0}]
    }
    return [list [list $myCos $mySin] [list [expr {-1.*$mySin}] $myCos] \
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Arguments:
#	fx	1 no flip, -1 horizontal flip
#	fy	1 no flip, -1 vertical flip
# Results:
#       The transformation matrix.
proc ::tkp::matrix::flip {{cx 0} {cy 0} {fx 1} {fy 1}} {
    return [list [list $fx 0] [list 0 $fy] \
	[list [expr {$cx*(1-$fx)}] [expr {$cy*($fy-1)}]]]
}

# ::tkp::matrix::rotateflip --
# Arguments:
#	angle	Angle in radians or degrees (with "d" suffix)
#	cx	X-center coordinate
#	cy	Y-center coordinate
#	fx	1 no flip, -1 horizontal flip
#	fy	1 no flip, -1 vertical flip
# Results:
#       The transformation matrix.
proc ::tkp::matrix::rotateflip {{angle 0} {cx 0} {cy 0} {fx 1} {fy 1}} {
    if {[string match "*d" $angle]} {
	set angle [expr {[string range $angle 0 end-1] / 45.0 * atan(1)}]
    }
    set myCos [expr {cos($angle)}]
    set mySin [expr {sin($angle)}]
    if {$cx == 0 && $cy == 0} {
	return [list [list [expr {$fx*$myCos}] [expr {$fx*$mySin}]] \
	    [list [expr {-1.*$mySin*$fy}] [expr {$myCos*$fy}]] {0 0}]
    }
    return [list [list [expr {$fx*$myCos}] [expr {$fx*$mySin}]] \
	[list [expr {-1.*$mySin*$fy}] [expr {$myCos*$fy}]] \
        [list \
       	[expr {$myCos*$cx*(1.-$fx) - $mySin*$cy*($fy-1.) + $cx - $myCos*$cx + $mySin*$cy}] \
        [expr {$mySin*$cx*(1.-$fx) + $myCos*$cy*($fy-1.) + $cy - $mySin*$cx - $myCos*$cy}] \
	]]

}

# ::tkp::matrix::skewx --
# Arguments:
#	angle	Angle in radians or degrees (with "d" suffix)
# Results:
#       The transformation matrix.
proc ::tkp::matrix::skewx {angle} {
    if {[string match "*d" $angle]} {
	set angle [expr {[string range $angle 0 end-1] / 45.0 * atan(1)}]
    }
    return [list {1 0} [list [expr {tan($angle)}] 1] {0 0}]
}

# ::tkp::matrix::skewy --
# Arguments:
#	angle	Angle in radians or degrees (with "d" suffix)
# Results:
#       The transformation matrix.
proc ::tkp::matrix::skewy {angle} {
    if {[string match "*d" $angle]} {
	set angle [expr {[string range $angle 0 end-1] / 45.0 * atan(1)}]
    }
    return [list [list 1 [expr {tan($angle)}]] {0 1} {0 0}]
}

# ::tkp::matrix::move --
# Arguments:
#	dx	Difference in x direction







|













|










|
|











|











|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Arguments:
#	fx	1 no flip, -1 horizontal flip
#	fy	1 no flip, -1 vertical flip
# Results:
#       The transformation matrix.
proc ::tkp::matrix::flip {{cx 0} {cy 0} {fx 1} {fy 1}} {
    return [list [list $fx 0] [list 0 $fy] \
	[list [expr {$cx*(1.-$fx)}] [expr {$cy*(1.-$fy)}]]]
}

# ::tkp::matrix::rotateflip --
# Arguments:
#	angle	Angle in radians or degrees (with "d" suffix)
#	cx	X-center coordinate
#	cy	Y-center coordinate
#	fx	1 no flip, -1 horizontal flip
#	fy	1 no flip, -1 vertical flip
# Results:
#       The transformation matrix.
proc ::tkp::matrix::rotateflip {{angle 0} {cx 0} {cy 0} {fx 1} {fy 1}} {
    if {[string match "*d" $angle]} {
	set angle [expr {[string range $angle 0 end-1] / 0.017453292519943295}]
    }
    set myCos [expr {cos($angle)}]
    set mySin [expr {sin($angle)}]
    if {$cx == 0 && $cy == 0} {
	return [list [list [expr {$fx*$myCos}] [expr {$fx*$mySin}]] \
	    [list [expr {-1.*$mySin*$fy}] [expr {$myCos*$fy}]] {0 0}]
    }
    return [list [list [expr {$fx*$myCos}] [expr {$fx*$mySin}]] \
	[list [expr {-1.*$mySin*$fy}] [expr {$myCos*$fy}]] \
        [list \
       	[expr {$myCos*$cx*(1.-$fx) - $mySin*$cy*(1.-$fy) + $cx - $myCos*$cx + $mySin*$cy}] \
        [expr {$mySin*$cx*(1.-$fx) + $myCos*$cy*(1.-$fy) + $cy - $mySin*$cx - $myCos*$cy}] \
	]]

}

# ::tkp::matrix::skewx --
# Arguments:
#	angle	Angle in radians or degrees (with "d" suffix)
# Results:
#       The transformation matrix.
proc ::tkp::matrix::skewx {angle} {
    if {[string match "*d" $angle]} {
	set angle [expr {[string range $angle 0 end-1] / 0.017453292519943295}]
    }
    return [list {1 0} [list [expr {tan($angle)}] 1] {0 0}]
}

# ::tkp::matrix::skewy --
# Arguments:
#	angle	Angle in radians or degrees (with "d" suffix)
# Results:
#       The transformation matrix.
proc ::tkp::matrix::skewy {angle} {
    if {[string match "*d" $angle]} {
	set angle [expr {[string range $angle 0 end-1] / 0.017453292519943295}]
    }
    return [list [list 1 [expr {tan($angle)}]] {0 1} {0 0}]
}

# ::tkp::matrix::move --
# Arguments:
#	dx	Difference in x direction
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#	cy	center y coordinate
#	a	angle in radians or degrees (with "d" suffix)
#	d ...	distances
# Results:
#	Return points at given distances on a ray from center x,y to angle a.
proc ::tkp::path::cg::xyad2p {cx cy a d args} {
    if {[string match "*d" $a]} {
	set a [expr {[string range $a 0 end-1] / 45.0 * atan(1)}]
    }
    lmap d [concat $d $args] {
	list [expr {$cx + $d * cos($a)}] [expr {$cy - $d * sin($a)}]
    }
}

# ::tkp::path::cg::xyra2p
# Arguments:
#	cx	center x coordinate
#	cy	center y coordinate
#	r	radius
#	a	angle in radians or degrees (with "d" suffix)
# Results:
#	Return points forming angle a on a circle with radius r.
proc ::tkp::path::cg::xyra2p {cx cy r a args} {
    if {[string match "*d" $a]} {
	set a [expr {[string range $a 0 end-1] / 45.0 * atan(1)}]
    }
    lmap a [concat $a $args] {
	list [expr {$cx + $r * cos($a)}] [expr {$cy - $r * sin($a)}]
    }
}

# ::tkp::path::ellipse --







|
















|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#	cy	center y coordinate
#	a	angle in radians or degrees (with "d" suffix)
#	d ...	distances
# Results:
#	Return points at given distances on a ray from center x,y to angle a.
proc ::tkp::path::cg::xyad2p {cx cy a d args} {
    if {[string match "*d" $a]} {
	set a [expr {[string range $a 0 end-1] / 0.017453292519943295}]
    }
    lmap d [concat $d $args] {
	list [expr {$cx + $d * cos($a)}] [expr {$cy - $d * sin($a)}]
    }
}

# ::tkp::path::cg::xyra2p
# Arguments:
#	cx	center x coordinate
#	cy	center y coordinate
#	r	radius
#	a	angle in radians or degrees (with "d" suffix)
# Results:
#	Return points forming angle a on a circle with radius r.
proc ::tkp::path::cg::xyra2p {cx cy r a args} {
    if {[string match "*d" $a]} {
	set a [expr {[string range $a 0 end-1] / 0.017453292519943295}]
    }
    lmap a [concat $a $args] {
	list [expr {$cx + $r * cos($a)}] [expr {$cy - $r * sin($a)}]
    }
}

# ::tkp::path::ellipse --