<commit_before>app             = require("app")
Backbone        = require("backbone")
ResizableBuffer = require("libs/resizable_buffer")
THREE           = require("three")
Dimensions      = require("../model/dimensions")
constants       = require("../constants")

class ContourGeometry

  COLOR_NORMAL : new THREE.Color(0x000000)
  COLOR_DELETE : new THREE.Color(0xff0000)

  constructor : (@volumeTracing, @flycam) ->

    _.extend(this, Backbone.Events)

    @color = @COLOR_NORMAL

    @listenTo(@volumeTracing, "volumeAnnotated", @reset)
    @listenTo(@volumeTracing, "updateLayer", (contourList) ->
      @color = if cellId == 0 then @COLOR_DELETE else @COLOR_NORMAL
      @reset()
      for p in contourList
        @addEdgePoint(p)
    )

    @createMeshes()


  createMeshes : ->

    edgeGeometry = new THREE.BufferGeometry()
    edgeGeometry.addAttribute( 'position', Float32Array, 0, 3 )
    edgeGeometry.dynamic = true

    @edge = new THREE.Line(edgeGeometry, new THREE.LineBasicMaterial({linewidth: 2}), THREE.LineStrip)
    @edge.vertexBuffer = new ResizableBuffer(3)

    @reset()


  reset : ->

    @edge.material.color = @color
    @edge.vertexBuffer.clear()<commit_msg>#1000 Fix undefined variable error<commit_after>app             = require("app")
Backbone        = require("backbone")
ResizableBuffer = require("libs/resizable_buffer")
THREE           = require("three")
Dimensions      = require("../model/dimensions")
constants       = require("../constants")

class ContourGeometry

  COLOR_NORMAL : new THREE.Color(0x000000)
  COLOR_DELETE : new THREE.Color(0xff0000)

  constructor : (@volumeTracing, @flycam) ->

    _.extend(this, Backbone.Events)

    @color = @COLOR_NORMAL

    @listenTo(@volumeTracing, "volumeAnnotated", @reset)
    @listenTo(@volumeTracing, "updateLayer", (cellId, contourList) ->
      @color = if cellId == 0 then @COLOR_DELETE else @COLOR_NORMAL
      @reset()
      for p in contourList
        @addEdgePoint(p)
    )

    @createMeshes()


  createMeshes : ->

    edgeGeometry = new THREE.BufferGeometry()
    edgeGeometry.addAttribute( 'position', Float32Array, 0, 3 )
    edgeGeometry.dynamic = true

    @edge = new THREE.Line(edgeGeometry, new THREE.LineBasicMaterial({linewidth: 2}), THREE.LineStrip)
    @edge.vertexBuffer = new ResizableBuffer(3)

    @reset()


  reset : ->

    @edge.material.color = @color
    @edge.vertexBuffer.clear()
{'fraction_non_alphanumeric': 0.12796011632737847, 'fraction_numerical': 0.017449106771915246, 'mean_word_length': 3.3781818181818184, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7248847', 'n_tokens_mistral': 792, 'n_tokens_neox': 725, 'n_words': 152}