92 Error(
name,
"number of x-y points for %s must be at least three!",
name);
96 Error(
name,
"number of z points for %s must be at least two!",
name);
133 xtru.TXTRU::Copy(*
this);
148 if (
fZ)
delete []
fZ;
170 rhs.TXTRU::Copy(*
this);
180 auto &tgt =
static_cast<TXTRU &
>(obj);
182 delete [] tgt.
fXvtx; tgt.fXvtx =
nullptr;
183 delete [] tgt.fYvtx; tgt.fYvtx =
nullptr;
184 delete [] tgt.fZ; tgt.fZ =
nullptr;
185 delete [] tgt.fScale; tgt.fScale =
nullptr;
186 delete [] tgt.fX0; tgt.fX0 =
nullptr;
187 delete [] tgt.fY0; tgt.fY0 =
nullptr;
195 tgt.fXvtx[i] =
fXvtx[i];
196 tgt.fYvtx[i] =
fYvtx[i];
207 tgt.fScale[j] =
fScale[j];
229 Int_t newNalloc = iz + 1;
235 for (i = 0; i < newNalloc; i++) {
282 Int_t newNalloc = ipt + 1;
286 for (i = 0; i < newNalloc; i++) {
325 if ((
n < 0) || (
n >=
fNxy)) {
336 if ((
n < 0) || (
n >=
fNxy)) {
347 if ((
n < 0) || (
n >=
fNz)) {
358 if ((
n < 0) || (
n >=
fNz)) {
369 if ((
n < 0) || (
n >=
fNz)) {
380 if ((
n < 0) || (
n >=
fNz)) {
399 printf(
"TXTRU %s Nxy=%d [of %d] Nz=%d [of %d] Option=%s\n",
402 const char *shape = 0;
403 const char *zorder = 0;
408 case kConvexCCW: shape =
"Convex CCW ";
break;
409 case kConvexCW: shape =
"Convex CW ";
break;
411 case kConcaveCW: shape =
"Concave CW ";
break;
417 case kConvexIncZ: zorder =
"Convex Increasing Z";
break;
418 case kConvexDecZ: zorder =
"Convex Decreasing Z";
break;
419 case kConcaveIncZ: zorder =
"Concave Increasing Z";
break;
420 case kConcaveDecZ: zorder =
"Concave Decreasing Z";
break;
423 printf(
" XY shape '%s', '%s'\n",shape,zorder);
435 const char *
name = 0;
442 for (ixyz=0; ixyz<6; ixyz++) {
444 case 0:
p =
fXvtx;
name =
"x"; nlimit = nxy;
break;
445 case 1:
p =
fYvtx;
name =
"y"; nlimit = nxy;
break;
446 case 2:
p =
fZ;
name =
"z"; nlimit = nz;
break;
447 case 3:
p =
fScale;
name =
"scale"; nlimit = nz;
break;
448 case 4:
p =
fX0;
name =
"x0"; nlimit = nz;
break;
449 case 5:
p =
fY0;
name =
"y0"; nlimit = nz;
break;
451 if (ixyz<=1 && !print_vtx)
continue;
452 if (ixyz>=2 && !print_z)
continue;
454 printf(
" Float_t %s[] = \n { %10g",
name,*
p++);
456 for (i=1;i<nlimit;i++) {
457 printf(
", %10g",*
p++);
458 if (i%6==5) printf(
"\n ");
472 Int_t ipt, ixy, iz, ioff;
485 for (i=0; i<
fNz; i++) {
486 iz = (reversez) ?
fNz-1 - i : i;
488 for (j=0; j<
fNxy; j++) {
489 ixy = (iscw) ?
fNxy-1 - j : j;
528 <<
" TXTRU::SplitConcavePolygon is not yet implemented" << std::endl;
537 if ((npts < 0) || (npts >
fNxy)) {
549 if ((nz < 0) || (nz >
fNz)) {
550 Error(
fName,
"truncate to %d impossible on %d points",nz,
fNz);
568 plus = minus = zero = 0;
570 for (ixy=0; ixy<
fNxy; ixy++) {
582 Float_t xprod = dxprev*dynext - dxnext*dyprev;
586 }
else if (xprod < 0) {
597 if (plus==0 || minus==0) {
616 plus = minus = zero = 0;
619 for (iz=0; iz<
fNz; iz++) {
635 }
else if (iz==
fNz-1) {
640 Float_t xprod = dznext*dsprev - dzprev*dsnext;
644 }
else if (xprod < 0) {
653 if (
fNz<1 || scaleSignChange) {
657 if (plus==0 || minus==0) {
680 std::cout <<
"TXTRU::DumpPoints - " << npoints <<
" points" << std::endl;
684 for (ipt=0; ipt<npoints; ipt++) {
685 x = pointbuff[ioff++];
686 y = pointbuff[ioff++];
687 z = pointbuff[ioff++];
688 printf(
" [%4d] %6.1f %6.1f %6.1f \n",ipt,
x,
y,z);
697 std::cout <<
"TXTRU::DumpSegments - " << nsegments <<
" segments" << std::endl;
701 for (iseg=0; iseg<nsegments; iseg++) {
702 icol = segbuff[ioff++];
703 p1 = segbuff[ioff++];
704 p2 = segbuff[ioff++];
705 printf(
" [%4d] %3d (%4d,%4d)\n",iseg,icol,p1,p2);
714 std::cout <<
"TXTRU::DumpPolygons - " << npolygons <<
" polygons" << std::endl;
716 int icol, nseg, iseg;
718 for (ipoly=0; ipoly<npolygons; ipoly++) {
719 icol = polybuff[ioff++];
720 nseg = polybuff[ioff++];
722 std::cout <<
" [" << std::setw(4) << ipoly <<
"] icol " << std::setw(3) << icol
723 <<
" nseg " << std::setw(3) << nseg <<
" (";
725 printf(
" [%d4] icol %d3 nseg %d3 (", ipoly, icol, nseg);
727 for (iseg=0; iseg<nseg-1; iseg++) {
728 std::cout << polybuff[ioff++] <<
",";
730 std::cout << polybuff[ioff++] <<
")" << std::endl;
732 std::cout <<
" buffer size " << buffsize <<
" last used " << --ioff << std::endl;
755 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*(nbPols-2)+2*(2+
fNxy))) {
773 for (i=0; i<
fNz; i++) {
777 for (j=0; j<
fNxy; j++) {
780 buffer.
fSegs[indx++] = indx2+j;
781 buffer.
fSegs[indx++] = indx2+k;
784 for (i=0; i<
fNz-1; i++) {
788 for (j=0; j<
fNxy; j++) {
791 buffer.
fSegs[indx++] = indx2+j;
792 buffer.
fSegs[indx++] = indx2+k;
800 for (i=0; i<
fNz-1; i++) {
802 for (j=0; j<
fNxy; j++) {
804 buffer.
fPols[indx++] =
c+j%3;
805 buffer.
fPols[indx++] = 4;
806 buffer.
fPols[indx++] = indx2+j;
812 buffer.
fPols[indx++] =
c+2;
815 for (j =
fNxy - 1; j >= 0; --j) {
816 buffer.
fPols[indx++] = indx2+j;
823 for (j=0; j<
fNxy; j++) {
824 buffer.
fPols[indx++] = indx2+j;
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
Generic 3D primitive description class.
void SetSectionsValid(UInt_t mask)
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.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual void Copy(TObject &object) const
Copy this to obj.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
This is the base class for all geometry shapes.
Int_t GetBasicColor() const
Get basic color.
Int_t ShapeDistancetoPrimitive(Int_t numPoints, Int_t px, Int_t py)
Distance to primitive.
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections) const
We have to set kRawSize (unless already done) to allocate buffer space before kRaw can be filled.
void TransformPoints(Double_t *points, UInt_t NbPnts) const
Transform points (LocalToMaster)
void ToLower()
Change string to lower-case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void CheckOrdering()
Determine ordering over which to process points, segments, surfaces so that they render correctly.
virtual void DefineVertex(Int_t pointNum, Float_t x, Float_t y)
Set vertex point ipt to (x,y) expand size of array if necessary.
void SplitConcavePolygon(Bool_t split=kTRUE)
(Dis)Enable the splitting of concave polygon outlines into multiple convex polygons.
virtual Float_t GetSectionX0(Int_t secNum) const
Return x0 shift of a z section.
void DumpSegments(int nsegments, int *segbuff) const
Dump the segment info for visual inspection.
TXTRU & operator=(const TXTRU &rhs)
Deep assignment operator.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute the distance from point px,py to a TXTRU by calculating the closest approach to each corner.
virtual Float_t GetOutlinePointX(Int_t pointNum) const
Return x coordinate of a vertex point.
virtual Float_t GetSectionScale(Int_t secNum) const
Return scale factor for a z section.
virtual Float_t GetSectionY0(Int_t secNum) const
Return y0 shift of a z section.
void DumpPolygons(int npolygons, int *polybuff, int buffsize) const
Dump the derived polygon info for visual inspection.
void Copy(TObject &xtru) const override
TXTRU Copy method.
void DumpPoints(int npoints, float *pointbuff) const
Dump the vertex points for visual inspection.
virtual void TruncateNxy(Int_t npts)
Truncate the vertex list.
void Print(Option_t *option="") const override
Dump the info of this TXTRU shape Option:
virtual Float_t GetSectionZ(Int_t secNum) const
Return z of a z section.
const TBuffer3D & GetBuffer3D(Int_t) const override
Get buffer 3d.
virtual void DefineSection(Int_t secNum, Float_t z, Float_t scale=1., Float_t x0=0., Float_t y0=0.)
Set z section iz information expand size of array if necessary.
void SetPoints(Double_t *points) const override
Create TXTRU points in buffer order as expected by other methods (counterclockwise xy,...
void Sizeof3D() const override
Return total X3D needed by TNode::ls (when called with option "x")
TXTRU()
TXTRU shape - default constructor.
~TXTRU() override
TXTRU destructor deallocates arrays.
virtual void TruncateNz(Int_t npts)
Truncate the z section list.
virtual Float_t GetOutlinePointY(Int_t pointNum) const
Return y coordinate of a vertex point.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.