Go to the source code of this file.
Definition at line 28 of file vrml.h.
References Vec3D::GetLength(), Vec3D::X, Vec3D::Y, and Vec3D::Z.
Referenced by Export_to_VRML_format2().
31 *length = GetDistance(pointA, pointB);
34 *translation = (pointA + pointB) / 2.0f;
40 Vec3D needed =
Vec3D(pointB.
X - pointA.
X, pointB.
Y - pointA.
Y, pointB.
Z - pointA.
Z);
43 Vec3D needed_n, init_n;
49 *angle = acos(Dot(needed_n, init_n));
58 *axis =
Vec3D(vx, vy, vz);
Mdouble GetLength() const
Implementation of a 3D vector (by Vitaliy).
void Export_to_VRML_format2 |
( |
std::string |
fname | ) |
|
Definition at line 63 of file vrml.h.
References CylinderTransformer(), Vec3D::X, Vec3D::Y, and Vec3D::Z.
65 ofstream grout(fname.c_str());
72 title \"Granular Media\"\n\
74 \"Packing configuration.\"\n\
75 \"Author: Vitaliy Ogarko; vogarko@gmail.com\"\n\
79 type [ \"EXAMINE\", \"ANY\" ]\n\
128 Vec3D translation, axis;
134 pointsA[0] =
Vec3D(0,0,0); pointsB[0] =
Vec3D(1,0,0);
135 pointsA[1] =
Vec3D(0,0,0); pointsB[1] =
Vec3D(0,1,0);
136 pointsA[2] =
Vec3D(0,0,0); pointsB[2] =
Vec3D(0,0,1);
138 pointsA[3] =
Vec3D(1,0,0); pointsB[3] =
Vec3D(1,0,1);
139 pointsA[4] =
Vec3D(1,0,0); pointsB[4] =
Vec3D(1,1,0);
141 pointsA[5] =
Vec3D(0,1,0); pointsB[5] =
Vec3D(0,1,1);
142 pointsA[6] =
Vec3D(0,1,0); pointsB[6] =
Vec3D(1,1,0);
144 pointsA[7] =
Vec3D(0,0,1); pointsB[7] =
Vec3D(0,1,1);
145 pointsA[8] =
Vec3D(0,0,1); pointsB[8] =
Vec3D(1,0,1);
147 pointsA[9] =
Vec3D(1,1,1); pointsB[9] =
Vec3D(0,1,1);
148 pointsA[10] =
Vec3D(1,1,1); pointsB[10] =
Vec3D(1,1,0);
149 pointsA[11] =
Vec3D(1,1,1); pointsB[11] =
Vec3D(1,0,1);
152 for(
int i=0; i<12; i++)
157 if (i == 11) { angle = 0.; }
161 translation " << translation.
X <<
" " << translation.
Y <<
" " << translation.
Z <<
"\n\
162 rotation " << axis.
X <<
" " << axis.
Y <<
" " << axis.
Z <<
" " << angle <<
"\n\
164 appearance Appearance {\n\
165 material Material { diffuseColor 0.8 0.8 0.8 }\n\
167 geometry Cylinder {\n\
169 height " << length <<
"\n\
183 appearance Appearance {\n\
184 material Material { diffuseColor 0.8 0.8 0.8\n\
194 appearance Appearance {\n\
195 material Material { diffuseColor 0.8 0.8 0.8\n\
205 appearance Appearance {\n\
206 material Material { diffuseColor 0.8 0.8 0.8\n\
216 appearance Appearance {\n\
217 material Material { diffuseColor 0.8 0.8 0.8\n\
227 appearance Appearance {\n\
228 material Material { diffuseColor 0.8 0.8 0.8\n\
238 appearance Appearance {\n\
239 material Material { diffuseColor 0.8 0.8 0.8\n\
249 appearance Appearance {\n\
250 material Material { diffuseColor 0.8 0.8 0.8\n\
260 appearance Appearance {\n\
261 material Material { diffuseColor 0.8 0.8 0.8\n\
272 position -0.9 1.6 3\n\
273 orientation -0.572612659264449 -0.806095467134217 -0.14941499361097152 0.6261167634082665\n\
274 fieldOfView 0.785398\n\
275 description \"Viewpoint 1\"\n\
281 for(
int i=0; i<Nmax; i++)
284 grout <<
"Transform {" <<
"\n";
285 grout <<
"translation ";
288 grout << Px[i] <<
' ' << Py[i] <<
' ' << Pz[i] <<
"\n";
290 grout <<
"children Shape {" <<
"\n";
291 grout <<
"geometry Sphere {" <<
"\n";
295 grout << Pr[i] <<
"\n";
300 grout <<
"appearance Appearance {" <<
"\n";
303 grout <<
"material Material { diffuseColor ";
319 if (Pr[i] == MinRadius)
333 r = (Pr[i] - MinRadius) / (MaxRadius - MinRadius);
359 grout << c1 <<
" " << c2 <<
" " << c3 <<
"\n";
361 grout <<
" transparency " << transparency <<
"\n}\n";
void CylinderTransformer(Vec3D pointA, Vec3D pointB, Mdouble *length, Mdouble *angle, Vec3D *translation, Vec3D *axis)
Implementation of a 3D vector (by Vitaliy).