// @(#)root/eve:$Id$ // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 /************************************************************************* * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #include "TEveTriangleSet.h" #include "TEveRGBAPalette.h" #include "TEveManager.h" #include "TMath.h" #include "TVector3.h" #include "TRandom3.h" //______________________________________________________________________________ // // Made from a list of vertices and a list of triangles (triplets of // vertex indices). // // If input is composed from triangles with direct vertex coordinates // one should consider finding all occurences of the same vertex // and specifying it only once. // ClassImp(TEveTriangleSet); //______________________________________________________________________________ TEveTriangleSet::TEveTriangleSet(Int_t nv, Int_t nt, Bool_t norms, Bool_t cols) : TEveElementList("TEveTriangleSet", "", kTRUE), fNVerts (nv), fVerts(0), fNTrings (nt), fTrings(0), fTringNorms(0), fTringCols(0) { // Constructor. InitMainTrans(); fVerts = new Float_t[3*fNVerts]; fTrings = new Int_t [3*fNTrings]; fTringNorms = (norms) ? new Float_t[3*fNTrings] : 0; fTringCols = (cols) ? new UChar_t[3*fNTrings] : 0; } //______________________________________________________________________________ TEveTriangleSet::~TEveTriangleSet() { // Destructor. delete [] fVerts; delete [] fTrings; delete [] fTringNorms; delete [] fTringCols; } /******************************************************************************/ //______________________________________________________________________________ void TEveTriangleSet::GenerateTriangleNormals() { // Generate triangle normals via cross product of triangle edges. if (fTringNorms == 0) fTringNorms = new Float_t[3*fNTrings]; TVector3 e1, e2, n; Float_t *norm = fTringNorms; Int_t *tring = fTrings; for(Int_t t=0; tRedraw3D(); } /******************************************************************************/ //______________________________________________________________________________ void TEveTriangleSet::ComputeBBox() { // Compute bounding box. // Virtual from TAttBBox. if (fNVerts <= 0) { BBoxZero(); return; } BBoxInit(); Float_t* v = fVerts; for (Int_t i=0; iVertex(0); for (Int_t i=0; iTriangle(0); for (Int_t i=0; i