Skip to content

Instantly share code, notes, and snippets.

@ashgti
Created April 2, 2009 16:25
Show Gist options
  • Save ashgti/89273 to your computer and use it in GitHub Desktop.
Save ashgti/89273 to your computer and use it in GitHub Desktop.
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
#define input "prev-state"
#define output "CylinderVMD"
#define N 1100
int main() {
int index1[N], index2[N], i;
double x[N], y[N], z[N], fx[N], fy[N], fz[N], R, L;
fstream in;
fstream out;
in.open(input, fstream::in);
out.open(output, fstream::out);
for(i=0; i<N; i=i+1)
in >> index1[i] >> index2[i] >> x[i] >> y[i] >> z[i] >> fx[i] >> fy[i] >> fz[i];
cout << "Enter the radius and the length of the cylinder:";
cin >> R >> L;
for (i=0; i<N; i=i+1) {
if ((x[i]*x[i]+z[i]*z[i]<=R*R)&&(z[i]<=L))
out << index1[i] << index2[i] << x[i] << y[i] << z[i] << fx[i] << fy[i] << fz[i];
}
in.close();
out.close();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment