[vtkusers] Plot Tubular Paths from xyz

Justin Clark jreileyclark at gmail.com
Mon Aug 7 23:22:00 EDT 2017


Sorry, Not a C++ programmer.  I'm confused by multiple parts so far in the code.

double r;
  for (unsigned int i = 0; i < n; ++i)
    {
    double t = (tMax - tMin) / (n - 1) * i + tMin;
    interpolatedRadius->InterpolateTuple(t, &r);
    tubeRadius->SetTuple1(i, r);
    }

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?

Any help converting this into python?

So far I have...

import vtk

points = vtk.vtkPoints()
points.InsertPoint(0,1,0,0)
points.InsertPoint(1,2,0,0)
points.InsertPoint(2,3,1,0)
points.InsertPoint(3,4,1,0)
points.InsertPoint(4,5,0,0)
points.InsertPoint(5,6,0,0)

spline = vtk.vtkParametricSpline()
spline.SetPoints(points)

functionSource = vtk.vtkParametricFunctionSource()
functionSource.SetParametricFunction(spline)
functionSource.SetUResolution(10*points.GetNumberOfPoints())
functionSource.Update()

interpolatedRadius = vtk.vtkTupleInterpolator()
interpolatedRadius.SetInterpolationTypetoLinear()
interpolatedRadius.SetNumberOfComponents(1)
interpolatedRadius.AddTuple(0,0.2)
interpolatedRadius.AddTuple(0,0.2)
interpolatedRadius.AddTuple(0,0.2)
interpolatedRadius.AddTuple(0,0.1)
interpolatedRadius.AddTuple(0,0.1)
interpolatedRadius.AddTuple(0,0.1)

n = functionSource.GetUresolution()

tubeRadius = vtk.vtkDoubleArray()
tubeRadius.SetNumberOfValues(n)
tmin = interpolatedRadius.GetMinimumT()
tmax = interpolatedRadius.GetMaximumT()

for i in range(n):
    t = ((tmax - tmin)/(n-1))*i + tmin
    interpolatedRadius.InterpolateTuple(t,???)



-----Original Message-----
From: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
Sent: Monday, August 7, 2017 12:05 PM
To: Justin Clark <jreileyclark at gmail.com>
Cc: VTK Users <vtkusers at vtk.org>
Subject: Re: [vtkusers] Plot Tubular Paths from xyz

Here is a C++ example:
https://lorensen.github.io/VTKExamples/site/Cxx/VisualizationAlgorithms/TubesFromSplines/


On Mon, Aug 7, 2017 at 1:03 PM, Justin Clark <jreileyclark at gmail.com <mailto:jreileyclark at gmail.com> > wrote:
>
>
> Hi all,
>
> 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!
>
> 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?
>
> Thanks!
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com> 
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170807/e1cad969/attachment.html>


More information about the vtkusers mailing list