<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META NAME="Generator" CONTENT="MS Exchange Server version rmj.rmm.rup.rpr">
<TITLE>RE: [vtkusers] Plot Tubular Paths from xyz</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Sorry, Not a C++ programmer. I'm confused by multiple parts so far in the code.</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">double r;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri"> for (unsigned int i = 0; i < n; ++i)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri"> {</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri"> double t = (tMax - tMin) / (n - 1) * i + tMin;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri"> interpolatedRadius->InterpolateTuple(t, &r);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri"> tubeRadius->SetTuple1(i, r);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri"> }</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">What does "&r" mean above? We instantiate r as a double, but we don't assign it a value. Then we interpolate between t and the memory address of r?</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Any help converting this into python?</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">So far I have...</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">import vtk</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">points = vtk.vtkPoints()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">points.InsertPoint(0,1,0,0)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">points.InsertPoint(1,2,0,0)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">points.InsertPoint(2,3,1,0)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">points.InsertPoint(3,4,1,0)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">points.InsertPoint(4,5,0,0)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">points.InsertPoint(5,6,0,0)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">spline = vtk.vtkParametricSpline()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">spline.SetPoints(points)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">functionSource = vtk.vtkParametricFunctionSource()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">functionSource.SetParametricFunction(spline)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">functionSource.SetUResolution(10*points.GetNumberOfPoints())</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">functionSource.Update()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius = vtk.vtkTupleInterpolator()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius.SetInterpolationTypetoLinear()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius.SetNumberOfComponents(1)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius.AddTuple(0,0.2)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius.AddTuple(0,0.2)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius.AddTuple(0,0.2)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius.AddTuple(0,0.1)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius.AddTuple(0,0.1)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">interpolatedRadius.AddTuple(0,0.1)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">n = functionSource.GetUresolution()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">tubeRadius = vtk.vtkDoubleArray()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">tubeRadius.SetNumberOfValues(n)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">tmin = interpolatedRadius.GetMinimumT()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">tmax = interpolatedRadius.GetMaximumT()</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">for i in range(n):</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri"> t = ((tmax - tmin)/(n-1))*i + tmin</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri"> interpolatedRadius.InterpolateTuple(t,</FONT></SPAN><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">???</FONT></SPAN><SPAN LANG="en-us"><FONT COLOR="#7F7F7F" FACE="Calibri">)</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">-----Original Message-----<BR>
From: Bill Lorensen [<A HREF="mailto:bill.lorensen@gmail.com">mailto:bill.lorensen@gmail.com</A>]<BR>
Sent: Monday, August 7, 2017 12:05 PM<BR>
To: Justin Clark <jreileyclark@gmail.com><BR>
Cc: VTK Users <vtkusers@vtk.org><BR>
Subject: Re: [vtkusers] Plot Tubular Paths from xyz</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Here is a C++ example:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN><A HREF="https://lorensen.github.io/VTKExamples/site/Cxx/VisualizationAlgorithms/TubesFromSplines/"><SPAN LANG="en-us"><FONT FACE="Calibri">https://lorensen.github.io/VTKExamples/site/Cxx/VisualizationAlgorithms/TubesFromSplines/</FONT></SPAN><SPAN LANG="en-us"></SPAN></A><SPAN LANG="en-us"></SPAN></P>
<BR>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">On Mon, Aug 7, 2017 at 1:03 PM, Justin Clark <</FONT></SPAN><SPAN LANG="en-us"></SPAN><A HREF="mailto:jreileyclark@gmail.com"><SPAN LANG="en-us"><FONT FACE="Calibri">jreileyclark@gmail.com</FONT></SPAN><SPAN LANG="en-us"></SPAN></A><SPAN LANG="en-us"><FONT FACE="Calibri">> wrote:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Hi all,</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Total vtk newbie here trying to figure out a solution in vtk python. I would like to plot multiple tubular paths defined by a set of (x, y, z) data. Multiple paths. I'm trying to plot wellbores. Once the wellbores are plotted I intend to use them as sources and sinks for simulation and streamline purposes. Any guidance would be helpful!</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Using existing examples I believe I need to insert my xyz's into a vtkPoints object. Then interpolate using a spline, and use the spline to define my tube path?</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Thanks!</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> _______________________________________________</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Powered by</FONT></SPAN><SPAN LANG="en-us"> </SPAN><A HREF="http://www.kitware.com"><SPAN LANG="en-us"><FONT FACE="Calibri">www.kitware.com</FONT></SPAN><SPAN LANG="en-us"></SPAN></A><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Visit other Kitware open-source projects at</FONT></SPAN><SPAN LANG="en-us"> </SPAN><A HREF="http://www.kitware.com/opensource/opensource.html"><SPAN LANG="en-us"><FONT FACE="Calibri">http://www.kitware.com/opensource/opensource.html</FONT></SPAN><SPAN LANG="en-us"></SPAN></A><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Please keep messages on-topic and check the VTK FAQ at:</FONT></SPAN><SPAN LANG="en-us"> </SPAN><A HREF="http://www.vtk.org/Wiki/VTK_FAQ"><SPAN LANG="en-us"><FONT FACE="Calibri">http://www.vtk.org/Wiki/VTK_FAQ</FONT></SPAN><SPAN LANG="en-us"></SPAN></A><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Search the list archives at:</FONT></SPAN><SPAN LANG="en-us"> </SPAN><A HREF="http://markmail.org/search/?q=vtkusers"><SPAN LANG="en-us"><FONT FACE="Calibri">http://markmail.org/search/?q=vtkusers</FONT></SPAN><SPAN LANG="en-us"></SPAN></A><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">> Follow this link to subscribe/unsubscribe:</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">></FONT></SPAN><SPAN LANG="en-us"> </SPAN><A HREF="http://public.kitware.com/mailman/listinfo/vtkusers"><SPAN LANG="en-us"><FONT FACE="Calibri">http://public.kitware.com/mailman/listinfo/vtkusers</FONT></SPAN><SPAN LANG="en-us"></SPAN></A><SPAN LANG="en-us"></SPAN></P>
<BR>
<BR>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">-- </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Unpaid intern in BillsBasement at noware dot com</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
</BODY>
</HTML>