58class Sphere :
public Shape {
74 : Shape(color,
x,
y, z), fRadius(radius)
103 Double_t origin[3] = {0.0, 0.0, 0.0};
104 Double_t halfLength[3] = {fRadius, fRadius, fRadius};
132class Box :
public Shape {
148 : Shape(color,
x,
y, z), fDX(dX), fDY(dY), fDZ(dZ)
178 Double_t halfLength[3] = {fDX, fDY, fDZ};
186 buffer.
SetRawSizes(8, 3 * 8, 12, 3 * 12, 6, 6 * 6);
193 buffer.
fPnts[0] = fX - fDX;
194 buffer.
fPnts[1] = fY - fDY;
195 buffer.
fPnts[2] = fZ - fDZ;
196 buffer.
fPnts[3] = fX + fDX;
197 buffer.
fPnts[4] = fY - fDY;
198 buffer.
fPnts[5] = fZ - fDZ;
199 buffer.
fPnts[6] = fX + fDX;
200 buffer.
fPnts[7] = fY + fDY;
201 buffer.
fPnts[8] = fZ - fDZ;
202 buffer.
fPnts[9] = fX - fDX;
203 buffer.
fPnts[10] = fY + fDY;
204 buffer.
fPnts[11] = fZ - fDZ;
205 buffer.
fPnts[12] = fX - fDX;
206 buffer.
fPnts[13] = fY - fDY;
207 buffer.
fPnts[14] = fZ + fDZ;
208 buffer.
fPnts[15] = fX + fDX;
209 buffer.
fPnts[16] = fY - fDY;
210 buffer.
fPnts[17] = fZ + fDZ;
211 buffer.
fPnts[18] = fX + fDX;
212 buffer.
fPnts[19] = fY + fDY;
213 buffer.
fPnts[20] = fZ + fDZ;
214 buffer.
fPnts[21] = fX - fDX;
215 buffer.
fPnts[22] = fY + fDY;
216 buffer.
fPnts[23] = fZ + fDZ;
221 buffer.
fSegs[0] = fColor;
224 buffer.
fSegs[3] = fColor;
227 buffer.
fSegs[6] = fColor;
230 buffer.
fSegs[9] = fColor;
231 buffer.
fSegs[10] = 3;
232 buffer.
fSegs[11] = 0;
233 buffer.
fSegs[12] = fColor;
234 buffer.
fSegs[13] = 4;
235 buffer.
fSegs[14] = 5;
236 buffer.
fSegs[15] = fColor;
237 buffer.
fSegs[16] = 5;
238 buffer.
fSegs[17] = 6;
239 buffer.
fSegs[18] = fColor;
240 buffer.
fSegs[19] = 6;
241 buffer.
fSegs[20] = 7;
242 buffer.
fSegs[21] = fColor;
243 buffer.
fSegs[22] = 7;
244 buffer.
fSegs[23] = 4;
245 buffer.
fSegs[24] = fColor;
246 buffer.
fSegs[25] = 0;
247 buffer.
fSegs[26] = 4;
248 buffer.
fSegs[27] = fColor;
249 buffer.
fSegs[28] = 1;
250 buffer.
fSegs[29] = 5;
251 buffer.
fSegs[30] = fColor;
252 buffer.
fSegs[31] = 2;
253 buffer.
fSegs[32] = 6;
254 buffer.
fSegs[33] = fColor;
255 buffer.
fSegs[34] = 3;
256 buffer.
fSegs[35] = 7;
263 buffer.
fPols[0] = fColor;
269 buffer.
fPols[6] = fColor;
273 buffer.
fPols[10] = 10;
274 buffer.
fPols[11] = 1;
275 buffer.
fPols[12] = fColor;
276 buffer.
fPols[13] = 4;
277 buffer.
fPols[14] = 10;
278 buffer.
fPols[15] = 6;
279 buffer.
fPols[16] = 11;
280 buffer.
fPols[17] = 2;
281 buffer.
fPols[18] = fColor;
282 buffer.
fPols[19] = 4;
283 buffer.
fPols[20] = 11;
284 buffer.
fPols[21] = 7;
285 buffer.
fPols[22] = 8;
286 buffer.
fPols[23] = 3;
287 buffer.
fPols[24] = fColor;
288 buffer.
fPols[25] = 4;
289 buffer.
fPols[26] = 1;
290 buffer.
fPols[27] = 2;
291 buffer.
fPols[28] = 3;
292 buffer.
fPols[29] = 0;
293 buffer.
fPols[30] = fColor;
294 buffer.
fPols[31] = 4;
295 buffer.
fPols[32] = 7;
296 buffer.
fPols[33] = 6;
297 buffer.
fPols[34] = 5;
298 buffer.
fPols[35] = 4;
306class SBPyramid :
public Shape {
309 ~SBPyramid()
override{};
323 : Shape(color,
x,
y, z), fDX(dX), fDY(dY), fDZ(dZ)
352 Double_t halfLength[3] = {fDX, fDY, fDZ / 2.0};
353 Double_t origin[3] = {fX, fY, fZ + halfLength[2]};
361 buffer.
SetRawSizes(5, 3 * 5, 8, 3 * 8, 5, 6 + 4 * 5);
368 buffer.
fPnts[0] = fX - fDX;
369 buffer.
fPnts[1] = fY - fDY;
370 buffer.
fPnts[2] = fZ;
371 buffer.
fPnts[3] = fX + fDX;
372 buffer.
fPnts[4] = fY - fDY;
373 buffer.
fPnts[5] = fZ;
374 buffer.
fPnts[6] = fX + fDX;
375 buffer.
fPnts[7] = fY + fDY;
376 buffer.
fPnts[8] = fZ;
377 buffer.
fPnts[9] = fX - fDX;
378 buffer.
fPnts[10] = fY + fDY;
379 buffer.
fPnts[11] = fZ;
380 buffer.
fPnts[12] = fX;
381 buffer.
fPnts[13] = fY;
382 buffer.
fPnts[14] = fZ + fDZ;
388 buffer.
fSegs[0] = fColor;
391 buffer.
fSegs[3] = fColor;
394 buffer.
fSegs[6] = fColor;
397 buffer.
fSegs[9] = fColor;
398 buffer.
fSegs[10] = 3;
399 buffer.
fSegs[11] = 0;
400 buffer.
fSegs[12] = fColor;
401 buffer.
fSegs[13] = 0;
402 buffer.
fSegs[14] = 4;
403 buffer.
fSegs[15] = fColor;
404 buffer.
fSegs[16] = 1;
405 buffer.
fSegs[17] = 4;
406 buffer.
fSegs[18] = fColor;
407 buffer.
fSegs[19] = 2;
408 buffer.
fSegs[20] = 4;
409 buffer.
fSegs[21] = fColor;
410 buffer.
fSegs[22] = 3;
411 buffer.
fSegs[23] = 4;
418 buffer.
fPols[0] = fColor;
425 buffer.
fPols[6] = fColor;
429 buffer.
fPols[10] = 5;
430 buffer.
fPols[11] = fColor;
431 buffer.
fPols[12] = 3;
432 buffer.
fPols[13] = 1;
433 buffer.
fPols[14] = 5;
434 buffer.
fPols[15] = 6;
435 buffer.
fPols[16] = fColor;
436 buffer.
fPols[17] = 3;
437 buffer.
fPols[18] = 2;
438 buffer.
fPols[19] = 6;
439 buffer.
fPols[20] = 7;
440 buffer.
fPols[21] = fColor;
441 buffer.
fPols[22] = 3;
442 buffer.
fPols[23] = 3;
443 buffer.
fPols[24] = 7;
444 buffer.
fPols[25] = 4;
461 std::vector<Shape *> fShapes;
473 aShape =
new Sphere(
kYellow, 80.0, 60.0, 120.0, 10.0);
474 fShapes.push_back(aShape);
475 aShape =
new Box(
kRed, 0.0, 0.0, 0.0, 20.0, 20.0, 20.0);
476 fShapes.push_back(aShape);
477 aShape =
new Box(
kBlue, 50.0, 100.0, 200.0, 5.0, 10.0, 15.0);
478 fShapes.push_back(aShape);
479 aShape =
new SBPyramid(
kGreen, 20.0, 25.0, 45.0, 30.0, 30.0, 90.0);
480 fShapes.push_back(aShape);
509 std::vector<Shape *>::const_iterator ShapeIt = fShapes.begin();
511 while (ShapeIt != fShapes.end()) {
515 TBuffer3D &buffer = shape->GetBuffer3D(reqSections);
519 shape->GetBuffer3D(reqSections);
530 printf(
"\n\nviewer3DLocal: This frame demonstates local frame use of 3D viewer architecture.\n");
531 printf(
"Creates sphere, two boxes and a square based pyramid, described in local frame.\n");
532 printf(
"We do not implement raw tesselation of sphere - hence will not appear in viewers\n");
533 printf(
"which do not support in natively (non-GL viewer).\n\n");
535 MyGeom *myGeom =
new MyGeom;
#define ClassDefOverride(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