Half Edge in THREE

HTML

<html>

  <body>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/three.js/95/three.min.js'></script>
    <script src='https://rawgit.com/YaleDHLab/pix-plot/master/assets/js/trackball-controls.js'></script>
    <div id='selected'></div>
  </body>

</html>

CSS

html,
  body {
    width: 100%;
    height: 100%;
    background: #000;
  }

  body {
    margin: 0;
    overflow: hidden;
  }

  canvas {
    width: 100%;
    height: 100%;
  }

  #selected {
    position: absolute;
    top: 10;
    left: 10;
  }

JavaScript

class Face {
  constructor() {
    this.normal = new THREE.Vector3();
		this.midpoint = new THREE.Vector3();
		this.area = 0;
		this.constant = 0; // signed distance from face to the origin
		this.outside = null; // reference to a vertex in a vertex list this face can see
		this.mark = 0;
		this.edge = null;
  }

  create( a, b, c ) {
    // join vertex nodes
    a.next = c.prev = b;
    b.next = a.prev = c;
    c.next = b.prev = a;

    var e0 = new HalfEdge( a, this );
    var e1 = new HalfEdge( b, this );
    var e2 = new HalfEdge( c, this );
    // join edges
    e0.next = e2.prev = e1;
    e1.next = e0.prev = e2;
    e2.next = e1.prev = e0;
    // main half edge reference
    this.edge = e0;
    return this.compute();
  }

  getEdge( i ) {
    var edge = this.edge;
    while ( i > 0 ) {
      edge = edge.next;
      i --;
    }
    while ( i < 0 ) {
      edge = edge.prev;
      i ++;
    }
    return edge;
  }

  compute() {
    var triangle;
    if ( triangle === undefined ) triangle = new THREE.Triangle();
    var a = this.edge.tail();
    var b = this.edge.head();
    var c = this.edge.next.head();
    triangle.set( a.point, b.point, c.point );
    triangle.getNormal( this.normal );
    triangle.getMidpoint( this.midpoint );
    this.area = triangle.getArea();
    this.constant = this.normal.dot( this.midpoint );
    return this;
  }
  
  distanceToPoint( point ) {
    return this.normal.dot( point ) - this.constant;
  }
}


// Entity for a Doubly-Connected Edge List (DCEL).
class HalfEdge { 
  constructor(vertex, face) {
    this.vertex = vertex;
		this.prev = null;
		this.next = null;
		this.twin = null;
		this.face = face;
  }

  head() {
    return this.vertex;
  }

  tail() {
    return this.prev ? this.prev.vertex : null;
  }

  length() {
    var head = this.head();
    var tail = this.tail();
    if ( tail !== null ) {
      return tail.point.distanceTo( head.point );
    }
    return - 1;
  }

  lengthSquared() {
    var head = this.head();
   ...