|
User Documentation |
|
Centre for Vision, Speech & Signal Processing |
|
PUBLIC |
PolopsC::PolopsC(void)
PolopsC::PolopsC(const char *)
PolopsC::PolopsC(int,int)
PolopsC::PolopsC(const PolopsC &)
PolopsC::operator=(const PolopsC &)
PolopsC::~PolopsC(void)
PolopsC::Copy(void)
PolopsC::PolopsC(DListC,DListC)
PolopsC::PolopsC(PolopsC &,int,int)
PolopsC::PolopsC(PolopsC &,PolopsC &)
PolopsC::SoftLoad(const char *)
PolopsC::Load(const char *)
PolopsC::Save(const char *)
PolopsC::LoadSampler(int)
PolopsC::LoadM(const char *)
PolopsC::SaveM(const char *)
PolopsC::LoadPly(const char *)
PolopsC::SavePly(const char *)
PolopsC::LoadObj(const char *)
PolopsC::LoadObj(const char *,DListC &)
PolopsC::SaveObj(const char *)
PolopsC::SaveObj(const char *,SArray1dC &)
PolopsC::SaveObj(const char *,DListC &)
PolopsC::LoadTpoly(const char *)
PolopsC::SaveTpoly(const char *)
PolopsC::LoadDxf(const char *)
PolopsC::LoadGf(const char *)
PolopsC::SaveGf(const char *)
PolopsC::LoadTri(const char *)
PolopsC::SaveTri(const char *)
PolopsC::SaveDoubleTri(const char *)
PolopsC::SaveVrml1_0C(const char *,BooleanT)
PolopsC::SaveVrml2_0(const char *,BooleanT)
PolopsC::ExportFig(const char *,QuarternC)
PolopsC::ExportVec(const char *)
PolopsC::VSize(void)
PolopsC::FSize(void)
PolopsC::Vertex(int)
PolopsC::PutVert(int,const Vector3dC &)
PolopsC::GetVert(int)
PolopsC::Npoly(int)
PolopsC::PutNpoly(int,int)
PolopsC::Index(int,int)
PolopsC::PutIndex(int,int,int)
PolopsC::GetFace(int)
PolopsC::PutFace(int,int,int,int)
PolopsC::PutFace(int,int,int,int,int)
PolopsC::PutFace(int,int,int)
PolopsC::PutFace(int,FaceT)
PolopsC::Transform(RigidTransC)
PolopsC::Transform(HomtmC)
PolopsC::Scale(double)
PolopsC::ScaleXYZ(double,double,double)
PolopsC::BoxMin(void)
PolopsC::BoxMax(void)
PolopsC::FlipNormals(void)
PolopsC::FaceNormal(int)
PolopsC::Area(int)
PolopsC::AllArea(void)
PolopsC::Check(BooleanT)
PolopsC::MakeAllTriangles(void)
PolopsC::MakeAllFourSided(void)
PolopsC::ReIndex(void)
PolopsC::ForceReIndex(void)
PolopsC::Refine(int)
PolopsC::PurifyFaces(BooleanT)
PolopsC::Purify(BooleanT)
PolopsC::CentreOfMass(void)
|
Comments:
This is general purpose class for Polyehdral data structures. It is
designed to be compact in memory, and is mainly of use for passing
polyhedral data structures between different routines, renderers,
and a variety of data file formats.
It also has the useful operation "purify" which removes duplicated
vertices and reindexes. This is a non-trivial operation, but is made
necessary by some file formats that duplicate vertices.
The strategic decision to limit to only 3 and 4 sided polyhedra
was made because these are both common, and we dont intend to
use this structure for multisided polyhedra.
The array of faces contains vertex numbers 0-indexed.
Each face has an inside and an outside. These are rendered differently.
The ordering of the vertices around an outward pointing normal
should be anti-clockwise. It cannot be guaranteed that an
imported input file satisfies this.
There is no array bound checking on all the fast access functions.
PolopsC is a BIG Object.
The I/O routines do have basic error checks.
The usual policy is that the I/O routine converts 5 or more sided
faces into several 3 sided faces, but 3 and 4 sided faces are untouched
There is no automatic Purify on read, so do it yourself!!
For .tpoly, .dxf and .gf it is important.
All loads are soft except Load, soft means no exit on error.
Files that can be read .dxf .obj .tpoly .gf .tri
Files that can be written .obj .tpoly .gf .tri .wrl
DEPENDENCIES
libPolops.a depends on:
DList, AnGeo3(Vector3d), Misc(RefCountC, SArray1dC, Error,
GfSetC dependency undecided.
poltool also depends on :
Option
Variables:
Methods:
- PolopsC()
-
Constructs an empty polops
- PolopsC(const char * fname)
-
Constructs and use .Load
- PolopsC(int no_of_verts,int no_of_faces)
-
Constructs a polops with space allocated
- PolopsC(const PolopsC & pol)
-
Copy constructor
- PolopsC & operator=(const PolopsC & pol)
-
- ~PolopsC()
-
Destructor
- PolopsC Copy(void)
-
Returns a new copy (big object!)
- PolopsC(DListC<Vector3dC> v,DListC<FaceT> f)
-
Constructs a Polops from two lists, no automatic purify
- PolopsC(PolopsC & p1,int beg,int end)
-
Constructs a Polops from an inclusive subrange of a Polops
- PolopsC(PolopsC & p1,PolopsC & p2)
-
Constructs a Polops from two Polops
- int SoftLoad(const char * fname)
-
Load from any file, if error then return 0 else 1
- void Load(const char * fname)
-
Load from any file, if error then exit
- void Save(const char * fname)
-
Save to file .tri, .m, .obj, .ply, .tpoly, .wrl, .wrl1, .wrl2
no action if filename has zero length
- void LoadSampler(int type)
-
Loads 0=cube 1=icosahedron 2=tetrahedron 3=octahedron 4=dodecahedron
- int LoadM(const char * fname)
-
Load .m file (Stanford).
Needs to be revised to accept a general .m file
- void SaveM(const char * fname)
-
Save .m file (Stanford)
- int LoadPly(const char * fname)
-
Load .ply file, if error then return 0 else 1
- void SavePly(const char * fname)
-
Save .ply file
- int LoadObj(const char * fname)
-
Load .obj file, if error then return 0 else 1
- int LoadObj(const char * fname,DListC<SubGroupT> & groups)
-
Load .obj file.
Can also record the information of named goups.
i=beg; i<=end;
- void SaveObj(const char * fname)
-
Save .obj file
- void SaveObj(const char * fname,SArray1dC<SubGroupT> & groups)
-
- void SaveObj(const char * fname,DListC<SubGroupT> & groups)
-
Save .obj file
- int LoadTpoly(const char * fname)
-
Load .tpoly file.
- void SaveTpoly(const char * fname)
-
Save .tpoly file
- int LoadDxf(const char * fname)
-
Load .dxf file.
- int LoadGf(const char * fname)
-
Load .gf file.
- void SaveGf(const char * fname)
-
Save .gf file
- int LoadTri(const char * fname)
-
Load .tri file.
- void SaveTri(const char * fname)
-
Save to file .tri (12 precision)
- void SaveDoubleTri(const char * fname)
-
Saves data to a .tri file, but with a higher precision, compared to SaveTri().
- int SaveVrml1_0C(const char * fname,BooleanT translate = FALSE)
-
Save to file .wrl VRML Version 1.0C
If translate is true, then the translation to move the object to
the origin is computed, and written into the VRML file.
- int SaveVrml2_0(const char * fname,BooleanT translate = FALSE)
-
Save to file .wrl VRML Version 2.0
If translate is true, then the translation to move the object to
the origin is computed, and written into the VRML file.
- void ExportFig(const char * fname,QuarternC q)
-
Rotate by q, then produce a fig picture sorted along the z axis
- void ExportVec(const char * fname)
-
Export just the vertices in the .vec format
- int VSize()
-
Returns the number of vertices
- int FSize()
-
Returns the number of faces
- Vector3dC Vertex(int i)
-
Returns vertex number i
- void PutVert(int i,const Vector3dC & v)
-
Load v into vertex i
- Vector3dC GetVert(int i)
-
Returns vertex number i
- int Npoly(int f)
-
Returns number of vertices in face f
- void PutNpoly(int f,int npoly)
-
Set face f to have npoly vertices
- int Index(int f,int i)
-
Returns vertex index of i'th vertex in f'th face
- void PutIndex(int f,int i,int v)
-
Sets the vertex index of i'th vertex in f'th face
- FaceT GetFace(int i)
-
Returns face i
- void PutFace(int i,int v0,int v1,int v2)
-
Load the i'th face with a 3 sided face.
- void PutFace(int i,int v0,int v1,int v2,int v3)
-
Load the i'th face with a 4 sided face.
- void PutFace(int i,int npoly,int v[])
-
Load the i'th face with a 3 or 4 sided face.
- void PutFace(int i,FaceT f)
-
Load the i'th face with a 3 or 4 sided face.
- void Transform(RigidTransC rt)
-
Applies the supplied transform to all vertices
- void Transform(HomtmC h)
-
Applies the supplied transform to all vertices
- void Scale(double factor)
-
Applies the scale factor to all vertices
- void ScaleXYZ(double x,double y,double z)
-
Applies the individule x,y,z scale factors to all vertices
- Vector3dC BoxMin(void)
-
Returns a vector with the smallest x, y and z in the Polops
- Vector3dC BoxMax(void)
-
Returns a vector with the largest x, y and z in the Polops
- void FlipNormals()
-
Reverses the direction of the normals by reordering the indices around each face
- Vector3dC FaceNormal(int f)
-
Returns the unit outward normal for specified face
An extra check is done to see if the difference vectors calculated from
the face are close to 0. Meaning that the cross product would be 0, and
that Unit() would be working on 0 length and so producing garbage. The
test uses the const SmallestLengthM as the threshold, see its comments
for more details.
- double Area(int f)
-
Returns the area of face F
- double AllArea()
-
Returns the total area
- BooleanT Check(BooleanT trace)
-
Perform some consistency checks, return TRUE if valid
Check done to see if the difference vectors calculated from the face are
close to 0. See comments associated with const SmallestLengthM
- void MakeAllTriangles()
-
Convert each 4 sided face to 2 3 sided faces
- void MakeAllFourSided()
-
Convert each 3 sided face to 3 four sided faces
- void ReIndex()
-
Changes a 1-indexed data structure to 0-indexed if the structure APPEARS to be 1-indexed (NOT foolproof).
Appropriate if you think it might be 1-indexed but arent sure.
- void ForceReIndex()
-
Changes a 1-indexed data structure to 0-indexed.
- void Refine(int grid_size)
-
This divides each face into grid_size^2 smaller faces.
Eg. grid_size=1 does nothing, 2 makes squares divide into 4
smaller squares.
You will probably want to purify after this.
- void PurifyFaces(BooleanT warn = TRUE)
-
All out of range faces are removed. An optional warning is printed.
- void Purify(BooleanT warn = TRUE)
-
Removes duplicate vertices.
In a PolopsC structure the number of faces in usually constant but
vertices may be duplicated. This happens particularly in some data
files. It is a non trivial exercise to remove duplicated vertices
because of the renumbering. The Purify member function performs
this task.
Calls PurifyFaces
- Vector3dC CentreOfMass(void)
-
Returns the centre of mass.
It simply sums up the vectors (vertices) and divides it by the number
of vertices.
|
Programmer: Andrew Stoddart , Documentation by CxxDoc: Tue Mar 20 10:48:08 2001
|