Commit cceb77c7 authored by legoc's avatar legoc
Browse files

Corrected trajectories in energy

parent 8824772b
......@@ -151,13 +151,18 @@ class EnergyLine extends TrajectoryLine {
// Calculate length of the segment. Applies the scale.
let length = this._end.clone().sub(this._start).length() * this.getEnergyScale();
// Create a line segment for the line.
let segment = new LineSegment(new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, length), 0.5 / scale, this._lineMaterial);
this._line = segment;
if (length > 0) {
// It is necessary not to draw line with length 0 because the underlying cylinder has a default length 1.
this._line = new LineSegment(new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, length), 0.5 / scale, this._lineMaterial);
// Add the line to the data group.
this._dataGroup.add(this._line.object3D);
// Add the line to the data group.
this._dataGroup.add(this._line.object3D);
}
else {
this._line = null;
}
}
// Update the data.
......@@ -189,6 +194,7 @@ class EnergyLine extends TrajectoryLine {
this._line.object3D.visible = visibility;
}
this._dataGroup.visible = visibility;
this._pointSphereGroup.visible = visibility;
}
/**
......
......@@ -104,12 +104,8 @@ class TrajectoryView3D extends View3D {
this._energyLine.start = energyStart;
this._energyLine.end = energyStart;
// Show energy line for ki and kf trajectories.
if (this._type === 'ki' || this._type === 'kf') {
this._energyLine.setVisibility(true);
}
this._energyLine.setVisibility(true);
this._drawLines = true;
}
else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment