}
}
-//=======================================================================
-//function : computeDegeneratedTorus
-//purpose : compute bounding box for degenerated torus
-//=======================================================================
-
-static void computeDegeneratedTorus (const gp_Torus& theTorus,
- const Standard_Real theUMin, const Standard_Real theUMax,
- const Standard_Real theVMin, const Standard_Real theVMax,
- Bnd_Box& theB)
-{
- gp_Pnt aP = theTorus.Location();
- Standard_Real aRa = theTorus.MajorRadius();
- Standard_Real aRi = theTorus.MinorRadius();
- Standard_Real aXmin,anYmin,aZmin,aXmax,anYmax,aZmax;
- aXmin = aP.X() - aRa - aRi;
- aXmax = aP.X() + aRa + aRi;
- anYmin = aP.Y() - aRa - aRi;
- anYmax = aP.Y() + aRa + aRi;
- aZmin = aP.Z() - aRi;
- aZmax = aP.Z() + aRi;
-
- Standard_Real aPhi = ACos (-aRa / aRi);
-
- Standard_Real anUper = 2. * M_PI - Precision::PConfusion();
- Standard_Real aVper = 2. * aPhi - Precision::PConfusion();
- if (theUMax - theUMin >= anUper && theVMax - theVMin >= aVper)
- {
- // a whole torus
- theB.Update(aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
- return;
- }
-
- Standard_Real anU,aV;
- Standard_Real anUmax = theUMin + 2. * M_PI;
- const gp_Ax3& aPos = theTorus.Position();
- gp_Pnt aPExt = aP;
- aPExt.SetX(aXmin);
- ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
- anU = ElCLib::InPeriod(anU,theUMin,anUmax);
- if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
- {
- theB.Add(aPExt);
- }
- //
- aPExt.SetX(aXmax);
- ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
- anU = ElCLib::InPeriod(anU,theUMin,anUmax);
- if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
- {
- theB.Add(aPExt);
- }
- aPExt.SetX(aP.X());
- //
- aPExt.SetY(anYmin);
- ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
- anU = ElCLib::InPeriod(anU,theUMin,anUmax);
- if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
- {
- theB.Add(aPExt);
- }
- //
- aPExt.SetY(anYmax);
- ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
- anU = ElCLib::InPeriod(anU,theUMin,anUmax);
- if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
- {
- theB.Add(aPExt);
- }
- aPExt.SetY(aP.Y());
- //
- aPExt.SetZ(aZmin);
- ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
- anU = ElCLib::InPeriod(anU,theUMin,anUmax);
- if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
- {
- theB.Add(aPExt);
- }
- //
- aPExt.SetZ(aZmax);
- ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
- anU = ElCLib::InPeriod(anU,theUMin,anUmax);
- if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
- {
- theB.Add(aPExt);
- }
- //
- // Add boundaries of patch
- // UMin, UMax
- gp_Circ aC = ElSLib::TorusUIso(aPos,aRa,aRi,theUMin);
- BndLib::Add(aC,theVMin,theVMax,0.,theB);
- aC = ElSLib::TorusUIso(aPos,aRa,aRi,theUMax);
- BndLib::Add(aC,theVMin,theVMax,0.,theB);
- // VMin, VMax
- aC = ElSLib::TorusVIso(aPos,aRa,aRi,theVMin);
- BndLib::Add(aC,theUMin,theUMax,0.,theB);
- aC = ElSLib::TorusVIso(aPos,aRa,aRi,theVMax);
- BndLib::Add(aC,theUMin,theUMax,0.,theB);
-}
-
void BndLib::Add(const gp_Sphere& S,const Standard_Real UMin,
const Standard_Real UMax,const Standard_Real VMin,
const Standard_Real VMax,const Standard_Real Tol, Bnd_Box& B)
if (Fi2<Fi1) return;
- if (Ra<Ri)
- {
- computeDegeneratedTorus(S,UMin,UMax,VMin,VMax,B);
- B.Enlarge(Tol);
- return;
- }
-
#define SC 0.71
#define addP0 (Compute(UMin,UMax,Ra+Ri,Ra+Ri,gp_Pnt(S.XAxis().Direction().XYZ()),gp_Pnt(S.YAxis().Direction().XYZ()),S.Location(),B))
#define addP1 (Compute(UMin,UMax,Ra+Ri*SC,Ra+Ri*SC,gp_Pnt(S.XAxis().Direction().XYZ()),gp_Pnt(S.YAxis().Direction().XYZ()),gp_Pnt(S.Location().XYZ()+(Ri*SC)*S.Axis().Direction().XYZ()),B))
#include <Geom_Curve.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx>
-#include <Geom_ToroidalSurface.hxx>
#include <Geom_Surface.hxx>
#include <GProp_GProps.hxx>
#include <Message_Msg.hxx>
}
BRep_Builder B;
- Handle(Geom_ToroidalSurface) aTorSurf = Handle(Geom_ToroidalSurface)::DownCast(mySurf->Surface());
- Standard_Boolean anIsDegeneratedTor = ( aTorSurf.IsNull() ? Standard_False : aTorSurf->MajorRadius() < aTorSurf->MinorRadius() );
-
if ( w1.IsNull() ) return Standard_False;
else if ( w2.IsNull()) {
// For spheres and BSpline cone-like surfaces(bug 24055):
gp_Dir2d d;
Standard_Real aRange;
- if( ismodeu && anIsDegeneratedTor )
- {
- Standard_Real aRa = aTorSurf->MajorRadius();
- Standard_Real aRi = aTorSurf->MinorRadius();
- Standard_Real aPhi = ACos (-aRa / aRi);
- p.SetCoord (0.0, ( ismodeu > 0 ? M_PI + aPhi : aPhi ));
-
- Standard_Real aXCoord = -ismodeu;
- d.SetCoord ( aXCoord, 0.);
- aRange = 2.*M_PI;
- }
- else if ( ismodeu && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
+ if ( ismodeu && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
p.SetCoord ( ( ismodeu < 0 ? 0. : 2.*M_PI ), ismodeu * 0.5 * M_PI );
Standard_Real aXCoord = -ismodeu;
d.SetCoord ( aXCoord, 0.);
// validity of orientation of the open wires in parametric space.
// In case of U closed surface wire with minimal V coordinate should be directed in positive direction by U
// In case of V closed surface wire with minimal U coordinate should be directed in negative direction by V
- if (!vclosed || !uclosed || anIsDegeneratedTor)
+ if (!vclosed || !uclosed)
{
Standard_Real deltaOther = 0.5 * (m2[coord][0] + m2[coord][1]) - 0.5 * (m1[coord][0] + m1[coord][1]);
if (deltaOther * isneg < 0)
// A special kind of FixShifted is necessary for torus-like
// surfaces to adjust wires by period ALONG the missing SEAM direction
// tr9_r0501-ug.stp #187640
- if ( uclosed && vclosed && !anIsDegeneratedTor ) {
+ if ( uclosed && vclosed ) {
Standard_Real shiftw2 =
ShapeAnalysis::AdjustByPeriod ( 0.5 * ( m2[coord][0] + m2[coord][1] ),
0.5 * ( m1[coord][0] + m1[coord][1] +
+++ /dev/null
-puts "===================================="
-puts "0032239: Data Exchange, STEP import - bounding box is too large"
-puts "===================================="
-puts ""
-
-pload ALL
-
-# Read file
-
-stepread [locate_data_file bug32239.STEP] b *
-
-# Check that shape is valid
-
-checkshape b_1
-
-# Check bounding box
-
-set xmin0 -62.992562093513783
-set ymin0 -51.45371311501097
-set zmin0 -33.223762093513777
-set xmax0 43.263112093513783
-set ymax0 33.211062093513789
-set zmax0 37.744962093513792
-set bb [bounding b_1]
-set xmin [lindex $bb 0]
-set ymin [lindex $bb 1]
-set zmin [lindex $bb 2]
-set xmax [lindex $bb 3]
-set ymax [lindex $bb 4]
-set zmax [lindex $bb 5]
-
-if { [expr abs($xmin - $xmin0)] > 1.0e-5 } {
- set bb_changed 1
-}
-if { [expr abs($xmax - $xmax0)] > 1.0e-5 } {
- set bb_changed 1
-}
-if { [expr abs($ymin - $ymin0)] > 1.0e-5 } {
- set bb_changed 1
-}
-if { [expr abs($ymax - $ymax0)] > 1.0e-5 } {
- set bb_changed 1
-}
-if { [expr abs($zmin - $zmin0)] > 1.0e-5 } {
- set bb_changed 1
-}
-if { [expr abs($zmax - $zmax0)] > 1.0e-5 } {
- set bb_changed 1
-}
-
-if { [info exists bb_changed] } {
- puts "Error: not expected bounding box"
-}
-
-renamevar b_1 result
-checkview -display result -3d -path ${imagedir}/${test_image}.png
-