threepp/extras/QuickHull.h
VertexNode *nextVertexToAdd()
  {
    // if the 'assigned' list of vertices is empty, no vertices are left. return with 'undefined'
    if ( !assigned.empty() ) {

      VertexNode *eyeVertex = nullptr;
      float maxDistance = 0;

      // grab the first available face and start with the first visible vertex of that face
      Face *eyeFace = assigned.head->face(faces);
      VertexNode *vertex = eyeFace->outside;

      // now calculate the farthest vertex that face can see
      do {

        float distance = eyeFace->distanceToPoint( vertex->point );

        if ( distance > maxDistance ) {

          maxDistance = distance;
          eyeVertex = vertex;
        }

        vertex = vertex->next;

      } while ( vertex && vertex->face(faces) == eyeFace );

      return eyeVertex;
    }
    return nullptr;
  }
/*
   * Finds the next vertex to create faces with the current hull
   */
Finds the next vertex to create faces with the current hull
Finds the next vertex to create faces with the current hull
VertexNode *nextVertexToAdd()
  {
    if ( !assigned.empty() ) {
      VertexNode *eyeVertex = nullptr;
      float maxDistance = 0;
      Face *eyeFace = assigned.head->face(faces);
      VertexNode *vertex = eyeFace->outside;
      do {
        float distance = eyeFace->distanceToPoint( vertex->point );
        if ( distance > maxDistance ) {
          maxDistance = distance;
          eyeVertex = vertex;
        }
        vertex = vertex->next;
      } while ( vertex && vertex->face(faces) == eyeFace );
      return eyeVertex;
    }
    return nullptr;
  }
VertexNode * nextVertexToAdd ( ) { if ( ! assigned . empty ( ) ) { VertexNode * eyeVertex = nullptr ; float maxDistance = 0 ; Face * eyeFace = assigned . head -> face ( faces ) ; VertexNode * vertex = eyeFace -> outside ; do { float distance = eyeFace -> distanceToPoint ( vertex -> point ) ; if ( distance > maxDistance ) { maxDistance = distance ; eyeVertex = vertex ; } vertex = vertex -> next ; } while ( vertex && vertex -> face ( faces ) == eyeFace ) ; return eyeVertex ; } return nullptr ; }
Finds the next vertex to create faces with the current hull
Finds the next vertex to create faces with the current hull
// if the 'assigned' list of vertices is empty, no vertices are left. return with 'undefined' // grab the first available face and start with the first visible vertex of that face // now calculate the farthest vertex that face can see