<commit_before>import {
  Vector3
} from "three";

import THREELine from "./THREELine.js";

import FrenetSerretFrame from "../math/FrenetSerretFrame.js";

export default class THREERibbon extends THREELine {
  constructor({
    points,
    thickness,
    detail,
    geometry,
    material
  } = {}) {
    super({
      points,
      thickness,
      detail,
      geometry,
      material
    });

    this.head = new Vector3();
  }

  update() {
    if(!this._initialized) {
      super.update();
      this._initialized = true;
      return;
    }

    this.userData._linePositions.copyWithin(0, 3);
    this.userData._lineNormals.copyWithin(0, 3);

    const headId = this.points.length - 1;
    this.userData._linePositions[headId * 3] = this.head.x;
    this.userData._linePositions[headId * 3 + 1] = this.head.y;
    this.userData._linePositions[headId * 3 + 2] = this.head.z;

    FrenetSerretFrame.compute({
      positions: this.userData._linePositions,
      normals: this.userData._lineNormals,
      range: [headId - 3, headId]
    });
  }
}<commit_msg>initialize head to head point in THREERibbon<commit_after>import {
  Vector3
} from "three";

import THREELine from "./THREELine.js";

import FrenetSerretFrame from "../math/FrenetSerretFrame.js";

export default class THREERibbon extends THREELine {
  constructor({
    points,
    thickness,
    detail,
    geometry,
    material
  } = {}) {
    super({
      points,
      thickness,
      detail,
      geometry,
      material
    });

    this.head = points[this.points.length - 1].clone();
  }

  update() {
    if(!this._initialized) {
      super.update();
      this._initialized = true;
      return;
    }

    this.userData._linePositions.copyWithin(0, 3);
    this.userData._lineNormals.copyWithin(0, 3);

    const headId = this.points.length - 1;
    this.userData._linePositions[headId * 3] = this.head.x;
    this.userData._linePositions[headId * 3 + 1] = this.head.y;
    this.userData._linePositions[headId * 3 + 2] = this.head.z;

    FrenetSerretFrame.compute({
      positions: this.userData._linePositions,
      normals: this.userData._lineNormals,
      range: [headId - 3, headId]
    });
  }
}
{'fraction_non_alphanumeric': 0.12705667276051189, 'fraction_numerical': 0.011882998171846435, 'mean_word_length': 2.685185185185185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7517728', 'n_tokens_mistral': 770, 'n_tokens_neox': 745, 'n_words': 140}