Warning, file /include/opencascade/Prs3d_BndBox.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _Prs3d_BndBox_H__
0017 #define _Prs3d_BndBox_H__
0018
0019 #include <Bnd_OBB.hxx>
0020 #include <Graphic3d_ArrayOfSegments.hxx>
0021 #include <Graphic3d_ArrayOfTriangles.hxx>
0022 #include <Prs3d_Drawer.hxx>
0023 #include <Prs3d_Presentation.hxx>
0024 #include <Prs3d_Root.hxx>
0025
0026
0027 class Prs3d_BndBox : public Prs3d_Root
0028 {
0029 public:
0030
0031
0032
0033
0034 Standard_EXPORT static void Add(const occ::handle<Prs3d_Presentation>& thePresentation,
0035 const Bnd_Box& theBndBox,
0036 const occ::handle<Prs3d_Drawer>& theDrawer);
0037
0038
0039
0040
0041
0042 Standard_EXPORT static void Add(const occ::handle<Prs3d_Presentation>& thePresentation,
0043 const Bnd_OBB& theBndBox,
0044 const occ::handle<Prs3d_Drawer>& theDrawer);
0045
0046 public:
0047
0048
0049 static occ::handle<Graphic3d_ArrayOfSegments> FillSegments(const Bnd_OBB& theBox)
0050 {
0051 if (theBox.IsVoid())
0052 {
0053 return occ::handle<Graphic3d_ArrayOfSegments>();
0054 }
0055
0056 occ::handle<Graphic3d_ArrayOfSegments> aSegs = new Graphic3d_ArrayOfSegments(8, 12 * 2);
0057 FillSegments(aSegs, theBox);
0058 return aSegs;
0059 }
0060
0061
0062
0063 static occ::handle<Graphic3d_ArrayOfSegments> FillSegments(const Bnd_Box& theBox)
0064 {
0065 if (theBox.IsVoid())
0066 {
0067 return occ::handle<Graphic3d_ArrayOfSegments>();
0068 }
0069
0070 occ::handle<Graphic3d_ArrayOfSegments> aSegs = new Graphic3d_ArrayOfSegments(8, 12 * 2);
0071 FillSegments(aSegs, theBox);
0072 return aSegs;
0073 }
0074
0075
0076
0077
0078
0079 static void FillSegments(const occ::handle<Graphic3d_ArrayOfSegments>& theSegments,
0080 const Bnd_OBB& theBox)
0081 {
0082 if (!theBox.IsVoid())
0083 {
0084 gp_Pnt aXYZ[8];
0085 theBox.GetVertex(aXYZ);
0086 fillSegments(theSegments, aXYZ);
0087 }
0088 }
0089
0090
0091
0092
0093
0094 static void FillSegments(const occ::handle<Graphic3d_ArrayOfSegments>& theSegments,
0095 const Bnd_Box& theBox)
0096 {
0097 if (!theBox.IsVoid())
0098 {
0099 const gp_Pnt aMin = theBox.CornerMin();
0100 const gp_Pnt aMax = theBox.CornerMax();
0101 const gp_Pnt aXYZ[8] = {
0102 gp_Pnt(aMin.X(), aMin.Y(), aMin.Z()),
0103 gp_Pnt(aMax.X(), aMin.Y(), aMin.Z()),
0104 gp_Pnt(aMin.X(), aMax.Y(), aMin.Z()),
0105 gp_Pnt(aMax.X(), aMax.Y(), aMin.Z()),
0106 gp_Pnt(aMin.X(), aMin.Y(), aMax.Z()),
0107 gp_Pnt(aMax.X(), aMin.Y(), aMax.Z()),
0108 gp_Pnt(aMin.X(), aMax.Y(), aMax.Z()),
0109 gp_Pnt(aMax.X(), aMax.Y(), aMax.Z()),
0110 };
0111 fillSegments(theSegments, aXYZ);
0112 }
0113 }
0114
0115 public:
0116
0117
0118
0119
0120 static void fillSegments(const occ::handle<Graphic3d_ArrayOfSegments>& theSegments,
0121 const gp_Pnt* theBox)
0122 {
0123 const int aFrom = theSegments->VertexNumber();
0124 for (int aVertIter = 0; aVertIter < 8; ++aVertIter)
0125 {
0126 theSegments->AddVertex(theBox[aVertIter]);
0127 }
0128
0129 theSegments->AddEdges(aFrom + 1, aFrom + 2);
0130 theSegments->AddEdges(aFrom + 3, aFrom + 4);
0131 theSegments->AddEdges(aFrom + 5, aFrom + 6);
0132 theSegments->AddEdges(aFrom + 7, aFrom + 8);
0133
0134 theSegments->AddEdges(aFrom + 1, aFrom + 3);
0135 theSegments->AddEdges(aFrom + 2, aFrom + 4);
0136 theSegments->AddEdges(aFrom + 5, aFrom + 7);
0137 theSegments->AddEdges(aFrom + 6, aFrom + 8);
0138
0139 theSegments->AddEdges(aFrom + 1, aFrom + 5);
0140 theSegments->AddEdges(aFrom + 2, aFrom + 6);
0141 theSegments->AddEdges(aFrom + 3, aFrom + 7);
0142 theSegments->AddEdges(aFrom + 4, aFrom + 8);
0143 }
0144 };
0145
0146 #endif