releasesPerSecond: rptToRPS()

in web/frontend/libs/@deltix/vizceral/src/base/connectionView.js [179:303]


        releasesPerSecond: rptToRPS(rpt),
        secondsPerRelease: rptToSPR(rpt),
      });
    }
  }

  return result;
}

function rptToRPS (rpt) {
  return rpt * 60;
}

function rptToSPR (rpt) {
  return 1 / rptToRPS(rpt);
}


class ConnectionView extends BaseView {
  constructor (connection, maxParticles, customWidth) {
    super(connection);
    this.setParticleLevels();
    this.maxParticles = maxParticles;

    this.dimmedLevel = 0.05;

    this.centerVector = new THREE.Vector3(0, 0, 0);
    this.length = 0;

    this.particleSystemSize = this.maxParticleReleasedPerTick;

    this.uniforms = {
      amplitude: { type: 'f', value: 1.0 },
      color: { type: 'c', value: new THREE.Color(0xFFFFFF) },
      opacity: { type: 'f', value: 1.0 },
      texture: { type: 't', value: particleTexture, transparent: true },
    };

    this.shaderMaterial = baseShaderMaterial.clone();
    this.shaderMaterial.uniforms = this.uniforms;

    this.customWidth = customWidth;
    this.connectionWidth = Math.min(this.object.source.getView().radius, this.object.target.getView().radius) * 0.45;
    this.connectionDepth = Math.min(connection.source.getView().getDepth(), (connection.target.getView().getDepth()) / 2) - 2;

    this.lastParticleIndex = this.particleSystemSize - 1;
    this.freeIndexes = [];

    const ps = generateParticleSystem(this.particleSystemSize, this.customWidth, this.connectionWidth, this.connectionDepth);
    for (let i = 0; i < this.particleSystemSize; i++) {
      this.freeIndexes[i] = i;
    }

    this.velocity = ps.velocities;
    this.particles = new THREE.Points(ps.geometry, this.shaderMaterial);
    this.positionAttr = this.particles.geometry.getAttribute('position');
    this.opacityAttr = this.particles.geometry.getAttribute('customOpacity');
    this.container.add(this.particles);

    // Line used to support interactivity
    this.interactiveLineGeometry = new THREE.Geometry();
    this.interactiveLineMaterial = new THREE.LineBasicMaterial({
      depthTest: true,
      depthWrite: false,
      transparent: true,
      opacity: 0,
    });
    this.interactiveLine = new THREE.Line(this.interactiveLineGeometry, this.interactiveLineMaterial);
    this.addInteractiveChild(this.interactiveLine);
    this.container.add(this.interactiveLine);

    // Add the connection notice
    this.noticeView = new ConnectionNoticeView(this);
    this.validateNotices();


    this.updateVolume();
  }

  setParticleLevels () {
    this.maxParticleReleasedPerTick = 19;
  }

  growParticles (bumpSize) {
    const newSize = bumpSize + this.particleSystemSize;

    for (let i = this.particleSystemSize; i < newSize; i++) {
      this.freeParticleIndex(i);
    }

    this.particleSystemSize = newSize;

    const ps = generateParticleSystem(this.particleSystemSize, this.customWidth, this.connectionWidth, this.connectionDepth);
    const newParticles = new THREE.Points(ps.geometry, this.shaderMaterial);

    copyParticleSystemState(newParticles, this.particles);

    copyArray(ps.velocities, this.velocity);
    this.velocity = ps.velocities;

    // out with the old...
    this.container.remove(this.particles);
    const oldParticles = this.particles;
    setTimeout(() => {
      oldParticles.geometry.dispose();
    }, 1); // do it async to avoid deleting geometry that might have been updated in this tick.

    this.particles = newParticles;
    this.positionAttr = this.particles.geometry.getAttribute('position');
    this.opacityAttr = this.particles.geometry.getAttribute('customOpacity');
    this.container.add(this.particles);

    this.updatePosition();

    return this.nextFreeParticleIndex();
  }

  freeParticleIndex (i) {
    this.lastParticleIndex = Math.max(this.lastParticleIndex + 1, 0);
    this.freeIndexes[this.lastParticleIndex] = i;
  }

  nextFreeParticleIndex (totalAsk) {
    if (this.lastParticleIndex < 0) {
      if (this.particleSystemSize >= this.maxParticles) {