58 fX(
x), fY(
y), fZ(z), fColor(color)
61class Sphere :
public Shape
107 Double_t origin[3] = { 0.0, 0.0, 0.0 };
108 Double_t halfLength[3] = { fRadius, fRadius, fRadius };
136class Box :
public Shape
156 fDX(dX), fDY(dY), fDZ(dZ)
184 Double_t origin[3] = { fX, fY, fZ };
185 Double_t halfLength[3] = { fDX, fDY, fDZ };
200 buffer.
fPnts[ 0] = fX - fDX; buffer.
fPnts[ 1] = fY - fDY; buffer.
fPnts[ 2] = fZ - fDZ;
201 buffer.
fPnts[ 3] = fX + fDX; buffer.
fPnts[ 4] = fY - fDY; buffer.
fPnts[ 5] = fZ - fDZ;
202 buffer.
fPnts[ 6] = fX + fDX; buffer.
fPnts[ 7] = fY + fDY; buffer.
fPnts[ 8] = fZ - fDZ;
203 buffer.
fPnts[ 9] = fX - fDX; buffer.
fPnts[10] = fY + fDY; buffer.
fPnts[11] = fZ - fDZ;
204 buffer.
fPnts[12] = fX - fDX; buffer.
fPnts[13] = fY - fDY; buffer.
fPnts[14] = fZ + fDZ;
205 buffer.
fPnts[15] = fX + fDX; buffer.
fPnts[16] = fY - fDY; buffer.
fPnts[17] = fZ + fDZ;
206 buffer.
fPnts[18] = fX + fDX; buffer.
fPnts[19] = fY + fDY; buffer.
fPnts[20] = fZ + fDZ;
207 buffer.
fPnts[21] = fX - fDX; buffer.
fPnts[22] = fY + fDY; buffer.
fPnts[23] = fZ + fDZ;
212 buffer.
fSegs[ 0] = fColor ; buffer.
fSegs[ 1] = 0 ; buffer.
fSegs[ 2] = 1 ;
213 buffer.
fSegs[ 3] = fColor ; buffer.
fSegs[ 4] = 1 ; buffer.
fSegs[ 5] = 2 ;
214 buffer.
fSegs[ 6] = fColor ; buffer.
fSegs[ 7] = 2 ; buffer.
fSegs[ 8] = 3 ;
215 buffer.
fSegs[ 9] = fColor ; buffer.
fSegs[10] = 3 ; buffer.
fSegs[11] = 0 ;
216 buffer.
fSegs[12] = fColor ; buffer.
fSegs[13] = 4 ; buffer.
fSegs[14] = 5 ;
217 buffer.
fSegs[15] = fColor ; buffer.
fSegs[16] = 5 ; buffer.
fSegs[17] = 6 ;
218 buffer.
fSegs[18] = fColor ; buffer.
fSegs[19] = 6 ; buffer.
fSegs[20] = 7 ;
219 buffer.
fSegs[21] = fColor ; buffer.
fSegs[22] = 7 ; buffer.
fSegs[23] = 4 ;
220 buffer.
fSegs[24] = fColor ; buffer.
fSegs[25] = 0 ; buffer.
fSegs[26] = 4 ;
221 buffer.
fSegs[27] = fColor ; buffer.
fSegs[28] = 1 ; buffer.
fSegs[29] = 5 ;
222 buffer.
fSegs[30] = fColor ; buffer.
fSegs[31] = 2 ; buffer.
fSegs[32] = 6 ;
223 buffer.
fSegs[33] = fColor ; buffer.
fSegs[34] = 3 ; buffer.
fSegs[35] = 7 ;
230 buffer.
fPols[ 0] = fColor ; buffer.
fPols[ 1] = 4 ; buffer.
fPols[ 2] = 8 ;
232 buffer.
fPols[ 6] = fColor ; buffer.
fPols[ 7] = 4 ; buffer.
fPols[ 8] = 9 ;
234 buffer.
fPols[12] = fColor ; buffer.
fPols[13] = 4 ; buffer.
fPols[14] = 10 ;
236 buffer.
fPols[18] = fColor ; buffer.
fPols[19] = 4 ; buffer.
fPols[20] = 11 ;
238 buffer.
fPols[24] = fColor ; buffer.
fPols[25] = 4 ; buffer.
fPols[26] = 1 ;
240 buffer.
fPols[30] = fColor ; buffer.
fPols[31] = 4 ; buffer.
fPols[32] = 7 ;
249class SBPyramid :
public Shape
270 fDX(dX), fDY(dY), fDZ(dZ)
298 Double_t halfLength[3] = { fDX, fDY, fDZ/2.0 };
299 Double_t origin[3] = { fX , fY, fZ + halfLength[2]};
314 buffer.
fPnts[ 0] = fX - fDX; buffer.
fPnts[ 1] = fY - fDY; buffer.
fPnts[ 2] = fZ;
315 buffer.
fPnts[ 3] = fX + fDX; buffer.
fPnts[ 4] = fY - fDY; buffer.
fPnts[ 5] = fZ;
316 buffer.
fPnts[ 6] = fX + fDX; buffer.
fPnts[ 7] = fY + fDY; buffer.
fPnts[ 8] = fZ;
317 buffer.
fPnts[ 9] = fX - fDX; buffer.
fPnts[10] = fY + fDY; buffer.
fPnts[11] = fZ;
318 buffer.
fPnts[12] = fX; buffer.
fPnts[13] = fY ; buffer.
fPnts[14] = fZ + fDZ;
324 buffer.
fSegs[ 0] = fColor ; buffer.
fSegs[ 1] = 0 ; buffer.
fSegs[ 2] = 1 ;
325 buffer.
fSegs[ 3] = fColor ; buffer.
fSegs[ 4] = 1 ; buffer.
fSegs[ 5] = 2 ;
326 buffer.
fSegs[ 6] = fColor ; buffer.
fSegs[ 7] = 2 ; buffer.
fSegs[ 8] = 3 ;
327 buffer.
fSegs[ 9] = fColor ; buffer.
fSegs[10] = 3 ; buffer.
fSegs[11] = 0 ;
328 buffer.
fSegs[12] = fColor ; buffer.
fSegs[13] = 0 ; buffer.
fSegs[14] = 4 ;
329 buffer.
fSegs[15] = fColor ; buffer.
fSegs[16] = 1 ; buffer.
fSegs[17] = 4 ;
330 buffer.
fSegs[18] = fColor ; buffer.
fSegs[19] = 2 ; buffer.
fSegs[20] = 4 ;
331 buffer.
fSegs[21] = fColor ; buffer.
fSegs[22] = 3 ; buffer.
fSegs[23] = 4 ;
338 buffer.
fPols[ 0] = fColor ; buffer.
fPols[ 1] = 4 ; buffer.
fPols[ 2] = 0 ;
341 buffer.
fPols[ 6] = fColor ; buffer.
fPols[ 7] = 3 ; buffer.
fPols[ 8] = 0 ;
343 buffer.
fPols[11] = fColor ; buffer.
fPols[12] = 3 ; buffer.
fPols[13] = 1 ;
345 buffer.
fPols[16] = fColor ; buffer.
fPols[17] = 3 ; buffer.
fPols[18] = 2 ;
347 buffer.
fPols[21] = fColor ; buffer.
fPols[22] = 3 ; buffer.
fPols[23] = 3 ;
366 std::vector<Shape *> fShapes;
378 aShape =
new Sphere(
kYellow, 80.0, 60.0, 120.0, 10.0);
379 fShapes.push_back(aShape);
380 aShape =
new Box(
kRed, 0.0, 0.0, 0.0, 20.0, 20.0, 20.0);
381 fShapes.push_back(aShape);
382 aShape =
new Box(
kBlue, 50.0, 100.0, 200.0, 5.0, 10.0, 15.0);
383 fShapes.push_back(aShape);
384 aShape =
new SBPyramid(
kGreen, 20.0, 25.0, 45.0, 30.0, 30.0, 90.0);
385 fShapes.push_back(aShape);
414 std::vector<Shape *>::const_iterator ShapeIt = fShapes.begin();
416 while (ShapeIt != fShapes.end()) {
420 TBuffer3D & buffer = shape->GetBuffer3D(reqSections);
424 shape->GetBuffer3D(reqSections);
435 printf(
"\n\nviewer3DLocal: This frame demonstates local frame use of 3D viewer architecture.\n");
436 printf(
"Creates sphere, two boxes and a square based pyramid, described in local frame.\n");
437 printf(
"We do not implement raw tesselation of sphere - hence will not appear in viewers\n");
438 printf(
"which do not support in natively (non-GL viewer).\n\n");
440 MyGeom * myGeom =
new MyGeom;
#define ClassDef(name, id)
Use this attribute class when an object should have 3D capabilities.
Sphere description class - see TBuffer3DTypes for producer classes Supports hollow and cut spheres.
Generic 3D primitive description class.
void SetLocalMasterIdentity()
Set kRaw tessellation section of buffer with supplied sizes.
Double_t fLocalMaster[16]
void ClearSectionsValid()
Clear any sections marked valid.
void SetSectionsValid(UInt_t mask)
void SetAABoundingBox(const Double_t origin[3], const Double_t halfLengths[3])
Set fBBVertex in kBoundingBox section to a axis aligned (local) BB using supplied origin and box half...
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
Mother of all ROOT objects.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
Abstract 3D shapes viewer.
virtual Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=nullptr)=0