Shell Script Practice Set 1

notes ${} 和 $[] $[expression] can calculate easily. ${expression} can tell us the value of a element in array. eg val1=23 val2=24 echo $val1+$val2 echo $[$val1+$val2] #it is equal to `echo $(( $val1+$val2 )` [edemon@CentOS workspace]$ ./incalc.sh 23+24 47 assign values to array. array=(`echo {1..10}`) echo ${array[0]}” “${array[9]} [edemon@CentOS workspace]$ Read more…

VTK – vtkClipPolyData Example

The article shows how to clip a cone by a plane. The vtkClipPolyData object provides a major algorithm to process the 3D model. Here is python script that describes all details about it. #!/usr/bin/env python import vtk cone = vtk.vtkConeSource() coneMapper = vtk.vtkPolyDataMapper() coneMapper.SetInputConnection( cone.GetOutputPort() ) coneActor = vtk.vtkActor() coneActor.SetMapper( Read more…

VTK – vtkGraphLayoutView Example

vtkRandomGraphSource can be used to create a random graph which includes points and edges. vtkGraphLayoutView is a vtkRenderView which has its own renderer and iterator, we can use it to display graph view. from vtk import * # create a random graph source = vtkRandomGraphSource() source.SetNumberOfVertices(100) source.SetNumberOfEdges(110) source.StartWithTreeOn() #create a Read more…

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X