Still improving the documentation of the samples
This commit is contained in:
parent
ac9b6b16f2
commit
9ae5490a8b
|
|
@ -1,4 +1,4 @@
|
||||||
DEPENDPATH += .
|
DEPENDPATH += . ../../..
|
||||||
INCLUDEPATH += . ../../..
|
INCLUDEPATH += . ../../..
|
||||||
CONFIG += console stl
|
CONFIG += console stl
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,26 @@
|
||||||
|
|
||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
SUBDIRS = trimesh_base \
|
SUBDIRS = trimesh_base \
|
||||||
trimesh_topology \
|
trimesh_attribute \
|
||||||
trimesh_smooth \
|
trimesh_ball_pivoting \
|
||||||
|
trimesh_closest \
|
||||||
|
trimesh_copy \
|
||||||
trimesh_curvature \
|
trimesh_curvature \
|
||||||
trimesh_normal \
|
|
||||||
trimesh_inertia \
|
|
||||||
trimesh_refine \
|
|
||||||
trimesh_clustering \
|
trimesh_clustering \
|
||||||
|
trimesh_edge \
|
||||||
|
trimesh_ext_mc \
|
||||||
|
trimesh_hole \
|
||||||
|
trimesh_inertia \
|
||||||
|
trimesh_intersection \
|
||||||
trimesh_isosurface \
|
trimesh_isosurface \
|
||||||
trimesh_join \
|
trimesh_join \
|
||||||
trimesh_edge \
|
trimesh_normal \
|
||||||
trimesh_optional \
|
trimesh_optional \
|
||||||
trimesh_intersection \
|
trimesh_ray \
|
||||||
trimesh_ball_pivoting \
|
trimesh_refine \
|
||||||
trimesh_hole \
|
|
||||||
trimesh_sampling \
|
trimesh_sampling \
|
||||||
|
trimesh_smooth \
|
||||||
|
trimesh_topology \
|
||||||
polygonmesh_base \
|
polygonmesh_base \
|
||||||
aabb_binary_tree \
|
aabb_binary_tree
|
||||||
trimesh_attribute
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ Attributes are a simple mechanism to associate user-defined 'attributes' to the
|
||||||
class MyEdge;
|
class MyEdge;
|
||||||
class MyFace;
|
class MyFace;
|
||||||
class MyVertex;
|
class MyVertex;
|
||||||
struct MyUsedTypes : public UsedTypes< Use<MyVertex> ::AsVertexType,
|
struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex> ::AsVertexType,
|
||||||
Use<MyFace> ::AsFaceType>{};
|
vcg::Use<MyFace> ::AsFaceType>{};
|
||||||
|
|
||||||
class MyVertex : public Vertex< MyUsedTypes, vertex::Coord3f,vertex::Normal3f>{};
|
class MyVertex : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f,vcg::vertex::Normal3f>{};
|
||||||
class MyFace : public Face< MyUsedTypes, face::VertexRef, face::Normal3f> {};
|
class MyFace : public vcg::Face< MyUsedTypes, vcg::face::VertexRef, vcg::face::Normal3f> {};
|
||||||
|
|
||||||
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};
|
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ This file contain a minimal example of the library
|
||||||
class MyEdge;
|
class MyEdge;
|
||||||
class MyFace;
|
class MyFace;
|
||||||
class MyVertex;
|
class MyVertex;
|
||||||
struct MyUsedTypes : public UsedTypes< Use<MyVertex> ::AsVertexType,
|
struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex> ::AsVertexType,
|
||||||
Use<MyEdge> ::AsEdgeType,
|
vcg::Use<MyEdge> ::AsEdgeType,
|
||||||
Use<MyFace> ::AsFaceType>{};
|
vcg::Use<MyFace> ::AsFaceType>{};
|
||||||
|
|
||||||
class MyVertex : public Vertex<MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
|
class MyVertex : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
|
||||||
class MyFace : public Face< MyUsedTypes, face::FFAdj, face::VertexRef, face::BitFlags > {};
|
class MyFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::VertexRef, vcg::face::BitFlags > {};
|
||||||
class MyEdge : public Edge<MyUsedTypes>{};
|
class MyEdge : public vcg::Edge<MyUsedTypes>{};
|
||||||
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
|
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
|
|
@ -63,7 +63,7 @@ int main( int argc, char **argv )
|
||||||
|
|
||||||
MyMesh m;
|
MyMesh m;
|
||||||
|
|
||||||
if(tri::io::ImporterOFF<MyMesh>::Open(m,argv[1])!=tri::io::ImporterOFF<MyMesh>::NoError)
|
if(vcg::tri::io::ImporterOFF<MyMesh>::Open(m,argv[1])!=vcg::tri::io::ImporterOFF<MyMesh>::NoError)
|
||||||
{
|
{
|
||||||
printf("Error reading file %s\n",argv[1]);
|
printf("Error reading file %s\n",argv[1]);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,12 @@
|
||||||
* for more details. *
|
* for more details. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/*! \file trimesh_clustering.cpp
|
||||||
|
\ingroup code_sample
|
||||||
|
|
||||||
|
\brief a minimal example of a clustering based simplification
|
||||||
|
|
||||||
|
*/
|
||||||
#include<vcg/complex/complex.h>
|
#include<vcg/complex/complex.h>
|
||||||
|
|
||||||
#include <vcg/complex/algorithms/update/bounding.h>
|
#include <vcg/complex/algorithms/update/bounding.h>
|
||||||
|
|
@ -29,16 +35,16 @@
|
||||||
#include <vcg/complex/algorithms/clustering.h>
|
#include <vcg/complex/algorithms/clustering.h>
|
||||||
|
|
||||||
// input output
|
// input output
|
||||||
#include <wrap/io_trimesh/import_ply.h>
|
#include <wrap/io_trimesh/import.h>
|
||||||
#include <wrap/io_trimesh/export_ply.h>
|
#include <wrap/io_trimesh/export.h>
|
||||||
|
|
||||||
class MyFace;
|
class MyFace;
|
||||||
class MyVertex;
|
class MyVertex;
|
||||||
|
|
||||||
struct MyUsedTypes : public UsedTypes< Use<MyVertex>::AsVertexType, Use<MyFace>::AsFaceType>{};
|
struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex>::AsVertexType, vcg::Use<MyFace>::AsFaceType>{};
|
||||||
|
|
||||||
class MyVertex : public Vertex< MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
|
class MyVertex : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
|
||||||
class MyFace : public Face < MyUsedTypes, face::VertexRef, face::Normal3f, face::BitFlags > {};
|
class MyFace : public vcg::Face < MyUsedTypes, vcg::face::VertexRef, vcg::face::Normal3f, vcg::face::BitFlags > {};
|
||||||
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};
|
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
|
@ -46,9 +52,7 @@ int main(int argc, char **argv)
|
||||||
if(argc<3)
|
if(argc<3)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"\n trimesh_clustering ("__DATE__")\n"
|
"Usage: trimesh_clustering filein.ply fileout.ply [opt] \n"
|
||||||
" Visual Computing Group I.S.T.I. C.N.R.\n"
|
|
||||||
"Usage: PlyRefine filein.ply fileout.ply [opt] \n"
|
|
||||||
"options: \n"
|
"options: \n"
|
||||||
"-k cellnum approx number of cluster that should be defined; (default 10e5)\n"
|
"-k cellnum approx number of cluster that should be defined; (default 10e5)\n"
|
||||||
"-s size in absolute units the size of the clustering cell (override the previous param)\n"
|
"-s size in absolute units the size of the clustering cell (override the previous param)\n"
|
||||||
|
|
@ -57,15 +61,15 @@ int main(int argc, char **argv)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i=3;
|
|
||||||
int CellNum=100000;
|
int CellNum=100000;
|
||||||
float CellSize=0;
|
float CellSize=0;
|
||||||
bool DupFace=false;
|
bool DupFace=false;
|
||||||
|
|
||||||
|
int i=3;
|
||||||
while(i<argc)
|
while(i<argc)
|
||||||
{
|
{
|
||||||
if(argv[i][0]!='-')
|
if(argv[i][0]!='-')
|
||||||
{printf("Error unable to parse option '%s'\n",argv[i]); exit(0);}
|
{ printf("Error unable to parse option '%s'\n",argv[i]); exit(0); }
|
||||||
switch(argv[i][1])
|
switch(argv[i][1])
|
||||||
{
|
{
|
||||||
case 'k' : CellNum=atoi(argv[i+1]); ++i; printf("Using %i clustering cells\n",CellNum); break;
|
case 'k' : CellNum=atoi(argv[i+1]); ++i; printf("Using %i clustering cells\n",CellNum); break;
|
||||||
|
|
@ -78,12 +82,12 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
MyMesh m;
|
MyMesh m;
|
||||||
|
|
||||||
if(vcg::tri::io::ImporterPLY<MyMesh>::Open(m,argv[1])!=0)
|
if(vcg::tri::io::ImporterPLY<MyMesh>::Open(m,argv[1])!=0)
|
||||||
{
|
{
|
||||||
printf("Error reading file %s\n",argv[1]);
|
printf("Error reading file %s\n",argv[1]);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vcg::tri::UpdateBounding<MyMesh>::Box(m);
|
vcg::tri::UpdateBounding<MyMesh>::Box(m);
|
||||||
vcg::tri::UpdateNormal<MyMesh>::PerFace(m);
|
vcg::tri::UpdateNormal<MyMesh>::PerFace(m);
|
||||||
printf("Input mesh vn:%i fn:%i\n",m.VN(),m.FN());
|
printf("Input mesh vn:%i fn:%i\n",m.VN(),m.FN());
|
||||||
|
|
@ -95,15 +99,10 @@ int main(int argc, char **argv)
|
||||||
printf("Grid of %i x %i x %i cells\n",Grid.Grid.siz[0],Grid.Grid.siz[1],Grid.Grid.siz[2]);
|
printf("Grid of %i x %i x %i cells\n",Grid.Grid.siz[0],Grid.Grid.siz[1],Grid.Grid.siz[2]);
|
||||||
printf("with cells size of %.2f x %.2f x %.2f units\n",Grid.Grid.voxel[0],Grid.Grid.voxel[1],Grid.Grid.voxel[2]);
|
printf("with cells size of %.2f x %.2f x %.2f units\n",Grid.Grid.voxel[0],Grid.Grid.voxel[1],Grid.Grid.voxel[2]);
|
||||||
|
|
||||||
int t0=clock();
|
|
||||||
Grid.AddMesh(m);
|
Grid.AddMesh(m);
|
||||||
int t1=clock();
|
|
||||||
Grid.ExtractMesh(m);
|
Grid.ExtractMesh(m);
|
||||||
int t2=clock();
|
|
||||||
printf("Output mesh vn:%i fn:%i\n",m.VN(),m.FN());
|
printf("Output mesh vn:%i fn:%i\n",m.VN(),m.FN());
|
||||||
printf("Simplified in :%i msec (%i+%i)\n",t2-t0,t1-t0,t2-t1);
|
|
||||||
|
|
||||||
vcg::tri::io::PlyInfo pi;
|
vcg::tri::io::ExporterPLY<MyMesh>::Save(m,argv[2]);
|
||||||
vcg::tri::io::ExporterPLY<MyMesh>::Save(m,argv[2],pi.mask);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,14 @@
|
||||||
* for more details. *
|
* for more details. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/*! \file trimesh_curvature.cpp
|
||||||
|
\ingroup code_sample
|
||||||
|
|
||||||
|
\brief an example showing the various techniques for computing curvatures
|
||||||
|
|
||||||
|
This file contain a minimal example of the library
|
||||||
|
|
||||||
|
*/
|
||||||
#include<vcg/complex/complex.h>
|
#include<vcg/complex/complex.h>
|
||||||
|
|
||||||
#include<wrap/io_trimesh/export_off.h>
|
#include<wrap/io_trimesh/export_off.h>
|
||||||
|
|
@ -31,13 +39,13 @@
|
||||||
class MyEdge;
|
class MyEdge;
|
||||||
class MyFace;
|
class MyFace;
|
||||||
class MyVertex;
|
class MyVertex;
|
||||||
struct MyUsedTypes : public UsedTypes< Use<MyVertex> ::AsVertexType,
|
struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex> ::AsVertexType,
|
||||||
Use<MyEdge> ::AsEdgeType,
|
vcg::Use<MyEdge> ::AsEdgeType,
|
||||||
Use<MyFace> ::AsFaceType>{};
|
vcg::Use<MyFace> ::AsFaceType>{};
|
||||||
|
|
||||||
class MyVertex : public Vertex<MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
|
class MyVertex : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
|
||||||
class MyFace : public Face< MyUsedTypes, face::FFAdj, face::VertexRef, face::BitFlags > {};
|
class MyFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::VertexRef, vcg::face::BitFlags > {};
|
||||||
class MyEdge : public Edge<MyUsedTypes>{};
|
class MyEdge : public vcg::Edge<MyUsedTypes>{};
|
||||||
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
|
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,16 @@
|
||||||
* for more details. *
|
* for more details. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/*! \file trimesh_inertia.cpp
|
||||||
|
\ingroup code_sample
|
||||||
|
|
||||||
|
\brief An example of computing the inertia properties of meshes
|
||||||
|
|
||||||
|
Two meshes are created a rectangular box and a torus and their mass properties are computed and shown.
|
||||||
|
The result should match the closed formula for these objects (with a reasonable approximation)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#include<vcg/complex/complex.h>
|
#include<vcg/complex/complex.h>
|
||||||
|
|
||||||
#include<wrap/io_trimesh/import_off.h>
|
#include<wrap/io_trimesh/import_off.h>
|
||||||
|
|
@ -27,49 +37,86 @@
|
||||||
#include<vcg/complex/algorithms/inertia.h>
|
#include<vcg/complex/algorithms/inertia.h>
|
||||||
#include<vcg/complex/algorithms/create/platonic.h>
|
#include<vcg/complex/algorithms/create/platonic.h>
|
||||||
|
|
||||||
using namespace vcg;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
class MyEdge;
|
class MyEdge;
|
||||||
class MyFace;
|
class MyFace;
|
||||||
class MyVertex;
|
class MyVertex;
|
||||||
struct MyUsedTypes : public UsedTypes< Use<MyVertex> ::AsVertexType,
|
struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex> ::AsVertexType,
|
||||||
Use<MyEdge> ::AsEdgeType,
|
vcg::Use<MyEdge> ::AsEdgeType,
|
||||||
Use<MyFace> ::AsFaceType>{};
|
vcg::Use<MyFace> ::AsFaceType>{};
|
||||||
|
|
||||||
class MyVertex : public Vertex<MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
|
class MyVertex : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
|
||||||
class MyFace : public Face< MyUsedTypes, face::FFAdj, face::Normal3f, face::VertexRef, face::BitFlags > {};
|
class MyFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::Normal3f, vcg::face::VertexRef, vcg::face::BitFlags > {};
|
||||||
class MyEdge : public Edge<MyUsedTypes>{};
|
class MyEdge : public vcg::Edge<MyUsedTypes>{};
|
||||||
class MyMesh : public tri::TriMesh< vector<MyVertex>, vector<MyFace> , vector<MyEdge> > {};
|
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
MyMesh tet,oct,hex,dod,ico;
|
MyMesh boxMesh,torusMesh;
|
||||||
|
vcg::Matrix33f IT;
|
||||||
|
vcg::Point3f ITv;
|
||||||
|
|
||||||
tri::Hexahedron(hex);
|
vcg::tri::Hexahedron(boxMesh);
|
||||||
tri::Tetrahedron(tet);
|
vcg::Matrix44f ScaleM,TransM;
|
||||||
tri::Octahedron(oct);
|
ScaleM.SetScale(1.0f, 2.0f, 5.0f);
|
||||||
tri::Dodecahedron(dod);
|
TransM.SetTranslate(2.0f,3.0f,4.0f);
|
||||||
tri::Icosahedron(ico);
|
vcg::tri::UpdatePosition<MyMesh>::Matrix(boxMesh,ScaleM);
|
||||||
Matrix44f ScaleM,TransM;
|
vcg::tri::UpdatePosition<MyMesh>::Matrix(boxMesh,TransM);
|
||||||
ScaleM.SetScale(1,2,1);
|
vcg::tri::Inertia<MyMesh> Ib(boxMesh);
|
||||||
TransM.SetTranslate(1,1,1);
|
vcg::Point3f cc = Ib.CenterOfMass();
|
||||||
// tri::UpdatePosition<MyMesh>::Matrix(hex,ScaleM);
|
Ib.InertiaTensorEigen(IT,ITv);
|
||||||
tri::UpdatePosition<MyMesh>::Matrix(hex,TransM);
|
|
||||||
|
|
||||||
tri::Inertia<MyMesh> I;
|
printf("Box of size 2,4,10, centered in (2,3,4)\n");
|
||||||
I.Compute(hex);
|
printf("Volume %f \n",Ib.Mass());
|
||||||
Point3f cc = I.CenterOfMass();
|
|
||||||
printf("Mass %f \n",I.Mass());
|
|
||||||
printf("CenterOfMass %f %f %f\n",cc[0],cc[1],cc[2]);
|
printf("CenterOfMass %f %f %f\n",cc[0],cc[1],cc[2]);
|
||||||
Matrix33f IT;
|
printf("InertiaTensor Values %6.3f %6.3f %6.3f\n",ITv[0],ITv[1],ITv[2]);
|
||||||
Point3f ITv;
|
printf("InertiaTensor Matrix\n");
|
||||||
I.InertiaTensorEigen(IT,ITv);
|
|
||||||
printf("InertiaTensor %f %f %f\n\n",ITv[0],ITv[1],ITv[2]);
|
|
||||||
|
|
||||||
printf("InertiaTensor %f %f %f\n",IT[0][0],IT[0][1],IT[0][2]);
|
printf(" %6.3f %6.3f %6.3f\n",IT[0][0],IT[0][1],IT[0][2]);
|
||||||
printf("InertiaTensor %f %f %f\n",IT[1][0],IT[1][1],IT[1][2]);
|
printf(" %6.3f %6.3f %6.3f\n",IT[1][0],IT[1][1],IT[1][2]);
|
||||||
printf("InertiaTensor %f %f %f\n",IT[2][0],IT[2][1],IT[2][2]);
|
printf(" %6.3f %6.3f %6.3f\n",IT[2][0],IT[2][1],IT[2][2]);
|
||||||
|
|
||||||
|
// Now we have a box with sides (h,w,d) 2,4,10, centered in (2,3,4)
|
||||||
|
// Volume is 80
|
||||||
|
// inertia tensor should be:
|
||||||
|
// I_h = 1/12 m *(w^2+d^2) = 1/12 * 80 * (16+100) = 773.33
|
||||||
|
// I_w = 1/12 m *(h^2+d^2) = 1/12 * 80 * (4+100) = 693.33
|
||||||
|
// I_d = 1/12 m *(h^2+w^2) = 1/12 * 80 * (4+16) = 133.33
|
||||||
|
|
||||||
|
|
||||||
|
vcg::tri::Torus(torusMesh,2,1,1024,512);
|
||||||
|
vcg::tri::Inertia<MyMesh> It(torusMesh);
|
||||||
|
cc = It.CenterOfMass();
|
||||||
|
It.InertiaTensorEigen(IT,ITv);
|
||||||
|
|
||||||
|
printf("\nTorus of radius 2,1\n");
|
||||||
|
printf("Mass %f \n",It.Mass());
|
||||||
|
printf("CenterOfMass %f %f %f\n",cc[0],cc[1],cc[2]);
|
||||||
|
printf("InertiaTensor Values %6.3f %6.3f %6.3f\n",ITv[0],ITv[1],ITv[2]);
|
||||||
|
printf("InertiaTensor Matrix\n");
|
||||||
|
|
||||||
|
printf(" %6.3f %6.3f %6.3f\n",IT[0][0],IT[0][1],IT[0][2]);
|
||||||
|
printf(" %6.3f %6.3f %6.3f\n",IT[1][0],IT[1][1],IT[1][2]);
|
||||||
|
printf(" %6.3f %6.3f %6.3f\n",IT[2][0],IT[2][1],IT[2][2]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Now we have a torus with c = 2, a = 1
|
||||||
|
c = radius of the ring
|
||||||
|
a = radius of the section
|
||||||
|
|
||||||
|
Volume is:
|
||||||
|
V= 2 PI^2 * a^2 * c = ~39.478
|
||||||
|
|
||||||
|
Inertia tensor should be:
|
||||||
|
|
||||||
|
| ( 5/8 a^2 + 1/2 c^2 ) M 0 0 |
|
||||||
|
| 0 ( 5/8 a^2 + 1/2 c^2 ) M 0 | =
|
||||||
|
| 0 0 (3/4 a^2 + c^2) M |
|
||||||
|
|
||||||
|
| ( 5/8+2 ) M 0 0 | | 103.630 0 0 |
|
||||||
|
= | 0 ( 5/8+2 ) M 0 | = | 0 103.630 0 |
|
||||||
|
| 0 0 (3/4+2) M | | 0 0 187.52 |
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue