Commit 323e8662 authored by hrchilds's avatar hrchilds

Merge RC to trunk, picking up improvement to Tube operator by Jean Favre.

git-svn-id: 18c085ea-50e0-402c-830e-de6fd14e8384
parent 246f8fad
......@@ -23,6 +23,7 @@ list of changes in release 2.6.</p>
<p><b><font size="4">Bugs fixed in version 2.6.3</font></b></p>
<li>The algorithm for generating tubes (i.e., Tube operator) has been significantly improved, removing artifacts seen in previous versions.</li>
<li>VisIt's frontendlauncher script now sets LD_LIBRARY_PATH so VisIt's internal Python interpreter can properly locate Python shared libraries within the VisIt installation.</li>
<li>VisIt once again honors any plugin directories specified by the <i>VISITPLUGINDIR</i> environment variable. Some sites use the environment variable to point multiple users to a custom plugin directory.</li>
<li>VisIt now always passes "-l username" to ssh when making remote connections when running on Windows since qtssh, the ssh utility VisIt uses on Windows, requires it.</li>
......@@ -50,7 +50,6 @@
#include <vtkPolyData.h>
#include <vtkPolyLine.h>
#include <vtkTubeFilter.h>
// ----------------------------------------------------------------------------
// class PointSequence
// ----------------------------------------------------------------------------
......@@ -493,6 +492,11 @@ bool vtkConnectedTubeFilter::BuildConnectivityArrays(vtkPolyData *input)
// I modified the calls to GetPoint() to use the other variant of the call
// with two arguments. The previous version would fail getting the right values.
// Used vtkIdType where needed
// Jean Favre, Tue May 28 13:28:41 CEST 2013
// I added a quaternion interpolation to smoothly interpolate the direction vectors
// used to construct the tube. This eliminates abrupt twists along the tube
// ****************************************************************************
int vtkConnectedTubeFilter::RequestData(
vtkInformation *vtkNotUsed(request),
......@@ -585,6 +589,7 @@ int vtkConnectedTubeFilter::RequestData(
// Use a centered difference approximation for direction
double v0[3], v1[3], v2[3], dir[3], pt[3];
double prev_dir[3], prev_v1[3], prev_v2[3];
inPts->GetPoint(ix2, v2);
inPts->GetPoint(ix1, v1);
vtkMath::Subtract(v2, v1, dir);
......@@ -597,13 +602,57 @@ int vtkConnectedTubeFilter::RequestData(
inPts->GetPoint(ix, v0);
vtkMath::Subtract(v2, v0, dir);
// Get a couple vectors orthogonal to our direction
//double v1[3], v2[3];
vtkMath::Perpendiculars(dir, v1,v2, 0.0);
//inNormals->GetTuple(i, v1);
vtkMath::Cross(dir, v1, v2);
// Get a couple vectors orthogonal to our direction
//double v1[3], v2[3];
vtkMath::Perpendiculars(dir, v1,v2, 0.0);
// we can't just get two new orthogonal vectors each time because of abrupt changes
// We will construct the matrix which xforms the "previous dir" vector
// into this new dir vector, and then use this rigid body motion to
// xform v1 and v2 from the previous point
double Xform[3][3];
double vec[3];
vtkMath::Cross(prev_dir, dir, vec);
double costheta = vtkMath::Dot(prev_dir, dir);
double sintheta = vtkMath::Norm(vec);
double theta = atan2(sintheta, costheta);
if (sintheta != 0)
vec[0] /= sintheta;
vec[1] /= sintheta;
vec[2] /= sintheta;
// convert to quaternion
costheta = cos(0.5*theta);
sintheta = sin(0.5*theta);
double quat[4];
quat[0] = costheta;
quat[1] = vec[0]*sintheta;
quat[2] = vec[1]*sintheta;
quat[3] = vec[2]*sintheta;
// convert to matrix
vtkMath::QuaternionToMatrix3x3(quat, Xform); // Xform will xform prev_dir into dir
// now use it
vtkMath::Multiply3x3 (Xform, prev_v1, v1);
vtkMath::Multiply3x3 (Xform, prev_v2, v2);
prev_dir[0] = dir[0]; prev_dir[1] = dir[1]; prev_dir[2] = dir[2];
prev_v1[0] = v1[0]; prev_v1[1] = v1[1]; prev_v1[2] = v1[2];
prev_v2[0] = v2[0]; prev_v2[1] = v2[1]; prev_v2[2] = v2[2];
// Hang on to the first point index we create; we need it
// to create the cells
vtkIdType firstIndex = newPts->GetNumberOfPoints();
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