- aView->Projects(Xmin,Ymin,Zmin,U,V,W) ;
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {
- Npoint++ ; theX += Xmin ; theY += Ymin ; theZ += Zmin ;
- }
- aView->Projects(Xmax,Ymin,Zmin,U,V,W) ;
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {
- Npoint++ ; theX += Xmax ; theY += Ymin ; theZ += Zmin ;
- }
- aView->Projects(Xmin,Ymax,Zmin,U,V,W) ;
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {
- Npoint++ ; theX += Xmin ; theY += Ymax ; theZ += Zmin ;
- }
- aView->Projects(Xmax,Ymax,Zmin,U,V,W) ;
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {
- Npoint++ ; theX += Xmax ; theY += Ymax ; theZ += Zmin ;
- }
- aView->Projects(Xmin,Ymin,Zmax,U,V,W) ;
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {
- Npoint++ ; theX += Xmin ; theY += Ymin ; theZ += Zmax ;
- }
- aView->Projects(Xmax,Ymin,Zmax,U,V,W) ;
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {
- Npoint++ ; theX += Xmax ; theY += Ymin ; theZ += Zmax ;
- }
- aView->Projects(Xmin,Ymax,Zmax,U,V,W) ;
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {
- Npoint++ ; theX += Xmin ; theY += Ymax ; theZ += Zmax ;
- }
- aView->Projects(Xmax,Ymax,Zmax,U,V,W) ;
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {
- Npoint++ ; theX += Xmax ; theY += Ymax ; theZ += Zmax ;
- }
+#if OCC_VERSION_LARGE > 0x06070100
+ Bnd_Box aBox = aStructure->MinMaxValues();
+ aXmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X();
+ aYmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y();
+ aZmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Z();
+ aXmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().X();
+ aYmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Y();
+ aZmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Z();
+#else
+ aStructure->MinMaxValues( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
+#endif
+
+ // Infinite structures are skipped
+ Standard_Real aLIM = ShortRealLast() - 1.0;
+ if ( Abs( aXmin ) > aLIM || Abs( aYmin ) > aLIM || Abs( aZmin ) > aLIM
+ || Abs( aXmax ) > aLIM || Abs( aYmax ) > aLIM || Abs( aZmax ) > aLIM ) {
+ continue;
+ }
+
+ gp_Pnt aPoints[8] = {
+ gp_Pnt( aXmin, aYmin, aZmin ), gp_Pnt( aXmin, aYmin, aZmax ),
+ gp_Pnt( aXmin, aYmax, aZmin ), gp_Pnt( aXmin, aYmax, aZmax ),
+ gp_Pnt( aXmax, aYmin, aZmin ), gp_Pnt( aXmax, aYmin, aZmax ),
+ gp_Pnt( aXmax, aYmax, aZmin ), gp_Pnt( aXmax, aYmax, aZmax )
+ };
+
+ for ( Standard_Integer aPointIt = 0; aPointIt < 8; ++aPointIt ) {
+ const gp_Pnt& aBBPoint = aPoints[aPointIt];
+
+#if OCC_VERSION_LARGE > 0x06070100
+ gp_Pnt aProjected = aView3d->Camera()->Project( aBBPoint );
+ const Standard_Real& U = aProjected.X();
+ const Standard_Real& V = aProjected.Y();
+#else
+ Standard_Real U = 0.0;
+ Standard_Real V = 0.0;
+ Standard_Real W = 0.0;
+ aView3d->View()->Projects( aBBPoint.X(), aBBPoint.Y(), aBBPoint.Z(), U, V, W );
+#endif
+
+ if (U >= aScreenLimits[0]
+ && U <= aScreenLimits[1]
+ && V >= aScreenLimits[2]
+ && V <= aScreenLimits[3])
+ {
+ aPointsNb++;
+ theX += aBBPoint.X();
+ theY += aBBPoint.Y();
+ theZ += aBBPoint.Z();