<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>Greetings VTK users,</SPAN></FONT></FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT> </DIV>
<DIV><FONT><SPAN class=593143318-21042006></SPAN><FONT face="Courier New"><FONT
size=2><SPAN class=593143318-21042006>I am new to VTK, and this is my first time
addressing this forum, so please forgive any obvious
questions.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>I need to make a plane with a lot of holes in it, which
I managed to do using the vtkClipPolyData
function.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>I combined all the implicit cylinders together with a
vtkImplicitBoolean (union) and fed the result to the
clipper.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>The problem is that it is too slow for my intended
purpose.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>Anyone have any ideas to speed up this
task?</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>Sample Java code is listed
below.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>Many thanks,</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>Cordially,</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>Tim</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006>***********************************************************************************88</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT face="Courier New"><FONT size=2><SPAN
class=593143318-21042006></SPAN>//<BR>//This example <SPAN
class=593143318-21042006>creates a plane pierced by 380
holes</SPAN> <BR>//<BR>//</FONT></FONT></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>//we import the vtk wrapped classes f<SPAN
class=593143318-21042006>i</SPAN>rst<BR>import java.util.Vector;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>import vtk.*;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>//then we define our class<BR>public class
Main {<BR>// in the static contructor we load in the native code<BR>// The
libraries must be in your path to work<BR>static {
<BR> System.loadLibrary("vtkCommonJava");
<BR> System.loadLibrary("vtkFilteringJava");
<BR> System.loadLibrary("vtkIOJava");
<BR> System.loadLibrary("vtkImagingJava");
<BR> System.loadLibrary("vtkGraphicsJava");
<BR> System.loadLibrary("vtkRenderingJava"); <BR>}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>// now the main program<BR>public static
void main (String []args) throws Exception {<BR> <BR> final
double planeHeight = .28;<BR> final double planeWidth =
.22;<BR> final int holeCnt = 380;<BR> final int rowCount =
38;<BR> final double holeRadius = 0.0025;<BR> final double
offsetFromTop = 0.005;<BR> final double offsetFromSide =
0.01075;<BR> final double holeSpacing = .00725;<BR>
<BR> <BR> vtkPlaneSource planeSource =
new
vtkPlaneSource();<BR> planeSource.SetOrigin(0,-planeHeight/2,0);<BR> planeSource.SetPoint1(planeWidth,-planeHeight/2,0);<BR> planeSource.SetPoint2(0,planeHeight/2,0);<BR> planeSource.SetResolution(200,200);<BR> <BR> vtkPolyDataMapper
planeMapper = new vtkPolyDataMapper();</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> Vector <vtkCylinder>
holeList = new
Vector<vtkCylinder>(holeCnt);<BR> vtkGeneralTransform trans =
new
vtkGeneralTransform();<BR> trans.RotateX(90);<BR> <BR> vtkImplicitBoolean
holes = new
vtkImplicitBoolean();<BR> holes.SetOperationTypeToUnion();<BR> <BR> for
(int i= 0 ; i<holeCnt; i++)<BR> {<BR><SPAN
class=593143318-21042006>
</SPAN>double currentOffsetFromTop = -planeHeight/2 + offsetFromTop +
i%rowCount*holeSpacing;<BR><SPAN
class=593143318-21042006>
</SPAN>holeList.insertElementAt(new vtkCylinder(), i);<BR><SPAN
class=593143318-21042006>
</SPAN>holeList.elementAt(i).SetCenter(offsetFromSide*(i/rowCount+1), 0,
currentOffsetFromTop);<BR><SPAN
class=593143318-21042006>
</SPAN>holeList.elementAt(i).SetRadius(holeRadius);<BR><SPAN
class=593143318-21042006>
</SPAN>holeList.elementAt(i).SetTransform(trans);<BR><SPAN
class=593143318-21042006>
</SPAN>holes.AddFunction(holeList.elementAt(i));<BR>
} <BR>
<BR> vtkClipPolyData planeClipper = new
vtkClipPolyData();<BR>
planeClipper.InsideOutOn();<BR>
planeClipper.SetInput(planeSource.GetOutput());<BR>
planeClipper.SetClipFunction(holes);<BR>
planeClipper.GenerateClippedOutputOn();<BR> vtkPolyData
planePolyData = planeClipper.GetClippedOutput(); </FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>
planeMapper.SetInput(planePolyData);<BR> vtkActor
planeActor = new vtkActor();<BR>
planeActor.SetMapper(planeMapper);<BR>
<BR> vtkRenderer ren1 = new
vtkRenderer();<BR> ren1.SetBackground(0.1, 0.2,
0.4);<BR>
ren1.AddActor(planeActor);<BR> //<BR> // Finally we create the render
window which will show up on the screen.<BR> // We add our two renderers
into the render window using AddRenderer. We also<BR> // set the size to be
600 pixels by 300.<BR> //<BR> vtkRenderWindow renWin = new
vtkRenderWindow();<BR> renWin.AddRenderer( ren1
);<BR> renWin.SetSize(600, 600);</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New"
size=2> ren1.GetActiveCamera().Azimuth(0);</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> vtkRenderWindowInteractor iren = new
vtkRenderWindowInteractor();<BR> iren.SetRenderWindow(renWin);</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> vtkInteractorStyleTrackballCamera
style = <BR> new
vtkInteractorStyleTrackballCamera();<BR> iren.SetInteractorStyle(style);</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New"
size=2> iren.Initialize();<BR> iren.Start();<BR> }<BR>}<BR></FONT></DIV></BODY></HTML>