ChildIsCollapsed returns true if the split proportion for given child index is 0. Also checks the overall tile splits for the child.
(idx int)
| 321 | // for given child index is 0. Also checks the overall tile |
| 322 | // splits for the child. |
| 323 | func (sl *Splits) ChildIsCollapsed(idx int) bool { |
| 324 | if sl.Split(idx) < 0.01 { |
| 325 | return true |
| 326 | } |
| 327 | ci := 0 |
| 328 | for i, t := range sl.Tiles { |
| 329 | tn := tileNumElements[t] |
| 330 | if idx < ci || idx >= ci+tn { |
| 331 | ci += tn |
| 332 | continue |
| 333 | } |
| 334 | ri := idx - ci |
| 335 | if sl.TileSplits[i] < 0.01 { |
| 336 | return true |
| 337 | } |
| 338 | // extra consideration for long split onto subs: |
| 339 | switch t { |
| 340 | case TileFirstLong: |
| 341 | if ri > 0 && sl.SubSplits[i][1] < 0.01 { |
| 342 | return true |
| 343 | } |
| 344 | case TileSecondLong: |
| 345 | if ri < 2 && sl.SubSplits[i][0] < 0.01 { |
| 346 | return true |
| 347 | } |
| 348 | } |
| 349 | return false |
| 350 | } |
| 351 | return false |
| 352 | } |
| 353 | |
| 354 | // tilesTotal returns the total number of child elements associated |
| 355 | // with the current set of Tiles elements, and whether there are any |