unjoin

$line unjoin $other
cuts off joined lines by replacing common dots by new ones.

obj method line unjoin other {
  set dot [$self firstDot]
  set others [$dot lines]
  if {$other in $others} then {
    $dot remove $self
    my dots [lreplace [my dots] 0 0\
        [new dot -x [$dot cget -x] -y [$dot cget -y]]]
    $self firstDot add $self
  }
  set dot [$self lastDot]
  set others [$dot lines]
  if {$other in $others} then {
    $dot remove $self
    my dots [lreplace [my dots] end end\
        [new dot -x [$dot cget -x] -y [$dot cget -y]]]
    $self lastDot add $self
  }
}

© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z