Frusta

Check-in [14d9d2b7cf]
Login

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

Overview
Comment:slice: collected more segments in other facet/slice configurations
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:14d9d2b7cf91c754b9f4719a567cf31b451caa45
User & Date: rmelton 2013-05-31 23:16:25
Context
2013-06-01
03:00
added more slice/facet orientations check-in: b4930df8c4 user: rmelton tags: trunk
2013-05-31
23:16
slice: collected more segments in other facet/slice configurations check-in: 14d9d2b7cf user: rmelton tags: trunk
16:56
slice: collecting segements from facets that completely cross slice check-in: 1860c3770b user: rmelton tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/slice.tcl.

215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251










252

253
254
255
256
257














258

259
260















261
262
263
264
265
266
267
...
304
305
306
307
308
309
310
311
312
313
314

315
316
317
318
319
320
321
    #-------------------------
    if {$zC > $z1} {        lappend aboveP $vC
    } elseif {$zC >= $z0} { lappend midP   $vC
    } else {                lappend belowP $vC
    }
    #-------------------------
    switch -- [llength $aboveP],[llength $midP],[llength $belowP] {
      "cross-slice"    {}
      1,0,2 {
        lassign [lindex $aboveP 0] aX aY aZ
        lassign [lindex $belowP 0] bX bY bZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X1     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y1     [expr {$Zratio*($aY-$bY)+$bY}]
        lassign [lindex $belowP 1] bX bY bZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X2     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y2     [expr {$Zratio*($aY-$bY)+$bY}]
        ## line segment X1,Y1,z X2,Y2,z
        lappend sliceSegments($slice) [list $X1 $Y1 $z   $X2 $Y2 $z]
      }
      2,0,1 {
        lassign [lindex $aboveP 0] aX aY aZ
        lassign [lindex $belowP 0] bX bY bZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X1     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y1     [expr {$Zratio*($aY-$bY)+$bY}]
        lassign [lindex $aboveP 1] aX aY aZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X2     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y2     [expr {$Zratio*($aY-$bY)+$bY}]
        ## line segment X1,Y1,z X2,Y2,z
        lappend sliceSegments($slice) [list $X1 $Y1 $z   $X2 $Y2 $z]
      }

      "cross-slice with one in the middle" {}
      1,1,1 {}












      "all within slice" {}
      0,3,0 {}
      
      "one in slice, two above" {}
      2,1,0 {}














      

      "one in slice, two below" {}
      0,1,2 {}















      
      "two in slice, one above" {}
      1,2,0 {}
      
      "two in slice, one below" {}
      0,2,1 {}
      
................................................................................
          -tags $tags\
          -style solid\
          -color \#606060
    }
    ##
    variable sliceSegments
    foreach i [array names sliceSegments] {
      foreach segment $sliceSegments($i) {
        $w.canvas3d create line $segment \
            -color yellow -width 2\
            -tags [list sliceSegments slice_segments_$i]

      }
    }

    View::Update $w.canvas3d SetLayerRanges {*}$layerRange
  }









|











|












|


|
|
>
>
>
>
>
>
>
>
>
>
|
>
|


|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|


|
>







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
...
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
    #-------------------------
    if {$zC > $z1} {        lappend aboveP $vC
    } elseif {$zC >= $z0} { lappend midP   $vC
    } else {                lappend belowP $vC
    }
    #-------------------------
    switch -- [llength $aboveP],[llength $midP],[llength $belowP] {
      "cross-slice" -
      1,0,2 {
        lassign [lindex $aboveP 0] aX aY aZ
        lassign [lindex $belowP 0] bX bY bZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X1     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y1     [expr {$Zratio*($aY-$bY)+$bY}]
        lassign [lindex $belowP 1] bX bY bZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X2     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y2     [expr {$Zratio*($aY-$bY)+$bY}]
        ## line segment X1,Y1,z X2,Y2,z
        lappend sliceSegments($slice) [list $X1 $Y1 $z   $X2 $Y2 $z] {}
      }
      2,0,1 {
        lassign [lindex $aboveP 0] aX aY aZ
        lassign [lindex $belowP 0] bX bY bZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X1     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y1     [expr {$Zratio*($aY-$bY)+$bY}]
        lassign [lindex $aboveP 1] aX aY aZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X2     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y2     [expr {$Zratio*($aY-$bY)+$bY}]
        ## line segment X1,Y1,z X2,Y2,z
        lappend sliceSegments($slice) [list $X1 $Y1 $z   $X2 $Y2 $z] {}
      }

      "cross-slice with one in the middle" -
      1,1,1 {
        ## connect the above/below intersection with the mid-point
        lassign [lindex $aboveP 0] aX aY aZ
        lassign [lindex $belowP 0] bX bY bZ
        set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
        set X1     [expr {$Zratio*($aX-$bX)+$bX}]
        set Y1     [expr {$Zratio*($aY-$bY)+$bY}]
        lassign [lindex $midP 0] aX aY aZ
        ## line segment X1,Y1,z  aX,aY,z
        lappend sliceSegments($slice) [list $X1 $Y1 $z  $aX $aY $z] {}
        #lappend sliceSegments($slice) [list $X1 $Y1 $z  $aX $aY $z] {-color cyan}
      }

      "all within slice" -
      0,3,0 {}
      
      "one in slice, two above" -
      2,1,0 {
        ## connect the 2 above z-midpoints
        lassign [lindex $aboveP 0] aX aY aZ
        lassign [lindex $midP   0] bX bY bZ
        if {$bZ < $z} {
          set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
          set X1     [expr {$Zratio*($aX-$bX)+$bX}]
          set Y1     [expr {$Zratio*($aY-$bY)+$bY}]
          lassign [lindex $aboveP 1] aX aY aZ
          set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
          set X2     [expr {$Zratio*($aX-$bX)+$bX}]
          set Y2     [expr {$Zratio*($aY-$bY)+$bY}]
          ## line segment X1,Y1,z X2,Y2,z
          lappend sliceSegments($slice) [list $X1 $Y1 $z   $X2 $Y2 $z] {-color lightblue}
        } ;# else ignore anything above the halfway point
      }

      "one in slice, two below" -
      0,1,2 {
        ## connect the 2 below z-midpoints
        lassign [lindex $midP   0] aX aY aZ
        lassign [lindex $belowP 0] bX bY bZ
        if {$aZ > $z} {
          set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
          set X1     [expr {$Zratio*($aX-$bX)+$bX}]
          set Y1     [expr {$Zratio*($aY-$bY)+$bY}]
          lassign [lindex $belowP 1] bX bY bZ
          set Zratio [expr {($z-$bZ)/($aZ-$bZ)}]
          set X2     [expr {$Zratio*($aX-$bX)+$bX}]
          set Y2     [expr {$Zratio*($aY-$bY)+$bY}]
          ## line segment X1,Y1,z X2,Y2,z
          lappend sliceSegments($slice) [list $X1 $Y1 $z   $X2 $Y2 $z] {-color lightblue}
        } ;# else ignore anything above the halfway point
      }
      
      "two in slice, one above" {}
      1,2,0 {}
      
      "two in slice, one below" {}
      0,2,1 {}
      
................................................................................
          -tags $tags\
          -style solid\
          -color \#606060
    }
    ##
    variable sliceSegments
    foreach i [array names sliceSegments] {
      foreach {segment opts} $sliceSegments($i) {
        $w.canvas3d create line $segment \
            -color yellow -width 2\
            -tags [list sliceSegments slice_segments_$i]\
            {*}$opts
      }
    }

    View::Update $w.canvas3d SetLayerRanges {*}$layerRange
  }


Changes to lib/view.tcl.

195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
...
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
          if {[info exists cfg(layerMin,$w)]} {
            $w itemconfig fill||move -hidden 1
            eval { ;## slicedModel
              $w itemconfig sliceBoundaries -hidden 1
              if {$cfg(wireframe,$w)} {
                $w itemconfig slicedModel -hidden 1
              } else {
                $w itemconfig slicedModel -style outline -hidden 0 -color orange
              }
            }
            $w itemconfig sliceSegments -hidden 1
            for {set i $cfg(layerMin,$w)} {$i <= $cfg(layerMax,$w)} {incr i} {
              if {$cfg(hidemoves,$w)} {
                $w itemconfig Layer_$i -hidden 0
              } else {
................................................................................
                $w itemconfig "Layer_$i && ! move" -hidden 0
              }
              ## slicedModel
              if {$cfg(showSlicePlanes,$w)} {
                $w itemconfig slice_boundary_$i -hidden 0
              }
              if {$cfg(wireframe,$w)} {
                $w itemconfig facet-layer-$i -hidden 0
              } else {
                $w itemconfig facet-layer-$i -style solid -color red
              }
              ## slice segments
              $w itemconfig slice_segments_$i -hidden 0
            }
          }







|







 







|







195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
...
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
          if {[info exists cfg(layerMin,$w)]} {
            $w itemconfig fill||move -hidden 1
            eval { ;## slicedModel
              $w itemconfig sliceBoundaries -hidden 1
              if {$cfg(wireframe,$w)} {
                $w itemconfig slicedModel -hidden 1
              } else {
                $w itemconfig slicedModel -style outline -hidden 0 -color \#800000
              }
            }
            $w itemconfig sliceSegments -hidden 1
            for {set i $cfg(layerMin,$w)} {$i <= $cfg(layerMax,$w)} {incr i} {
              if {$cfg(hidemoves,$w)} {
                $w itemconfig Layer_$i -hidden 0
              } else {
................................................................................
                $w itemconfig "Layer_$i && ! move" -hidden 0
              }
              ## slicedModel
              if {$cfg(showSlicePlanes,$w)} {
                $w itemconfig slice_boundary_$i -hidden 0
              }
              if {$cfg(wireframe,$w)} {
                $w itemconfig facet-layer-$i -hidden 0 -color red
              } else {
                $w itemconfig facet-layer-$i -style solid -color red
              }
              ## slice segments
              $w itemconfig slice_segments_$i -hidden 0
            }
          }