summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCharles Chamberlain <charles@nrwhl.xyz>2023-08-16 18:45:33 +0000
committerCharles Chamberlain <charles@nrwhl.xyz>2023-08-16 18:45:33 +0000
commit43cd75eff9be56a6ca4e6286b9031ed4670be391 (patch)
treefa16e45bbdc4e7e390c09375333d3c328b540adb /lib
parentMerge pull request #65 from FolkComputer/osnr/incremental-tag-detection (diff)
downloadfolk-43cd75eff9be56a6ca4e6286b9031ed4670be391.tar.gz
folk-43cd75eff9be56a6ca4e6286b9031ed4670be391.zip
Add bottomright, topleft, region functions etc
Diffstat (limited to 'lib')
-rw-r--r--lib/math.tcl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/math.tcl b/lib/math.tcl
index 9fc6839a..f688a465 100644
--- a/lib/math.tcl
+++ b/lib/math.tcl
@@ -139,6 +139,18 @@ namespace eval ::region {
set bottomEdgeIndex [lindex [lsort -indices -real -index 1 $edgeMidpoints] end]
vec2 midpoint {*}[edgeToLineSegment $r [lindex [edges $r] $bottomEdgeIndex]]
}
+ proc bottomleft {r} {
+ lindex [vertices $r] 0
+ }
+ proc bottomright {r} {
+ lindex [vertices $r] 1
+ }
+ proc topright {r} {
+ lindex [vertices $r] 2
+ }
+ proc topleft {r} {
+ lindex [vertices $r] 3
+ }
proc mapVertices {varname r body} {
lreplace $r 0 0 [uplevel [list lmap $varname [vertices $r] $body]]