ROOT logo
Gled » GEOM1 » TringTvor

class TringTvor: public ZRCStone

Function Members (Methods)

public:
TringTvor()
TringTvor(const TringTvor&)
TringTvor(Int_t nv, Int_t nt)
TringTvor(Int_t nv, Int_t nt, Bool_t smoothp, Bool_t colp = false, Bool_t texp = false)
virtual~TringTvor()
voidTObject::AbstractMethod(const char* method) const
Int_tAddTriangles(Int_t nt)
Int_tAddVertices(Int_t nv)
virtual voidTObject::AppendPad(Option_t* option = "")
voidAssertBoundingBox()
voidAssertCols()
voidAssertNorms()
voidAssertTexs()
voidAssertTringCols()
voidAssertTringNorms()
Float_tBoundingBoxDiagonal() const
Float_tBoundingBoxHalfDiagonal() const
Float_tBoundingBoxVolume() const
Float_tBoundingBoxXYArea() const
virtual voidTObject::Browse(TBrowser* b)
voidCalculateBoundingBox()
Float_tCalculateTriangleNormal(Int_t ti, Float_t* normal)
Float_tCalculateTriangleNormalAndCog(Int_t ti, Float_t* normal, Float_t* cog)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
UChar_t*Color(Int_t i)
UChar_t*Cols()
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
voidZRCStone::DecRefCount()
virtual voidTObject::Delete(Option_t* option = "")MENU
voidDeletePrimaryArrays()
voidDeleteSecondaryArrays()
voidDeleteTriangleStrips()
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
voidExportPovMesh(ostream& o, Bool_t smoothp = false)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
Int_tFindNeighboursPerVertex(vector<Int_t>* neighbours)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
voidFindTrianglesPerVertex(vector<Int_t>* trings_per_vert)
voidGenerateTriangleColorsFromTriangleStrips()
voidGenerateTriangleColorsFromVertexColors()
voidGenerateTriangleColorsFromVertexColors(set<Int_t>& triangles)
voidGenerateTriangleColorsFromVertexColors(UChar_t* VCA, UChar_t* TCA)
voidGenerateTriangleColorsFromVertexColors(set<Int_t>& triangles, UChar_t* VCA, UChar_t* TCA)
voidGenerateTriangleNormals()
voidGenerateTriangleNormalsAndColors(void (*)(Float_t*, UChar_t*, void*) foo, void* ud)
voidGenerateTriangleStrips(Int_t max_verts = 128)
voidGenerateVertexNormals()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
Float_tGetMaxEdgeLen() const
Float_tGetMaxVertexDistance() const
Float_tGetMinEdgeLen() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
boolHasCols()
virtual ULong_tTObject::Hash() const
boolHasNorms()
boolHasTexs()
Bool_tHasTrianlgeStrips() const
Bool_tHasTringCols()
Bool_tHasTringNorms()
voidZRCStone::IncRefCount()
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidMakeCols()
voidMakeNorms()
voidMakePrimaryArrays()
voidMakeSecondaryArrays(Bool_t smoothp, Bool_t colp = false, Bool_t texp = false)
voidMakeTexs()
voidMakeTringCols()
voidMakeTringNorms()
voidTObject::MayNotUse(const char* method) const
Float_t*Normal(Int_t i)
Float_t*Norms()
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TringTvor&operator=(const TringTvor&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidReset(Int_t nv, Int_t nt)
voidReset(Int_t nv, Int_t nt, Bool_t smoothp, Bool_t colp = false, Bool_t texp = false)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetNormal(Int_t i, Float_t x, Float_t y, Float_t z)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
voidSetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a = 255)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetVertex(Int_t i, const Float_t* q)
voidSetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
Float_tSqrDistanceToVertex(Int_t vi, const Float_t* p)
Float_tSqrLen(const Float_t* a, const Float_t* b)
voidSqrMinMaxEdgeLen(Int_t ti, Float_t& min, Float_t& max)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
Float_t*Texs()
Float_t*Texture(Int_t i)
Int_t*Triangle(Int_t i)
UChar_t*TriangleColor(Int_t i)
Float_t*TriangleNormal(Int_t i)
Bool_tTriangleOtherVertices(Int_t t, Int_t v, Int_t& v_prev, Int_t& v_next)
UChar_t*TringCols()
Float_t*TringNorms()
Int_t*Trings()
virtual voidTObject::UseCurrentStyle()
Float_t*Vertex(Int_t i)
Float_t*Verts()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
voidWipeCols()
voidWipeNorms()
voidWipeTexs()
voidWipeTringCols()
voidWipeTringNorms()
voidWipeTrings()
voidWipeVerts()
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
void_init()

Data Members

public:
Float_tmBBoxHalfDiagonalHalf-length of bounding-box diagonal.
Bool_tmBBoxOK
vector<UChar_t>mColsRGBA color, 4*mNVert
Float_tmCtrExtBox[6]
Float_tmMaxEdgeLen
Float_tmMaxVertexDistanceMaximum distance of any vertex from the origin.
Float_tmMinEdgeLen
Float_tmMinMaxBox[6]
Int_tmNStripEls! Number of trianlge strip vertices (= 2*n-strips + n-of-triangles).
Int_tmNStrips! Number of trianlge strips.
Int_tmNTrings
Int_tmNVerts
vector<Float_t>mNormsNormals, 3*mNVert
Int_t**mStripBegs! [mNStrips] Pointers to strip beginnings into mStripEls, needed for glMultiDrawElements.
Int_t*mStripEls! [mNStripEls] Vertex indices for all strips.
Int_t*mStripLens! [mNStrips] Lengths of strips.
Int_t*mStripTrings! [mNStripEls] Indices of triangles belonging to strip vertices, mNStripEls (first two triangles of each strip are not used). Needed for flat shading.
vector<Float_t>mTexsTexture coordinates, 2*mNVert
vector<UChar_t>mTringColsTriangle colors, 4*mNTrings
vector<Float_t>mTringNormsTriangle normals, 3*mNTrings
vector<Int_t>mTringsVertex-indices of triangles, 3*mNTrings
vector<Float_t>mVertsVertex coordinates, 3*mNVert

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void _init()
TringTvor()
TringTvor(Int_t nv, Int_t nt)
TringTvor(Int_t nv, Int_t nt, Bool_t smoothp, Bool_t colp = false, Bool_t texp = false)
~TringTvor()
void Reset(Int_t nv, Int_t nt)
void Reset(Int_t nv, Int_t nt, Bool_t smoothp, Bool_t colp = false, Bool_t texp = false)
void MakePrimaryArrays()
void DeletePrimaryArrays()
void MakeSecondaryArrays(Bool_t smoothp, Bool_t colp = false, Bool_t texp = false)
void DeleteSecondaryArrays()
Int_t AddVertices(Int_t nv)
 Returns old number of vertices.
Int_t AddTriangles(Int_t nt)
 Returns old number of triangles.
void CalculateBoundingBox()
Float_t BoundingBoxXYArea() const
Float_t BoundingBoxVolume() const
Float_t CalculateTriangleNormal(Int_t ti, Float_t* normal)
 Calculates triangle normal from vertex-data and stores it into 'normal'.
 Returns original norm of the vector.

 This is to be used when triangle normals are not stored or during
 construction of the tvor.
Float_t CalculateTriangleNormalAndCog(Int_t ti, Float_t* normal, Float_t* cog)
 Calculates triangle normal from vertex-data and stores it into
 'normal'. Returns original norm of the vector. Center-of-gravity
 of the triangle is returned in 'cog'.

 This is to be used when triangle normals are not stored or during
 construction of the tvor.
void GenerateTriangleNormals()
void GenerateTriangleColorsFromVertexColors()
void GenerateTriangleColorsFromVertexColors(UChar_t* VCA, UChar_t* TCA)
void GenerateTriangleColorsFromVertexColors(set<Int_t>& triangles)
void GenerateTriangleColorsFromVertexColors(set<Int_t>& triangles, UChar_t* VCA, UChar_t* TCA)
void GenerateTriangleColorsFromTriangleStrips()
 Assign random colors to different triangle strips.
void GenerateVertexNormals()
 Generate per-vertex normals by averaging over normals of all triangles
 sharing the vertex.
 Requires building of intermediate structure.

 ??? Need an argument: weight normal contribution by triangle area
 ??? or ... perhaps better ... by vertex angle.
     This is somewhat done in vertex-connection stuff in Var1::TriMesh.
void FindTrianglesPerVertex(vector<Int_t>* trings_per_vert)
 Populate array of vectors 'trings_per_vert' from triangle data.
 The output array must be properly allocated in advance.
Int_t FindNeighboursPerVertex(vector<Int_t>* neighbours)
 Populate array of vectors 'neighbours' from triangle data.
 The output array must be properly allocated in advance.
 Returns total number of connections (which is 2*N_edge for closed
 surfaces).
void GenerateTriangleStrips(Int_t max_verts = 128)
void DeleteTriangleStrips()
void ExportPovMesh(ostream& o, Bool_t smoothp = false)
 Exports triangle-data as POV mesh2 object.
 By experimentation I would say that smooth triangles do not work properly
 in pov-3.6.1 (15.10.2006).
Bool_t TriangleOtherVertices(Int_t t, Int_t v, Int_t& v_prev, Int_t& v_next)
 Find other two vertices (than v) in triangle t.
 If you do: e1 = v_prev - v, e2 = v_next - v, then: e2 x e1 points
 in the normal direction.
Float_t SqrDistanceToVertex(Int_t vi, const Float_t* p)
 Returns square distance from vertex vi to fiven point p.
Float_t SqrLen(const Float_t* a, const Float_t* b)
 Returns square length of line between a and b.
void SqrMinMaxEdgeLen(Int_t ti, Float_t& min, Float_t& max)
 Stores min and max edge lengths into the passed refs.
bool HasNorms()
{ return ! mNorms.empty(); }
bool HasCols()
{ return ! mCols .empty(); }
bool HasTexs()
{ return ! mTexs .empty(); }
void MakeNorms()
{ mNorms.resize(3*mNVerts); }
void MakeCols()
{ mCols .resize(4*mNVerts); }
void MakeTexs()
{ mTexs .resize(2*mNVerts); }
void AssertNorms()
{ if ( ! HasNorms()) MakeNorms(); }
void AssertCols()
{ if ( ! HasCols()) MakeCols(); }
void AssertTexs()
{ if ( ! HasTexs()) MakeTexs(); }
void WipeVerts()
{ std::vector<Float_t> v; mVerts.swap(v); }
void WipeNorms()
{ std::vector<Float_t> v; mNorms.swap(v); }
void WipeCols()
{ std::vector<UChar_t> v; mCols.swap(v); }
void WipeTexs()
{ std::vector<Float_t> v; mTexs.swap(v); }
Float_t* Verts()
{ return &mVerts[0]; }
Float_t* Norms()
{ return &mNorms[0]; }
UChar_t* Cols()
{ return &mCols[0]; }
Float_t* Texs()
{ return &mTexs[0]; }
Float_t* Vertex(Int_t i)
{ return &(mVerts[3*i]); }
Float_t* Normal(Int_t i)
{ return &(mNorms[3*i]); }
UChar_t* Color(Int_t i)
{ return &(mCols[4*i]); }
Float_t* Texture(Int_t i)
{ return &(mTexs[2*i]); }
Bool_t HasTringNorms()
{ return ! mTringNorms.empty(); }
Bool_t HasTringCols()
{ return ! mTringCols .empty(); }
void MakeTringNorms()
{ mTringNorms.resize(3*mNTrings); }
void MakeTringCols()
{ mTringCols .resize(4*mNTrings); }
void AssertTringNorms()
{ if ( ! HasTringNorms()) MakeTringNorms(); }
void AssertTringCols()
{ if ( ! HasTringCols()) MakeTringCols(); }
void WipeTrings()
{ std::vector<Int_t> v; mTrings.swap(v); }
void WipeTringNorms()
{ std::vector<Float_t> v; mTringNorms.swap(v); }
void WipeTringCols()
{ std::vector<UChar_t> v; mTringCols.swap(v); }
Int_t* Trings()
{ return &mTrings[0]; }
Float_t* TringNorms()
{ return &mTringNorms[0]; }
UChar_t* TringCols()
{ return &mTringCols[0]; }
Int_t* Triangle(Int_t i)
{ return &mTrings[3*i]; }
Float_t* TriangleNormal(Int_t i)
{ return &mTringNorms[3*i]; }
UChar_t* TriangleColor(Int_t i)
{ return &mTringCols[4*i]; }
Bool_t HasTrianlgeStrips() const
{ return mNStripEls != 0; }
TringTvor()
void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
{ Float_t* v = Vertex(i); v[0] = x; v[1] = y; v[2] = z; }
void SetVertex(Int_t i, const Float_t* q)
{ Float_t* v = Vertex(i); v[0] = q[0]; v[1] = q[1]; v[2] = q[2]; }
void SetNormal(Int_t i, Float_t x, Float_t y, Float_t z)
{ Float_t* v = Normal(i); v[0] = x; v[1] = y; v[2] = z; }
void SetTriangle(Int_t i, Int_t v0, Int_t v1, Int_t v2)
{ Int_t* t = Triangle(i); t[0] = v0; t[1] = v1; t[2] = v2; }
void SetTriangleColor(Int_t i, UChar_t r, UChar_t g, UChar_t b, UChar_t a = 255)
{ UChar_t* c = TriangleColor(i); c[0] = r; c[1] = g; c[2] = b; c[3] = a; }
void AssertBoundingBox()
{ if (mBBoxOK == false) CalculateBoundingBox(); }
Float_t GetMaxVertexDistance() const
{ return mMaxVertexDistance; }
Float_t BoundingBoxDiagonal() const
{ return 2.0f * mBBoxHalfDiagonal; }
Float_t BoundingBoxHalfDiagonal() const
{ return mBBoxHalfDiagonal; }
Float_t GetMinEdgeLen() const
{ return mMinEdgeLen; }
Float_t GetMaxEdgeLen() const
{ return mMaxEdgeLen; }
void GenerateTriangleNormalsAndColors(void (*foo)(Float_t*, UChar_t*, void*), void* ud)