Check-in [09d123a672]
Not logged in

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

Overview
Comment:option to specify angle in degrees from ticket [36481a3e08]
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 09d123a672d7f539848dc884aefd16f8bf6bf030
User & Date: chw 2019-07-07 04:42:25
References
2019-07-07
04:43 Review ticket [36481a3e08]: Make tkp::matrix::rotate accept angles in degrees too plus 4 other changes artifact: ddbddc0c3c user: chw
Context
2019-07-07
04:51
use curl option -sslverifypeer 0 in TSB's Northwind example check-in: 39ee1aca6e user: chw tags: trunk
04:42
option to specify angle in degrees from ticket [36481a3e08] check-in: 09d123a672 user: chw tags: trunk
04:17
add selected nsf upstream changes check-in: 3ac37b54a8 user: chw tags: trunk
Changes

jni/nsf/doc/example-scripts/rosetta-singleton.tcl became executable.

jni/nsf/library/xotcl/apps/comm/link-checker.xotcl became executable.

jni/nsf/library/xotcl/apps/comm/webserver.xotcl became executable.

Changes to jni/tkpath/library/tkpath.tcl.

24
25
26
27
28
29
30
31
32
33
34
35
36



37
38
39
40
41
42
43
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78



79
80
81
82
83
84
85
..
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
...
158
159
160
161
162
163
164
165
166
167
168
169



170
171
172
173
174
175
176
177
178
179
180
181
182
183



184
185
186
187
188
189
190
	namespace export *
	namespace ensemble create
    }
}

# ::tkp::matrix::rotate --
# Arguments:
#	angle	Angle in grad
#	cx	X-center coordinate
#	cy	Y-center coordinate
# Results:
#       The transformation matrix.
proc ::tkp::matrix::rotate {angle {cx 0} {cy 0}} {



    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] \
	[list [expr {$cx - $myCos*$cx + $mySin*$cy}] \
................................................................................
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 grad
#	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}} {



    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}]] \
................................................................................
        [expr {$mySin*$cx*(1.-$fx) + $myCos*$cy*($fy-1.) + $cy - $mySin*$cx - $myCos*$cy}] \
	]]

}

# ::tkp::matrix::skewx --
# Arguments:
#	angle	Angle in grad
# Results:
#       The transformation matrix.
proc ::tkp::matrix::skewx {angle} {



    return [list {1 0} [list [expr {tan($angle)}] 1] {0 0}]
}

# ::tkp::matrix::skewy --
# Arguments:
#	angle	Angle in grad
# Results:
#       The transformation matrix.
proc ::tkp::matrix::skewy {angle} {



    return [list [list 1 [expr {tan($angle)}]] {0 1} {0 0}]
}

# ::tkp::matrix::move --
# Arguments:
#	dx	Difference in x direction
#	dy	Difference in y direction
................................................................................
    expr {$a * 57.29577951308232}
}

# ::tkp::path::cg::xyad2p
# Arguments:
#	cx	center x coordinate
#	cy	center y coordinate
#	a	angle in radians
#	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} {



    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
# Results:
#	Return points forming angle a on a circle with radius r.
proc ::tkp::path::cg::xyra2p {cx cy r a args} {



    lmap a [concat $a $args] {
	list [expr {$cx + $r * cos($a)}] [expr {$cy - $r * sin($a)}]
    }
}

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







|





>
>
>







 







|







>
>
>







 







|



>
>
>





|



>
>
>







 







|




>
>
>










|



>
>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
..
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
..
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
127
...
170
171
172
173
174
175
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
208
	namespace export *
	namespace ensemble create
    }
}

# ::tkp::matrix::rotate --
# Arguments:
#	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] \
	[list [expr {$cx - $myCos*$cx + $mySin*$cy}] \
................................................................................
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}]] \
................................................................................
        [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
#	dy	Difference in y direction
................................................................................
    expr {$a * 57.29577951308232}
}

# ::tkp::path::cg::xyad2p
# Arguments:
#	cx	center x coordinate
#	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 --
# Arguments: