Skip to content

Commit

Permalink
Improve template
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmasson committed Oct 11, 2017
1 parent d2ed595 commit 62f0539
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions build/mathcell.js
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ function template( options, bounds, lights, texts, points, lines, surfaces ) {
var box = new THREE.Geometry();
box.vertices.push( new THREE.Vector3( a[0]*b0[0], a[1]*b0[1], a[2]*b0[2] ) );
box.vertices.push( new THREE.Vector3( a[0]*b1[0], a[1]*b1[1], a[2]*b1[2] ) );
var boxMesh = new THREE.LineSegments( box );
var boxMesh = new THREE.Line( box );
if ( options.frame ) scene.add( new THREE.BoxHelper( boxMesh, 'black' ) );
if ( options.axesLabels ) {
Expand Down Expand Up @@ -1332,19 +1332,17 @@ function template( options, bounds, lights, texts, points, lines, surfaces ) {
function addLine( json ) {
var geometry = new THREE.Geometry();
for ( var i=0 ; i < json.points.length - 1 ; i++ ) {
for ( var i=0 ; i < json.points.length ; i++ ) {
var v = json.points[i];
geometry.vertices.push( new THREE.Vector3( a[0]*v[0], a[1]*v[1], a[2]*v[2] ) );
var v = json.points[i+1];
geometry.vertices.push( new THREE.Vector3( a[0]*v[0], a[1]*v[1], a[2]*v[2] ) );
}
var transparent = json.opacity < 1 ? true : false;
var material = new THREE.LineBasicMaterial( { color: json.color, linewidth: json.linewidth,
transparent: transparent, opacity: json.opacity } );
var c = geometry.center().multiplyScalar( -1 );
var mesh = new THREE.LineSegments( geometry, material );
var mesh = new THREE.Line( geometry, material );
mesh.position.set( c.x, c.y, c.z );
scene.add( mesh );
}
Expand Down
8 changes: 3 additions & 5 deletions src/plot/threejs-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function template( options, bounds, lights, texts, points, lines, surfaces ) {
var box = new THREE.Geometry();
box.vertices.push( new THREE.Vector3( a[0]*b0[0], a[1]*b0[1], a[2]*b0[2] ) );
box.vertices.push( new THREE.Vector3( a[0]*b1[0], a[1]*b1[1], a[2]*b1[2] ) );
var boxMesh = new THREE.LineSegments( box );
var boxMesh = new THREE.Line( box );
if ( options.frame ) scene.add( new THREE.BoxHelper( boxMesh, 'black' ) );
if ( options.axesLabels ) {
Expand Down Expand Up @@ -207,19 +207,17 @@ function template( options, bounds, lights, texts, points, lines, surfaces ) {
function addLine( json ) {
var geometry = new THREE.Geometry();
for ( var i=0 ; i < json.points.length - 1 ; i++ ) {
for ( var i=0 ; i < json.points.length ; i++ ) {
var v = json.points[i];
geometry.vertices.push( new THREE.Vector3( a[0]*v[0], a[1]*v[1], a[2]*v[2] ) );
var v = json.points[i+1];
geometry.vertices.push( new THREE.Vector3( a[0]*v[0], a[1]*v[1], a[2]*v[2] ) );
}
var transparent = json.opacity < 1 ? true : false;
var material = new THREE.LineBasicMaterial( { color: json.color, linewidth: json.linewidth,
transparent: transparent, opacity: json.opacity } );
var c = geometry.center().multiplyScalar( -1 );
var mesh = new THREE.LineSegments( geometry, material );
var mesh = new THREE.Line( geometry, material );
mesh.position.set( c.x, c.y, c.z );
scene.add( mesh );
}
Expand Down

0 comments on commit 62f0539

Please sign in to comment.