]> OCCT Git - occt-copy.git/commitdiff
0029115: [Regression] GeomAdaptor mistakenly reports non-periodic curves to be periodic CR29115
authornbv <nbv@opencascade.com>
Wed, 21 Feb 2018 14:31:37 +0000 (17:31 +0300)
committernbv <nbv@opencascade.com>
Mon, 26 Mar 2018 07:40:51 +0000 (10:40 +0300)
1. Section "Concept of periodicity applied in OCCT-algorithms" has been added in Doxigen-documentation

2. Method IsPeriodic() of classes Geom(2d)_TrimmedCurve has changed its behavior. Please see the documentation about correspond methods.

3. Methods IsUPeriodic() and IsVPeriodic()  has changed their behavior.

4. Methods Geom_SurfaceOfLinearExtrusion::UPeriod() and Geom_SurfaceOfRevolution::VPeriod() has changed their behavior.

5. Method GeomLib::IsClosed(...) has been added in order to check closure of 3D/2D curve with some tolerance.

6. Methods ShapeAnalysis_Curve::IsPeriodic(...), BRepBlend_HCurve2dTool::IsPeriodic(...), Contap_HCurve2dTool::IsPeriodic(...), IntPatch_HCurve2dTool::IsPeriodic(...), BRepBlend_HCurveTool::IsPeriodic(...) have been removed.

7. Method

   void BOPTools_AlgoTools2D::AdjustPCurveOnFace (const TopoDS_Face& theF,
                                                  const Handle(Geom_Curve)& theC3D,
                                                  const Handle(Geom2d_Curve)& theC2D,
                                                  Handle(Geom2d_Curve)& theC2DA,
                                                  const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());

has been removed.

8. The following classes have become abstract (some methods have become pure virtual): Adaptor2d_Curve2d, Adaptor3d_Curve, Adaptor3d_Surface.

9. Methods ChFiDS_ElSpine::IsClosed() GeomFill_SnglrFunc::IsClosed(), ProjLib_CompProjectedCurve::IsClosed(), ProjLib_CompProjectedCurve::IsPeriodic(), ProjLib_CompProjectedCurve::Period() have been created.

10. Methods GeomLib::AllowExtend(...), GeomLib::AllowExtendUParameter(...) and GeomLib::AllowExtendVParameter(...) have been created.

11. Interface of Geom_ConicalSurface::Apex(...) method has been corrected insignificantly.

12. Method IntTools_Tools::IsClosed(...) has been removed.

146 files changed:
dox/user_guides/modeling_data/modeling_data.md
src/Adaptor2d/Adaptor2d_Curve2d.hxx
src/Adaptor2d/Adaptor2d_HCurve2d.hxx
src/Adaptor2d/Adaptor2d_Line2d.hxx
src/Adaptor2d/Adaptor2d_OffsetCurve.hxx
src/Adaptor3d/Adaptor3d_Curve.cxx
src/Adaptor3d/Adaptor3d_Curve.hxx
src/Adaptor3d/Adaptor3d_CurveOnSurface.hxx
src/Adaptor3d/Adaptor3d_HCurve.hxx
src/Adaptor3d/Adaptor3d_HSurface.hxx
src/Adaptor3d/Adaptor3d_HSurfaceTool.hxx
src/Adaptor3d/Adaptor3d_IsoCurve.hxx
src/Adaptor3d/Adaptor3d_Surface.cxx
src/Adaptor3d/Adaptor3d_Surface.hxx
src/BOPTools/BOPTools_AlgoTools.cxx
src/BOPTools/BOPTools_AlgoTools2D.cxx
src/BOPTools/BOPTools_AlgoTools2D.hxx
src/BOPTools/BOPTools_AlgoTools3D.cxx
src/BRepAdaptor/BRepAdaptor_CompCurve.hxx
src/BRepAdaptor/BRepAdaptor_Curve.hxx
src/BRepAdaptor/BRepAdaptor_Surface.hxx
src/BRepAlgo/BRepAlgo.cxx
src/BRepApprox/BRepApprox_SurfaceTool.hxx
src/BRepBlend/BRepBlend_HCurve2dTool.hxx
src/BRepBlend/BRepBlend_HCurveTool.hxx
src/BRepBndLib/BRepBndLib.cxx
src/BRepCheck/BRepCheck_Edge.cxx
src/BRepClass/BRepClass_Intersector.cxx
src/BRepFeat/BRepFeat_Form.cxx
src/BRepFill/BRepFill_MultiLine.cxx
src/BRepFill/BRepFill_OffsetWire.cxx
src/BRepLib/BRepLib.cxx
src/BRepLib/BRepLib_MakeEdge.cxx
src/BRepLib/BRepLib_MakeShell.cxx
src/BRepMesh/BRepMesh_EdgeTessellator.cxx
src/BRepMesh/BRepMesh_FastDiscret.cxx
src/BRepOffset/BRepOffset_Inter2d.cxx
src/BRepOffset/BRepOffset_Tool.cxx
src/BRepTest/BRepTest_SurfaceCommands.cxx
src/BRepTools/BRepTools.cxx
src/BRepTools/BRepTools_NurbsConvertModification.cxx
src/BRepTools/BRepTools_TrsfModification.cxx
src/BiTgte/BiTgte_CurveOnEdge.hxx
src/BiTgte/BiTgte_CurveOnVertex.hxx
src/BinTools/BinTools_Curve2dSet.cxx
src/BinTools/BinTools_CurveSet.cxx
src/BinTools/BinTools_SurfaceSet.cxx
src/Bisector/Bisector_BisecAna.cxx
src/Bisector/Bisector_BisecAna.hxx
src/Bisector/Bisector_BisecCC.hxx
src/Bisector/Bisector_BisecPC.hxx
src/ChFi2d/ChFi2d_FilletAlgo.cxx
src/ChFi3d/ChFi3d_Builder_0.cxx
src/ChFi3d/ChFi3d_Builder_C1.cxx
src/ChFiDS/ChFiDS_ElSpine.cxx
src/ChFiDS/ChFiDS_ElSpine.hxx
src/Contap/Contap_HCurve2dTool.hxx
src/DBRep/DBRep_DrawableShape.cxx
src/Draft/Draft_Modification.cxx
src/Draft/Draft_Modification_1.cxx
src/DrawTrSurf/DrawTrSurf_BSplineCurve2d.cxx
src/Extrema/Extrema_CurveTool.cxx
src/Extrema/Extrema_CurveTool.hxx
src/Extrema/Extrema_ExtPExtS.cxx
src/Geom/Geom_BezierCurve.hxx
src/Geom/Geom_ConicalSurface.cxx
src/Geom/Geom_ConicalSurface.hxx
src/Geom/Geom_Curve.hxx
src/Geom/Geom_OffsetCurve.cxx
src/Geom/Geom_OffsetCurve.hxx
src/Geom/Geom_OffsetSurface.cxx
src/Geom/Geom_OffsetSurface.hxx
src/Geom/Geom_RectangularTrimmedSurface.cxx
src/Geom/Geom_RectangularTrimmedSurface.hxx
src/Geom/Geom_Surface.hxx
src/Geom/Geom_SurfaceOfLinearExtrusion.cxx
src/Geom/Geom_SurfaceOfLinearExtrusion.hxx
src/Geom/Geom_SurfaceOfRevolution.cxx
src/Geom/Geom_SurfaceOfRevolution.hxx
src/Geom/Geom_TrimmedCurve.cxx
src/Geom/Geom_TrimmedCurve.hxx
src/Geom2d/Geom2d_Curve.hxx
src/Geom2d/Geom2d_OffsetCurve.cxx
src/Geom2d/Geom2d_OffsetCurve.hxx
src/Geom2d/Geom2d_TrimmedCurve.cxx
src/Geom2d/Geom2d_TrimmedCurve.hxx
src/Geom2dAdaptor/Geom2dAdaptor_Curve.hxx
src/Geom2dConvert/Geom2dConvert.cxx
src/GeomAdaptor/GeomAdaptor_Curve.hxx
src/GeomAdaptor/GeomAdaptor_Surface.hxx
src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.hxx
src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.hxx
src/GeomConvert/GeomConvert.cxx
src/GeomFill/GeomFill_GuideTrihedronPlan.cxx
src/GeomFill/GeomFill_LocationGuide.cxx
src/GeomFill/GeomFill_NSections.cxx
src/GeomFill/GeomFill_SnglrFunc.cxx
src/GeomFill/GeomFill_SnglrFunc.hxx
src/GeomLib/GeomLib.cxx
src/GeomLib/GeomLib.hxx
src/GeomPlate/GeomPlate_Surface.hxx
src/GeomProjLib/GeomProjLib.cxx
src/HLRBRep/HLRBRep_BCurveTool.hxx
src/HLRBRep/HLRBRep_BSurfaceTool.hxx
src/HLRBRep/HLRBRep_Curve.hxx
src/HLRBRep/HLRBRep_CurveTool.hxx
src/HLRBRep/HLRBRep_LineTool.hxx
src/HLRBRep/HLRBRep_Surface.hxx
src/HLRBRep/HLRBRep_SurfaceTool.hxx
src/IntCurveSurface/IntCurveSurface_Inter.gxx
src/IntCurveSurface/IntCurveSurface_TheHCurveTool.hxx
src/IntPatch/IntPatch_HCurve2dTool.hxx
src/IntPatch/IntPatch_Intersection.cxx
src/IntPatch/IntPatch_PrmPrmIntersection.cxx
src/IntPatch/IntPatch_RstInt.cxx
src/IntPatch/IntPatch_SpecialPoints.cxx
src/IntPatch/IntPatch_WLineTool.cxx
src/IntTools/IntTools_FaceFace.cxx
src/IntTools/IntTools_Tools.cxx
src/IntTools/IntTools_Tools.hxx
src/IntWalk/IntWalk_PWalking.cxx
src/LocOpe/LocOpe_WiresOnShape.cxx
src/MAT2d/MAT2d_Tool2d.cxx
src/ProjLib/ProjLib_CompProjectedCurve.hxx
src/ProjLib/ProjLib_ComputeApprox.cxx
src/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx
src/ProjLib/ProjLib_ProjectOnPlane.hxx
src/ProjLib/ProjLib_ProjectedCurve.hxx
src/ShapeAnalysis/ShapeAnalysis_Curve.cxx
src/ShapeAnalysis/ShapeAnalysis_Curve.hxx
src/ShapeBuild/ShapeBuild_Edge.cxx
src/ShapeConstruct/ShapeConstruct.cxx
src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx
src/ShapeCustom/ShapeCustom_BSplineRestriction.cxx
src/ShapeFix/ShapeFix_Edge.cxx
src/ShapeFix/ShapeFix_EdgeProjAux.cxx
src/ShapeFix/ShapeFix_Wire.cxx
src/ShapeFix/ShapeFix_Wire_1.cxx
src/ShapeUpgrade/ShapeUpgrade_SplitCurve2d.cxx
src/ShapeUpgrade/ShapeUpgrade_SplitCurve3d.cxx
src/StepToTopoDS/StepToTopoDS_GeometricTool.cxx
src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx
src/TopOpeBRepDS/TopOpeBRepDS_BuildTool.cxx
src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx
src/TopOpeBRepTool/TopOpeBRepTool_ShapeTool.cxx
src/math/math_NewtonMinimum.cxx

index 914260fc25eb6281b8899af044e674fcec75078b..0d3d87050d7a4a3f091abcd5e54ff5e16c6b4f57 100644 (file)
@@ -723,6 +723,143 @@ When you write an algorithm which operates on geometric objects, use <i> Adaptor
 As a result, you can use the algorithm with any kind of object, if you provide for this object an interface derived from *Adaptor3d* or *Adaptor2d*.
 These interfaces are easy to use: simply create an adapted curve or surface from a *Geom2d* curve, and then use this adapted curve as an argument for the algorithm? which requires it.
 
+@section occt_modat_4per Concept of periodicity applied in OCCT-algorithms
+
+@subsection occt_modat_4per_1 Mathematical definition
+
+In math, the following definition of periodicity is applied (detailed information can be found in <a href="https://en.wikipedia.org/wiki/Periodic_function">Wikipedia</a> or on the site of <a href="http://mathworld.wolfram.com/PeriodicFunction.html">WolframMathWorld</a>):
+
+A function of a real variable \f$ f(x) \f$ is said to be periodic with period \f$ T \neq 0 \f$ if<br>
+<span>1.</span>        For every \f$ x \in \mathfrak{D}_{f} \f$ (\f$ \mathfrak{D}_{f} \f$ is the domain of the function \f$ f(x) \f$), the point \f$ \left (x \pm T*n  \right ) \in \mathfrak{D}_{f} \f$ (where \f$ n \f$ applies positive integer values only: \f$ n=1,2,... \f$ ) and the condition
+\f[ f(x-T*n)=f(x+T*n)=f(x) \f]
+is satisfied.<br>
+<span>2.</span>        For every \f$ x \notin \mathfrak{D}_{f} \f$, the point \f$ \left (x \pm T*n  \right ) \notin \mathfrak{D}_{f} \f$, (where \f$ n=1,2,... \f$ ).<br>
+
+@subsubsection occt_modat_4per_1_1 Example
+
+For example, the tangent function \f$ f(x)=\tan(x) \f$ is periodic with least period (a least positive constant \f$ T \f$, which will be called later as period) \f$ \pi \f$ because \f$ \tan(x) \f$ is not defined only in points \f$ x=\left (\frac{\pi }{2}\pm \pi *n  \right ) \f$ (where \f$ n=0,1,2,... \f$) and for other points the condition<br>
+\f[ \tan(x-\pi*n)=\tan(x+\pi*n)=\tan(x) \f]
+is satisfied.
+
+As we can see from the definition, any periodic function cannot have bounded domain (because product \f$ T*n \f$ tends to infinite) but can be discontinuous. Let us look, how it is realized in OCCT.
+
+@subsection occt_modat_4per_2 Periodicity of bounded curves
+
+First of all, OCCT works only with continuous elements (curves and surfaces). <b>I.e. work with curves having continuity less than C0 (e.g. with any gaps) is not supported.</b>
+
+In OCCT, set of bounded curves includes only Bezier curves, B-spline curves and trimmed curves. Let us consider these objects from point of view to be periodic.
+
+@subsubsection occt_modat_4per_2_1 Bezier curves
+
+Bezier curve is always defined in the range \f$ \mathfrak{D}=\left [ 0,1 \right ] \f$ and does not allow any analytical extension. Therefore, <b>Bezier curve cannot be periodic at all</b>.
+
+@subsubsection occt_modat_4per_2_2 B-spline curve
+
+OCCT can create <a href="https://en.wikiversity.org/wiki/CAGD/B-splines#Periodic_B-splines">periodic B-spline</a> and can convert any closed B-spline into periodic one. At that, any periodic B-spline is defined on the set of real numbers (\f$ \mathfrak{D}=\mathbb{R} \f$). Nevertheless, in OCCT, periodic B-splines are included in set of bounded curves, too. The class of Bounded curves does not separate periodic and not-periodic B-splines.<br>
+
+However, <b>range of not-periodic B-spline must be considered as its domain</b>. I.e. if any not-periodic B-spline curve is parametrized in the range \f$ t \in \left [ 0,1 \right ] \f$ then its evaluation in the point \f$ t=1.5 \f$ is forbidden (in general). Evaluation of B-spline curve on its analytical extension can be used in some cases. However, it is out of scope of this article.
+
+@subsubsection occt_modat_4per_2_3 Trimmed curve
+
+OCCT-algorithms allow trimmed curve’s existing out of trim boundaries (exceptionally, if these boundaries match the domain completely). Evidently, the trimmed curve is not defined in the region where its basis curve is not defined.<br>
+
+E.g. if some trimmed curve is an arc of circle and the trim boundaries are \f$ t \in \left [ \frac{\pi }{2},\pi \right ] \f$ then nothing prevents us to compute the value of this arc in the point \f$ t=\frac{3\pi}{2} \f$. Analogically, for some line trimmed in the range \f$ t \in \left [ 0,1 \right ] \f$ nothing prevents us to compute the value in the point \f$ t=100 \f$. In other words, <b>trim boundaries must not be considered as domain boundaries</b>. And curve trimmed from any periodic curve exists out of trim boundaries. Consequently, this trimmed curve can be considered as periodic curve.<br>
+
+Also, let us make the final conclusion. <b>In OCCT-algorithms, trimmed curve is considered to be periodic if its basis curve is periodic. At that trim boundaries do not play any role. I.e. the curve itself can be periodic and not-closed</b>.<br>
+
+@subsubsection occt_modat_4per_2_4 Trim boundaries
+
+@ref occt_modat_4per_2_3 "We have just found out" that the trim boundaries are not domain boundaries. But what is their real role in OCCT-algorithms?
+
+Trim boundaries define some work range of the trimmed curve. Indeed, this (default) work range exists for any OCCT-curve (not only for trimmed one). For any periodic not-trimmed curve, the work range is \f$ \mathfrak{W}=\left [ 0,T \right ) \f$ (where \f$ T \f$ is the period of the curve). For bounded not-trimmed curve, this work range matches its domain. For other not-trimmed curves (e.g. line), the work range is \f$ \mathfrak{W}=\left ( -\infty ,+\infty  \right ) \f$ (i.e. matches its domain, too).
+
+Operation <b><i>"TRIM"</i></b> applied to the curve allows changing its work range (shifting or reducing but not increasing). <b>Setting work range greater than the default one is strictly forbidden</b>.
+
+E.g. the default work range of any circle is \f$ \mathfrak{W}=\left [ 0,2\pi \right ) \f$. With <b><i>"TRIM"</i></b> operation you can create trimmed circle (i.e. arc) with work ranges \f$ \left [ 0,\pi \right ] \f$, \f$ \left [ 5\pi,\frac{11\pi}{2} \right ] \f$, \f$ \left [ 100\pi,102\pi \right ] \f$ etc. However, you must have failed to create arc with work range \f$ \left [ 50\pi,55\pi \right ] \f$, because this new work range is greater than \f$ \mathfrak{W} \f$.
+
+For not-periodic B-spline curve with default work range \f$ \mathfrak{W}=\left [ 0,1 \right ] \f$, you can create trimmed B-spline curve with work ranges \f$ \left [ 0,0.1 \right ] \f$, \f$ \left [ 0.6,0.78 \right ] \f$, \f$ \left [ 0.5,1 \right ] \f$ etc. However, you must have failed to set work range to \f$ \left [ 0.8,1.5 \right ] \f$ (because the input B-spline is not defined in the range \f$ \left ( 1,1.5 \right ] \f$).
+
+For a line, you can create any work range with <b><i>"TRIM"</i></b> operation. Every work range will be valid.
+
+Use the method **GeomLib::AllowExtend(...)** in order to check whether the new work range can be applied to the curve. Please see documentation about this method.
+
+However, what does work range bring to OCCT? The point is that the most OCCT-algorithms tend to work in work ranges of their input data. So, if you call extrema high-level tool (exactly API) then you will obtain point with parameters already adjusted in work range of the arguments. If you call surface-surface intersection algorithm (API again) then you will obtain 3D-curve and two 2D-curves, which are already in surfaces’ work ranges (you do not need any shifting them). So, correct using work ranges makes work with OCCT more convenient.
+
+@subsection occt_modat_4per_3 Periodicity of curves’ adaptors
+
+In OCCT, periodicity of adaptors depends on the periodicity of its curves only. Any ranges are not taken into account.
+
+At that, it is useful to note the fact that adaptor’s curve is always not trimmed. I.e. if some trimmed curve is sent into some adaptor then the adaptor will store the basis (not trimmed) curve and First/Last parameters of adaptor will be set to the corresponding trim-boundaries.
+
+Moreover, there are some specific adaptors in OCCT. E.g. **BRepAdaptor_CompCurve**. Periodicity of such adaptors is defined in a special way. So, it is necessary to read reference manual about these classes in order to get more clear understanding of their behavior.
+
+@subsection occt_modat_4per_4 Periodicity of surfaces
+
+In OCCT, surface(s) is set in parametric form by vector-function of two real variables: \f$ S(U,V) \f$. As result, term of periodicity is considered for every such variable separately (\f$ U\f$-periodic and \f$ V \f$-periodic surfaces are considered). Also, there exist bi-periodic surfaces (e.g. Toroidal surface), which are periodic in both \f$ U \f$- and \f$ V \f$-directions (OCCT does not work with univariate function of a complex argument; therefore commonly-used terms "Double periodic" or "Triple periodic" are not figured in OCCT).
+
+So, \f$ U \f$-periodic surface can be defined as follows: <b>The surface \f$ S(U,V) \f$ is \f$ U \f$-periodic if for every fixed value of \f$ V \f$-argument \f$ (V=V_{0})\f$ one of the following conditions is satisfied:<br>
+<span>1.</span>        For every \f$ U\in \mathbb{R} \f$, the point \f$ (U, V_{0}) \notin \mathfrak{D}_{S} \f$, where \f$ \mathfrak{D}_{S} \f$ is the domain of the surface \f$ S \f$;<br>
+<span>2.</span>        Otherwise, the univariate function of real variable \f$ F(U)=S(U,V_{0} ) \f$ is periodic.</b><br>
+
+V-periodic surface can be defined analogically: <b>The surface \f$ S(U,V) \f$ is \f$ V \f$-periodic if for every fixed value of \f$ U \f$-argument \f$ (U=U_{0})\f$ one of the following conditions is satisfied:<br>
+<span>1.</span>        For every \f$ V\in \mathbb{R} \f$, the point \f$ (U_{0}, V) \notin \mathfrak{D}_{S} \f$, where \f$ \mathfrak{D}_{S} \f$ is the domain of the surface \f$ S \f$;<br>
+<span>2.</span>        Otherwise, the univariate function of real variable \f$ F(V)=S(U_{0}, V) \f$ is periodic.</b><br>
+
+All remarks made @ref occt_modat_4per_2 "above" considering bounded curves are satisfied for bounded surfaces. At that, a work range of any surface is a region in 2D (rectangular) Cartesian coordinate system taking into account permissible values of U and V parameters. The example is given @ref occt_modat_4per_5 "below".
+
+There exist some methods analogical to **GeomLib::AllowExtend(...)** but can be applied to surface. These methods are called **GeomLib::AllowExtendUParameter(...)** and **GeomLib::AllowExtendVParameter(...)**.
+
+@subsection occt_modat_4per_5 Special questions about periodicity of surfaces
+@subsubsection occt_modat_4per_5_1 Periodicity of a spherical surface
+
+Let us consider a spherical surface having radius \f$ R \f$. It can be defined in local coordinate system (<a href="http://help.autodesk.com/view/INVNTOR/2014/ENU/?guid=GUID-FF15BB0D-5FE9-45F9-92FD-D70A3F6A8FD0">UCS</a>) by the vector function of two scalar arguments:
+\f[ 
+  S\left ( U,V \right )=R* \begin{pmatrix}
+                            \cos (U)*\cos (V)\\ 
+                            \sin (U)*\cos (V)\\ 
+                            \sin (V)
+                          \end{pmatrix} 
+\f]
+
+As we can see, this function is \f$ V \f$-periodic and its \f$ V \f$-period is equal to \f$ 2\pi \f$. And it is \f$ U \f$-periodic with \f$ U \f$-period \f$ 2\pi \f$. I.e. (theoretically) the default work range of any surface with such equation is the set of 2D-points such \f$ \mathfrak{W}=\left \{(U,V)|0\leq U < 2\pi, 0\leq V < 2\pi \right \} \f$.
+
+However, let us take two different points in the parametric space: \f$ (0,0) \f$ and \f$ (\pi,\pi) \f$. Their 3D-images are: \f$ S\left ( 0,0 \right )=\begin{pmatrix}R & 0 & 0\end{pmatrix}^{T} \f$, \f$ S\left ( \pi,\pi \right )=\begin{pmatrix}R & 0 & 0\end{pmatrix}^{T} \f$. As we can see, 3D-points are the same. This fact is inappropriate for different points from one work range. Such result says about that the surface \f$ S(U,V) \f$ is self-interfered surface.
+
+<b>Working with self-interfered elements is not supported by OCCT at all</b>. Therefore, in order to make spherical surface valid, specific domain is assigned to sphere. Namely:<br>
+
+\f[ \mathfrak{D}_{S}= \left \{(U,V)|-\infty < U < +\infty , -\frac{\pi}{2}\leq V \leq  \frac{\pi}{2} \right \} \f]
+
+Of course, the range for V-parameter must be \f$ -\frac{\pi}{2}+2\pi n\leq V \leq  \frac{\pi}{2}+2\pi n \f$ (where \f$ n \f$ applies positive integer values only: \f$ n=1,2,... \f$). However, this range is discontinuous and is not supported (see the section @ref occt_modat_4per_2). Therefore, \f$ V \f$-parameter of spherical surface is considered to be bounded. Consequently, <b>sphere is considered to be not \f$ V \f$-periodic</b>.
+
+Based on this fact, the default sphere’s work range is \f$ \mathfrak{W}=\left \{(U,V)|0\leq U < 2\pi, -\frac{\pi}{2}\leq V \leq  \frac{\pi}{2} \right \} \f$. Please pay attention to the fact that the spherical surface is \f$ U \f$-periodic surface. Therefore, value of \f$ U \f$-parameter can be any real number (\f$U \in \mathbb{R}\f$). However, its work range in \f$ U \f$-direction cannot be greater than \f$ 2\pi \f$. In that way the sphere is not self-interfered (the point \f$ (\pi,\pi) \f$ is out of its domain) and is valid completely.
+
+@subsubsection occt_modat_4per_5_2 Periodicity of a Surface-of-Revolution
+
+@ref occt_modat_4per_5_1 "Analogical situation" exists with surface of revolution. Having taken into account all said above, let us formulate conditions when the surface of revolution is \f$ V \f$-periodic.
+
+Evidently, for that case, the basis curve must be periodic curve. Additionally, revolving full curve (taken with its default work range) must not lead to create self-interfered surface of revolution (i.e. this curve must not intersect the rotation axis). In other words, <b>the valid (not self-interfered) surface of revolution must be based on closed periodic curve in order to be \f$ V \f$-periodic</b>.
+
+Please note that the basis curve can be not-closed by different reasons (not only in order to avoid creating self-interfered surface of revolution), which are neither nor separated nor analyzed by OCCT. OCCT uses simple check: periodicity of basis curve and its closure. It is connected with the fact that the property of periodicity of a Surface-of-Revolution is not very important for OCCT-algorithms because almost all algorithms work only with work range of a Surface-of-Revolution (i.e. in most cases we do not need in adjusting parameters).
+
+Based on the foregoing, the domain of any not \f$ V \f$-periodic surface of revolution is \f$ \mathfrak{D}_{S}= \left \{(U,V)|-\infty < U < +\infty , C_{f} \leq V \leq  C_{l} \right \} \f$, where \f$ \left [C_{f},C_{l}  \right ] \f$ is the work range of the basis curve (i.e. the work range of the basis curve defines the domain of the surface). The default work range of this surface is \f$ \mathfrak{W}=\left \{(U,V)|0\leq U < 2\pi, C_{f} \leq V \leq  C_{l} \right \} \f$.
+
+Finally, it is got to be said that the constructors of surface of revolution do not check the situation when invalid result can be created. It must be done on application level (e.g. by using **GeomLib::AllowExtendVParameter(...)** method). We offer to use the following steps (which should be used only in places where you doubt in validity of created surface of revolution):
+
+<span>1.</span>Create a surface of revolution with default work-range of the basis curve;<br>
+<span>2.</span>Compute new work range of the basis curve (it depends on your requirements only);<br>
+<span>3.</span>Call **GeomLib::AllowExtendVParameter(...)** method with existing surface of revolution and the new range. If the new range is valid the method will return TRUE.<br>
+
+The method **GeomLib::AllowExtendVParameter(...)** works with spherical surface, too.
+
+@subsection occt_modat_4per_6 Periodicity of surfaces’ adaptors
+
+@ref occt_modat_4per_3 "As for curves", periodicity of adaptors depends on the periodicity of its surfaces only. All remarks about curve's adaptor are fair to surfaces.
+
+@subsection occt_modat_4per_7 Methods Period(), UPeriod() and VPeriod()
+
+For periodic elements (curves/surfaces/adaptors) methods Period(), UPeriod() and VPeriod() return their period value. However, for not-periodic elements the behavior of these methods depends on the specific object (sometimes exception can be thrown, sometimes 0 will be returned, sometimes these methods will return some positive value). In general, such behavior is described in the documentation to the classes.
+
+Nevertheless, <b><i>calling of these methods for not-periodic elements is not recommended</i></b> and the behavior of theses methods (for not-periodic elements) can be changed in future OCCT-versions.
 
 @section occt_modat_5 Topology
 
index c845bcef7a349a576bb2e31f429d979652b8268a..07b99c12494ee2c7f31fcc735b742f8bf85105b7 100644 (file)
@@ -84,11 +84,17 @@ public:
   //! If <First> >= <Last>
   Standard_EXPORT virtual Handle(Adaptor2d_HCurve2d) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const;
   
-  Standard_EXPORT virtual Standard_Boolean IsClosed() const;
+  Standard_EXPORT virtual Standard_Boolean IsClosed() const = 0;
   
-  Standard_EXPORT virtual Standard_Boolean IsPeriodic() const;
+  //! //! Returns true if the curve in this adaptor is periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_EXPORT virtual Standard_Boolean IsPeriodic() const = 0;
   
-  Standard_EXPORT virtual Standard_Real Period() const;
+  //! Returns the period of 2D-adaptor's curve
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_EXPORT virtual Standard_Real Period() const = 0;
   
   //! Computes the point of parameter U on the curve.
   Standard_EXPORT virtual gp_Pnt2d Value (const Standard_Real U) const;
index 1e2f8157517db006f51761455ecc992df63ed17e..e1f9a4c8c292ac3559ad11f9c4c616915c5210ee 100644 (file)
@@ -76,9 +76,15 @@ public:
   
     Standard_Boolean IsClosed() const;
   
-    Standard_Boolean IsPeriodic() const;
-  
-    Standard_Real Period() const;
+  //! //! Returns true if the curve in this adaptor is periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_Boolean IsPeriodic() const;
+  
+  //! Returns the period of 2D-adaptor's curve
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_Real Period() const;
   
     gp_Pnt2d Value (const Standard_Real U) const;
   
index f365e50804a89da34007039447684700b57b6108..6361517e5c3f75c7aaf2bb6719661e24c49d134f 100644 (file)
@@ -87,8 +87,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Always returns FALSE
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Raises exception Standard_NoSuchObject
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   Standard_EXPORT gp_Pnt2d Value (const Standard_Real X) const Standard_OVERRIDE;
index b1b1c356f30f757c6bffc78f79f268c2a2a7e82a..13e9132c59e083cec526fdb8d29fcc64fb38dc74 100644 (file)
@@ -105,8 +105,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 49b02da158fb08c5ab37101734ecacc94290ea96..e2088450190b7921f6a36447f2ca9112aaa4930f 100644 (file)
@@ -106,40 +106,6 @@ Handle(Adaptor3d_HCurve) Adaptor3d_Curve::Trim(const Standard_Real , const Stand
   throw Standard_NotImplemented("Adaptor3d_Curve::Trim");
 }
 
-
-//=======================================================================
-//function : IsClosed
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Adaptor3d_Curve::IsClosed() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Curve::IsClosed");
-}
-
-
-//=======================================================================
-//function : IsPeriodic
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Adaptor3d_Curve::IsPeriodic() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Curve::IsPeriodic");
-}
-
-
-//=======================================================================
-//function : Period
-//purpose  : 
-//=======================================================================
-
-Standard_Real Adaptor3d_Curve::Period() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Curve::Period");
-}
-
-
 //=======================================================================
 //function : Value
 //purpose  : 
index de882dc430913009e2f71bd38c8babd1019af3a4..c069e122cf9a4c78d5b66b722006925a21ee88fc 100644 (file)
@@ -86,11 +86,15 @@ public:
   //! If <First> >= <Last>
   Standard_EXPORT virtual Handle(Adaptor3d_HCurve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const;
   
-  Standard_EXPORT virtual Standard_Boolean IsClosed() const;
+  Standard_EXPORT virtual Standard_Boolean IsClosed() const = 0;
   
-  Standard_EXPORT virtual Standard_Boolean IsPeriodic() const;
+  //! //! Returns true if the curve in this adaptor is periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_EXPORT virtual Standard_Boolean IsPeriodic() const = 0;
   
-  Standard_EXPORT virtual Standard_Real Period() const;
+  //! Returns the period of the periodic adaptor's curve
+  Standard_EXPORT virtual Standard_Real Period() const = 0;
   
   //! Computes the point of parameter U on the curve.
   Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U) const;
index c7431f67a4d2e6376f5f7c8e371a8f58ae868e3a..16d05dc7c97a6742b03d636dfface6e6421d0283 100644 (file)
@@ -112,8 +112,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 3e4e321af0a363ec2f586937d67f79a00a1f7f62..f0f1b9a98bc74838a409dd099bfeb72aa873db50 100644 (file)
@@ -93,8 +93,14 @@ public:
   
     Standard_Boolean IsClosed() const;
   
+    //! Returns true if the curve in this adaptor is periodic 
+    //! (please see the documentation, the section
+    //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
     Standard_Boolean IsPeriodic() const;
   
+    //! Returns the period of the periodic adaptor's curve
+    //! (please see the documentation, the section
+    //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
     Standard_Real Period() const;
   
     gp_Pnt Value (const Standard_Real U) const;
index 80fd5f8199bea3c17ea453af5c5bbdcc44554de6..5d1b8f1c97876e5712940cc6303dc33a565ff429 100644 (file)
@@ -95,12 +95,20 @@ public:
   
     Standard_Boolean IsVClosed() const;
   
+    //! Returns true if the surface in this adaptor is periodic in U-direction
+    //! (please see the documentation, the section
+    //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
     Standard_Boolean IsUPeriodic() const;
   
+    //! Returns U-period of U-periodic surface
     Standard_Real UPeriod() const;
   
+    //! Returns true if the surface in this adaptor is periodic in V-direction
+    //! (please see the documentation, the section
+    //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
     Standard_Boolean IsVPeriodic() const;
   
+    //! Returns V-period of V-periodic surface
     Standard_Real VPeriod() const;
   
     gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
index 6fd07573f317e4ffd8e629174e659a24b8d30b68..60d6dfb63f2ef7b4fbe39b03268b3f95e0304dd0 100644 (file)
@@ -80,13 +80,17 @@ public:
   
     static Standard_Boolean IsVClosed (const Handle(Adaptor3d_HSurface)& S);
   
-    static Standard_Boolean IsUPeriodic (const Handle(Adaptor3d_HSurface)& S);
+  //! Returns TRUE if S is U-periodic
+  static Standard_Boolean IsUPeriodic (const Handle(Adaptor3d_HSurface)& S);
   
-    static Standard_Real UPeriod (const Handle(Adaptor3d_HSurface)& S);
-  
-    static Standard_Boolean IsVPeriodic (const Handle(Adaptor3d_HSurface)& S);
+  //! Returns U-period of S
+  static Standard_Real UPeriod (const Handle(Adaptor3d_HSurface)& S);
+
+  //! Returns TRUE if S is V-periodic
+  static Standard_Boolean IsVPeriodic (const Handle(Adaptor3d_HSurface)& S);
   
-    static Standard_Real VPeriod (const Handle(Adaptor3d_HSurface)& S);
+  //! Returns V-period of S
+  static Standard_Real VPeriod (const Handle(Adaptor3d_HSurface)& S);
   
     static gp_Pnt Value (const Handle(Adaptor3d_HSurface)& S, const Standard_Real u, const Standard_Real v);
   
index 2032eb9888827d66ba40ec9e245ed74547356fa6..104ab5aeea749838de0bd45a34cb184f4db77677 100644 (file)
@@ -114,6 +114,8 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the surface (returned by Surface() method) is periodic
+  //! along the chosen direction.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
index 42adac71bbfe31532fd1cb12ee7c678ae6331473..090c3d95361fa8070fd7e05a5b3b47ced980c994 100644 (file)
@@ -179,73 +179,6 @@ Handle(Adaptor3d_HSurface) Adaptor3d_Surface::VTrim(const Standard_Real , const
   throw Standard_NotImplemented("Adaptor3d_Surface::VTrim");
 }
 
-
-//=======================================================================
-//function : IsUClosed
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Adaptor3d_Surface::IsUClosed() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Surface::IsUClosed");
-}
-
-
-//=======================================================================
-//function : IsVClosed
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Adaptor3d_Surface::IsVClosed() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Surface::IsVClosed");
-}
-
-
-//=======================================================================
-//function : IsUPeriodic
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Adaptor3d_Surface::IsUPeriodic() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Surface::IsUPeriodic");
-}
-
-
-//=======================================================================
-//function : UPeriod
-//purpose  : 
-//=======================================================================
-
-Standard_Real Adaptor3d_Surface::UPeriod() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Surface::UPeriod");
-}
-
-
-//=======================================================================
-//function : IsVPeriodic
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Adaptor3d_Surface::IsVPeriodic() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Surface::IsVPeriodic");
-}
-
-
-//=======================================================================
-//function : VPeriod
-//purpose  : 
-//=======================================================================
-
-Standard_Real Adaptor3d_Surface::VPeriod() const 
-{
-  throw Standard_NotImplemented("Adaptor3d_Surface::VPeriod");
-}
-
-
 //=======================================================================
 //function : Value
 //purpose  : 
index 1f5c3061eeb170f355f9e6df5b18b0295627ca86..701fd60669c32fd99e649d2b3eee987d78be8c80 100644 (file)
@@ -51,7 +51,7 @@ class Adaptor3d_HCurve;
 //! the surface by algorithms which use it.
 //! A derived concrete class is provided:
 //! GeomAdaptor_Surface for a surface from the Geom package.
-//! The  Surface class describes  the standard behaviour
+//! The  Surface class describes  the standard behavior
 //! of a surface for generic algorithms.
 //!
 //! The Surface can  be decomposed in intervals of any
@@ -59,7 +59,7 @@ class Adaptor3d_HCurve;
 //! NbIntervals.  A current interval can be set.  Most
 //! of the methods apply to the current interval.
 //! Warning: All the methods are virtual and implemented with a
-//! raise to allow to redefined only the methods realy
+//! raise to allow to redefined only the methods really
 //! used.
 //!
 //! Polynomial coefficients of BSpline surfaces used for their evaluation are
@@ -113,17 +113,25 @@ public:
   //! If <First> >= <Last>
   Standard_EXPORT virtual Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const;
   
-  Standard_EXPORT virtual Standard_Boolean IsUClosed() const;
+  Standard_EXPORT virtual Standard_Boolean IsUClosed() const = 0;
   
-  Standard_EXPORT virtual Standard_Boolean IsVClosed() const;
+  Standard_EXPORT virtual Standard_Boolean IsVClosed() const = 0;
   
-  Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const;
+  //! Returns true if the surface in this adaptor is periodic in U-direction
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ")
+  Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0;
   
-  Standard_EXPORT virtual Standard_Real UPeriod() const;
+  //! Returns U-period of U-periodic surface
+  Standard_EXPORT virtual Standard_Real UPeriod() const = 0;
   
-  Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
+  //! Returns true if the surface in this adaptor is periodic in V-direction
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0;
   
-  Standard_EXPORT virtual Standard_Real VPeriod() const;
+  //! Returns V-period of V-periodic surface
+  Standard_EXPORT virtual Standard_Real VPeriod() const = 0;
   
   //! Computes the point of parameters U,V on the surface.
   Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
index b4f474ba38d8fbe45d0b8b003257d2107e4de706..3b3eaad27f08c572fbf6be9f610ebc05c137e1e6 100644 (file)
@@ -1544,9 +1544,7 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
   //
   aTolE=BRep_Tool::Tolerance(aE);
   //
-  const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2);
-  Handle(Geom_TrimmedCurve)aC3DETrim=
-    new Geom_TrimmedCurve(aC3DE, aT1, aT2);
+  BRep_Tool::Range(aE, aT1, aT2);
   //
   for (i=0; i<2; ++i) {
     bPC = !i ? bPC1 : bPC2;
@@ -1566,21 +1564,15 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
     aFFWD.Orientation(TopAbs_FORWARD);
     //
     aC2D=aC2Dx1;
-    if (aC2D.IsNull()) { 
+    if (aC2D.IsNull())
+    {
       BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD, theContext);
       BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D, 
                                        aOutFirst, aOutLast, 
                                        aOutTol, theContext);
       }
     //
-    if (aC3DE->IsPeriodic()) {
-      BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2,  aC2D, 
-                                               aC2DA, theContext);
-    }
-    else {
-      BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, 
-                                               aC2DA, theContext);
-    }
+    BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, aC2DA, theContext);
     //
     aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
     //BRepLib::SameParameter(aE);
index b24667e264db652c230a538e5bccff8c314219db..bef30d6205b1fad14d754d75c469ae30de492464 100644 (file)
@@ -250,22 +250,6 @@ Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
 //function : AdjustPCurveOnFace
 //purpose  : 
 //=======================================================================
-void BOPTools_AlgoTools2D::AdjustPCurveOnFace
-  (const TopoDS_Face& theF,
-   const Handle(Geom_Curve)&   theC3D,
-   const Handle(Geom2d_Curve)& theC2D,
-   Handle(Geom2d_Curve)& theC2DA,
-   const Handle(IntTools_Context)& theContext)
-{
-  Standard_Real aT1 = theC3D->FirstParameter();
-  Standard_Real aT2 = theC3D->LastParameter();
-  //
-  BOPTools_AlgoTools2D::AdjustPCurveOnFace (theF, aT1, aT2, theC2D, theC2DA, theContext);
-}
-//=======================================================================
-//function : AdjustPCurveOnFace
-//purpose  : 
-//=======================================================================
 void BOPTools_AlgoTools2D::AdjustPCurveOnFace 
   (const TopoDS_Face& theF,
    const Standard_Real theFirst,
index a867d0d9aa0eb1472b537b5b62180eee3fe026c7..57bc954958fa6155dc5187ccb295aa7b8b4a8935 100644 (file)
@@ -110,15 +110,6 @@ public:
   Standard_EXPORT static Standard_Boolean HasCurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF);
   
 
-  //! Adjust P-Curve <theC2D> (3D-curve <theC3D>) on surface of the face <theF>.<br>
-  //! <theContext> - storage for caching the geometrical tools
-  Standard_EXPORT static void AdjustPCurveOnFace (const TopoDS_Face& theF,
-                                                  const Handle(Geom_Curve)& theC3D,
-                                                  const Handle(Geom2d_Curve)& theC2D,
-                                                  Handle(Geom2d_Curve)& theC2DA,
-                                                  const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
-  
-
   //! Adjust P-Curve <aC2D> (3D-curve <C3D>) on surface <aF> .<br>
   //! [aT1,  aT2] - range to adjust<br>
   //! <theContext> - storage for caching the geometrical tools
index d45c8a139f146ad3bc877df5dfc9b9bbad031f38..80cf4e6ccbd01f387ec91c4a8a5df2a0f1da5576 100644 (file)
@@ -75,8 +75,8 @@ static
 void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
                                               const TopoDS_Face& aF)
 {
-  Standard_Boolean bIsUPeriodic, bIsVPeriodic, bIsLeft;
-  Standard_Real aTol, a, b, anUPeriod, anVPeriod, aT, anU, dU, anU1;
+  Standard_Boolean bIsLeft;
+  Standard_Real aTol, a, b, aT, anU, dU, anU1;
   Standard_Real aScPr, anV, dV, anV1;
   Standard_Real aUmin, aUmax, aVmin, aVmax;
   gp_Pnt2d aP2D;
@@ -97,58 +97,19 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
   //
   aS->Bounds(aUmin, aUmax, aVmin, aVmax);
   //
-  bIsUPeriodic=aS->IsUPeriodic();
-  bIsVPeriodic=aS->IsVPeriodic();
-  //
-  anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0.;
-  anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.;
+  const Standard_Boolean bIsUPeriodic = aS->IsUPeriodic(),
+                         bIsVPeriodic = aS->IsVPeriodic();
+
+  const Standard_Real anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0.,
+                      anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.;
+
+  const Standard_Boolean bIsUClosed = aS->IsUClosed(),
+                         bIsVClosed = aS->IsVClosed();
   //
-  if (!bIsUPeriodic && !bIsVPeriodic) {
-    Standard_Boolean bIsUClosed, bIsVClosed;
-    Handle(Geom_BSplineSurface) aBS;
-    Handle(Geom_BezierSurface) aBZ;
-    Handle(Geom_RectangularTrimmedSurface) aRTS;
-    //
-    bIsUClosed=Standard_False;
-    bIsVClosed=Standard_False;
-    aBS=Handle(Geom_BSplineSurface)::DownCast(aS);
-    aBZ=Handle(Geom_BezierSurface) ::DownCast(aS);
-    aRTS=Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
-    //
-    if (!aBS.IsNull()) {
-      bIsUClosed=aBS->IsUClosed();
-      bIsVClosed=aBS->IsVClosed();
-    }
-    else if (!aBZ.IsNull()) {
-      bIsUClosed=aBZ->IsUClosed();
-      bIsVClosed=aBZ->IsVClosed();
-    }
-    else if (!aRTS.IsNull()) {
-      Handle(Geom_Surface) aSB;
-      //
-      aSB=aRTS->BasisSurface();
-      bIsUPeriodic=aSB->IsUPeriodic();
-      bIsVPeriodic=aSB->IsVPeriodic();
-      //
-      if (!(bIsUPeriodic || bIsVPeriodic)) {
-        return;
-      }
-      anUPeriod = bIsUPeriodic ? aSB->UPeriod() : 0.;
-      anVPeriod = bIsVPeriodic ? aSB->VPeriod() : 0.;
-    }
-    //
-    if (aRTS.IsNull()) {
-      if (!bIsUClosed && !bIsVClosed) {
-        return;
-      }
-      //
-      if (bIsUClosed) {
-        anUPeriod=aUmax-aUmin;
-      }
-      if (bIsVClosed) {
-        anVPeriod=aVmax-aVmin;
-      }
-    }
+  if ((!bIsUPeriodic || !bIsUClosed) &&
+      (!bIsVPeriodic || !bIsVClosed))
+  {
+    return;
   }
   //
   //---------------------------------------------------
index ca46e6e36b413926e4a064a1716f893cebc931b0..b0dc8eb25f6e8fa5a319ff83c4f3c78033a31c3e 100644 (file)
@@ -110,8 +110,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Always returns FALSE
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns delta between last and first parameters
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve
index 96a87a73a64c1bd73d98595b233f32c789722b2a..b5ff8fa62b32c61522337c63949a0d89db62942f 100644 (file)
@@ -146,8 +146,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve
index 70858bf8faa77e87c245a2791feb62e60d400fed..c2397e125f93d2501940619888808a20f46dc482 100644 (file)
@@ -145,12 +145,16 @@ public:
   
     Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
+    //! This method is overridden from the basis class
     Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
+    //! This method is overridden from the basis class
     Standard_Real UPeriod() const Standard_OVERRIDE;
   
+    //! This method is overridden from the basis class
     Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+    //! This method is overridden from the basis class
     Standard_Real VPeriod() const Standard_OVERRIDE;
   
   //! Computes the point of parameters U,V on the surface.
index a6bdf8a1d20e8d26ba18287e3103a5f8f31ce358..edf0150fc96f096391dce5c240804726d2d64001 100644 (file)
@@ -229,13 +229,13 @@ TopoDS_Edge  BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
 
     GeomAdaptor_Curve  aGACurve(aCurve);
     GeomAbs_CurveType  aType       = aGACurve.GetType();
-    Handle(Geom_Curve) aBasisCurve = aGACurve.Curve();
     Standard_Boolean   isFwd       = (wexp.Orientation() != TopAbs_REVERSED);
 
-    if (aBasisCurve->IsPeriodic()) {
-      ElCLib::AdjustPeriodic
-        (aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
-        Precision::PConfusion(), fpar, lpar);
+    if (aGACurve.IsPeriodic())
+    {
+      const Handle(Geom_Curve) &aBasisCurve = aGACurve.Curve();
+      ElCLib::AdjustPeriodic(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
+                             Precision::PConfusion(), fpar, lpar);
     }
 
     if (CurveSeq.IsEmpty()) {
@@ -353,9 +353,10 @@ TopoDS_Edge  BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
       if (isSameCurve) {
         const Standard_Boolean isSameDir = (isFwd == IsFwdSeq.Last());
 
-        if (aBasisCurve->IsPeriodic()) {
+        if (aGACurve.IsPeriodic())
+        {
           // Treat periodic curves.
-          const Standard_Real aPeriod = aBasisCurve->Period();
+          const Standard_Real aPeriod = aGACurve.Period();
 
           if (isSameDir) {
             // Check if first parameter is greater then the last one.
index 0aa2504da24b10470efa123986b13406d5e30de1..3cafe74a45a657bd36ff5fa503661dfa151c0445 100644 (file)
@@ -81,13 +81,17 @@ public:
   
     static Standard_Boolean IsVClosed (const BRepAdaptor_Surface& S);
   
-    static Standard_Boolean IsUPeriodic (const BRepAdaptor_Surface& S);
-  
-    static Standard_Real UPeriod (const BRepAdaptor_Surface& S);
+  //! Returns TRUE if S is U-periodic
+  static Standard_Boolean IsUPeriodic (const BRepAdaptor_Surface& S);
+
+  //! Returns U-period of S
+  static Standard_Real UPeriod (const BRepAdaptor_Surface& S);
   
-    static Standard_Boolean IsVPeriodic (const BRepAdaptor_Surface& S);
+  //! Returns TRUE if S is V-periodic
+  static Standard_Boolean IsVPeriodic (const BRepAdaptor_Surface& S);
   
-    static Standard_Real VPeriod (const BRepAdaptor_Surface& S);
+  //! Returns V-period of S
+  static Standard_Real VPeriod (const BRepAdaptor_Surface& S);
   
     static gp_Pnt Value (const BRepAdaptor_Surface& S, const Standard_Real u, const Standard_Real v);
   
index bb4d60b3f27c914da79d321327bc1c964c0c4387..0d87482bd58c901e4251097767133a4339a44c79 100644 (file)
@@ -71,9 +71,11 @@ public:
   
     static Standard_Boolean IsClosed (const Handle(Adaptor2d_HCurve2d)& C);
   
-    static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_HCurve2d)& C);
+  //! Returns TRUE if C is periodic
+  static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_HCurve2d)& C);
   
-    static Standard_Real Period (const Handle(Adaptor2d_HCurve2d)& C);
+  //! Returns the period of C
+  static Standard_Real Period (const Handle(Adaptor2d_HCurve2d)& C);
   
   //! Computes the point of parameter U on the curve.
     static gp_Pnt2d Value (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U);
index aed677ec7a14b8e34b15f04cf28a42196a266b94..2d487000896452582e464f23e6c92724991aab1e 100644 (file)
@@ -71,9 +71,11 @@ public:
   
     static Standard_Boolean IsClosed (const Handle(Adaptor3d_HCurve)& C);
   
-    static Standard_Boolean IsPeriodic (const Handle(Adaptor3d_HCurve)& C);
+  //! Returns TRUE if C is periodic
+  static Standard_Boolean IsPeriodic (const Handle(Adaptor3d_HCurve)& C);
   
-    static Standard_Real Period (const Handle(Adaptor3d_HCurve)& C);
+  //! Returns the period of C
+  static Standard_Real Period (const Handle(Adaptor3d_HCurve)& C);
   
   //! Computes the point of parameter U on the curve.
     static gp_Pnt Value (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U);
index b7396836b24404abc549aeb30ec65bf23fba3254..2e717e8b488246b72621c4ce1dc7b56887a7f966 100644 (file)
@@ -39,6 +39,7 @@
 #include <BRepTools.hxx>
 #include <Geom_BSplineSurface.hxx>
 #include <Geom_BezierSurface.hxx>
+#include <GeomLib.hxx>
 #include <Bnd_Box2d.hxx>
 #include <BndLib_Add2dCurve.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
@@ -47,6 +48,8 @@
 #include <Geom_Plane.hxx>
 #include <Extrema_ExtSS.hxx>
 #include <GeomAdaptor_Surface.hxx>
+#include <GeomAdaptor_HSurface.hxx>
+
 //
 static Standard_Boolean CanUseEdges(const Adaptor3d_Surface& BS);
 //
@@ -463,7 +466,6 @@ void FindExactUVBounds(const TopoDS_Face FF,
     umax = aBAS.LastUParameter();
     vmin = aBAS.FirstVParameter();
     vmax = aBAS.LastVParameter();
-    Standard_Boolean isUperiodic = aBAS.IsUPeriodic(), isVperiodic = aBAS.IsVPeriodic();
     Standard_Real aT1, aT2;
     Standard_Real TolU = Max(aBAS.UResolution(Tol), Precision::PConfusion());
     Standard_Real TolV = Max(aBAS.VResolution(Tol), Precision::PConfusion());
@@ -495,13 +497,13 @@ void FindExactUVBounds(const TopoDS_Face FF,
         aV /= Sqrt(magn);
       }
       Standard_Real u = aP.X(), v = aP.Y();
-      if(isUperiodic)
+      if (aBAS.IsUPeriodic())
       {
-        ElCLib::InPeriod(u, umin, umax);
+        ElCLib::InPeriod(u, umin, umin + aBAS.UPeriod());
       }
-      if(isVperiodic)
+      if (aBAS.IsVPeriodic())
       {
-        ElCLib::InPeriod(v, vmin, vmax);
+        ElCLib::InPeriod(v, vmin, vmin + aBAS.VPeriod());
       }
       //
       if(Abs(u - umin) <= TolU || Abs(u - umax) <= TolU)
@@ -581,33 +583,33 @@ void FindExactUVBounds(const TopoDS_Face FF,
   Handle(Geom_Surface) aS = BRep_Tool::Surface(FF, aLoc);
   Standard_Real aUmin, aUmax, aVmin, aVmax;
   aS->Bounds(aUmin, aUmax, aVmin, aVmax);
-  if(!aS->IsUPeriodic())
+  if (!GeomLib::AllowExtendUParameter(aBAS.Surface(), umin, umax))
   {
     umin = Max(aUmin, umin);
     umax = Min(aUmax, umax);
   }
   else
   {
-    if(umax - umin > aS->UPeriod())
+    const Standard_Real aDelta = (umax - umin - aBAS.UPeriod()) / 2.0;
+    if (aBAS.IsUPeriodic() && (aDelta > 0.0))
     {
-      Standard_Real delta = umax - umin - aS->UPeriod();
-      umin += delta/2.;
-      umax -= delta/2;
+      umin += aDelta;
+      umax -= aDelta;
     }
   }
   //
-  if(!aS->IsVPeriodic())
+  if (!GeomLib::AllowExtendVParameter(aBAS.Surface(), vmin, vmax))
   {
     vmin = Max(aVmin, vmin);
     vmax = Min(aVmax, vmax);
   }
   else
   {
-    if(vmax - vmin > aS->VPeriod())
+    const Standard_Real aDelta = (vmax - vmin - aS->VPeriod()) / 2.0;
+    if (aBAS.IsVPeriodic() && (aDelta > 0.0))
     {
-      Standard_Real delta = vmax - vmin - aS->VPeriod();
-      vmin += delta/2.;
-      vmax -= delta/2;
+      vmin += aDelta;
+      vmax -= aDelta;
     }
   }
 }
index b65d247453ea8114ec92db6948579aed50c47ebc..4ccb2e6e06ad00c959b743cab33554ec8bbdf2f9 100644 (file)
@@ -197,6 +197,8 @@ void BRepCheck_Edge::Minimum()
           Standard_Real f = C3d->FirstParameter(), l = C3d->LastParameter();
           if (C3d->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve))
           {
+            // E.g. see "boolean bopfuse_complex J6" test script
+
             const Handle(Geom_Curve)& aC = Handle(Geom_TrimmedCurve)::DownCast (C3d)->BasisCurve(); 
             f = aC->FirstParameter();
             l = aC->LastParameter();
@@ -237,6 +239,8 @@ void BRepCheck_Edge::Minimum()
           Standard_Real f = PCref->FirstParameter(), l = PCref->LastParameter();
           if (PCref->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
           {
+            // E.g. see "boolean bopfuse_complex J6" test script
+
             const Handle(Geom2d_Curve)& aC = Handle(Geom2d_TrimmedCurve)::DownCast (PCref)->BasisCurve(); 
             f = aC->FirstParameter();
             l = aC->LastParameter();
@@ -373,6 +377,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
           Standard_Real fp = pc->FirstParameter(), lp = pc->LastParameter();
           if (pc->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
           {
+            // E.g. see "boolean bopfuse_complex J6" test script
+
             const Handle(Geom2d_Curve)& aC = Handle(Geom2d_TrimmedCurve)::DownCast (pc)->BasisCurve(); 
             fp = aC->FirstParameter();
             lp = aC->LastParameter();
index 4cdebf6b108cdf52925fa4ddcdacb9c8a92fcca0..cadc68599ea300ed98b94394e3c0c6929a348a96 100644 (file)
@@ -142,13 +142,6 @@ void  BRepClass_Intersector::Perform(const gp_Lin2d& L,
   }
 
   IntRes2d_Domain DE(pdeb,deb,toldeb,pfin,fin,tolfin);
-  // temporary periodic domain
-  if (C.Curve()->IsPeriodic()) {
-    DE.SetEquivalentParameters(C.FirstParameter(),
-      C.FirstParameter() + 
-      C.Curve()->LastParameter() -
-      C.Curve()->FirstParameter());
-  }
 
   Handle(Geom2d_Line) GL= new Geom2d_Line(L);
   Geom2dAdaptor_Curve CGA(GL);
index bfea093c05a5ac4a987889e6b92adfaba8b6406d..75706173a8071a3368072e0ebae59c50cda2038c 100644 (file)
@@ -153,6 +153,7 @@ static void Descendants(const TopoDS_Shape&,
   TopTools_ListIteratorOfListOfShape it,it2;
   Standard_Integer sens = 0;
 
+  // Almost all curves in scur are trimmed curve (e.g. see LocOpe_DPrism::Curves(...))
   TColGeom_SequenceOfCurve scur;
   Curves(scur);
 
index b51f7fe7f06d5ebf9a871b46b311afe185f5b7ac..9ddfc79d7124de295ade83f351bd57926a255401 100644 (file)
@@ -213,21 +213,27 @@ BRepFill_MultiLine::BRepFill_MultiLine(const TopoDS_Face&     Face1,
 
   // try duplication
   GeomAdaptor_Surface GAS1(S);
-  GeomAbs_SurfaceType Type1 = GAS1.GetType();
 
-  if ( UU1->IsPeriodic()) {
+  if (UU1->IsPeriodic() && UU1->IsClosed())
+  {
+    // Period will be equal to (UU1->LastParameter()-UU1->FirstParameter()).
+    // Therefore, UU1 must be closed
     ElCLib::AdjustPeriodic(UU1->FirstParameter(),
       UU1->LastParameter(),
       Precision::PConfusion(),
       Umin, Umax);
   }
-  if ( VV1->IsPeriodic()) {
+  if (VV1->IsPeriodic() && VV1->IsClosed())
+  {
+    // Period will be equal to (VV1->LastParameter()-VV1->FirstParameter()).
+    // Therefore, VV1 must be closed
     ElCLib::AdjustPeriodic(VV1->FirstParameter(),
       VV1->LastParameter(),
       Precision::PConfusion(),
       Vmin, Vmax);
   }
   if (GAS1.GetType() == GeomAbs_Sphere) {
+    //Is it really correct?
     if (myIsoU1)
       ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
       Precision::PConfusion(),
@@ -329,21 +335,27 @@ BRepFill_MultiLine::BRepFill_MultiLine(const TopoDS_Face&     Face1,
 
   // try duplication
   GeomAdaptor_Surface GAS2(S);
-  GeomAbs_SurfaceType Type2 = GAS2.GetType();
 
-  if ( UU2->IsPeriodic()) {
+  if (UU2->IsPeriodic() && UU2->IsClosed())
+  {
+    // Period will be equal to (UU2->LastParameter()-UU2->FirstParameter()).
+    // Therefore, UU2 must be U-closed
     ElCLib::AdjustPeriodic(UU2->FirstParameter(),
       UU2->LastParameter(),
       Precision::PConfusion(),
       Umin, Umax);
   }
-  if ( VV2->IsPeriodic()) {
+  if (VV2->IsPeriodic() && VV2->IsClosed())
+  {
+    // Period will be equal to (VV1->LastParameter()-VV1->FirstParameter()).
+    // Therefore, VV2 must be closed
     ElCLib::AdjustPeriodic(VV2->FirstParameter(),
       VV2->LastParameter(),
       Precision::PConfusion(),
       Vmin, Vmax);
   }
   if (GAS2.GetType() == GeomAbs_Sphere) {
+    //Is it really correct?
     if (myIsoU2)
       ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
       Precision::PConfusion(),
@@ -388,7 +400,8 @@ BRepFill_MultiLine::BRepFill_MultiLine(const TopoDS_Face&     Face1,
     if ( myKPart == 1)
       myCont = GeomAbs_G1;
 
-    if ( (Type1 == GeomAbs_Plane) && (Type2 == GeomAbs_Plane)) {
+    if ((GAS1.GetType() == GeomAbs_Plane) && (GAS2.GetType() == GeomAbs_Plane))
+    {
       myKPart = 2;
     }
   }
index 876501e15eec4e9ef2d87c98a1d65ca1b896146c..c9cf023a335a81fcbb21c3bb417b9357ad0d57ff 100644 (file)
 #include <TopTools_MapIteratorOfMapOfShape.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <TopTools_SequenceOfShape.hxx>
+#include <GeomLib.hxx>
 
 #include <stdio.h>
 #ifdef OCCT_DEBUG
@@ -1292,14 +1293,8 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh
     TopoDS_Vertex    V1,V2;
     
     const Handle(Geom2d_Curve)& Bis = Bisec.Value();
-    Standard_Boolean ForceAdd = Standard_False;
-    Handle(Geom2d_TrimmedCurve) aTC = Handle(Geom2d_TrimmedCurve)::DownCast(Bis);
-    if(!aTC.IsNull() && aTC->BasisCurve()->IsPeriodic())
-    {
-      gp_Pnt2d Pf = Bis->Value(Bis->FirstParameter());
-      gp_Pnt2d Pl = Bis->Value(Bis->LastParameter());
-      ForceAdd = Pf.Distance(Pl) <= Precision::Confusion();
-    }
+    const Standard_Boolean ForceAdd = (Bis->IsPeriodic() &&
+                                       GeomLib::IsClosed(Bis, Precision::Confusion()));
 
     U1 = Bis->FirstParameter();
     
index 60d0bbc92883d438a079915c7a1f12b4d806cfca..a096611af8a2b4e9bea6e4552c788ded42a49da6 100644 (file)
@@ -1282,30 +1282,21 @@ TopoDS_Edge BRepLib::SameParameter(const TopoDS_Edge& theEdge,
   Geom2dAdaptor_Curve& GAC2d = HC2d->ChangeCurve2d();
   GeomAdaptor_Surface& GAS = HS->ChangeSurface(); 
 
-  // modified by NIZHNY-OCC486  Tue Aug 27 17:15:13 2002 :
-  Standard_Boolean m_TrimmedPeriodical = Standard_False;
-  Handle(Standard_Type) TheType = C3d->DynamicType();
-  if( TheType == STANDARD_TYPE(Geom_TrimmedCurve))
+  if (C3d->IsPeriodic())
   {
-    Handle(Geom_Curve) gtC (Handle(Geom_TrimmedCurve)::DownCast (C3d)->BasisCurve());
-    m_TrimmedPeriodical = gtC->IsPeriodic();
+    // Range of the curve cannot be greater than period.
+    // If it is greater then it must be reduced.
+    const Standard_Real aDelta = Max(l3d - f3d - C3d->Period(), 0.0)/2.0;
+    f3d += aDelta;
+    l3d -= aDelta;
   }
-  // modified by NIZHNY-OCC486  Tue Aug 27 17:15:17 2002 .
 
-
-  if(!C3d->IsPeriodic()) {
-    Standard_Real Udeb = C3d->FirstParameter();
-    Standard_Real Ufin = C3d->LastParameter();
-    // modified by NIZHNY-OCC486  Tue Aug 27 17:17:14 2002 :
-    //if (Udeb > f3d) f3d = Udeb;
-    //if (l3d > Ufin) l3d = Ufin;
-    if(!m_TrimmedPeriodical)
-    {
-      if (Udeb > f3d) f3d = Udeb;
-      if (l3d > Ufin) l3d = Ufin;
-    }
-    // modified by NIZHNY-OCC486  Tue Aug 27 17:17:55 2002 .
+  if (!GeomLib::AllowExtend(*C3d, f3d, l3d))
+  {
+    if (C3d->FirstParameter() > f3d) f3d = C3d->FirstParameter();
+    if (l3d > C3d->LastParameter()) l3d = C3d->LastParameter();
   }
+
   if(!L3d.IsIdentity()){
     C3d = Handle(Geom_Curve)::DownCast(C3d->Transformed(L3d.Transformation()));
   }
index 6a3d8d52d6294f015849545ef489fc50e25da57a..5f725fafc932dbd4d3a0b9fe5c4cc2009bcac13f 100644 (file)
@@ -768,13 +768,9 @@ void  BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& CC,
                             const Standard_Real pp1,
                             const Standard_Real pp2)
 {
-  // kill trimmed curves
-  Handle(Geom_Curve) C = CC;
-  Handle(Geom_TrimmedCurve) CT = Handle(Geom_TrimmedCurve)::DownCast(C);
-  while (!CT.IsNull()) {
-    C = CT->BasisCurve();
-    CT = Handle(Geom_TrimmedCurve)::DownCast(C);
-  }
+  // kill trimmed curves to obtain First/Last-parameters of basis curve
+  const Handle(Geom_Curve) C = (CC->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) ? 
+                         Handle(Geom_TrimmedCurve)::DownCast(CC)->BasisCurve() : CC;
 
   // check parameters
   Standard_Real p1 = pp1;
@@ -782,18 +778,18 @@ void  BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& CC,
   Standard_Real cf = C->FirstParameter();
   Standard_Real cl = C->LastParameter();
   Standard_Real epsilon = Precision::PConfusion();
-  Standard_Boolean periodic = C->IsPeriodic();
   GeomAdaptor_Curve aCA(C);
 
   TopoDS_Vertex V1,V2;
-  if (periodic) {
+  if (C->IsPeriodic())
+  {
     // adjust in period
     ElCLib::AdjustPeriodic(cf,cl,epsilon,p1,p2);
     V1 = VV1;
     V2 = VV2;
   }
   else {
-    // reordonate
+    // reordinate
     if (p1 < p2) {
       V1 = VV1;
       V2 = VV2;
@@ -801,9 +797,7 @@ void  BRepLib_MakeEdge::Init(const Handle(Geom_Curve)& CC,
     else {
       V2 = VV1;
       V1 = VV2;
-      Standard_Real x = p1;
-      p1 = p2;
-      p2 = x;
+      std::swap(p1, p2);
     }
 
     // check range
index c866cb71058c4c779ba489405d33012c300e52fc..4f72560af704ca83af3426d531c9334d9707b4a9 100644 (file)
@@ -90,17 +90,11 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S,
                             const Standard_Real VMax,
                             const Standard_Boolean Segment)
 {
-  Handle(Geom_Surface) BS = S;
-  if ( S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
-    Handle(Geom_RectangularTrimmedSurface) RTS = 
-      Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
-    BS = RTS->BasisSurface();
-  }
   myError = BRepLib_EmptyShell;
   Standard_Real tol = Precision::Confusion();
 
   // Make a shell from a surface
-  GeomAdaptor_Surface GS(BS,UMin,UMax,VMin,VMax);
+  GeomAdaptor_Surface GS(S,UMin,UMax,VMin,VMax);
 
   Standard_Integer nu = GS.NbUIntervals(GeomAbs_C2);
   Standard_Integer nv = GS.NbVIntervals(GeomAbs_C2);
@@ -182,6 +176,8 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S,
     }
   }
 
+  Handle(Geom_Surface) SS = Handle(Geom_Surface)::DownCast(GS.Surface()->Copy());
+
   for (iv = 1; iv <= nv; iv++) {
 
     // compute the first edge and vertices of the line
@@ -222,7 +218,6 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S,
       // create the face at iu, iv
 
       // the surface
-      Handle(Geom_Surface) SS = Handle(Geom_Surface)::DownCast(BS->Copy());
       if (GS.GetType() == GeomAbs_BSplineSurface && Segment) {
        Handle(Geom_BSplineSurface)::DownCast(SS)
          ->Segment(upars(iu),upars(iu+1),
index 0daa3509d376bbaafe636928f29a15b8e2b766e5..85dc65092785a1c1bbc738487b7e34c73c01e28d 100644 (file)
@@ -187,6 +187,9 @@ Standard_Boolean BRepMesh_EdgeTessellator::Value(
       mySurface->GetType() != GeomAbs_BezierSurface  &&
       mySurface->GetType() != GeomAbs_OtherSurface)
   {
+    // For trimmed cone/cylinder.
+    // Return independently of the fact whether the surface trimmed.
+
     return Standard_True;
   }
 
index 1d453897ff34488535ab856926a24707482749f5..1b77c5d601cc91cf4e658855cd2c2e4f197579b2 100644 (file)
@@ -333,7 +333,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
 
       if (myumin < umin || myumax > umax)
       {
-        if (gFace->IsUPeriodic())
+        if (gFace->IsUPeriodic() && gFace->IsUClosed())
         {
           if ((myumax - myumin) > (umax - umin))
             myumax = myumin + (umax - umin);
@@ -350,7 +350,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
 
       if (myvmin < vmin || myvmax > vmax)
       {
-        if (gFace->IsVPeriodic())
+        if (gFace->IsVPeriodic() && gFace->IsVClosed())
         {
           if ((myvmax - myvmin) > (vmax - vmin))
             myvmax = myvmin + (vmax - vmin);
index e12dd8233ea146c573495e5f129e06ec4d093eba..9081c84192c2ccef2e0cf9700539dfaa5bcfa9c1 100644 (file)
@@ -929,6 +929,9 @@ void BRepOffset_Inter2d::ExtentEdge(const TopoDS_Edge& E,TopoDS_Edge& NE, const
           if (theCurve->IsKind(STANDARD_TYPE(Geom2d_BoundedCurve)) &&
               (FirstPar > anEf - a2Offset || LastPar < anEl + a2Offset))
             {
+              // Trimmed curves or periodic B-spline curves are processed
+              // in this branch.
+
               Handle(Geom2d_Curve) NewPCurve;
               if (ExtendPCurve(theCurve, anEf, anEl, a2Offset, NewPCurve))
                 {
index 0dcbcf3ac8ce47314a82330762a6bf4b2901ee76..d909d69d5c8aca09bfcc3305bbff34a5f142939e 100644 (file)
@@ -251,11 +251,8 @@ static void PutInBounds (const TopoDS_Face&          F,
   BRep_Tool::Range(E,f,l);  
 
   TopLoc_Location L; // Recup S avec la location pour eviter la copie.
-  Handle (Geom_Surface) S   = BRep_Tool::Surface(F,L);
+  const Handle (Geom_Surface) &S = BRep_Tool::Surface(F,L);
 
-  if (S->IsInstance(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
-    S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
-  }
   //---------------
   // Recadre en U.
   //---------------
@@ -1676,25 +1673,15 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
         
         Standard_Real f, l;
        const Handle(Geom_Curve)& aC3DE = BRep_Tool::Curve(anEdge, f, l);
-       Handle(Geom_TrimmedCurve) aC3DETrim;
            
-       if(!aC3DE.IsNull()) 
-            aC3DETrim = new Geom_TrimmedCurve(aC3DE, f, l);
-        
         BRep_Builder aBB;
        Standard_Real aTolEdge = BRep_Tool::Tolerance(anEdge);
                
         if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, cpF1)) {
           Handle(Geom2d_Curve) aC2d = aBC.Curve().FirstCurve2d();
-          if(!aC3DETrim.IsNull()) {
+          if (!aC3DE.IsNull()) {
                Handle(Geom2d_Curve) aC2dNew;
-               
-               if(aC3DE->IsPeriodic()) {
                   BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, f, l,  aC2d, aC2dNew, aContext);
-                 }
-               else {
-                  BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF1, aC3DETrim, aC2d, aC2dNew, aContext); 
-                 }
                aC2d = aC2dNew;
              }
              aBB.UpdateEdge(anEdge, aC2d, cpF1, aTolEdge);
@@ -1702,15 +1689,9 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
         
         if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, cpF2)) {
           Handle(Geom2d_Curve) aC2d = aBC.Curve().SecondCurve2d();
-          if(!aC3DETrim.IsNull()) {
+          if (!aC3DE.IsNull()) {
                Handle(Geom2d_Curve) aC2dNew;
-               
-               if(aC3DE->IsPeriodic()) {
                   BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, f, l,  aC2d, aC2dNew, aContext);
-                 }
-               else {
-                  BOPTools_AlgoTools2D::AdjustPCurveOnFace(cpF2, aC3DETrim, aC2d, aC2dNew, aContext); 
-                 }
                aC2d = aC2dNew;
              }
              aBB.UpdateEdge(anEdge, aC2d, cpF2, aTolEdge);
index 454e3c0c0dcc1939d42447bf6a3fa156a1b3efbd..ee35292b6d25e6ee5e8997ca481bfd0bca73a935 100644 (file)
@@ -265,6 +265,8 @@ static Standard_Integer pcurve(Draw_Interpretor& , Standard_Integer n, const cha
       Standard_Boolean IsPeriodic = c->IsPeriodic();
       if (c->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve))
       {
+        // E.g. see "boolean bopfuse_complex J6" test script
+
         const Handle(Geom2d_Curve)& aC = Handle(Geom2d_TrimmedCurve)::DownCast (c)->BasisCurve(); 
         IsPeriodic = aC->IsPeriodic();
         fr = aC->FirstParameter();
index 449a9c65305be4abdecc6d6f75ac3a3d8169a85e..57e352110d6248c6ce4efe021dff21ec4f76cfa8 100644 (file)
@@ -62,6 +62,7 @@
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopTools_SequenceOfShape.hxx>
+#include <GeomLib.hxx>
 #include <GeomLib_CheckCurveOnSurface.hxx>
 #include <errno.h>
 //=======================================================================
@@ -1011,12 +1012,32 @@ Standard_Real BRepTools::EvalAndUpdateTol(const TopoDS_Edge& theE,
   //Set first, last to avoid ErrosStatus = 2 because of 
   //too strong checking of limits in class CheckCurveOnSurface
   //
-  if(!C3d->IsPeriodic())
+
+  if (C3d->IsPeriodic())
+  {
+    // Range of the curve cannot be greater than period.
+    // If it is greater then it must be reduced.
+    const Standard_Real aDelta = Max(last - first - C3d->Period(), 0.0)/2.0;
+    first += aDelta;
+    last -= aDelta;
+  }
+
+  if (C2d->IsPeriodic())
+  {
+    // Range of the curve cannot be greater than period.
+    // If it is greater then it must be reduced.
+    const Standard_Real aDelta = Max(last - first - C2d->Period(), 0.0)/2.0;
+    first += aDelta;
+    last -= aDelta;
+  }
+
+  if (!GeomLib::AllowExtend(*C3d, first, last))
   {
     first = Max(first, C3d->FirstParameter());
     last = Min(last, C3d->LastParameter());
   }
-  if(!C2d->IsPeriodic())
+
+  if (!GeomLib::AllowExtend(*C2d, first, last))
   {
     first = Max(first, C2d->FirstParameter());
     last = Min(last, C2d->LastParameter());
index 1a8de56f7eef9eb96abe02d947e59b54bed32b4a..e5b85d39657ae26f0fc05027a1414303d3b32899 100644 (file)
@@ -50,6 +50,7 @@
 #include <GeomAdaptor_HSurface.hxx>
 #include <GeomAdaptor_Surface.hxx>
 #include <GeomConvert.hxx>
+#include <GeomLib.hxx>
 #include <gp_GTrsf2d.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_TrsfForm.hxx>
@@ -386,9 +387,11 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
       C2d = TC->BasisCurve();
     }
 
-    Standard_Real fc = C2d->FirstParameter(), lc = C2d->LastParameter();
+    const Standard_Real fc = C2d->FirstParameter(), 
+                        lc = C2d->LastParameter();
 
-    if(!C2d->IsPeriodic()) {
+    if (!GeomLib::AllowExtend(*C2d, f2d, l2d))
+    {
       if(fc - f2d > Precision::PConfusion()) f2d = fc;
       if(l2d - lc > Precision::PConfusion()) l2d = lc;
     }
index 6bc92499cd7d64ca2dae82aedb7ba34f69c2daf8..50ce78976b4a0da561b37075a28e0fe5bf7869c5 100644 (file)
@@ -175,21 +175,22 @@ Standard_Boolean BRepTools_TrsfModification::NewCurve2d
     NewC = TC->BasisCurve();
   }
 
-  Standard_Real fc = NewC->FirstParameter(), lc = NewC->LastParameter();
-
-  if(!NewC->IsPeriodic()) {
+  const Standard_Real fc = NewC->FirstParameter(), lc = NewC->LastParameter();
+  if (!GeomLib::AllowExtend(*NewC, f, l))
+  {
     if(fc - f > Precision::PConfusion()) f = fc;
     if(l - lc > Precision::PConfusion()) l = lc;
-    if(Abs(l - f) < Precision::PConfusion())
+  }
+
+  if (!NewC->IsPeriodic() && (Abs(l - f) < Precision::PConfusion()))
+  {
+    if(Abs(f - fc) < Precision::PConfusion())
+    {
+      l = lc;
+    }
+    else
     {
-      if(Abs(f - fc) < Precision::PConfusion())
-      {
-        l = lc;
-      }
-      else
-      {
-        f = fc;
-      }
+      f = fc;
     }
   }
 
index 2dd590986cdae73af305cc1544a3e02223346a24..d2223a61b1f72f66850a80271c5d704175ba6bdb 100644 (file)
@@ -87,8 +87,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is not implemented
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
-  
+
+  //! This method is not implemented
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 914bdd52a5feaa34159c254ce14198fb2699e06d..dda8d395fbf038fbc98c82589ea13ec0b8902fe0 100644 (file)
@@ -86,8 +86,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is not implemented
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is not implemented
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 0f34bf736cd508cc89b85dda9f2cf63390699da3..1003ab6697d5870f356353c172c0c60dc9db781f 100644 (file)
@@ -237,9 +237,9 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom2d_B
 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom2d_BSplineCurve)& B)
 {
   OS << (Standard_Byte)BSPLINE;
-  Standard_Boolean aRational = B->IsRational() ? 1:0;
+  Standard_Boolean aRational = B->IsRational() ? Standard_True : Standard_False;
   BinTools::PutBool(OS, aRational); //rational
-  Standard_Boolean aPeriodic = B->IsPeriodic() ? 1:0;
+  Standard_Boolean aPeriodic = B->IsPeriodic() ? Standard_True : Standard_False;
   BinTools::PutBool(OS, aPeriodic); //periodic
   // poles and weights
   Standard_Integer i,aDegree,aNbPoles,aNbKnots;
index 7f89e62b0d72ee1925239db8715002076f122a76..751af40c749a5f33ab4b1941dbc2757642ccbe14 100644 (file)
@@ -250,9 +250,9 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_Bez
 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_BSplineCurve)& B)
 {
   OS << (Standard_Byte)BSPLINE;
-  Standard_Boolean aRational = B->IsRational() ? 1:0;
+  Standard_Boolean aRational = B->IsRational() ? Standard_True : Standard_False;
   BinTools::PutBool(OS, aRational); //rational
-  Standard_Boolean aPeriodic = B->IsPeriodic() ? 1:0;
+  Standard_Boolean aPeriodic = B->IsPeriodic() ? Standard_True : Standard_False;
   BinTools::PutBool(OS, aPeriodic); //periodic
   // poles and weights
   Standard_Integer i,aDegree,aNbPoles,aNbKnots;
index c43fe79f791789d5f06538d9f482d851bd6e0cb1..c43e8b67ee4038830f9bf8ac2545d60067941b29 100644 (file)
@@ -298,10 +298,10 @@ static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_Bez
 static Standard_OStream& operator <<(Standard_OStream& OS, const Handle(Geom_BSplineSurface)& S)
 {
   OS << (Standard_Byte)BSPLINE;
-  Standard_Boolean urational = S->IsURational() ? 1:0;
-  Standard_Boolean vrational = S->IsVRational() ? 1:0;
-  Standard_Boolean uperiodic = S->IsUPeriodic() ? 1:0;
-  Standard_Boolean vperiodic = S->IsVPeriodic() ? 1:0;
+  Standard_Boolean urational = S->IsURational() ? Standard_True : Standard_False;
+  Standard_Boolean vrational = S->IsVRational() ? Standard_True : Standard_False;
+  Standard_Boolean uperiodic = S->IsUPeriodic() ? Standard_True : Standard_False;
+  Standard_Boolean vperiodic = S->IsVPeriodic() ? Standard_True : Standard_False;
   BinTools::PutBool(OS, urational); 
   BinTools::PutBool(OS, vrational); 
   BinTools::PutBool(OS, uperiodic); 
index 6e5330d7ec737e88f24ef6fe63d7f816cf07734f..324717e848aea8eb3c2efa73e17696ac76f7e19c 100644 (file)
@@ -1398,7 +1398,7 @@ Standard_Boolean Bisector_BisecAna::IsClosed() const
 //=============================================================================
 Standard_Boolean Bisector_BisecAna::IsPeriodic() const 
 {
-  return thebisector->BasisCurve()->IsPeriodic(); 
+  return thebisector->IsPeriodic();
 }
 
 //=============================================================================
index fbc0b8a21d94824097d851c14e0a8c385cc3f196..a6b6684405875a6ac9046e69e5020428dff5459e 100644 (file)
@@ -104,6 +104,7 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from Geom2d_Curve::IsPeriodic()
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
index 8340c0f76c11b58c0aedbebf6a8f4c65db0f7cbc..e827f79419257174f887d3a33230d1fb026fe355 100644 (file)
@@ -127,6 +127,7 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from Geom2d_Curve::IsPeriodic()
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns the point of parameter U.
index a748e7e4f5f36ccbef22ceea7cc8d35d1ecd825e..24c00053186686c3339f2c3d2a65e7833e38a6a2 100644 (file)
@@ -132,6 +132,7 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from Geom2d_Curve::IsPeriodic()
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns   the   distance   between  the  point  of
index 0eff8be730e4a88816c97b12da50666e02a2b3c5..ca439cecc6e01f61113b24501574e4014ba3c6a7 100644 (file)
@@ -122,10 +122,15 @@ void ChFi2d_FilletAlgo::Init(const TopoDS_Edge& theEdge1,
   myCurve1 = GeomProjLib::Curve2d(aCurve1, myStart1, myEnd1, myPlane);
   myCurve2 = GeomProjLib::Curve2d(aCurve2, myStart2, myEnd2, myPlane);
 
-  while (myCurve1->IsPeriodic() && myStart1 >= myEnd1)
-    myEnd1 += myCurve1->Period();
-  while (myCurve2->IsPeriodic() && myStart2 >= myEnd2)
-    myEnd2 += myCurve2->Period();
+  if(myCurve1->IsPeriodic() && myStart1 >= myEnd1)
+  {
+    myEnd1 = ElCLib::InPeriod(myEnd1, myStart1, myStart1 + myCurve1->Period());
+  }
+
+  if(myCurve2->IsPeriodic() && myStart2 >= myEnd2)
+  {
+    myEnd2 = ElCLib::InPeriod(myEnd2, myStart2, myStart2 + myCurve2->Period());
+  }
  
   if (aBAC1.GetType() == aBAC2.GetType()) 
   {
@@ -267,8 +272,10 @@ void ChFi2d_FilletAlgo::FillPoint(FilletPoint* thePoint, const Standard_Real the
 
     // checking the right parameter
     Standard_Real aParamProj = aProj.Parameter(a);
-    while(myCurve2->IsPeriodic() && aParamProj < myStart2)
-      aParamProj += myCurve2->Period();
+    if(myCurve2->IsPeriodic() && aParamProj < myStart2)
+    {
+      aParamProj = ElCLib::InPeriod(aParamProj, myStart2, myStart2 + myCurve2->Period());
+    }
 
     const Standard_Real d = aProj.Distance(a);
     thePoint->appendValue(d * d - myRadius * myRadius, (aParamProj >= myStart2 && aParamProj <= myEnd2 && aValid2));
index fd166d3442b288c5c75174832a829811952f4405..664218a5bf5bf8d8479f79e0913b8c1acbf7694f 100644 (file)
@@ -585,10 +585,7 @@ void ChFi3d_BoundSrf(GeomAdaptor_Surface& S,
   const Standard_Boolean checknaturalbounds)
 {
   Standard_Real umin = uumin, umax = uumax, vmin = vvmin, vmax = vvmax; 
-  Handle(Geom_Surface) surface = S.Surface();
-  Handle(Geom_RectangularTrimmedSurface) 
-    trs = Handle(Geom_RectangularTrimmedSurface)::DownCast(surface);
-  if(!trs.IsNull()) surface = trs->BasisSurface();
+  const Handle(Geom_Surface) &surface = S.Surface();
   Standard_Real u1,u2,v1,v2;
   surface->Bounds(u1,u2,v1,v2);
   Standard_Real peru=0, perv=0;
@@ -620,8 +617,16 @@ void ChFi3d_BoundSrf(GeomAdaptor_Surface& S,
   Standard_Real vv1 = vmin - Stepv;
   Standard_Real vv2 = vmax + Stepv;
   if(checknaturalbounds) {
-    if(!S.IsUPeriodic()) {uu1 = Max(uu1,u1);  uu2 = Min(uu2,u2);}
-    if(!S.IsVPeriodic()) {vv1 = Max(vv1,v1);  vv2 = Min(vv2,v2);}
+    if (!GeomLib::AllowExtendUParameter(S, uu1, uu2))
+    {
+      uu1 = Max(uu1,u1);
+      uu2 = Min(uu2,u2);
+    }
+    if (!GeomLib::AllowExtendVParameter(S, vv1, vv2))
+    {
+      vv1 = Max(vv1, v1);
+      vv2 = Min(vv2, v2);
+    }
   }
   S.Load(surface,uu1,uu2,vv1,vv2);
 }
@@ -984,12 +989,18 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1,
   Handle(Geom2d_Curve) pcf1 = fd1->Interference(jf1).PCurveOnFace();
   if(pcf1.IsNull()) return Standard_False;
   Standard_Boolean isper1 = pcf1->IsPeriodic();
-  if(isper1) {
+  if(isper1)
+  {
+    // Extract basis curve to obtain its First and Last parameters.
     Handle(Geom2d_TrimmedCurve) tr1 = Handle(Geom2d_TrimmedCurve)::DownCast(pcf1);
     if(!tr1.IsNull()) pcf1 = tr1->BasisCurve();
     C1.Load(pcf1);
   }
-  else C1.Load(pcf1,first-delta,last+delta);
+  else
+  {
+    C1.Load(pcf1, first - delta, last + delta);
+  }
+
   Standard_Real first1 = pcf1->FirstParameter(), last1 = pcf1->LastParameter();
 
   first = fd2->Interference(jf2).FirstParameter();
@@ -1000,12 +1011,18 @@ Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1,
   Handle(Geom2d_Curve) pcf2 = fd2->Interference(jf2).PCurveOnFace();
   if(pcf2.IsNull()) return Standard_False;
   Standard_Boolean isper2 = pcf2->IsPeriodic();
-  if(isper2) {
+  if(isper2)
+  {
+    // Extract basis curve to obtain its First and Last parameters.
     Handle(Geom2d_TrimmedCurve) tr2 = Handle(Geom2d_TrimmedCurve)::DownCast(pcf2);
     if(!tr2.IsNull()) pcf2 = tr2->BasisCurve();
     C2.Load(pcf2);
   }
-  else C2.Load(fd2->Interference(jf2).PCurveOnFace(),first-delta,last+delta);
+  else
+  {
+    C2.Load(pcf2, first - delta, last + delta);
+  }
+
   Standard_Real first2 = pcf2->FirstParameter(), last2 = pcf2->LastParameter();
 
   IntRes2d_IntersectionPoint int2d;
@@ -1635,13 +1652,13 @@ void  ChFi3d_ComputeArete(const ChFiDS_CommonPoint&   P1,
         Parfin = C3d->ReversedParameter(Parfin);
         C3d->Reverse();
       }
-      Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C3d);
-      if(!tc.IsNull()) {
-        C3d = tc->BasisCurve();
-        if (C3d->IsPeriodic()) {
-          ElCLib::AdjustPeriodic(C3d->FirstParameter(),C3d->LastParameter(),
-            tol2d,Pardeb,Parfin);
-        }
+
+      if (C3d->IsPeriodic())
+      {
+        Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C3d);
+        if (!tc.IsNull()) C3d = tc->BasisCurve();
+        ElCLib::AdjustPeriodic(C3d->FirstParameter(), C3d->LastParameter(),
+                               tol2d, Pardeb, Parfin);
       }
     }
     if(IFlag != 1) {
@@ -1665,13 +1682,13 @@ void  ChFi3d_ComputeArete(const ChFiDS_CommonPoint&   P1,
         Parfin = C3d->ReversedParameter(Parfin);
         C3d->Reverse();
       }
-      Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C3d);
-      if(!tc.IsNull()) {
-        C3d = tc->BasisCurve();
-        if (C3d->IsPeriodic()) {
-          ElCLib::AdjustPeriodic(C3d->FirstParameter(),C3d->LastParameter(),
-            tol2d,Pardeb,Parfin);
-        }
+
+      if (C3d->IsPeriodic())
+      {
+        Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C3d);
+        if (!tc.IsNull()) C3d = tc->BasisCurve();
+        ElCLib::AdjustPeriodic(C3d->FirstParameter(), C3d->LastParameter(),
+                               tol2d, Pardeb, Parfin);
       }
     }
     if(IFlag != 1) {
@@ -2966,9 +2983,6 @@ Handle(Geom_Surface) trsfsurf(const Handle(Adaptor3d_HSurface)& HS,
   else if(!hgs.IsNull()) {
     res = hgs->ChangeSurface().Surface();
   }
-  Handle(Geom_RectangularTrimmedSurface) 
-    tr = Handle(Geom_RectangularTrimmedSurface)::DownCast(res);
-  if(!tr.IsNull()) res = tr->BasisSurface();
 
   Standard_Real U1 = HS->FirstUParameter(), U2 = HS->LastUParameter();
   Standard_Real V1 = HS->FirstVParameter(), V2 = HS->LastVParameter();
@@ -3971,7 +3985,7 @@ Standard_EXPORT
   tolpared = edc.Resolution(tol);
   Cv = BRep_Tool::Curve(E, First, Last);
   //Add vertex with tangent
-  if (ES.IsPeriodic())
+  if (ES.IsPeriodic() && ES.IsClosed())
   {
     Standard_Real ParForElSpine = (E.Orientation() == TopAbs_FORWARD)? First : Last;
     gp_Pnt PntForElSpine;
@@ -4314,7 +4328,7 @@ Standard_EXPORT
     }       
   }
   // elspine periodic => BSpline Periodic
-  if(ES.IsPeriodic()) {
+  if(ES.IsPeriodic() && ES.IsClosed()) {
     if(!BSpline->IsPeriodic()) {
       BSpline->SetPeriodic();
       //modified by NIZNHY-PKV Fri Dec 10 12:20:22 2010ft
index b63ad083373d260fbcbdfe3a63c656497b00bd78..a696a6dbfe5540af01acb21ced955d7e0154b3f6 100644 (file)
@@ -241,7 +241,8 @@ static Standard_Boolean Update(const Handle(Adaptor3d_HSurface)& fb,
 
   Standard_Real  wbis = 0.;
 
-  Standard_Boolean isperiodic = ct->IsPeriodic(),recadrebis = Standard_False;
+  Standard_Boolean isperiodic = (ct->IsPeriodic() && ct->IsClosed()),
+                   recadrebis = Standard_False;
   Intersection.Perform(ct,fb);
   if (Intersection.IsDone()) {
     Standard_Integer nbp = Intersection.NbPoints(),i,isol = 0,isolbis = 0;
@@ -384,6 +385,7 @@ static Standard_Boolean Update(const Handle(Adaptor3d_HSurface)& face,
       if (!PConF.IsNull())
       {
         Handle(Geom2d_TrimmedCurve) aTrCurve = Handle(Geom2d_TrimmedCurve)::DownCast(PConF);
+        // Extract basis curve to obtain its first/last parameters.
         if (!aTrCurve.IsNull())
           PConF = aTrCurve->BasisCurve();
         if (!PConF->IsPeriodic())
@@ -483,10 +485,7 @@ static void ChFi3d_Recale(BRepAdaptor_Surface&   Bs,
                          gp_Pnt2d&              p2,
                          const Standard_Boolean refon1)
 {
-  Handle(Geom_Surface) surf = Bs.ChangeSurface().Surface();
-  Handle(Geom_RectangularTrimmedSurface)
-    ts = Handle(Geom_RectangularTrimmedSurface)::DownCast(surf);
-  if (!ts.IsNull()) surf = ts->BasisSurface();
+  const Handle(Geom_Surface) &surf = Bs.ChangeSurface().Surface();
   if (surf->IsUPeriodic()) {
     Standard_Real u1 = p1.X(), u2 = p2.X();
     Standard_Real uper = surf->UPeriod();
@@ -2722,7 +2721,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
           DStr.SetNewSurface(Face[nb-1],Sfacemoins1);
         }
        //// for periodic 3d curves ////
-       if (cad.IsPeriodic())
+       if (cad.IsPeriodic() && cad.IsClosed())
        {
          gp_Pnt2d P2d = BRep_Tool::Parameters( Vtx, Face[0] );
          Geom2dAPI_ProjectPointOnCurve Projector( P2d, C2dint1 );
index f5c0200cd4fb8b921ae661c011279c697ac27eb1..7900cd95a2c0365392ede7f35d03d50824deeefb 100644 (file)
@@ -161,6 +161,19 @@ Standard_Boolean ChFiDS_ElSpine::IsPeriodic() const
   return periodic;
 }
 
+//=======================================================================
+//function : IsPeriodic
+//purpose  : 
+//=======================================================================
+Standard_Boolean ChFiDS_ElSpine::IsClosed() const
+{
+  if (curve.GetType() == GeomAbs_OtherCurve)
+    return IsPeriodic();
+
+  const Handle(Geom_Curve) &aC = curve.Curve();
+  return curve.IsClosed() && 
+    ((plast - pfirst - aC->LastParameter() + aC->FirstParameter()) < gp::Resolution());
+}
 
 //=======================================================================
 //function : SetPeriodic
index e98953965a09d6958a9305ffda1bd75ee85d0d56..f727ffc4d11f7c6b44ff75f355790245111addb6 100644 (file)
@@ -83,10 +83,15 @@ public:
   
   Standard_EXPORT virtual GeomAbs_CurveType GetType() const Standard_OVERRIDE;
   
+  //! Returns TRUE if *this has been set to periodic by calling SetPeriodic(...) method
   Standard_EXPORT virtual Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns TRUE if *this is closed
+  Standard_EXPORT virtual Standard_Boolean IsClosed() const Standard_OVERRIDE;
+
   Standard_EXPORT void SetPeriodic (const Standard_Boolean I);
   
+  //! Returns the period of the periodic object
   Standard_EXPORT virtual Standard_Real Period() const Standard_OVERRIDE;
   
   Standard_EXPORT virtual gp_Pnt Value (const Standard_Real AbsC) const Standard_OVERRIDE;
index ac027a79b22e23d9a39017589cd56917fe5be9b7..c7a5bc732ed0ba364680626c71e94e2318177917 100644 (file)
@@ -71,9 +71,11 @@ public:
   
     static Standard_Boolean IsClosed (const Handle(Adaptor2d_HCurve2d)& C);
   
-    static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_HCurve2d)& C);
+  //! Returns TRUE if C is periodic
+  static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_HCurve2d)& C);
   
-    static Standard_Real Period (const Handle(Adaptor2d_HCurve2d)& C);
+  //! Returns the period of C
+  static Standard_Real Period (const Handle(Adaptor2d_HCurve2d)& C);
   
   //! Computes the point of parameter U on the curve.
     static gp_Pnt2d Value (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U);
index 95b4d022d1e6dbda4b7b708856dbb4482b49e7ed..a740b65f8e9450d24fecf9d0fa35735134529071 100644 (file)
@@ -35,6 +35,7 @@
 #include <Draw_Drawable3D.hxx>
 #include <Geom_BSplineCurve.hxx>
 #include <Geom_BSplineSurface.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
 #include <GeomAdaptor_HSurface.hxx>
 #include <GeomAdaptor_Surface.hxx>
 #include <gp_Lin2d.hxx>
@@ -391,9 +392,14 @@ void  DBRep_DrawableShape::DrawOn(Draw_Display& dis) const
 
       Standard_Boolean restriction = Standard_False;
       if(aSurf->IsUPeriodic() || aSurf->IsVPeriodic()) {
+        Handle(Geom_Surface) aBS = aSurf;
+        if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
+        {
+          aBS = Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf)->BasisSurface();
+        }
         Standard_Real SU1 = 0., SU2 = 0., SV1 = 0., SV2 = 0.;
         Standard_Real FU1 = 0., FU2 = 0., FV1 = 0., FV2 = 0.;
-        aSurf->Bounds(SU1,SU2,SV1,SV2);
+        aBS->Bounds(SU1, SU2, SV1, SV2);
         BRepTools::UVBounds (F->Face(),FU1,FU2,FV1,FV2);
         if(aSurf->IsUPeriodic()) {
           if(FU1 < SU1 || FU1 > SU2)
index 81a205a93a78ed9fcfb83c8144b1367e208ae99b..27b01612e70f80d01c9083a9299b3f172efc3f82 100644 (file)
@@ -468,11 +468,6 @@ Standard_Boolean Draft_Modification::NewParameter(const TopoDS_Vertex& V,
 
   P = myVMap.ChangeFromKey(V).Parameter(E);
   Handle(Geom_Curve) GC = myEMap.FindFromKey(E).Geometry();
-  Handle(Standard_Type) typc = GC->DynamicType();
-  if (typc == STANDARD_TYPE(Geom_TrimmedCurve)) {
-    GC = Handle(Geom_TrimmedCurve)::DownCast(GC);
-    typc = GC->DynamicType();
-  }
 
   if (GC->IsClosed()) {
     TopoDS_Vertex FV = TopExp::FirstVertex(E);
index 9ff93c998c57e705bf6cc6462e80b4456715f921..5a3e98d4c7b5eee34468cbb8d53af3c61116a7bd 100644 (file)
@@ -2075,8 +2075,9 @@ static Standard_Real Parameter(const Handle(Geom_Curve)& C,
       }
     }
 
-    if (cbase->IsPeriodic()) {
-      Standard_Real Per  = cbase->Period();
+    if (C->IsPeriodic())
+    {
+      Standard_Real Per = C->Period();
       Standard_Real Tolp = Precision::Parametric(Precision::Confusion());  
       if (Abs(Per-param) <= Tolp) {
         param = 0.;
index 814e3ebf9fc60334f1fa3097fbaffd53cba3eb94..c2bee6ed1d7165f0a0f99bf62bfa61ad89e2b833 100644 (file)
@@ -71,7 +71,7 @@ void DrawTrSurf_BSplineCurve2d::DrawOn (Draw_Display& dis) const
     for (Standard_Integer i = 2; i <= NbPoles; i++) {
       dis.DrawTo(CPoles(i));
     }
-    if (C->IsPeriodic())
+    if (C->IsPeriodic() && C->IsClosed())
       dis.DrawTo(CPoles(1));
   }
 
index 995e311ce017b3335a002d0d91cc327332bb8a9b..64aec13da2cd358ef93075e59c9e40873865188a 100644 (file)
 //=======================================================================
 Standard_Boolean Extrema_CurveTool::IsPeriodic(const Adaptor3d_Curve& C)
 {
-  GeomAbs_CurveType aType = GetType(C);
-  if (aType == GeomAbs_Circle ||
-      aType == GeomAbs_Ellipse)
-    return Standard_True;
-  else
-    return C.IsPeriodic();
+  return C.IsPeriodic();
 }
 
 //=======================================================================
index 163b1550e906ee7535492b25a24b899b8e2655b0..ba449e02ba9c88c5be072c8bfe1f516c203bfcad 100644 (file)
@@ -72,9 +72,11 @@ public:
   //!
     Standard_EXPORT static Handle(TColStd_HArray1OfReal) DeflCurvIntervals(const Adaptor3d_Curve& C);
 
-    Standard_EXPORT static Standard_Boolean IsPeriodic (const Adaptor3d_Curve& C);
-  
-    static Standard_Real Period (const Adaptor3d_Curve& C);
+  //! Returns TRUE if C is periodic
+  Standard_EXPORT static Standard_Boolean IsPeriodic (const Adaptor3d_Curve& C);
+
+  //! Returns the period of C
+  static Standard_Real Period (const Adaptor3d_Curve& C);
   
     static Standard_Real Resolution (const Adaptor3d_Curve& C, const Standard_Real R3d);
   
index 5329a15d4880a47c0cc5aca09c4521cf77df44a4..6526ea773eeee913998480d96447dc40973de66e 100644 (file)
@@ -309,7 +309,8 @@ void Extrema_ExtPExtS::Perform (const gp_Pnt& P)
     if (myC->IsPeriodic())
     {
       Standard_Real U2 = U;
-      ElCLib::AdjustPeriodic(myuinf, myuinf + 2.*M_PI, Precision::PConfusion(), U, U2);
+      ElCLib::AdjustPeriodic(myuinf, myuinf + myC->Period(), 
+                             Precision::PConfusion(), U, U2);
     }
     //////////////////////////////////////////////////
     gp_Pnt E = POC.Value();
index 38cf01356641a744915f487dfc775395e72eac4e..2dee910166012cc6de08bf33fafa2bfbdbd4489e 100644 (file)
@@ -229,8 +229,7 @@ public:
   Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
   
 
-  //! Returns True if the parametrization of a curve is periodic.
-  //! (P(u) = P(u + T) T = constante)
+  //! Always returns FALSE.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
 
index 5dd0e7029b393ebd8c683ec526cb9baa66367735..646596c1c257465418dd59875c619a81f3a2fd13 100644 (file)
@@ -230,12 +230,16 @@ void Geom_ConicalSurface::SetSemiAngle (const Standard_Real Ang) {
 //purpose  : 
 //=======================================================================
 
-Pnt Geom_ConicalSurface::Apex () const 
+Pnt Geom_ConicalSurface::Apex(Standard_Real* const theVParametr) const
 {
 
    XYZ Coord = Position().Direction().XYZ();
    Coord.Multiply (-radius / Tan (semiAngle));
    Coord.Add      (Position().Location().XYZ());
+
+   if (theVParametr)
+     *theVParametr = -radius / Sin(semiAngle);
+
    return Pnt     (Coord);
 }
 
index 40ac5b531ad6b98db7c0e8fd75e57a2e824bddd1..c272726d4e732b6cca588c61a5bbc5e8d07191a8 100644 (file)
@@ -179,7 +179,9 @@ public:
   //! side of the axis of revolution of this cone if the
   //! half-angle at the apex is positive, and on the positive
   //! side of the "main Axis" if the half-angle is negative.
-  Standard_EXPORT gp_Pnt Apex() const;
+  //! If theVParametr != 0 (points on the real variable) then it will store
+  //! the V-parameter of the apex.
+  Standard_EXPORT gp_Pnt Apex(Standard_Real* const theVParametr = 0) const;
   
 
   //! The conical surface is infinite in the V direction so
index 4cacecc422f0b72628779e5e413486c77af0b034..243f1f158418879becdc8b26a748f93f774b1c65 100644 (file)
@@ -141,25 +141,14 @@ public:
   //! application.
   Standard_EXPORT virtual Standard_Boolean IsClosed() const = 0;
   
-  //! Is the parametrization of the curve periodic ?
-  //! It is possible only if the curve is closed and if the
-  //! following relation is satisfied :
-  //! for each parametric value U the distance between the point
-  //! P(u) and the point P (u + T) is lower or equal to Resolution
-  //! from package gp, T is the period and must be a constant.
-  //! There are three possibilities :
-  //! . the curve is never periodic by definition (SegmentLine)
-  //! . the curve is always periodic by definition (Circle)
-  //! . the curve can be defined as periodic (BSpline). In this case
-  //! a function SetPeriodic allows you to give the shape of the
-  //! curve.  The general rule for this case is : if a curve can be
-  //! periodic or not the default periodicity set is non periodic
-  //! and you have to turn (explicitly) the curve into a periodic
-  //! curve  if you want the curve to be periodic.
+  //! Returns true if the curve is periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
   Standard_EXPORT virtual Standard_Boolean IsPeriodic() const = 0;
   
-  //! Returns the period of this curve.
-  //! Exceptions Standard_NoSuchObject if this curve is not periodic.
+  //! Returns the period of the periodic curve.
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
   Standard_EXPORT virtual Standard_Real Period() const;
   
   //! It is the global continuity of the curve
index 5bdffddbf0d0b99584ed2516cf8f553f0649b27e..826ed688c44e5b4abe62bec91f0cacdd7bb4b175 100644 (file)
@@ -139,6 +139,9 @@ void Geom_OffsetCurve::SetOffsetValue (const Standard_Real D)
 
 Standard_Boolean Geom_OffsetCurve::IsPeriodic () const
 {
+  if (basisCurve->Continuity() == GeomAbs_C0)
+    return Standard_False;
+
   return basisCurve->IsPeriodic();
 }
 
index a195a85e92ad4c305f482b76e8018e4086b2885a..05b9ca7f87d5360f2a4906afb137565ad829a9e3 100644 (file)
@@ -243,14 +243,12 @@ public:
   //! Raised if N < 0.
   Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
   
-  //! Returns true if this offset curve is periodic, i.e. if the
-  //! basis curve of this offset curve is periodic.
+  //! Returns TRUE if the basis curve is periodic. Returns FALSE otherwise.
+  //! Moreover, the basis curve must have continuity greater than C0.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns the period of this offset curve, i.e. the period
   //! of the basis curve of this offset curve.
-  //! Exceptions
-  //! Standard_NoSuchObject if the basis curve is not periodic.
   Standard_EXPORT virtual Standard_Real Period() const Standard_OVERRIDE;
   
   //! Applies the transformation T to this offset curve.
index 207deca32d79d88a142f2b5bde825fb0fb60a435..0f3dc08ad6acb88df70540e5dc8ba5aea08fa0a0 100644 (file)
@@ -639,6 +639,10 @@ Standard_Boolean Geom_OffsetSurface::IsCNv (const Standard_Integer N) const
 
 Standard_Boolean Geom_OffsetSurface::IsUPeriodic () const 
 {
+  //Indeed, the basis surface must have continuity greater than C0 
+  //in U-direction.
+  //However currently it is not checked.
+
   return basisSurf->IsUPeriodic();
 }
 
@@ -659,6 +663,10 @@ Standard_Real Geom_OffsetSurface::UPeriod() const
 
 Standard_Boolean Geom_OffsetSurface::IsVPeriodic () const 
 {
+  //Indeed, the basis surface must have continuity greater than C0 
+  //in U-direction.
+  //However currently it is not checked.
+
   return basisSurf->IsVPeriodic();
 }
 
index c568f3abac5440cd19ab42b7fda374e88617fa21..2771f50c403094c72684948ca3d55864f324889a 100644 (file)
@@ -209,24 +209,26 @@ public:
   //! Returns true if this offset surface is periodic in the u
   //! parametric direction, i.e. if the basis
   //! surface of this offset surface is periodic in this direction.
+  //! Moreover, the basis surface must have continuity greater than C0 
+  //! in U-direction but currently it is not checked.
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
   //! Returns the period of this offset surface in the u
   //! parametric direction respectively, i.e. the period of the
   //! basis surface of this offset surface in this parametric direction.
-  //! raises if the surface is not uperiodic.
   Standard_EXPORT virtual Standard_Real UPeriod() const Standard_OVERRIDE;
   
 
   //! Returns true if this offset surface is periodic in the v
   //! parametric direction, i.e. if the basis
   //! surface of this offset surface is periodic in this direction.
+  //! Moreover, the basis surface must have continuity greater than C0 
+  //! in V-direction but currently it is not checked.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
   //! Returns the period of this offset surface in the v
   //! parametric direction respectively, i.e. the period of the
   //! basis surface of this offset surface in this parametric direction.
-  //! raises if the surface is not vperiodic.
   Standard_EXPORT virtual Standard_Real VPeriod() const Standard_OVERRIDE;
   
   //! Computes the U isoparametric curve.
index eec0b8aeca012cca7d903d16b8861f8ceda2a682..aa94480c86f9b71ee94fae652ef25211807db5da 100644 (file)
@@ -237,7 +237,7 @@ void Geom_RectangularTrimmedSurface::SetTrim(const Standard_Real U1,
     if ( U1 == U2)
       throw Standard_ConstructionError("Geom_RectangularTrimmedSurface::U1==U2");
 
-    if (basisSurf->IsUPeriodic()) {
+    if (IsUPeriodic()) {
       UsameSense = USense;
       
       // set uTrim1 in the range Udeb , Ufin
@@ -277,7 +277,7 @@ void Geom_RectangularTrimmedSurface::SetTrim(const Standard_Real U1,
     if ( V1 == V2)
       throw Standard_ConstructionError("Geom_RectangularTrimmedSurface::V1==V2");
 
-    if (basisSurf->IsVPeriodic()) {
+    if (IsVPeriodic()) {
       VsameSense = VSense;
 
       // set vTrim1 in the range Vdeb , Vfin
@@ -561,9 +561,7 @@ void Geom_RectangularTrimmedSurface::Transform (const Trsf& T)
 
 Standard_Boolean Geom_RectangularTrimmedSurface::IsUPeriodic () const 
 {
-  if (basisSurf->IsUPeriodic() &&  !isutrimmed) 
-    return Standard_True;
-  return Standard_False;
+  return basisSurf->IsUPeriodic();
 }
 
 
@@ -585,9 +583,7 @@ Standard_Real Geom_RectangularTrimmedSurface::UPeriod() const
 
 Standard_Boolean Geom_RectangularTrimmedSurface::IsVPeriodic () const 
 { 
-  if (basisSurf->IsVPeriodic() && !isvtrimmed)
-    return Standard_True;
-  return Standard_False;
+  return basisSurf->IsVPeriodic();
 }
 
 
@@ -607,12 +603,18 @@ Standard_Real Geom_RectangularTrimmedSurface::VPeriod() const
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean Geom_RectangularTrimmedSurface::IsUClosed () const { 
-
-  if (isutrimmed)  
+Standard_Boolean Geom_RectangularTrimmedSurface::IsUClosed() const
+{
+  if (!basisSurf->IsUClosed())
     return Standard_False;
-  else             
-    return basisSurf->IsUClosed();
+
+  if (!isutrimmed)
+    return Standard_True;
+
+  Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0;
+  basisSurf->Bounds(aU1, aU2, aV1, aV2);
+
+  return (Abs((utrim2 + aU1) - (utrim1 + aU2)) < Precision::PConfusion());
 }
 
 
@@ -621,12 +623,18 @@ Standard_Boolean Geom_RectangularTrimmedSurface::IsUClosed () const {
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean Geom_RectangularTrimmedSurface::IsVClosed () const { 
-
-  if (isvtrimmed) 
+Standard_Boolean Geom_RectangularTrimmedSurface::IsVClosed() const
+{
+  if (!basisSurf->IsVClosed())
     return Standard_False;
-  else   
-    return basisSurf->IsVClosed();
+
+  if (!isvtrimmed)
+    return Standard_True;
+
+  Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0;
+  basisSurf->Bounds(aU1, aU2, aV1, aV2);
+
+  return (Abs((vtrim2 + aV1) - (vtrim1 + aV2)) < Precision::PConfusion());
 }
 
 //=======================================================================
index 857797370bc2081f27819ab1495e4ed4ee779054..51ca2d893d6297ea48e92db579da7bf4cd4d8834 100644 (file)
@@ -205,24 +205,19 @@ public:
   //! Raised if N < 0.
   Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
   
-  //! Returns true if this patch is periodic and not trimmed in the given
-  //! parametric direction.
+  //! Returns true if the basis surface is periodic in U-direction
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
-  //! Returns the period of this patch in the u
+  //! Returns the period of the basis surface in the u
   //! parametric direction.
-  //! raises if the surface is not uperiodic.
   Standard_EXPORT virtual Standard_Real UPeriod() const Standard_OVERRIDE;
   
 
-  //! Returns true if this patch is periodic and not trimmed in the given
-  //! parametric direction.
+  //! Returns true if the basis surface is periodic in V-direction
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
-  //! Returns the period of this patch in the v
+  //! Returns the period of the basis surface in the v
   //! parametric direction.
-  //! raises if the surface is not vperiodic.
-  //! value and derivatives
   Standard_EXPORT virtual Standard_Real VPeriod() const Standard_OVERRIDE;
   
   //! computes the U isoparametric curve.
index 187c3b47d9b53e2cb35b522b5514af087621857a..c4caaca0e5156ff5213069f045d683873715623f 100644 (file)
@@ -175,33 +175,25 @@ public:
   //! or equal to gp::Resolution().
   Standard_EXPORT virtual Standard_Boolean IsVClosed() const = 0;
   
-  //! Checks if this surface is periodic in the u
-  //! parametric direction. Returns true if:
-  //! - this surface is closed in the u parametric direction, and
-  //! - there is a constant T such that the distance
-  //! between the points P (u, v) and P (u + T,
-  //! v) (or the points P (u, v) and P (u, v +
-  //! T)) is less than or equal to gp::Resolution().
-  //! Note: T is the parametric period in the u parametric direction.
+  //! Returns true if the surface is U-periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
   Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0;
   
   //! Returns the period of this surface in the u
   //! parametric direction.
-  //! raises if the surface is not uperiodic.
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
   Standard_EXPORT virtual Standard_Real UPeriod() const;
   
-  //! Checks if this surface is periodic in the v
-  //! parametric direction. Returns true if:
-  //! - this surface is closed in the v parametric direction, and
-  //! - there is a constant T such that the distance
-  //! between the points P (u, v) and P (u + T,
-  //! v) (or the points P (u, v) and P (u, v +
-  //! T)) is less than or equal to gp::Resolution().
-  //! Note: T is the parametric period in the v parametric direction.
+  //! Returns true if the surface is V-periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
   Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0;
   
   //! Returns the period of this surface in the v parametric direction.
-  //! raises if the surface is not vperiodic.
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
   Standard_EXPORT virtual Standard_Real VPeriod() const;
   
   //! Computes the U isoparametric curve.
index 62d816d99490609959bb35c1a6e16e47425c8f0d..3ece3c8efb8d781703e4261a4c8c7ac990a582d4 100644 (file)
@@ -338,6 +338,15 @@ Standard_Boolean Geom_SurfaceOfLinearExtrusion::IsUPeriodic () const {
   return basisCurve->IsPeriodic ();
 }
 
+//=======================================================================
+//function : UPeriod
+//purpose  : 
+//=======================================================================
+Standard_Real Geom_SurfaceOfLinearExtrusion::UPeriod() const
+{
+  return basisCurve->Period();
+}
+
 //=======================================================================
 //function : IsVClosed
 //purpose  : 
index e0fb9d2f2f2c46921f1daacb0f1a5eab503c275e..b9f5fbf9401e0966a43c0abc984f039616697002 100644 (file)
@@ -160,6 +160,9 @@ public:
   //! IsVPeriodic always returns false.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of this surface in the u parametric direction.
+  virtual Standard_Real UPeriod() const Standard_OVERRIDE;
+
   //! Computes the U isoparametric curve of this surface
   //! of linear extrusion. This is the line parallel to the
   //! direction of extrusion, passing through the point of
index d1b86e43e9c3492a9e65fb849762aad935c630e0..48877b019c0211c5a00449fcbf923a144a9b86fa 100644 (file)
@@ -151,8 +151,8 @@ const gp_Pnt& Geom_SurfaceOfRevolution::Location () const {
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean Geom_SurfaceOfRevolution::IsUPeriodic () const {
-
+Standard_Boolean Geom_SurfaceOfRevolution::IsUPeriodic () const
+{
   return Standard_True; 
 }
 
@@ -213,12 +213,20 @@ Standard_Boolean Geom_SurfaceOfRevolution::IsVClosed () const
 //function : IsVPeriodic
 //purpose  : 
 //=======================================================================
+Standard_Boolean Geom_SurfaceOfRevolution::IsVPeriodic() const
+{
 
-Standard_Boolean Geom_SurfaceOfRevolution::IsVPeriodic () const { 
-
-  return basisCurve->IsPeriodic(); 
+  return (basisCurve->IsPeriodic() && basisCurve->IsClosed());
 }
 
+//=======================================================================
+//function : VPeriod
+//purpose  : 
+//=======================================================================
+Standard_Real Geom_SurfaceOfRevolution::VPeriod() const
+{
+  return basisCurve->Period();
+}
 
 //=======================================================================
 //function : SetAxis
index e83528e7329a7b6674334968cec7984d394e727e..cff770af8d4005a448432bcc226868ae66e454dd 100644 (file)
@@ -247,9 +247,12 @@ public:
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
   //! IsVPeriodic returns true if the meridian of this
-  //! surface of revolution is periodic.
+  //! surface of revolution is periodic and is closed.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of this surface in the v parametric direction.
+  Standard_EXPORT virtual Standard_Real VPeriod() const Standard_OVERRIDE;
+
   //! Computes the U isoparametric curve of this surface
   //! of revolution. It is the curve obtained by rotating the
   //! meridian through an angle U about the axis of revolution.
index 7fc934707b00883620d6e5cf92f04177e28d6478..9d310752046a690b38497099b73f5b790f961ba9 100644 (file)
@@ -126,7 +126,7 @@ void Geom_TrimmedCurve::SetTrim (const Standard_Real U1,
    Standard_Real Udeb = basisCurve->FirstParameter();
    Standard_Real Ufin = basisCurve->LastParameter();
 
-   if (basisCurve->IsPeriodic())  {
+   if (IsPeriodic())  {
      sameSense = Sense;
       
      // set uTrim1 in the range Udeb , Ufin
@@ -170,7 +170,7 @@ void Geom_TrimmedCurve::SetTrim (const Standard_Real U1,
 
 Standard_Boolean Geom_TrimmedCurve::IsClosed () const
 {
-  return ( StartPoint().Distance(EndPoint()) <= gp::Resolution());
+  return ( StartPoint().SquareDistance(EndPoint()) <= gp::Resolution());
 }
 
 //=======================================================================
@@ -180,8 +180,7 @@ Standard_Boolean Geom_TrimmedCurve::IsClosed () const
 
 Standard_Boolean Geom_TrimmedCurve::IsPeriodic () const 
 {
-  //return basisCurve->IsPeriodic();
-  return Standard_False;
+  return basisCurve->IsPeriodic();
 }
 
 
index 76569080707c9e507e2c00439a48d1bcaf8d08e2..177a94eb27e954b95fa62d7feddc32fce949e47d 100644 (file)
@@ -173,12 +173,10 @@ public:
   //! the EndPoint is lower or equal to Resolution from package gp.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! Always returns FALSE (independently of the type of basis curve).
+  //! Returns TRUE if the basis curve is periodic. Returns FALSE otherwise.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns the period of the basis curve of this trimmed curve.
-  //! Exceptions
-  //! Standard_NoSuchObject if the basis curve is not periodic.
   Standard_EXPORT virtual Standard_Real Period() const Standard_OVERRIDE;
   
 
index 844993b2bbfba594441fd6ea1daf112810d0a2c9..be072d10335e941be034fd5ab2cfa39f627c9871 100644 (file)
@@ -136,25 +136,14 @@ public:
   Standard_EXPORT virtual Standard_Boolean IsClosed() const = 0;
   
 
-  //! Returns true if the parameter of the curve is periodic.
-  //! It is possible only if the curve is closed and if the
-  //! following relation is satisfied :
-  //! for each parametric value U the distance between the point
-  //! P(u) and the point P (u + T) is lower or equal to Resolution
-  //! from package gp, T is the period and must be a constant.
-  //! There are three possibilities :
-  //! . the curve is never periodic by definition (SegmentLine)
-  //! . the curve is always periodic by definition (Circle)
-  //! . the curve can be defined as periodic (BSpline). In this case
-  //! a function SetPeriodic allows you to give the shape of the
-  //! curve.  The general rule for this case is : if a curve can be
-  //! periodic or not the default periodicity set is non periodic
-  //! and you have to turn (explicitly) the curve into a periodic
-  //! curve  if you want the curve to be periodic.
+  //! Returns true if the curve is periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
   Standard_EXPORT virtual Standard_Boolean IsPeriodic() const = 0;
   
-  //! Returns thne period of this curve.
-  //! raises if the curve is not periodic
+  //! Returns the period of the periodic curve.
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
   Standard_EXPORT virtual Standard_Real Period() const;
   
 
index 2c4ea9536c2695af6bd1844995c79979f73f4e25..a3e07cdd83c92c37659bee79a3546b287bfd996d 100644 (file)
@@ -332,6 +332,9 @@ Standard_Boolean Geom2d_OffsetCurve::IsCN (const Standard_Integer N) const
 
 Standard_Boolean Geom2d_OffsetCurve::IsPeriodic () const 
 { 
+  if (basisCurve->Continuity() == GeomAbs_C0)
+    return Standard_False;
+
   return basisCurve->IsPeriodic();
 }
 
index 0886f46baafc6d5528167963780bb6d66dab99ad..27e6650eb0112e1463f6aa917087023e8d69c37c 100644 (file)
@@ -238,16 +238,12 @@ public:
   //! Raised if N < 0.
   Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
   
-  //! Is the parametrization of a curve is periodic ?
-  //! If the basis curve is a circle or an ellipse the corresponding
-  //! OffsetCurve is periodic. If the basis curve can't be periodic
-  //! (for example BezierCurve) the OffsetCurve can't be periodic.
+  //! Returns TRUE if the basis curve is periodic. Returns FALSE otherwise.
+  //! Moreover, the basis curve must have continuity greater than C0.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns the period of this offset curve, i.e. the period
   //! of the basis curve of this offset curve.
-  //! Exceptions
-  //! Standard_NoSuchObject if the basis curve is not periodic.
   Standard_EXPORT virtual Standard_Real Period() const Standard_OVERRIDE;
   
   //! Applies the transformation T to this offset curve.
index 9cbfa698585994e817a80ec1a98b22a6885bde3b..348978a1c68718815c536a96f56dd255c1c5e290 100644 (file)
@@ -123,7 +123,7 @@ void Geom2d_TrimmedCurve::SetTrim (const Standard_Real U1,
   Standard_Real Udeb = basisCurve->FirstParameter();
   Standard_Real Ufin = basisCurve->LastParameter();
   
-  if (basisCurve->IsPeriodic())  {
+  if (IsPeriodic())  {
      sameSense = Sense;
       
      // set uTrim1 in the range Udeb , Ufin
@@ -209,12 +209,10 @@ Standard_Real Geom2d_TrimmedCurve::FirstParameter () const       { return uTrim1
 //function : IsClosed
 //purpose  : 
 //=======================================================================
-
-Standard_Boolean Geom2d_TrimmedCurve::IsClosed () const          
+Standard_Boolean Geom2d_TrimmedCurve::IsClosed() const
 {
-  Standard_Real Dist = 
-    Value(FirstParameter()).Distance(Value(LastParameter()));
-  return ( Dist <= gp::Resolution());
+  return
+    (Value(FirstParameter()).SquareDistance(Value(LastParameter())) < gp::Resolution());
 }
 
 //=======================================================================
@@ -222,10 +220,9 @@ Standard_Boolean Geom2d_TrimmedCurve::IsClosed () const
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean Geom2d_TrimmedCurve::IsPeriodic () const        
+Standard_Boolean Geom2d_TrimmedCurve::IsPeriodic() const
 {
-  //return basisCurve->IsPeriodic();
-  return Standard_False;
+  return basisCurve->IsPeriodic();
 }
 
 //=======================================================================
index 57e905fb25f72cbd93efa943c914461dac85de18..8c3dc86d4191267d956f35b22103175afc0672d1 100644 (file)
@@ -172,12 +172,10 @@ public:
   //! gp.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! Always returns FALSE (independently of the type of basis curve).
+  //! Returns TRUE if the basis curve is periodic. Returns FALSE otherwise.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns the period of the basis curve of this trimmed curve.
-  //! Exceptions
-  //! Standard_NoSuchObject if the basis curve is not periodic.
   Standard_EXPORT virtual Standard_Real Period() const Standard_OVERRIDE;
   
 
index 6ecbf6a5c44e4a9270d87cfb6f772fc492a8b1ed..b3b59423e9cd6b20f7d44b2218333e7c02646df6 100644 (file)
@@ -102,8 +102,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve
index 05c29d838832c46edc35ae3de76867b5af7b8284..c36a3abada2fbe0ee1d649255089d9a1bd4c104e 100644 (file)
@@ -37,6 +37,7 @@
 #include <Geom2dConvert_ApproxCurve.hxx>
 #include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
 #include <GeomAbs_Shape.hxx>
+#include <GeomLib.hxx>
 #include <gp.hxx>
 #include <gp_Circ2d.hxx>
 #include <gp_Dir2d.hxx>
@@ -207,7 +208,8 @@ const Convert_ParameterisationType  Parameterisation)
 
     // Si la courbe n'est pas vraiment restreinte, on ne risque pas 
     // le Raise dans le BS->Segment.
-    if (!Curv->IsPeriodic()) {     
+    if (!GeomLib::AllowExtend(*Curv, U1, U2))
+    {
       if (U1 < Curv->FirstParameter())
        U1 =  Curv->FirstParameter();
       if (U2 > Curv->LastParameter())
index 690480906cc3adca826cdc116bf5481e01e4dfde..9a05395f024f2d6f7fbab837b414597df3a85c69 100644 (file)
@@ -106,8 +106,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve
index 2f0d4838c3e49cad4beada9282aa7f0547888c62..090b51da280a4dd98a73a8d972640a147c2425ed 100644 (file)
@@ -124,12 +124,16 @@ public:
   
   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+    //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
   
   //! Computes the point of parameters U,V on the surface.
index c67e10f8e93ad99b085eabcc99be2ef50e21a86f..8352037e8dc4c489390fbb7917f6b625af540bf6 100644 (file)
@@ -116,12 +116,16 @@ public:
   
   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
   
+  //! Always returns FALSE
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
 
   //! Returns the parametric U  resolution corresponding
index 405d1a94af2c711b97a81749d2f50e50eecc1dce..9a431111b428119e5266972ee1526adc0116283f 100644 (file)
@@ -129,12 +129,16 @@ public:
   
   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
+  //! Always returns TRUE
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
 
   //! Returns the parametric U  resolution corresponding
index f23298afa1f93de99df7f5ab744a6bfd1bd45176..30ec9c61863c68b59e8e8cc3a96f1ddf82757c3b 100644 (file)
@@ -41,6 +41,7 @@
 #include <GeomConvert.hxx>
 #include <GeomConvert_ApproxCurve.hxx>
 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
+#include <GeomLib.hxx>
 #include <GeomLProp.hxx>
 #include <gp.hxx>
 #include <gp_Ax3.hxx>
@@ -194,7 +195,8 @@ Handle(Geom_BSplineCurve)  GeomConvert::CurveToBSplineCurve
 
     // Si la courbe n'est pas vraiment restreinte, on ne risque pas 
     // le Raise dans le BS->Segment.
-    if (!Curv->IsPeriodic()) {
+    if (!GeomLib::AllowExtend(*Curv, U1, U2))
+    {
       if (U1 < Curv->FirstParameter())
        U1 =  Curv->FirstParameter();
       if (U2 > Curv->LastParameter())
index 557a7b7f759ad2d6cd8576c8374462b8eb8c663f..fb0457e759fc0b5107f126b5bdf6dd22b3d4e18c 100644 (file)
@@ -644,7 +644,7 @@ void GeomFill_GuideTrihedronPlan::InitX(const Standard_Real Param)
     X(1) = (Pole->Value(1, Ideb).Coord(2) + 
            Pole->Value(1, Ifin).Coord(2)) / 2;
   }
-  if (myGuide->IsPeriodic()) {
+  if (myGuide->IsPeriodic() && myGuide->IsClosed()) {
     X(1) = ElCLib::InPeriod(X(1), myGuide->FirstParameter(), 
                                  myGuide->LastParameter());
   }
index d18a957d769c513096c61f82c7d809147b070fb5..f5cef1c32e041ef03679e1a268f636341b9cfcbb 100644 (file)
@@ -1436,7 +1436,7 @@ void GeomFill_LocationGuide::InitX(const Standard_Real Param) const
     X(3) = (P1.Coord(2) + P2.Coord(2)) /2;
   }
 
-  if (myGuide->IsPeriodic()) {
+  if (myGuide->IsPeriodic() && myGuide->IsClosed()) {
     X(1) = ElCLib::InPeriod(X(1), myGuide->FirstParameter(), 
                                  myGuide->LastParameter());
   }
index 07a69e3c661f7525e4f80ffe14b16440606d4d3c..e3e07b3cf396241a254d83225f46aa344786488a 100644 (file)
@@ -1000,18 +1000,15 @@ void GeomFill_NSections::GetMinimalWeight(TColStd_Array1OfReal& Weights) const
   gp_Circ C2 = AC2.Circle();
 
   Standard_Real p1 = myParams(1), p2 = myParams(myParams.Length());
-  Standard_Real radius = ( C2.Radius() - C1.Radius() ) * (V - p1) / (p2 - p1) 
-                                  + C1.Radius();
+  Standard_Real radius = (C2.Radius() - C1.Radius()) * (V - p1) / (p2 - p1) + C1.Radius();
 
   C1.SetRadius(radius);
   Handle(Geom_Curve) C = new (Geom_Circle) (C1);
 
-  const Standard_Real aParF = AC1.FirstParameter();
-  const Standard_Real aParL = AC1.LastParameter();
-  const Standard_Real aPeriod = AC1.IsPeriodic() ? AC1.Period() : 0.0;
-
-  if ((aPeriod == 0.0) || (Abs(aParL - aParF - aPeriod) > Precision::PConfusion()))
+  if (!AC1.IsClosed() || !AC1.IsPeriodic())
   {
+    const Standard_Real aParF = AC1.FirstParameter();
+    const Standard_Real aParL = AC1.LastParameter();
     Handle(Geom_Curve) Cbis = new Geom_TrimmedCurve(C, aParF, aParL);
     C = Cbis;
   }
index 07ecd327cfe8340ceffdd9930b782422c513f954..6d7fba49b35fecabdb8a8b193d03fbb2f87f161e 100644 (file)
@@ -90,6 +90,10 @@ void GeomFill_SnglrFunc::SetRatio(const Standard_Real Ratio)
   return myHCurve->Period();
 }
 
+Standard_Boolean GeomFill_SnglrFunc::IsClosed() const
+{
+  return myHCurve->IsClosed();
+}
 
  gp_Pnt GeomFill_SnglrFunc::Value(const Standard_Real U) const
 {
index 3de3e68e3f0f0a2c38d909c139ff65a2cb09623d..663e0d608fda85a52546faf3d127cadc7d93b6bf 100644 (file)
@@ -65,8 +65,13 @@ public:
   //! Computes the point of parameter U on the curve.
   Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
+  Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
+
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 4d004faca3f62f8d97e9277d1557ef083250366a..188bb4bb46ef61563af09b8709617e66602f717b 100644 (file)
@@ -53,6 +53,7 @@
 #include <CSLib.hxx>
 #include <CSLib_NormalStatus.hxx>
 #include <ElCLib.hxx>
+#include <Extrema_ECC.hxx>
 #include <Geom2d_BezierCurve.hxx>
 #include <Geom2d_BSplineCurve.hxx>
 #include <Geom2d_Circle.hxx>
 #include <Geom_BSplineCurve.hxx>
 #include <Geom_BSplineSurface.hxx>
 #include <Geom_Circle.hxx>
+#include <Geom_ConicalSurface.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Ellipse.hxx>
 #include <Geom_Hyperbola.hxx>
 #include <Geom_Line.hxx>
 #include <Geom_OffsetCurve.hxx>
+#include <Geom_OffsetSurface.hxx>
 #include <Geom_Parabola.hxx>
 #include <Geom_Plane.hxx>
 #include <Geom_RectangularTrimmedSurface.hxx>
 #include <Geom_Surface.hxx>
 #include <Geom_TrimmedCurve.hxx>
+#include <GeomAdaptor_Curve.hxx>
 #include <GeomAdaptor_HSurface.hxx>
 #include <GeomAdaptor_Surface.hxx>
 #include <GeomConvert.hxx>
@@ -962,14 +966,7 @@ void GeomLib::SameRange(const Standard_Real         Tolerance,
   else 
   { // On segmente le resultat
     Handle(Geom2d_TrimmedCurve) TC;
-    Handle(Geom2d_Curve) aCCheck = CurvePtr;
-
-    if(aCCheck->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
-    {
-      aCCheck = Handle(Geom2d_TrimmedCurve)::DownCast(aCCheck)->BasisCurve();
-    }
-
-    if(aCCheck->IsPeriodic())
+    if (CurvePtr->IsPeriodic())
     {
       if(Abs(LastOnCurve - FirstOnCurve) > Precision::PConfusion())
       {
@@ -2751,12 +2748,126 @@ Standard_Boolean GeomLib::IsBzVClosed (const Handle(Geom_BezierSurface)& S,
   return CompareWeightPoles(aPF, 0, aPL, 0, Tol2);
 }
 
+//=======================================================================
+//function : AllowExtendUParameter
+//purpose  : 
+//=======================================================================
+Standard_Boolean GeomLib::AllowExtendUParameter(const GeomAdaptor_Surface& theS,
+                                                const Standard_Real theNewUFirst,
+                                                const Standard_Real theNewULast)
+{
+  const Handle(Geom_Surface) &aSurf = theS.Surface();
+  Handle(Geom_Curve) aC = aSurf->VIso(theS.FirstVParameter());
+
+  if (aC->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
+  {
+    // In order to obtain the default curve's work range
+    aC = Handle(Geom_TrimmedCurve)::DownCast(aC)->BasisCurve();
+  }
+
+  return (AllowExtend(*aC, theNewUFirst, theNewULast));
+}
+
+//=======================================================================
+//function : AllowExtendVParameter
+//purpose  : 
+//=======================================================================
+Standard_Boolean GeomLib::AllowExtendVParameter(const GeomAdaptor_Surface& theS,
+                                                const Standard_Real theNewVFirst,
+                                                const Standard_Real theNewVLast)
+{
+  const GeomAbs_SurfaceType aSType = theS.GetType();
+
+  const Handle(Geom_Surface) &aSurf = theS.Surface();
+
+  if (aSType == GeomAbs_OffsetSurface)
+  {
+    const Handle(Geom_OffsetSurface) aOS = Handle(Geom_OffsetSurface)::DownCast(aSurf);
+    return AllowExtendVParameter(GeomAdaptor_Surface(aOS->BasisSurface()),
+                                 theNewVFirst, theNewVLast);
+  }
+
+  Handle(Geom_Curve) aC = aSurf->UIso(theS.FirstUParameter());
+
+  if (aC->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
+  {
+    // In order to obtain the default curve's work range
+    aC = Handle(Geom_TrimmedCurve)::DownCast(aC)->BasisCurve();
+  }
+
+  if (!AllowExtend(*aC, theNewVFirst, theNewVLast))
+    return Standard_False;
+
+  switch (aSType)
+  {
+    case GeomAbs_OtherSurface:
+      return Standard_True;
+    case GeomAbs_Sphere:
+    {
+      if ((theNewVFirst < -M_PI_2) || (theNewVLast > M_PI_2))
+      {
+        // After extending, the surface isoline will go 
+        // through the sphere pole
+        return Standard_False;
+      }
+    }
+    break;
+    case GeomAbs_Cone:
+    {
+      const Handle(Geom_ConicalSurface) aCone = Handle(Geom_ConicalSurface)::DownCast(aSurf);
+      Standard_Real anApexPrm = 0.0;
+      aCone->Apex(&anApexPrm);
+
+      if ((anApexPrm - theNewVFirst)*(theNewVLast - anApexPrm) > 0.0)
+      {
+        // The new boundaries intersect the cone apex
+        return Standard_False;
+      }
+    }
+    break;
+    case GeomAbs_SurfaceOfRevolution:
+    {
+      const Handle(Adaptor3d_HCurve) aCurv = theS.BasisCurve();
+      const Handle(Geom_Line) aL = new Geom_Line(theS.AxeOfRevolution());
+      const GeomAdaptor_Curve aLin(aL);
+
+      Extrema_ECC anExtr(aCurv->Curve(), aLin);
+      anExtr.Perform();
+      if (anExtr.IsDone() && anExtr.NbExt() > 0)
+      {
+        const Standard_Real aParF = theNewVFirst - Precision::PConfusion(),
+                            aParL = theNewVLast + Precision::PConfusion();
+        Extrema_POnCurv aP1, aP2;
+        for (Standard_Integer i = 1; i <= anExtr.NbExt(); i++)
+        {
+          if (anExtr.SquareDistance(i) > Precision::SquareConfusion())
+            continue;
+
+          anExtr.Points(i, aP1, aP2);
+          if ((aParF < aP1.Parameter()) && (aP1.Parameter() < aParL))
+          {
+            // After extending, the surface isoline will go 
+            // through the pole (singular point like pole of sphere)
+
+            return Standard_False;
+          }
+        }
+      }
+    }
+    break;
+    default:
+      break;
+  }
+
+  return Standard_True;
+}
+
 //=======================================================================
 //function : CompareWeightPoles
 //purpose  : Checks if thePoles1(i)*theW1(i) is equal to thePoles2(i)*theW2(i)
 //            with tolerance theTol.
 //           It is necessary for not rational B-splines and Bezier curves
-//            to set theW1 and theW2 adresses to zero.
+//            to set theW1 and theW2 addresses to zero.
 //=======================================================================
 static Standard_Boolean CompareWeightPoles(const TColgp_Array1OfPnt& thePoles1, 
                                            const TColStd_Array1OfReal* const theW1,
index b51028d2fc7d3dbb37f96b58118cca991b923397..414e3c293e16d0473c3f19f6b586d0189bd20640 100644 (file)
 class Geom_Curve;
 class gp_Ax2;
 class Geom2d_Curve;
+class Geom_Curve;
 class gp_GTrsf2d;
 class Adaptor3d_CurveOnSurface;
+class Adaptor3d_Surface;
+class GeomAdaptor_Surface;
 class Geom_BoundedCurve;
 class gp_Pnt;
 class gp_Vec;
@@ -54,6 +57,8 @@ class GeomLib_Tool;
 class GeomLib_PolyFunc;
 class GeomLib_LogSample;
 
+#include <Geom_TrimmedCurve.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
 
 //! Geom    Library.    This   package   provides   an
 //! implementation of  functions for basic computation
@@ -193,6 +198,68 @@ public:
   Standard_EXPORT static void IsClosed(const Handle(Geom_Surface)& S, const Standard_Real Tol,
                                        Standard_Boolean& isUClosed, Standard_Boolean& isVClosed);
 
+  //! This method defines if the ends of the given curve are
+  //! coincided with given tolerance.
+  //! This is a template-method. Therefore, it can be applied to 
+  //! 2D- and 3D-curve and to Adaptor-HCurve.
+  template <typename TypeCurve>
+  Standard_EXPORT static Standard_Boolean IsClosed(const Handle(TypeCurve)& theCur,
+                                                   const Standard_Real theTol)
+  {
+    const Standard_Real aFPar = theCur->FirstParameter(),
+                        aLPar = theCur->LastParameter();
+
+    return (theCur->Value(aFPar).SquareDistance(theCur->Value(aLPar)) < theTol*theTol);
+  }
+
+  //! Returns TRUE if theCurve will keep its validity for OCCT-algorithms
+  //! after its trimming in range [theNewFPar, theNewLPar].
+  //! This is a template-method. Therefore, it can be applied to 
+  //! 2D- and 3D-curve.
+  //! Using trimmed curves or Adaptor_HCurves is possible but undesirable
+  //! because theCurve must be parametrized in its default work-range
+  //! in order for this method to work correctly.
+  template <typename TypeCurve>
+  Standard_EXPORT static Standard_Boolean AllowExtend(const TypeCurve& theCurve,
+                                                      const Standard_Real theNewFPar,
+                                                      const Standard_Real theNewLPar)
+  {
+    Standard_Real aFPar = theCurve.FirstParameter(),
+                  aLPar = theCurve.LastParameter();
+
+    if ((aFPar <= theNewFPar) && (theNewLPar <= aLPar) && (theNewFPar < theNewLPar))
+    {
+      //New boundaries are in the current ones
+      return Standard_True;
+    }
+
+    if (!theCurve.IsPeriodic())
+    {
+      return Standard_False;
+    }
+
+    const Standard_Real aPeriod = theCurve.Period();
+
+    if ((theNewLPar - theNewFPar - aPeriod) > Epsilon(aPeriod))
+      return Standard_False;
+
+    return Standard_True;
+  }
+
+  //! Returns TRUE if theS will keep its validity for OCCT-algorithms
+  //! after its trimming in range [theNewUFirst, theNewULast] along U-direction
+  Standard_EXPORT static Standard_Boolean 
+                    AllowExtendUParameter(const GeomAdaptor_Surface& theS,
+                                          const Standard_Real theNewUFirst,
+                                          const Standard_Real theNewULast);
+
+  //! Returns TRUE if theS will keep its validity for OCCT-algorithms
+  //! after its trimming in range [theNewVFirst, theNewVLast] along V-direction
+  Standard_EXPORT static Standard_Boolean
+                    AllowExtendVParameter(const GeomAdaptor_Surface& theS,
+                                          const Standard_Real theNewVFirst,
+                                          const Standard_Real theNewVLast);
+
   //! Returns true if the poles of U1 isoline and the poles of
   //! U2 isoline of surface are identical according to tolerance criterion.
   //! For rational surfaces Weights(i)*Poles(i) are checked.
index 86dc118282d5f7ca51e827820c063a2f1adee4f0..af8cad0b9a992b57e6b481955dc443d1a05a95cc 100644 (file)
@@ -149,31 +149,14 @@ public:
   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
 
-  //! Is the parametrization of a surface periodic in the
-  //! direction U ?
-  //! It is possible only if the surface is closed in this
-  //! parametric direction and if the following relation is
-  //! satisfied :
-  //! for each parameter V the distance between the point
-  //! P (U, V)  and the point  P (U + T, V) is lower or equal
-  //! to Resolution from package gp. T is the parametric period
-  //! and must be a constant.
+  //! Always returns FALSE
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
   //! returns the Uperiod.
   //! raises if the surface is not uperiodic.
   Standard_EXPORT virtual Standard_Real UPeriod() const Standard_OVERRIDE;
   
-
-  //! Is the parametrization of a surface periodic in the
-  //! direction U ?
-  //! It is possible only if the surface is closed in this
-  //! parametric direction and if the following relation is
-  //! satisfied :
-  //! for each parameter V the distance between the point
-  //! P (U, V)  and the point  P (U + T, V) is lower or equal
-  //! to Resolution from package gp. T is the parametric period
-  //! and must be a constant.
+  //! Always returns FALSE
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
   //! returns the Vperiod.
index d8c61cd84ab443af9e326b930b643d6f5532d841..b60847810731a3643099363b7e2e695d4aa6abe2 100644 (file)
@@ -41,6 +41,7 @@
 #include <GeomAdaptor_HCurve.hxx>
 #include <GeomAdaptor_HSurface.hxx>
 #include <GeomAdaptor_Surface.hxx>
+#include <GeomLib.hxx>
 #include <GeomProjLib.hxx>
 #include <gp_Dir.hxx>
 #include <gp_Pln.hxx>
@@ -144,15 +145,16 @@ Handle(Geom2d_Curve) GeomProjLib::Curve2d(const Handle(Geom_Curve)& C,
     return G2dC;
   }
 
-  if ( C->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)) ) {
-    Handle(Geom_TrimmedCurve) CTrim = Handle(Geom_TrimmedCurve)::DownCast(C);
-    Standard_Real U1 = CTrim->FirstParameter();
-    Standard_Real U2 = CTrim->LastParameter();
-    if (!G2dC->IsPeriodic())
+  if (C->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
+  {
+    Standard_Real U1 = C->FirstParameter();
+    Standard_Real U2 = C->LastParameter();
+    if (!GeomLib::AllowExtend(*G2dC, U1, U2))
     {
       U1 = Max(U1, G2dC->FirstParameter());
       U2 = Min(U2, G2dC->LastParameter());
     }
+
     G2dC = new Geom2d_TrimmedCurve( G2dC, U1, U2);
   }
 
index 5d3a3e3ca802563595c04391e85b08ce6b8e15f2..764e6665bcc2b7edd2ecbb1b2951b5b826bde884 100644 (file)
@@ -72,9 +72,15 @@ public:
   
     static Standard_Boolean IsClosed (const BRepAdaptor_Curve& C);
   
-    static Standard_Boolean IsPeriodic (const BRepAdaptor_Curve& C);
-  
-    static Standard_Real Period (const BRepAdaptor_Curve& C);
+  //! Returns true if the curve is periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  static Standard_Boolean IsPeriodic (const BRepAdaptor_Curve& C);
+  
+  //! Returns the period of the periodic curve.
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  static Standard_Real Period (const BRepAdaptor_Curve& C);
   
   //! Computes the point of parameter U on the curve.
     static gp_Pnt Value (const BRepAdaptor_Curve& C, const Standard_Real U);
index 47c5168a8ed96f3734c15e30b18a7058f7331142..ba9e06863b025176092a2c73ddba46736623d8cb 100644 (file)
@@ -81,13 +81,17 @@ public:
   
     static Standard_Boolean IsVClosed (const BRepAdaptor_Surface& S);
   
-    static Standard_Boolean IsUPeriodic (const BRepAdaptor_Surface& S);
-  
-    static Standard_Real UPeriod (const BRepAdaptor_Surface& S);
+  //! Returns TRUE if S is U-periodic
+  static Standard_Boolean IsUPeriodic (const BRepAdaptor_Surface& S);
+
+  //! Returns U-period of S
+  static Standard_Real UPeriod (const BRepAdaptor_Surface& S);
   
-    static Standard_Boolean IsVPeriodic (const BRepAdaptor_Surface& S);
+  //! Returns TRUE if S is V-periodic
+  static Standard_Boolean IsVPeriodic (const BRepAdaptor_Surface& S);
   
-    static Standard_Real VPeriod (const BRepAdaptor_Surface& S);
+  //! Returns V-period of S
+  static Standard_Real VPeriod (const BRepAdaptor_Surface& S);
   
     static gp_Pnt Value (const BRepAdaptor_Surface& S, const Standard_Real u, const Standard_Real v);
   
index b457dfd13ec8322c8e3bf86a995897b4cbb1a7d1..db6225a1a0935742488eb872463dba08a7401c88 100644 (file)
@@ -133,8 +133,14 @@ public:
   
     Standard_Boolean IsClosed() const;
   
+    //! Returns true if the curve is periodic 
+    //! (please see the documentation, the section
+    //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
     Standard_Boolean IsPeriodic() const;
   
+    //! Returns the period of the periodic curve.
+    //! (please see the documentation, the section
+    //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
     Standard_Real Period() const;
   
   //! Computes the point of parameter U on the curve.
index ff54a4169acb89c3d4a694c4e0ed61126f7f195c..4a113e727dc8fa803463747e34d58758b0c72b8d 100644 (file)
@@ -75,9 +75,11 @@ public:
   
     static Standard_Boolean IsClosed (const Standard_Address C);
   
-    static Standard_Boolean IsPeriodic (const Standard_Address C);
+  //! Returns TRUE if C is periodic
+  static Standard_Boolean IsPeriodic (const Standard_Address C);
   
-    static Standard_Real Period (const Standard_Address C);
+  //! Returns the period of C
+  static Standard_Real Period (const Standard_Address C);
   
   //! Computes the point of parameter U on the curve.
     static gp_Pnt2d Value (const Standard_Address C, const Standard_Real U);
index a265bc0bd9bab282c6cc6cc3ad790fc85702175b..b0328f23945ae610bca3309f378b71cde8346463 100644 (file)
@@ -82,9 +82,11 @@ public:
   
     static Standard_Boolean IsClosed (const gp_Lin& C);
   
-    static Standard_Boolean IsPeriodic (const gp_Lin& C);
+  //! Returns TRUE if C is periodic
+  static Standard_Boolean IsPeriodic (const gp_Lin& C);
   
-    static Standard_Real Period (const gp_Lin& C);
+  //! Always returns 0
+  static Standard_Real Period (const gp_Lin& C);
   
   //! Computes the point of parameter U on the line.
     static gp_Pnt Value (const gp_Lin& C, const Standard_Real U);
index 5aa2933854af4594ea8fcb6396d7552c521a20ba..6199d0fdce9cb62c2c1b2f2264f09982d39accab 100644 (file)
@@ -103,13 +103,26 @@ public:
   
     Standard_Boolean IsVClosed() const;
   
-    Standard_Boolean IsUPeriodic() const;
-  
-    Standard_Real UPeriod() const;
-  
-    Standard_Boolean IsVPeriodic() const;
-  
-    Standard_Real VPeriod() const;
+  //! Returns true if the surface is U-periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_Boolean IsUPeriodic() const;
+
+  //! Returns the period of this surface in the u
+  //! parametric direction.
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_Real UPeriod() const;
+  
+  //! Returns true if the surface is V-periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_Boolean IsVPeriodic() const;
+  
+  //! Returns the period of this surface in the v parametric direction.
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Concept of periodicity applied in OCCT-algorithms ").
+  Standard_Real VPeriod() const;
   
   //! Computes the point of parameters U,V on the surface.
   Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
index 117842d08d3e89928bd7622814ab94e45edb4bc3..70e9029aa953671ca51986abae951ba9c4acbef7 100644 (file)
@@ -81,13 +81,17 @@ public:
   
     static Standard_Boolean IsVClosed (const Standard_Address S);
   
-    static Standard_Boolean IsUPeriodic (const Standard_Address S);
+  //! Returns TRUE if S is U-periodic
+  static Standard_Boolean IsUPeriodic (const Standard_Address S);
   
-    static Standard_Real UPeriod (const Standard_Address S);
+  //! Returns U-period of S
+  static Standard_Real UPeriod (const Standard_Address S);
   
-    static Standard_Boolean IsVPeriodic (const Standard_Address S);
+  //! Returns TRUE if S is V-periodic
+  static Standard_Boolean IsVPeriodic (const Standard_Address S);
   
-    static Standard_Real VPeriod (const Standard_Address S);
+  //! Returns V-period of S
+  static Standard_Real VPeriod (const Standard_Address S);
   
     static gp_Pnt Value (const Standard_Address S, const Standard_Real u, const Standard_Real v);
   
index d83d57cf4d9a71e34690fe4c34e01b237e4da635..621bb7f8e4669d56ab503be4b254d95923eb0f26 100644 (file)
@@ -229,8 +229,10 @@ void IntCurveSurface_Inter::DoNewBounds(
   Bounds.SetValue(3,v0);
   Bounds.SetValue(4,v1);
 
-  Standard_Boolean isUClosed = (TheSurfaceTool::IsUClosed(surface) || TheSurfaceTool::IsUPeriodic(surface));
-  Standard_Boolean isVClosed = (TheSurfaceTool::IsVClosed(surface) || TheSurfaceTool::IsVPeriodic(surface));
+  Standard_Boolean isUClosed = (TheSurfaceTool::IsUClosed(surface) || 
+                                TheSurfaceTool::IsUPeriodic(surface));
+  Standard_Boolean isVClosed = (TheSurfaceTool::IsVClosed(surface) ||
+                                TheSurfaceTool::IsVPeriodic(surface));
   Standard_Boolean checkU = (isUClosed) ? Standard_False : Standard_True;
   Standard_Boolean checkV = (isVClosed) ? Standard_False : Standard_True;
 
@@ -291,6 +293,7 @@ void IntCurveSurface_Inter::DoNewBounds(
   VSmax += 1.5*dV;
   if(VSmax > v1) VSmax = v1;
 
+  // We take full range in case of closed or periodic surface
   if(checkU) {
     Bounds.SetValue(1,USmin);
     Bounds.SetValue(2,USmax);
@@ -1290,21 +1293,13 @@ void IntCurveSurface_Inter::AppendPoint(const TheCurve& curve,
   //-- Test si la courbe est periodique
   Standard_Real w = lw, u = su, v = sv;
 
-  GeomAbs_CurveType aCType = TheCurveTool::GetType(curve);
-
-  if(TheCurveTool::IsPeriodic(curve) 
-     || aCType == GeomAbs_Circle 
-     || aCType == GeomAbs_Ellipse) {
+  if(TheCurveTool::IsPeriodic(curve)) {
     w = ElCLib::InPeriod(w, W0, W0 + TheCurveTool::Period(curve));
   }
 
   if((W0 - w) >= TOLTANGENCY || (w - W1) >= TOLTANGENCY) return;
 
-  GeomAbs_SurfaceType aSType = TheSurfaceTool::GetType(surface);
-  if (TheSurfaceTool::IsUPeriodic(surface)
-      || aSType == GeomAbs_Cylinder
-      || aSType == GeomAbs_Cone
-      || aSType == GeomAbs_Sphere) {
+  if (TheSurfaceTool::IsUPeriodic(surface)) {
     u = ElCLib::InPeriod(u, U0, U0 + TheSurfaceTool::UPeriod(surface));
   }
 
index ed954b5a09fa525e074c69222297725cba635f42..835d70a7ad663a6139db7d66c85b37e8c0af3db0 100644 (file)
@@ -72,9 +72,11 @@ public:
   
     static Standard_Boolean IsClosed (const Handle(Adaptor3d_HCurve)& C);
   
-    static Standard_Boolean IsPeriodic (const Handle(Adaptor3d_HCurve)& C);
+  //! Returns TRUE if C is periodic
+  static Standard_Boolean IsPeriodic (const Handle(Adaptor3d_HCurve)& C);
   
-    static Standard_Real Period (const Handle(Adaptor3d_HCurve)& C);
+  //! Returns the period of C
+  static Standard_Real Period (const Handle(Adaptor3d_HCurve)& C);
   
   //! Computes the point of parameter U on the curve.
     static gp_Pnt Value (const Handle(Adaptor3d_HCurve)& C, const Standard_Real U);
index 7c75083ce2e9a24eafe20097581c3bf19f9722e9..7c6bf0bd85d203cb08a3cf1edc8fb92540ab651a 100644 (file)
@@ -71,9 +71,11 @@ public:
   
     static Standard_Boolean IsClosed (const Handle(Adaptor2d_HCurve2d)& C);
   
-    static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_HCurve2d)& C);
+  //! Returns TRUE if C is periodic
+  static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_HCurve2d)& C);
   
-    static Standard_Real Period (const Handle(Adaptor2d_HCurve2d)& C);
+  //! Returns the period of C
+  static Standard_Real Period (const Handle(Adaptor2d_HCurve2d)& C);
   
   //! Computes the point of parameter U on the curve.
     static gp_Pnt2d Value (const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real U);
index 7a8d2e7263de74e8177c18ccb0a5554eb45226f9..366948c9816e6113293aaadb1e4a8771486e8e12 100644 (file)
@@ -25,6 +25,7 @@
 #include <IntPatch_PrmPrmIntersection.hxx>
 #include <IntPatch_WLine.hxx>
 #include <IntPatch_WLineTool.hxx>
+#include <IntSurf.hxx>
 
 #include <ProjLib_ProjectOnPlane.hxx>
 #include <Geom_Plane.hxx>
@@ -1427,11 +1428,9 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_HSurface)& the
     aBx1.Enlarge(Precision::PConfusion());
     aBx2.Enlarge(Precision::PConfusion());
 
-    const Standard_Real
-            anArrOfPeriod[4] = {theS1->IsUPeriodic()? theS1->UPeriod() : 0.0,
-                                theS1->IsVPeriodic()? theS1->VPeriod() : 0.0,
-                                theS2->IsUPeriodic()? theS2->UPeriod() : 0.0,
-                                theS2->IsVPeriodic()? theS2->VPeriod() : 0.0};
+    Standard_Real anArrOfPeriod[4];
+    IntSurf::SetPeriod(theS1, theS2, anArrOfPeriod);
+
     IntPatch_WLineTool::ExtendTwoWLines(slin, theS1, theS2, TolTang,
                                         anArrOfPeriod, aBx1, aBx2);
   }
index 149f379d2dd072d7db51e2852dd263d5d2d54d5e..d28b351dfa32d44831d324a0d1f1ee96f882f0e6 100644 (file)
@@ -33,6 +33,7 @@
 #include <IntPatch_RstInt.hxx>
 #include <IntPatch_WLine.hxx>
 #include <IntPolyh_Intersection.hxx>
+#include <IntSurf.hxx>
 #include <IntSurf_LineOn2S.hxx>
 #include <IntSurf_ListIteratorOfListOfPntOn2S.hxx>
 #include <IntSurf_PntOn2S.hxx>
@@ -1575,10 +1576,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
   VmaxLig2 = Surf2->LastVParameter();
 
   Standard_Real Periods [4];
-  Periods[0] = (Surf1->IsUPeriodic())? Surf1->UPeriod() : 0.;
-  Periods[1] = (Surf1->IsVPeriodic())? Surf1->VPeriod() : 0.;
-  Periods[2] = (Surf2->IsUPeriodic())? Surf2->UPeriod() : 0.;
-  Periods[3] = (Surf2->IsVPeriodic())? Surf2->VPeriod() : 0.;
+  IntSurf::SetPeriod(Surf1, Surf2, Periods);
 
   IntSurf_ListIteratorOfListOfPntOn2S IterLOP1(LOfPnts);
   if (Surf1->IsUClosed() || Surf1->IsVClosed() ||
@@ -1980,33 +1978,13 @@ void AdjustOnPeriodic(const Handle(Adaptor3d_HSurface)& Surf1,
                       const Handle(Adaptor3d_HSurface)& Surf2,
                       IntPatch_SequenceOfLine& aSLin)
 {
-  Standard_Boolean bIsPeriodic[4], bModified, bIsNull, bIsPeriod;
+  Standard_Boolean bModified, bIsNull, bIsPeriod;
   Standard_Integer i, j, k, aNbLines, aNbPx, aIndx, aIndq;
   Standard_Real aPeriod[4], dPeriod[4], ux[4], uq[4], aEps, du;
   //
   aEps=Precision::Confusion();
   //
-  for (k=0; k<4; ++k) {
-    aPeriod[k]=0.;
-  }
-  //
-  bIsPeriodic[0]=Surf1->IsUPeriodic();
-  bIsPeriodic[1]=Surf1->IsVPeriodic();
-  bIsPeriodic[2]=Surf2->IsUPeriodic();
-  bIsPeriodic[3]=Surf2->IsVPeriodic();
-  //
-  if (bIsPeriodic[0]){
-    aPeriod[0]=Surf1->UPeriod();
-  }
-  if (bIsPeriodic[1]){
-    aPeriod[1]=Surf1->VPeriod();
-  }
-  if (bIsPeriodic[2]){
-    aPeriod[2]=Surf2->UPeriod();
-  }
-  if (bIsPeriodic[3]){
-    aPeriod[3]=Surf2->VPeriod();
-  }
+  IntSurf::SetPeriod(Surf1, Surf2, aPeriod);
   //
   for (k=0; k<4; ++k) {
     dPeriod[k]=0.25*aPeriod[k];
@@ -2041,7 +2019,8 @@ void AdjustOnPeriodic(const Handle(Adaptor3d_HSurface)& Surf1,
         bIsNull=Standard_False;
         bIsPeriod=Standard_False;
         //
-        if (!bIsPeriodic[k]) {
+        if(aPeriod[k] == 0.0)
+        {
           continue;
         }
         //
@@ -2146,10 +2125,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
   D2->VParameters(aVpars2);
 
   Standard_Real Periods [4];
-  Periods[0] = (Surf1->IsUPeriodic())? Surf1->UPeriod() : 0.;
-  Periods[1] = (Surf1->IsVPeriodic())? Surf1->VPeriod() : 0.;
-  Periods[2] = (Surf2->IsUPeriodic())? Surf2->UPeriod() : 0.;
-  Periods[3] = (Surf2->IsVPeriodic())? Surf2->VPeriod() : 0.;
+  IntSurf::SetPeriod(Surf1, Surf2, Periods);
 
   //---------------------------------------------
   if((NbU1*NbV1<=Limit && NbV2*NbU2<=Limit))
index 0475179b2466e118fb7d176deb332a79524ba8ca..bd3588d6624c68c3905e5a060ea7f46eed8196d7 100644 (file)
@@ -1002,90 +1002,9 @@ void IntPatch_RstInt::PutVertexOnLine (const Handle(IntPatch_Line)& L,
   //-- On reprend la ligne et on recale les parametres des vertex.
   //-- 
   if (typL == IntPatch_Walking) {
-    Standard_Real pu1,pv1,pu2,pv2;
-    pu1=pv1=pu2=pv2=0.0;
-    switch(TypeS1) { 
-    case GeomAbs_Cylinder:
-    case GeomAbs_Cone:
-    case GeomAbs_Sphere:
-      pu1=M_PI+M_PI;
-      break;
-    case GeomAbs_Torus:
-      pu1=pv1=M_PI+M_PI;
-      break;
-    default:
-      {
-       if(   Surf1->IsUPeriodic())  {
-         pu1=Surf1->UPeriod();
-       }
-       else if(Surf1->IsUClosed()) { 
-         pu1=Surf1->LastUParameter() - Surf1->FirstUParameter();
-         //cout<<" UClosed1 "<<pu1<<endl;
-       }
-       if(   Surf1->IsVPeriodic()) {
-         pv1=Surf1->VPeriod();
-       }
-       else if(Surf1->IsVClosed()) { 
-         pv1=Surf1->LastVParameter() - Surf1->FirstVParameter();
-         //cout<<" VClosed1 "<<pv1<<endl;
-       }
-
-       break;
-      }      
-    }
-    
-    switch(TypeS2) { 
-    case GeomAbs_Cylinder:
-    case GeomAbs_Cone:
-    case GeomAbs_Sphere:
-
-      pu2=M_PI+M_PI;
-      break;
-    case GeomAbs_Torus:
-      pu2=pv2=M_PI+M_PI;
-      break;
-    default:
-      { 
-       if(   Surf2->IsUPeriodic()) {  
-         pu2=Surf2->UPeriod(); 
-       }
-       else if(Surf2->IsUClosed()) { 
-         pu2=Surf2->LastUParameter() - Surf2->FirstUParameter();
-         //cout<<" UClosed2 "<<pu2<<endl;
-       }
-
-       if(   Surf2->IsVPeriodic())  {
-         pv2=Surf2->VPeriod();
-       }
-       else if(Surf2->IsVClosed()) { 
-         pv2=Surf2->LastVParameter() - Surf2->FirstVParameter();
-         //cout<<" VClosed2 "<<pv2<<endl;
-       }
-
-       break;
-      }
-    }
-
-/*
-    if(pu1==0) { 
-      pu1=Surf1->LastUParameter() - Surf1->FirstUParameter();
-      pu1+=pu1;
-    }
-    if(pu2==0) { 
-      pu2=Surf2->LastUParameter() - Surf2->FirstUParameter();
-      pu2+=pu2;
-    }
-    if(pv1==0) { 
-      pv1=Surf1->LastVParameter() - Surf1->FirstVParameter();
-      pv1+=pv1;
-    }
-    if(pv2==0) { 
-      pv2=Surf2->LastVParameter() - Surf2->FirstVParameter();
-      pv2+=pv2;
-    } 
-*/
-
-    wlin->SetPeriod(pu1,pv1,pu2,pv2);
+    Standard_Real aPeriods[4];
+    IntSurf::SetPeriod(Surf1, Surf2, aPeriods);
+    wlin->SetPeriod(aPeriods[0], aPeriods[1], aPeriods[2], aPeriods[3]);
     wlin->ComputeVertexParameters(Tol);
   }
   else {
index b180d9abedd5aacee58977db60a28d560030c379..13e997b02ea8eda4f79941445b1edaa2534047b6 100644 (file)
@@ -339,16 +339,6 @@ Standard_Boolean IntPatch_SpecialPoints::
                                       const Standard_Boolean theIsReversed,
                                       const Standard_Boolean theIsReqRefCheck)
 {
-  const Standard_Real aUpPeriod = thePSurf->IsUPeriodic() ? thePSurf->UPeriod() : 0.0;
-  const Standard_Real aUqPeriod = theQSurf->IsUPeriodic() ? theQSurf->UPeriod() : 0.0;
-  const Standard_Real aVpPeriod = thePSurf->IsVPeriodic() ? thePSurf->VPeriod() : 0.0;
-  const Standard_Real aVqPeriod = theQSurf->IsVPeriodic() ? theQSurf->VPeriod() : 0.0;
-
-  const Standard_Real anArrOfPeriod[4] = {theIsReversed? aUpPeriod : aUqPeriod,
-                                          theIsReversed? aVpPeriod : aVqPeriod,
-                                          theIsReversed? aUqPeriod : aUpPeriod,
-                                          theIsReversed? aVqPeriod : aVpPeriod};
-
   //On parametric
   Standard_Real aU0 = 0.0, aV0 = 0.0;
   //aPQuad is Pole
@@ -594,6 +584,16 @@ Standard_Boolean IntPatch_SpecialPoints::
 
   if (!isIsoChoosen)
   {
+    Standard_Real anArrOfPeriod[4];
+    if (theIsReversed)
+    {
+      IntSurf::SetPeriod(thePSurf, theQSurf, anArrOfPeriod);
+    }
+    else
+    {
+      IntSurf::SetPeriod(theQSurf, thePSurf, anArrOfPeriod);
+    }
+
     AdjustPointAndVertex(theVertex.PntOn2S(), anArrOfPeriod, theAddedPoint);
   }
   else
@@ -651,16 +651,19 @@ Standard_Boolean IntPatch_SpecialPoints::
   //Here, in case of pole/apex adding, we forbid "jumping" between two neighbor
   //Walking-point with step greater than pi/4
   const Standard_Real aPeriod = (theSPType == IntPatch_SPntPole)? M_PI_2 : 2.0*M_PI;
-
-  const Standard_Real aUpPeriod = thePSurf->IsUPeriodic() ? thePSurf->UPeriod() : 0.0;
-  const Standard_Real aUqPeriod = theQSurf->IsUPeriodic() ? aPeriod : 0.0;
-  const Standard_Real aVpPeriod = thePSurf->IsVPeriodic() ? thePSurf->VPeriod() : 0.0;
-  const Standard_Real aVqPeriod = theQSurf->IsVPeriodic() ? aPeriod : 0.0;
-
-  const Standard_Real anArrOfPeriod[4] = {theIsReversed? aUpPeriod : aUqPeriod,
-                                          theIsReversed? aVpPeriod : aVqPeriod,
-                                          theIsReversed? aUqPeriod : aUpPeriod,
-                                          theIsReversed? aVqPeriod : aVpPeriod};
+  Standard_Real anArrOfPeriod[4];
+  if(theIsReversed)
+  {
+    IntSurf::SetPeriod(thePSurf, theQSurf, anArrOfPeriod);
+    if(anArrOfPeriod[2] > 0.0) anArrOfPeriod[2] = aPeriod;
+    if(anArrOfPeriod[3] > 0.0) anArrOfPeriod[3] = aPeriod;
+  }
+  else
+  {
+    IntSurf::SetPeriod(theQSurf, thePSurf, anArrOfPeriod);
+    if(anArrOfPeriod[0] > 0.0) anArrOfPeriod[0] = aPeriod;
+    if(anArrOfPeriod[1] > 0.0) anArrOfPeriod[1] = aPeriod;
+  }
 
   AdjustPointAndVertex(theRefPt, anArrOfPeriod, theNewPoint);
   return Standard_True;
index abfe5b04159053c485309e51f9a24b26b155fc45..9dca2dfe37d183e520a910cecf97ebce8c88af98 100644 (file)
@@ -19,6 +19,7 @@
 #include <ElCLib.hxx>
 #include <ElSLib.hxx>
 #include <IntPatch_SpecialPoints.hxx>
+#include <IntSurf.hxx>
 #include <NCollection_IncAllocator.hxx>
 #include <TopAbs_State.hxx>
 
@@ -1416,10 +1417,8 @@ void IntPatch_WLineTool::JoinWLines(IntPatch_SequenceOfLine& theSlin,
   const Standard_Real aMinRad = 1.0e-3*Min(theS1->Cylinder().Radius(),
                                               theS2->Cylinder().Radius());
 
-  const Standard_Real anArrPeriods[4] = {theS1->IsUPeriodic() ? theS1->UPeriod() : 0.0,
-                                         theS1->IsVPeriodic() ? theS1->VPeriod() : 0.0,
-                                         theS2->IsUPeriodic() ? theS2->UPeriod() : 0.0,
-                                         theS2->IsVPeriodic() ? theS2->VPeriod() : 0.0};
+  Standard_Real anArrPeriods[4];
+  IntSurf::SetPeriod(theS1, theS2, anArrPeriods);
 
   const Standard_Real anArrFBonds[4] = {theS1->FirstUParameter(), theS1->FirstVParameter(),
                                         theS2->FirstUParameter(), theS2->FirstVParameter()};
index 8726f0ad567ee237f99ac07a488b33cbd57ff20b..44a69635da55d8856e0216ab2bad3d27e8086bcc 100644 (file)
@@ -1877,8 +1877,8 @@ Handle(Geom_Curve) MakeBSpline  (const Handle(IntPatch_WLine)& WL,
     }
   }
   //
-  isuperiodic = anAdaptorSurface.IsUPeriodic();
-  isvperiodic = anAdaptorSurface.IsVPeriodic();
+  isuperiodic = (anAdaptorSurface.IsUPeriodic() && anAdaptorSurface.IsUClosed());
+  isvperiodic = (anAdaptorSurface.IsVPeriodic() && anAdaptorSurface.IsVClosed());
   //
   aType=anAdaptorSurface.GetType();
   if((aType==GeomAbs_BezierSurface) ||
@@ -2717,10 +2717,7 @@ Standard_Real MaxDistance(const Handle(Geom_Curve)& theC,
 
   // adjust domain for periodic surfaces
   TopLoc_Location aLoc;
-  Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace, aLoc);
-  if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
-    aSurf = (Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf))->BasisSurface();
-  }
+  const Handle(Geom_Surface) &aSurf = BRep_Tool::Surface(aFace, aLoc);
   gp_Pnt2d pnt = aPC->Value((fp+lp)/2);
   Standard_Real u,v;
   pnt.Coord(u,v);
index 46c891d3957fc543988ec04def0b1cb6672ee887..5e34b45e8703524e24f64f8bccc286a5a48482e6 100644 (file)
@@ -32,6 +32,7 @@
 #include <GeomAdaptor_Surface.hxx>
 #include <GeomAPI_ProjectPointOnCurve.hxx>
 #include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <GeomLib.hxx>
 #include <gp.hxx>
 #include <gp_Ax1.hxx>
 #include <gp_Dir.hxx>
@@ -83,37 +84,6 @@ static
   return !bFlag;
 }
 
-//=======================================================================
-//function : IsClosed
-//purpose  : 
-//=======================================================================
-  Standard_Boolean IntTools_Tools::IsClosed (const Handle(Geom_Curve)& aC3D)
-{
-  Standard_Boolean bRet;
-  Standard_Real aF, aL, aDist, aPC;
-  gp_Pnt aP1, aP2;
-  
-  Handle (Geom_BoundedCurve) aGBC=
-      Handle (Geom_BoundedCurve)::DownCast(aC3D);
-  if (aGBC.IsNull()) {
-    return Standard_False;
-  }
-  
-  aF=aC3D->FirstParameter();
-  aL=aC3D-> LastParameter();
-  
-  aC3D->D0(aF, aP1);
-  aC3D->D0(aL, aP2);
-
-  
-  //
-  aPC=Precision::Confusion();
-  aPC=aPC*aPC;
-  aDist=aP1.SquareDistance(aP2);
-  bRet=aDist<aPC;
-  return bRet;
-}
-
 //=======================================================================
 //function : RejectLines
 //purpose  : 
@@ -217,8 +187,9 @@ static
   Handle (Geom2d_Curve) aC2D2=IC.SecondCurve2d();
   Standard_Boolean bIsClosed;
 
-  bIsClosed=IntTools_Tools::IsClosed(aC3D);
-  if (!bIsClosed) {
+  bIsClosed = GeomLib::IsClosed(aC3D, Precision::Confusion());
+  if (!bIsClosed)
+  {
     return 0;
   }
 
index 5e828548a01e130364a7d80f065fdc5e5108bac1..e272795c181051ee794c595dd021cc00707af6f2 100644 (file)
@@ -130,14 +130,6 @@ public:
   //! Returns True if D1 and D2 coinside with given tolerance
   Standard_EXPORT static Standard_Boolean IsDirsCoinside (const gp_Dir& D1, const gp_Dir& D2, const Standard_Real aTol);
   
-
-  //! Returns True if aC is BoundedCurve from Geom and
-  //! the distance between first point
-  //! of the curve aC and last point
-  //! is less than 1.e-12
-  Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& aC);
-  
-
   //! Returns adaptive tolerance for given aTolBase
   //! if aC is trimmed curve and basis curve is parabola,
   //! otherwise returns value of aTolBase
index a1a3feb9287cd055da42f35eaaac3fae93a0274f..3bcabcc1e264d04a22806a12d14ae170758150ff 100644 (file)
@@ -267,10 +267,7 @@ STATIC_PRECEDENT_INFLEXION(0)
   if(ResoV2>0.0001*pasuv[3]) ResoV2=0.00001*pasuv[3];
 
 
-  if(Adaptor3d_HSurfaceTool::IsUPeriodic(Caro1)==Standard_False) { 
-    //UM1+=KELARG*pasuv[0];  Um1-=KELARG*pasuv[0];
-  }
-  else { 
+  if(Adaptor3d_HSurfaceTool::IsUPeriodic(Caro1)) { 
     Standard_Real t = UM1-Um1; 
     if(t<Adaptor3d_HSurfaceTool::UPeriod(Caro1)) { 
       t=0.5*(Adaptor3d_HSurfaceTool::UPeriod(Caro1)-t);
@@ -279,10 +276,7 @@ STATIC_PRECEDENT_INFLEXION(0)
     }
   }
 
-  if(Adaptor3d_HSurfaceTool::IsVPeriodic(Caro1)==Standard_False) { 
-    //VM1+=KELARG*pasuv[1];  Vm1-=KELARG*pasuv[1];
-  }
-  else { 
+  if(Adaptor3d_HSurfaceTool::IsVPeriodic(Caro1)) { 
     Standard_Real t = VM1-Vm1; 
     if(t<Adaptor3d_HSurfaceTool::VPeriod(Caro1)) { 
       t=0.5*(Adaptor3d_HSurfaceTool::VPeriod(Caro1)-t);
@@ -291,10 +285,7 @@ STATIC_PRECEDENT_INFLEXION(0)
     }
   }
 
-  if(Adaptor3d_HSurfaceTool::IsUPeriodic(Caro2)==Standard_False) { 
-    //UM2+=KELARG*pasuv[2];  Um2-=KELARG*pasuv[2];
-  }
-  else { 
+  if(Adaptor3d_HSurfaceTool::IsUPeriodic(Caro2)){ 
     Standard_Real t = UM2-Um2; 
     if(t<Adaptor3d_HSurfaceTool::UPeriod(Caro2)) { 
       t=0.5*(Adaptor3d_HSurfaceTool::UPeriod(Caro2)-t);
@@ -303,10 +294,7 @@ STATIC_PRECEDENT_INFLEXION(0)
     }
   }
 
-  if(Adaptor3d_HSurfaceTool::IsVPeriodic(Caro2)==Standard_False) {   
-    //VM2+=KELARG*pasuv[3];  Vm2-=KELARG*pasuv[3];
-  }
-  else { 
+  if(Adaptor3d_HSurfaceTool::IsVPeriodic(Caro2)){ 
     Standard_Real t = VM2-Vm2; 
     if(t<Adaptor3d_HSurfaceTool::VPeriod(Caro2)) { 
       t=0.5*(Adaptor3d_HSurfaceTool::VPeriod(Caro2)-t);
index d463cf9bf1163648889bee9139a3cd9cf08b2094..d62ddfcdb5b7259fc602dc8a34dba1213e8e1e4d 100644 (file)
@@ -618,11 +618,14 @@ Standard_Boolean Project(const TopoDS_Vertex& V,
       if (dumin > dumax && adSurf.IsUPeriodic())
       {
         Standard_Real aX1 = aPBound2d.X();
-        Standard_Real aShift = ShapeAnalysis::AdjustToPeriod(aX1, adSurf.FirstUParameter(), adSurf.LastUParameter());
+        Standard_Real aShift = 
+          ShapeAnalysis::AdjustToPeriod(aX1, adSurf.FirstUParameter(),
+                                        adSurf.FirstUParameter() + adSurf.UPeriod());
         aX1 += aShift;
         aPBound2d.SetX(aX1);
         Standard_Real aX2 = p2d.X();
-        aShift = ShapeAnalysis::AdjustToPeriod(aX2, adSurf.FirstUParameter(), adSurf.LastUParameter());
+        aShift = ShapeAnalysis::AdjustToPeriod(aX2, adSurf.FirstUParameter(),
+                                               adSurf.FirstUParameter() + adSurf.UPeriod());
         aX2 += aShift;
         dumin = Abs(aX2 - aX1);
         if (dumin > dumax &&  (Abs(dumin - adSurf.UPeriod()) < Precision::PConfusion()) )
@@ -637,11 +640,14 @@ Standard_Boolean Project(const TopoDS_Vertex& V,
       if (dvmin > dvmax && adSurf.IsVPeriodic())
       {
         Standard_Real aY1 = aPBound2d.Y();
-        Standard_Real aShift = ShapeAnalysis::AdjustToPeriod(aY1, adSurf.FirstVParameter(), adSurf.LastVParameter());
+        Standard_Real aShift = 
+          ShapeAnalysis::AdjustToPeriod(aY1, adSurf.FirstVParameter(),
+                                        adSurf.FirstUParameter() + adSurf.VPeriod());
         aY1 += aShift;
         aPBound2d.SetY(aY1);
         Standard_Real aY2 = p2d.Y();
-        aShift = ShapeAnalysis::AdjustToPeriod(aY2, adSurf.FirstVParameter(), adSurf.LastVParameter());
+        aShift = ShapeAnalysis::AdjustToPeriod(aY2, adSurf.FirstVParameter(),
+                                               adSurf.FirstUParameter() + adSurf.VPeriod());
         aY2 += aShift;
         dvmin = Abs(aY1 - aY2);
         if (dvmin > dvmax && ( Abs(dvmin - adSurf.VPeriod()) < Precision::Confusion()) )
index eb5b68352e47e08c54116e6fe93a3dcfc773f544..c08f9d3971228e1822469546a4d8c1dfc2f43a90 100644 (file)
@@ -506,8 +506,8 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector
   Handle(Geom2d_TrimmedCurve) bisector = 
     ChangeGeomBis(abisector->BisectorNumber()).ChangeValue();
 
-  if(bisector->BasisCurve()->IsPeriodic() && param == Precision::Infinite()) {
-    param = bisector->FirstParameter() + 2*M_PI;
+  if(bisector->IsPeriodic()) {
+    param = Min(bisector->FirstParameter() + bisector->Period(), param);
   }
   if (param > bisector->BasisCurve()->LastParameter()) {
     param = bisector->BasisCurve()->LastParameter(); 
@@ -527,8 +527,8 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector
   const Standard_Integer      apoint)
 {
   Standard_Real Param;
-  Handle(Geom2d_TrimmedCurve) Bisector =
-    ChangeGeomBis(abisector->BisectorNumber()).ChangeValue();
+  const Handle(Geom2d_TrimmedCurve) &Bisector = 
+                  ChangeGeomBis(abisector->BisectorNumber()).ChangeValue();
 
   Handle(Bisector_Curve) Bis = Handle(Bisector_Curve)::
     DownCast(Bisector->BasisCurve());
@@ -536,8 +536,8 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector
   //  Param = ParameterOnCurve(Bisector,theGeomPnts.Value(apoint));
   Param = Bis->Parameter(GeomPnt (apoint));
 
-  if (Bisector->BasisCurve()->IsPeriodic()) {
-    if (Bisector->FirstParameter() > Param) Param = Param + 2*M_PI;
+  if (Bisector->IsPeriodic()) {
+    if (Bisector->FirstParameter() > Param) Param += Bisector->Period();
   }
   if(Bisector->FirstParameter() >= Param)return Standard_False;
   if(Bisector->LastParameter()  <  Param)return Standard_False;
@@ -587,7 +587,7 @@ Standard_Boolean MAT2d_Tool2d::Projection (const Standard_Integer IEdge   ,
     INext = (IEdge == theCircuit->NumberOfItems()) ? 1 : (IEdge + 1);
     if (theCircuit->ConnexionOn(INext)) {
       ParamMax = theCircuit->Connexion(INext)->ParameterOnFirst(); 
-      if (Curve->BasisCurve()->IsPeriodic()){
+      if (Curve->IsPeriodic()){
         ElCLib::AdjustPeriodic(0.,2*M_PI,Eps,ParamMin,ParamMax);
       }
     }
@@ -1316,7 +1316,7 @@ IntRes2d_Domain  Domain(const Handle(Geom2d_TrimmedCurve)& Bisector1,
 
   IntRes2d_Domain Domain1(Bisector1->Value(Param1),Param1,Tolerance,
     Bisector1->Value(Param2),Param2,Tolerance);
-  if(Bisector1->BasisCurve()->IsPeriodic()) {
+  if(Bisector1->IsPeriodic()) {
     Domain1.SetEquivalentParameters(0.,2.*M_PI);
   }
   return Domain1;
index 2568a533399cc9cca64b8a2ebeec98e64343d48c..ce63e2af2f083d08e1fe895186686d6265d3ec10 100644 (file)
@@ -156,8 +156,25 @@ public:
   //! Parabola, BezierCurve, BSplineCurve, OtherCurve.
   Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE;
 
-
-
+  //! Always returns FALSE
+  virtual Standard_Boolean IsClosed() const Standard_OVERRIDE
+  {
+    return Standard_False;
+  }
+
+  //! Always returns FALSE
+  virtual Standard_Boolean IsPeriodic() const Standard_OVERRIDE
+  {
+    return Standard_False;
+  }
+
+  //! Currently this method is not implemented because
+  //! IsPeriodic method always return FALSE
+  virtual Standard_Real Period() const Standard_OVERRIDE
+  {
+    Standard_ASSERT_INVOKE("ProjLib_CompProjectedCurve::Period() is not implemented");
+    return 0.0;
+  }
 
 protected:
 
index 50909981873c6f32c768086771e627261b4d8612..913751706ad8b09acce75eda38eb9322945901d0 100644 (file)
@@ -315,11 +315,13 @@ static void Function_SetUVBounds(Standard_Real& myU1,
           Step = Function_ComputeStep(myCurve, R);
         }
         //
-        Standard_Boolean isclandper = (!(myCurve->IsClosed()) && !(myCurve->IsPeriodic()));
+        Standard_Boolean isclandper = !(myCurve->IsClosed() || myCurve->IsPeriodic());
         Standard_Boolean isFirst = Standard_True;
         for(Standard_Real par = W1 + Step; par <= W2; par += Step)
         {
-          if(!isclandper) par += Step;
+          if(myCurve->IsPeriodic()) 
+            par += Step;
+
           P = myCurve->Value(par);
           ElSLib::Parameters( Cone, P, U, V);
           U += Delta;
@@ -839,7 +841,7 @@ static void Function_SetUVBounds(Standard_Real& myU1,
 //
 //
 //=======================================================================
-//classn : ProjLib_Function
+//class : ProjLib_Function
 //purpose  : 
 //=======================================================================
 class ProjLib_Function : public AppCont_Function
@@ -848,25 +850,25 @@ class ProjLib_Function : public AppCont_Function
   Handle(Adaptor3d_HSurface) mySurface;
   Standard_Boolean myIsPeriodic[2];
   Standard_Real myPeriod[2];
-  public :
+public:
 
-  Standard_Real    myU1,myU2,myV1,myV2;
-  Standard_Boolean UCouture,VCouture;
+  Standard_Real    myU1, myU2, myV1, myV2;
+  Standard_Boolean UCouture, VCouture;
 
-  ProjLib_Function(const Handle(Adaptor3d_HCurve)&   C, 
+  ProjLib_Function(const Handle(Adaptor3d_HCurve)&   C,
                    const Handle(Adaptor3d_HSurface)& S)
-: myCurve(C),
-  mySurface(S),
-  myU1(0.0),
-  myU2(0.0),
-  myV1(0.0),
-  myV2(0.0),
-  UCouture(Standard_False),
-  VCouture(Standard_False)
+                   : myCurve(C),
+                   mySurface(S),
+                   myU1(0.0),
+                   myU2(0.0),
+                   myV1(0.0),
+                   myV2(0.0),
+                   UCouture(Standard_False),
+                   VCouture(Standard_False)
   {
     myNbPnt = 0;
     myNbPnt2d = 1;
-    Function_SetUVBounds(myU1,myU2,myV1,myV2,UCouture,VCouture,myCurve,mySurface);
+    Function_SetUVBounds(myU1, myU2, myV1, myV2, UCouture, VCouture, myCurve, mySurface);
     myIsPeriodic[0] = mySurface->IsUPeriodic();
     myIsPeriodic[1] = mySurface->IsVPeriodic();
 
@@ -881,27 +883,27 @@ class ProjLib_Function : public AppCont_Function
       myPeriod[1] = 0.0;
   }
 
-  void PeriodInformation(const Standard_Integer theDimIdx,
-                         Standard_Boolean& IsPeriodic,
-                         Standard_Real& thePeriod) const
+  virtual void PeriodInformation(const Standard_Integer theDimIdx,
+                                 Standard_Boolean& IsPeriodic,
+                                 Standard_Real& thePeriod) const Standard_OVERRIDE
   {
     IsPeriodic = myIsPeriodic[theDimIdx - 1];
     thePeriod = myPeriod[theDimIdx - 1];
   }
 
-  Standard_Real FirstParameter() const
+  virtual Standard_Real FirstParameter() const Standard_OVERRIDE
   {
     return (myCurve->FirstParameter());
   }
 
-  Standard_Real LastParameter() const
+  virtual Standard_Real LastParameter() const Standard_OVERRIDE
   {
     return (myCurve->LastParameter());
   }
 
-  Standard_Boolean Value(const Standard_Real   theT,
-                         NCollection_Array1<gp_Pnt2d>& thePnt2d,
-                         NCollection_Array1<gp_Pnt>&   /*thePnt*/) const
+  virtual Standard_Boolean Value(const Standard_Real   theT,
+                                 NCollection_Array1<gp_Pnt2d>& thePnt2d,
+                                 NCollection_Array1<gp_Pnt>&   /*thePnt*/) const Standard_OVERRIDE
   {
     thePnt2d(1) = Function_Value(theT, myCurve, mySurface, myU1, myU2, myV1, myV2, UCouture, VCouture);
     return Standard_True;
@@ -912,13 +914,13 @@ class ProjLib_Function : public AppCont_Function
     return Function_Value(theT, myCurve, mySurface, myU1, myU2, myV1, myV2, UCouture, VCouture);
   }
 
-  Standard_Boolean D1(const Standard_Real   theT,
-                      NCollection_Array1<gp_Vec2d>& theVec2d,
-                      NCollection_Array1<gp_Vec>&   /*theVec*/) const
+  virtual Standard_Boolean D1(const Standard_Real   theT,
+                              NCollection_Array1<gp_Vec2d>& theVec2d,
+                              NCollection_Array1<gp_Vec>&   /*theVec*/) const Standard_OVERRIDE
   {
     gp_Pnt2d aPnt2d;
     gp_Vec2d aVec2d;
-    Standard_Boolean isOk = Function_D1(theT, aPnt2d,aVec2d, myCurve, mySurface, myU1, myU2, myV1, myV2, UCouture, VCouture);
+    Standard_Boolean isOk = Function_D1(theT, aPnt2d, aVec2d, myCurve, mySurface, myU1, myU2, myV1, myV2, UCouture, VCouture);
     theVec2d(1) = aVec2d;
     return isOk;
   }
index 14185a35045fa14ff9545afb60ae1c029313a0f8..6657b91d9714cba663f9c73dc827ea1d935fec30 100644 (file)
@@ -93,65 +93,6 @@ struct aFuncStruct
   Standard_Real myPeriod[2]; // U and V period correspondingly.
 };
 
-//=======================================================================
-//function : computePeriodicity
-//purpose  : Compute period information on adaptor.
-//=======================================================================
-static void computePeriodicity(const Handle(Adaptor3d_HSurface)& theSurf,
-                               Standard_Real &theUPeriod,
-                               Standard_Real &theVPeriod)
-{
-  theUPeriod = 0.0;
-  theVPeriod = 0.0;
-
-  // Compute once information about periodicity.
-  // Param space may be reduced in case of rectangular trimmed surface,
-  // in this case really trimmed bounds should be set as unperiodic.
-  Standard_Real aTrimF, aTrimL, aBaseF, aBaseL, aDummyF, aDummyL;
-  Handle(Geom_Surface) aS = GeomAdaptor::MakeSurface(theSurf->Surface(), Standard_False); // Not trim.
-  // U param space.
-  if (theSurf->IsUPeriodic())
-  {
-    theUPeriod = theSurf->UPeriod();
-  }
-  else if(theSurf->IsUClosed())
-  {
-    theUPeriod = theSurf->LastUParameter() - theSurf->FirstUParameter();
-  }
-  if (theUPeriod != 0.0)
-  {
-    aTrimF = theSurf->FirstUParameter(); // Trimmed first
-    aTrimL = theSurf->LastUParameter(); // Trimmed last
-    aS->Bounds(aBaseF, aBaseL, aDummyF, aDummyL); // Non-trimmed values.
-    if (Abs (aBaseF - aTrimF) + Abs (aBaseL - aTrimL) > Precision::PConfusion())
-    {
-      // Param space reduced.
-      theUPeriod = 0.0;
-    }
-  }
-
-  // V param space.
-  if (theSurf->IsVPeriodic())
-  {
-    theVPeriod = theSurf->VPeriod();
-  }
-  else if(theSurf->IsVClosed())
-  {
-    theVPeriod = theSurf->LastVParameter() - theSurf->FirstVParameter();
-  }
-  if (theVPeriod != 0.0)
-  {
-    aTrimF = theSurf->FirstVParameter(); // Trimmed first
-    aTrimL = theSurf->LastVParameter(); // Trimmed last
-    aS->Bounds(aDummyF, aDummyL, aBaseF, aBaseL); // Non-trimmed values.
-    if (Abs (aBaseF - aTrimF) + Abs (aBaseL - aTrimL) > Precision::PConfusion())
-    {
-      // Param space reduced.
-      theVPeriod = 0.0;
-    }
-  }
-}
-
 //=======================================================================
 //function : aFuncValue
 //purpose  : compute functional value in (theU,theV) point
@@ -291,14 +232,13 @@ static gp_Pnt2d Function_Value(const Standard_Real theU,
 
   // Non-analytical case.
   Standard_Real Dist2Min = RealLast();
-  Standard_Real uperiod = theData.myPeriod[0],
-                vperiod = theData.myPeriod[1],
-                u, v;
+  const Standard_Real uperiod = theData.myPeriod[0],
+                      vperiod = theData.myPeriod[1];
 
   // U0 and V0 are the points within the initialized period.
   if(U0 < Uinf)
   {
-    if(!uperiod)
+    if(uperiod == 0.0)
       U0 = Uinf;
     else
     {
@@ -308,7 +248,7 @@ static gp_Pnt2d Function_Value(const Standard_Real theU,
   }
   if(U0 > Usup)
   {
-    if(!uperiod)
+    if (uperiod == 0.0)
       U0 = Usup;
     else
     {
@@ -318,7 +258,7 @@ static gp_Pnt2d Function_Value(const Standard_Real theU,
   }
   if(V0 < Vinf)
   {
-    if(!vperiod)
+    if(vperiod == 0.0)
       V0 = Vinf;
     else
     {
@@ -328,7 +268,7 @@ static gp_Pnt2d Function_Value(const Standard_Real theU,
   }
   if(V0 > Vsup)
   {
-    if(!vperiod)
+    if(vperiod == 0.0)
       V0 = Vsup;
     else
     {
@@ -371,6 +311,7 @@ static gp_Pnt2d Function_Value(const Standard_Real theU,
   locext.Perform(p, U0, V0);
   if (locext.IsDone()) 
   {
+    Standard_Real u, v;
     locext.Point().Parameter(u, v);
     Dist2Min = anOrthogSqValue(p, theData.mySurf, u, v);
     if (Dist2Min < theData.mySqProjOrtTol && // Point is projection.
@@ -395,6 +336,7 @@ static gp_Pnt2d Function_Value(const Standard_Real theU,
         GoodValue = i;
       }
     }
+    Standard_Real u, v;
     ext.Point(GoodValue).Parameter(u, v);
     Dist2Min = anOrthogSqValue(p, theData.mySurf, u, v);
     if (Dist2Min < theData.mySqProjOrtTol && // Point is projection.
@@ -429,7 +371,8 @@ class ProjLib_PolarFunction : public AppCont_Function
     myNbPnt = 0;
     myNbPnt2d = 1;
 
-    computePeriodicity(Surf, myStruct.myPeriod[0], myStruct.myPeriod[1]);
+    myStruct.myPeriod[0] = (Surf->IsUPeriodic() && Surf->IsUClosed()) ? Surf->UPeriod() : 0.0;
+    myStruct.myPeriod[1] = (Surf->IsVPeriodic() && Surf->IsVClosed()) ? Surf->VPeriod() : 0.0;
 
     myStruct.myCurve = C;
     myStruct.myInitCurve2d = InitialCurve2d;
@@ -848,8 +791,9 @@ Handle(Geom2d_BSplineCurve) ProjLib_ComputeApproxOnPolarSurface::Perform
        }
       }
 
-      Standard_Real anUPeriod, anVPeriod;
-      computePeriodicity(S, anUPeriod, anVPeriod);
+      const Standard_Real anUPeriod = (S->IsUPeriodic() && S->IsUClosed()) ? S->UPeriod() : 0.0;
+      const Standard_Real anVPeriod = (S->IsVPeriodic() && S->IsVClosed()) ? S->VPeriod() : 0.0;
+
       Standard_Integer NbC = LOfBSpline2d.Extent();
       Handle(Geom2d_BSplineCurve) CurBS;
       CurBS = Handle(Geom2d_BSplineCurve)::DownCast(LOfBSpline2d.First());
@@ -917,8 +861,8 @@ Handle(Adaptor2d_HCurve2d)
     DistTol3d = myMaxDist;
   }
   Standard_Real DistTol3d2 = DistTol3d * DistTol3d;
-  Standard_Real uperiod = 0.0, vperiod = 0.0;
-  computePeriodicity(Surf, uperiod, vperiod);
+  const Standard_Real uperiod = (Surf->IsUPeriodic() && Surf->IsUClosed()) ? Surf->UPeriod() : 0.0;
+  const Standard_Real vperiod = (Surf->IsVPeriodic() && Surf->IsVClosed()) ? Surf->VPeriod() : 0.0;
 
   // NO myTol is Tol2d !!!!
   //Standard_Real TolU = myTolerance, TolV = myTolerance;
index e3d50ce4965fd92aaf3cc1320dcc75bc6c49e35e..a298bb8f7396eb5f21711878c9d7cfb357bd3b0b 100644 (file)
@@ -120,8 +120,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index c788587cd3cfefb2c9ddc93dff1fd0f3682102b8..de5599e90083b0fd0421282ec480a1ad126dde89 100644 (file)
@@ -146,8 +146,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! This method is overridden from the basis class
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index d97d1f452ec3a5db023cffde2c151ab885ad3ca1..9969ad5237a79e21eb9e080dcd64aac832ac7a8d 100644 (file)
@@ -521,8 +521,8 @@ Standard_Boolean ShapeAnalysis_Curve::ValidateRange (const Handle(Geom_Curve)& t
     }
   }
 
-  // 15.11.2002 PTV OCC966
-  if (ShapeAnalysis_Curve::IsPeriodic(theCurve)) {
+  if(theCurve->IsPeriodic() && theCurve->IsClosed())
+  {
     ElCLib::AdjustPeriodic(cf,cl,Precision::PConfusion(),First,Last); //:a7 abv 11 Feb 98: preci -> PConfusion()
   }
   else if (First < Last) {
@@ -1205,39 +1205,3 @@ Standard_Boolean ShapeAnalysis_Curve::IsClosed(const Handle(Geom_Curve)& theCurv
 
   return (aClosedVal <= preci2);
 }
-//=======================================================================
-//function : IsPeriodic
-//purpose  : OCC996
-//=======================================================================
-
-Standard_Boolean ShapeAnalysis_Curve::IsPeriodic(const Handle(Geom_Curve)& theCurve)
-{
-  // 15.11.2002 PTV OCC966
-  // remove regressions in DE tests (diva, divb, divc, toe3) in KAS:dev
-  // ask IsPeriodic on BasisCurve
-  Handle(Geom_Curve) aTmpCurve = theCurve;
-  while ( (aTmpCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) ||
-          (aTmpCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) ) {
-    if (aTmpCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve)))
-      aTmpCurve = Handle(Geom_OffsetCurve)::DownCast(aTmpCurve)->BasisCurve();
-    if (aTmpCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
-      aTmpCurve = Handle(Geom_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve();
-  }
-  return aTmpCurve->IsPeriodic();
-}
-
-Standard_Boolean ShapeAnalysis_Curve::IsPeriodic(const Handle(Geom2d_Curve)& theCurve)
-{
-  // 15.11.2002 PTV OCC966
-  // remove regressions in DE tests (diva, divb, divc, toe3) in KAS:dev
-  // ask IsPeriodic on BasisCurve
-  Handle(Geom2d_Curve) aTmpCurve = theCurve;
-  while ( (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve))) ||
-          (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) ) {
-    if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve)))
-      aTmpCurve = Handle(Geom2d_OffsetCurve)::DownCast(aTmpCurve)->BasisCurve();
-    if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
-      aTmpCurve = Handle(Geom2d_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve();
-  }
-  return aTmpCurve->IsPeriodic();
-}
index cacecdac289c0f1b197899097848c36b7c17381e..c19f1e27e844df64e98758836cc1efed0db002ec 100644 (file)
@@ -131,18 +131,6 @@ public:
   //! If <preci> < 0 then Precision::Confusion is used.
   Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& curve, const Standard_Real preci = -1);
   
-  //! This method was implemented as fix for changes in trimmed curve
-  //! behaviour. For the moment trimmed curve returns false anyway.
-  //! So it is necessary to adapt all Data exchange tools for this behaviour.
-  //! Current implementation takes into account that curve may be offset.
-  Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom_Curve)& curve);
-  
-  //! The same as for Curve3d.
-  Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom2d_Curve)& curve);
-
-
-
-
 protected:
 
 
index c17a4e4fcacc4eebc8996147b7c44465d2c25c27..323b1cc6c6b4c3f1a498fece4eb1b2a73b66e31c 100644 (file)
@@ -143,38 +143,6 @@ static Standard_Real AdjustByPeriod(const Standard_Real Val,
   return ( diff >0 ? -P : P ) * (Standard_Integer)( D / P + 0.5 );
 }
 
-static Standard_Boolean IsPeriodic(const Handle(Geom_Curve)& theCurve)
-{
-  // 15.11.2002 PTV OCC966
-  // remove regressions in DE tests (diva, divb, divc, toe3) in KAS:dev
-  // ask IsPeriodic on BasisCurve
-  Handle(Geom_Curve) aTmpCurve = theCurve;
-  while ( (aTmpCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) ||
-    (aTmpCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) ) {
-      if (aTmpCurve->IsKind(STANDARD_TYPE(Geom_OffsetCurve)))
-        aTmpCurve = Handle(Geom_OffsetCurve)::DownCast(aTmpCurve)->BasisCurve();
-      if (aTmpCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve)))
-        aTmpCurve = Handle(Geom_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve();
-  }
-  return aTmpCurve->IsPeriodic();
-}
-
-Standard_Boolean IsPeriodic(const Handle(Geom2d_Curve)& theCurve)
-{
-  // 15.11.2002 PTV OCC966
-  // remove regressions in DE tests (diva, divb, divc, toe3) in KAS:dev
-  // ask IsPeriodic on BasisCurve
-  Handle(Geom2d_Curve) aTmpCurve = theCurve;
-  while ( (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve))) ||
-    (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) ) {
-      if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve)))
-        aTmpCurve = Handle(Geom2d_OffsetCurve)::DownCast(aTmpCurve)->BasisCurve();
-      if (aTmpCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
-        aTmpCurve = Handle(Geom2d_TrimmedCurve)::DownCast(aTmpCurve)->BasisCurve();
-  }
-  return aTmpCurve->IsPeriodic();
-}
-
 void ShapeBuild_Edge::CopyRanges (const TopoDS_Edge& toedge, 
   const TopoDS_Edge& fromedge,
   const Standard_Real alpha,
@@ -235,7 +203,7 @@ void ShapeBuild_Edge::CopyRanges (const TopoDS_Edge& toedge,
         if (toGC->IsKind(STANDARD_TYPE(BRep_Curve3D))) {
           Handle(Geom_Curve) aCrv3d = Handle(BRep_Curve3D)::DownCast(toGC)->Curve3D();
           // 15.11.2002 PTV OCC966
-          if ( ! aCrv3d.IsNull() && IsPeriodic(aCrv3d) ) {
+          if ( ! aCrv3d.IsNull() && aCrv3d->IsPeriodic() ) {
             aPeriod = aCrv3d->Period();
             aCrvF = aCrv3d->FirstParameter();
             aCrvL = aCrv3d->LastParameter();
@@ -245,7 +213,7 @@ void ShapeBuild_Edge::CopyRanges (const TopoDS_Edge& toedge,
         else if  (toGC->IsKind(STANDARD_TYPE(BRep_CurveOnSurface))) {
           Handle(Geom2d_Curve) aCrv2d = Handle(BRep_CurveOnSurface)::DownCast(toGC)->PCurve();
           // 15.11.2002 PTV OCC966
-          if (!aCrv2d.IsNull() && IsPeriodic(aCrv2d)) {
+          if (!aCrv2d.IsNull() && aCrv2d->IsPeriodic()) {
             aPeriod = aCrv2d->Period();
             aCrvF = aCrv2d->FirstParameter();
             aCrvL = aCrv2d->LastParameter();
@@ -618,7 +586,7 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
         if (c3d.IsNull())
           return Standard_False;
         // 15.11.2002 PTV OCC966
-        if(!IsPeriodic(c3d)) {
+        if(!c3d->IsPeriodic()) {
           Standard_Boolean isLess = Standard_False;
           if(f < c3d->FirstParameter()) {
             isLess = Standard_True;
index b8b6b1f6eb7b7b2e2bb3c8adc896e921985881f6..60ecbf81403513eb150e580e115aba03bbe933bd 100644 (file)
@@ -40,6 +40,7 @@
 #include <GeomConvert_ApproxCurve.hxx>
 #include <GeomConvert_ApproxSurface.hxx>
 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
+#include <GeomLib.hxx>
 #include <gp_Pln.hxx>
 #include <gp_Vec.hxx>
 #include <Precision.hxx>
@@ -392,17 +393,18 @@ static inline HCurve GetCurveCopy(const HCurve& curve,
 }
 
 template<class HCurve> 
-static inline void SegmentCurve (HCurve& curve,
-                                 const Standard_Real first,
-                                 const Standard_Real last)
+static inline void SegmentCurve (HCurve& theCurve,
+                                 const Standard_Real theFirst,
+                                 const Standard_Real theLast)
 {
-  if(curve->FirstParameter() < first - Precision::PConfusion() || 
-     curve->LastParameter() > last + Precision::PConfusion()) {
-    if(curve->IsPeriodic())
-      curve->Segment(first,last);
-    else curve->Segment(Max(curve->FirstParameter(),first),
-                        Min(curve->LastParameter(),last));
+  Standard_Real aF = theFirst, aL = theLast;
+  if (!GeomLib::AllowExtend(*theCurve, aF, aL))
+  {
+    aF = Max(theCurve->FirstParameter(), aF);
+    aL = Min(theCurve->LastParameter(), aL);
   } 
+
+  theCurve->Segment(aF, aL);
 }
 
 template<class HPoint> 
index 117680e430e260d400f9fdfcbadabd5c6c20c3ae..57ed6f6b79e97977c824aafdb39eb1db96b1c143 100644 (file)
@@ -56,6 +56,7 @@
 #include <GeomAdaptor_HSurface.hxx>
 #include <GeomAPI_Interpolate.hxx>
 #include <GeomAPI_PointsToBSpline.hxx>
+#include <GeomLib.hxx>
 #include <GeomProjLib.hxx>
 #include <gp_Pnt2d.hxx>
 #include <ElCLib.hxx>
@@ -537,7 +538,11 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(Handle(G
   return result;
 }
 
- //! Fix possible period jump and handle walking period parameter.
+//=======================================================================
+//function : fixPeriodictyTroubles
+//purpose  : Fix possible period jump and handle walking period parameter.
+//           This function will adjust only first and last point of thePnt-array
+//=======================================================================
  static Standard_Boolean fixPeriodictyTroubles(gp_Pnt2d *thePnt, // pointer to gp_Pnt2d[4] beginning
                                                Standard_Integer theIdx, // Index of objective coord: 1 ~ X, 2 ~ Y
                                                Standard_Real thePeriod, // Period on objective coord
@@ -660,8 +665,17 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(Handle(G
    Standard_Integer i = 0;
 
    Standard_Real aTol2 = theTol * theTol;
-   Standard_Boolean isPeriodicU = mySurf->Surface()->IsUPeriodic();
-   Standard_Boolean isPeriodicV = mySurf->Surface()->IsVPeriodic();
+   const Handle(Geom_Surface) &aSurf = mySurf->Surface();
+
+   // Method IsUClosed/IsVClosed returns incorrect result
+   // for some kind of surfaces (e.g. Geom_OffsetSurface based on
+   // B-spline surface is always not U(V)-closed). Therefore, 
+   // here we use honest computation of closure.
+   Standard_Boolean isUClosed = Standard_False, isVClosed = Standard_False;
+   GeomLib::IsClosed(aSurf, Precision::Confusion(), isUClosed, isVClosed);
+   
+   const Standard_Boolean isPeriodicU = isUClosed && aSurf->IsUPeriodic(),
+                          isPeriodicV = isVClosed && aSurf->IsVPeriodic();
 
    // Workaround:
    // Protection against bad "tolerance" shapes.
@@ -759,7 +773,6 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(Handle(G
      return 0;
    gp_Vec2d aVec0 (aP2d[0], aP2d[3]);
    gp_Vec2d aVec = aVec0 / dPar;
-   Handle(Geom_Surface) aSurf = mySurf->Surface();
    Standard_Boolean isNormalCheck = aSurf->IsCNu(1) && aSurf->IsCNv(1);
    if (isNormalCheck) {
      for(i = 1; i <= nb; i++)
index 9a5e73bda27f856b40228bce4136f068f6aa4c6e..394e73742380c4e86e3d88502ae7c024ca5689ec 100644 (file)
@@ -999,7 +999,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertCurve(const Handle(Geom_
       Handle(Geom_Curve) aCurve1;
       Standard_Real pf =aCurve->FirstParameter(), pl =  aCurve->LastParameter();
       // 15.11.2002 PTV OCC966
-      if(ShapeAnalysis_Curve::IsPeriodic(aCurve) && (First != Last))  aCurve1 = new Geom_TrimmedCurve(aCurve,First,Last);
+      if(aCurve->IsPeriodic() && (First != Last))  aCurve1 = new Geom_TrimmedCurve(aCurve, First, Last);
       else if(pf < (First - Precision::PConfusion()) || 
         pl > (Last + Precision::PConfusion())) {
           Standard_Real F = Max(First,pf),
@@ -1308,7 +1308,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertCurve2d(const Handle(Geo
       Handle(Geom2d_Curve) aCurve1;
       Standard_Real pf =aCurve->FirstParameter(), pl =  aCurve->LastParameter();
       // 15.11.2002 PTV OCC966
-      if(ShapeAnalysis_Curve::IsPeriodic(aCurve) && (First != Last)) aCurve1 = new Geom2d_TrimmedCurve(aCurve,First,Last);
+      if(aCurve->IsPeriodic() && (First != Last)) aCurve1 = new Geom2d_TrimmedCurve(aCurve,First,Last);
       else if(aCurve->FirstParameter() < (First - Precision::PConfusion())  || 
         aCurve->LastParameter() > (Last + Precision::PConfusion())) {
           Standard_Real F = Max(First,pf),
index 46fbfbd943b800059afd926d452ca4df537f8fbc..92ecda5fc60f0d8cfd08b3b69efc25af8918a9ae 100644 (file)
@@ -385,7 +385,7 @@ static Handle(Geom2d_Curve) TranslatePCurve (const Handle(Geom_Surface)& aSurf,
             oldFirst = geometric_representation_ptr->First();
            oldLast = geometric_representation_ptr->Last();
             // 15.11.2002 PTV OCC966
-           if(ShapeAnalysis_Curve::IsPeriodic(Curve2dPtr)) {
+           if(Curve2dPtr->IsPeriodic()) {
              Handle(Geom2d_TrimmedCurve) tc = new Geom2d_TrimmedCurve(Curve2dPtr,oldFirst,oldLast);
              Standard_Real shift = tc->FirstParameter()-oldFirst;
              oldFirst += shift;
index 5b2fb486faeb3fa6f9aac68e48394a87cce4ebc0..7e7049f2703f90b5cc39c32ecb53de54a5c26a54 100644 (file)
@@ -444,7 +444,7 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci)
   if(parU || parV) {
     Standard_Real uf,ul,vf,vl;
     theSurface->Bounds(uf,ul,vf,vl);
-    Standard_Real period = (parU ? ul-uf : vl-vf);
+    Standard_Real period = (parU ? theSurface->UPeriod() : theSurface->VPeriod());
     w1+=ShapeAnalysis::AdjustToPeriod(w1,0,period);
     myFirstParam = w1;
     w2+=ShapeAnalysis::AdjustToPeriod(w2,0,period);
@@ -578,7 +578,8 @@ void ShapeFix_EdgeProjAux::UpdateParam2d (const Handle(Geom2d_Curve)& theCurve2d
   Standard_Real preci2d = Precision::PConfusion(); //:S4136: Parametric(preci, 0.01);
 
   // 15.11.2002 PTV OCC966
-  if (ShapeAnalysis_Curve::IsPeriodic(theCurve2d)) {
+  if(theCurve2d->IsPeriodic() && theCurve2d->IsClosed())
+  {
     ElCLib::AdjustPeriodic(cf,cl,preci2d,myFirstParam,myLastParam);
   }
   else if (theCurve2d->IsClosed()) {
index 5966d91a5a73b977517f15703c0374d7bbf97175..66942371b74a7e185db453504870f0d6ae26fd2f 100644 (file)
@@ -1368,9 +1368,13 @@ Standard_Boolean ShapeFix_Wire::FixShifted()
   Standard_Boolean IsVCrvClosed = Standard_False;
   Standard_Real VRange = 1.;
   if (surf->Surface()->IsKind (STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
+    //! Issue #29115. Surface of revolution is considered to be V-periodic
+    //! if and only if its basis curve is periodic and closed simultaneously.
+    //! Therefore, we need to keep this complex check for the given specific algorithm.
+
     Handle(Geom_SurfaceOfRevolution) aSurOfRev = Handle(Geom_SurfaceOfRevolution)::DownCast(surf->Surface());
     Handle(Geom_Curve) aBaseCrv = aSurOfRev->BasisCurve();
-    while ( (aBaseCrv->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) ||
+    while ((aBaseCrv->IsKind(STANDARD_TYPE(Geom_OffsetCurve))) ||
            (aBaseCrv->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) ) {
       if (aBaseCrv->IsKind(STANDARD_TYPE(Geom_OffsetCurve)))
         aBaseCrv = Handle(Geom_OffsetCurve)::DownCast(aBaseCrv)->BasisCurve();
@@ -1379,7 +1383,7 @@ Standard_Boolean ShapeFix_Wire::FixShifted()
     }
     if (aBaseCrv->IsPeriodic()) {
       vclosed = Standard_True;
-      VRange = aBaseCrv->Period();
+      VRange = aSurOfRev->VPeriod();
       IsVCrvClosed = Standard_True;
 #ifdef OCCT_DEBUG
       cout << "Warning: ShapeFix_Wire::FixShifted set vclosed True for Surface of Revolution" << endl;
index 5c00a23f4976e0754ff8a4743a7eb64dcad26167..2ff259773a2cb85e7ac493f8f14328875520ac58 100644 (file)
@@ -165,7 +165,7 @@ static Standard_Real AdjustOnPeriodic3d (const Handle(Geom_Curve)& c,
                                         const Standard_Real param)
 {
   // 15.11.2002 PTV OCC966
-  if (ShapeAnalysis_Curve::IsPeriodic(c)) 
+  if (c->IsPeriodic()) 
   {
     Standard_Real T = c->Period();
     Standard_Real shift = -IntegerPart(first/T)*T; if (first<0.) shift += T;
@@ -360,7 +360,7 @@ static Standard_Real AdjustOnPeriodic3d (const Handle(Geom_Curve)& c,
         {
           OCC_CATCH_SIGNALS
           // 15.11.2002 PTV OCC966
-         if(!ShapeAnalysis_Curve::IsPeriodic(c))
+         if(!c->IsPeriodic())
            tc = new Geom_TrimmedCurve(c,Max(first,c->FirstParameter()),Min(last,c->LastParameter()));
          else tc = new Geom_TrimmedCurve(c,first,last);
          bsp = GeomConvert::CurveToBSplineCurve(tc);
@@ -755,7 +755,7 @@ static Standard_Real AdjustOnPeriodic2d (const Handle(Geom2d_Curve)& pc,
                                         const Standard_Real param)
 {
   // 15.11.2002 PTV OCC966
-  if (ShapeAnalysis_Curve::IsPeriodic(pc)) 
+  if (pc->IsPeriodic()) 
   {
     Standard_Real T = pc->Period();
     Standard_Real shift = -IntegerPart(first/T)*T; if (first<0.) shift += T;
@@ -942,7 +942,7 @@ static Standard_Real AdjustOnPeriodic2d (const Handle(Geom2d_Curve)& pc,
           OCC_CATCH_SIGNALS
          Handle(Geom2d_Curve) c;
           // 15.11.2002 PTV OCC966
-         if(!ShapeAnalysis_Curve::IsPeriodic(pc))
+         if(!pc->IsPeriodic())
            c = new Geom2d_TrimmedCurve(pc,Max(first,pc->FirstParameter()),Min(last,pc->LastParameter()));
          else 
            c = new Geom2d_TrimmedCurve(pc,first,last);
index c533c518a703780c73444de3bc35eaebcbdeab1d..b2514b161b13e19f52c713d4738f3c6377d8fe83 100644 (file)
@@ -72,7 +72,7 @@ ShapeUpgrade_SplitCurve2d::ShapeUpgrade_SplitCurve2d()
   if(aCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) 
     aCurve=Handle(Geom2d_TrimmedCurve)::DownCast(aCurve)->BasisCurve();
   // 15.11.2002 PTV OCC966
-  if(!ShapeAnalysis_Curve::IsPeriodic(C)) {
+  if(!C->IsPeriodic()) {
     Standard_Real fP = aCurve->FirstParameter();
     Standard_Real lP  = aCurve->LastParameter();
     if(Abs(firstPar-fP) < precision)
index f3cf45209f42ef42c62544161bff01a5cbd6ffdd..58602dedbde9118acb415073fd34d93f0c73f572 100644 (file)
@@ -71,7 +71,7 @@ ShapeUpgrade_SplitCurve3d::ShapeUpgrade_SplitCurve3d()
   if(aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) 
     aCurve=Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve();
   // 15.11.2002 PTV OCC966
-  if(!ShapeAnalysis_Curve::IsPeriodic(C)) {
+  if(!C->IsPeriodic()) {
     Standard_Real fP = aCurve->FirstParameter();
     Standard_Real lP  = aCurve->LastParameter();
     if(Abs(firstPar-fP) < precision)
@@ -156,7 +156,7 @@ ShapeUpgrade_SplitCurve3d::ShapeUpgrade_SplitCurve3d()
   
   //pdn fix on BuildCurve 3d
   // 15.11.2002 PTV OCC966
-  if(!ShapeAnalysis_Curve::IsPeriodic(myCurve)) {
+  if(!myCurve->IsPeriodic()) {
     //pdn exceptons only on non periodic curves
     Standard_Real precision = Precision::PConfusion();
     Standard_Real firstPar = myCurve->FirstParameter();
index a0351ee0296c1ea9bfed8e2a782fde768cd4a6d7..f050e8114ef34705bf6de7198a977d4a255e3e8c 100644 (file)
@@ -261,7 +261,7 @@ Standard_Boolean  StepToTopoDS_GeometricTool::UpdateParam3d
 
   if (w1 < w2) return Standard_True;
 
-  if (theCurve->IsPeriodic()) 
+  if (theCurve->IsPeriodic() && theCurve->IsClosed()
     ElCLib::AdjustPeriodic(cf,cl,Precision::PConfusion(),w1,w2); //:a7 abv 11 Feb 98: preci -> PConfusion()
   else if (theCurve->IsClosed()) {
     // l'un des points projecte se trouve sur l'origine du parametrage
index b2b17747bc7a8acdc0b46a8a4055f3819d46f9db..71ec077f013361952a730adf23386a14a23c14e8 100644 (file)
@@ -158,7 +158,7 @@ static void CheckPCurves (TopoDS_Wire& aWire, const TopoDS_Face& aFace,
       w2 = cf;
     }
 
-    if (w1 > w2 && mySurf->IsUPeriodic())
+    if (w1 > w2 && mySurf->IsUPeriodic() && mySurf->IsUClosed())
     {
       Standard_Real u1,u2,v1,v2;
       mySurf->Bounds(u1,u2,v1,v2);
index 6ed5f5bc81c01326855b689c20ee866702b123cb..5397384a673ef7265a6c9062ffd328bb465417f3 100644 (file)
@@ -708,7 +708,7 @@ void TopOpeBRepDS_BuildTool::ComputePCurves
   
   if ( C3D->IsPeriodic() ) {
     // ellipse on cone : periodize parmin,parmax
-    Standard_Real period = C3D->LastParameter() - C3D->FirstParameter();
+    Standard_Real period = C3D->Period();
     Standard_Real f,l;
     if (Vmin.Orientation() == TopAbs_FORWARD) { f = parmin; l = parmax; }
     else {                                      f = parmax; l = parmin; }
@@ -998,7 +998,7 @@ void  TopOpeBRepDS_BuildTool::UpdateEdge(const TopoDS_Shape& Ein,
   if ( Cou->IsPeriodic() ) {
     Standard_Real f2n = f2, l2n = l2;
     if ( l2n <= f2n ) {
-      ElCLib::AdjustPeriodic(f1,l1,Precision::PConfusion(),f2n,l2n);
+      ElCLib::AdjustPeriodic(f1,f1+Cou->Period(),Precision::PConfusion(),f2n,l2n);
       Range(Eou,f2n,l2n);
     }
   }
@@ -1082,7 +1082,7 @@ void TopOpeBRepDS_BuildTool::TranslateOnPeriodic
  
   Standard_Real first = C3Df, last = C3Dl;
   if (C3D->IsPeriodic()) {
-    if ( last < first ) last += Abs(first - last);
+    if ( last < first ) last += C3D->Period();
   }
 
   // jyl-xpu : 13-06-97 : 
index 24307fb38454e037a80f37e9ece6fa474241682e..c25048f11fc78f0e41b116672e08cadf3d2e46ee 100644 (file)
@@ -198,9 +198,7 @@ static Standard_Boolean CheckPCurve
 
   // adjust domain for periodic surfaces
   TopLoc_Location aLoc;
-  Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace, aLoc);
-  if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
-    aSurf = (Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf))->BasisSurface();
+  const Handle(Geom_Surface) &aSurf = BRep_Tool::Surface(aFace, aLoc);
 
   gp_Pnt2d pnt = aPC->Value((fp+lp)/2);
   Standard_Real u,v;
index 1cb9bc25aa3160a4458fff94b468e59de2b05e6d..745a854937eea8b90603445d8549545f4b0d3313 100644 (file)
@@ -307,8 +307,8 @@ Standard_Real TopOpeBRepTool_ShapeTool::PeriodizeParameter
 
   TopLoc_Location Loc;
   const Handle(Geom_Surface) Surf = BRep_Tool::Surface(F,Loc);
-  Standard_Boolean isUperio = Surf->IsUPeriodic();
-  Standard_Boolean isVperio = Surf->IsVPeriodic();
+  Standard_Boolean isUperio = Surf->IsUPeriodic() && Surf->IsUClosed();
+  Standard_Boolean isVperio = Surf->IsVPeriodic() && Surf->IsVClosed();
   if (!isUperio && !isVperio) return periopar;
 
   Standard_Real Ufirst,Ulast,Vfirst,Vlast;
index dd326dc1a9a50f0e4cac3614ee965f6d1b79390f..76c2b8cd1bcac4f5eaccdacae67f22baed740142 100644 (file)
@@ -165,15 +165,19 @@ void math_NewtonMinimum::Perform(math_MultipleVarFunctionWithHessian& F,
       Standard_Real aMult = RealLast();
       for(Standard_Integer anIdx = 1; anIdx <= myLeft.Upper(); anIdx++)
       {
+        const Standard_Real anAbsStep = Abs(TheStep(anIdx));
+        if (anAbsStep < gp::Resolution())
+          continue;
+
         if (suivant->Value(anIdx) < myLeft(anIdx))
         {
-          Standard_Real aValue = Abs(precedent->Value(anIdx) - myLeft(anIdx)) / Abs(TheStep(anIdx));
+          Standard_Real aValue = Abs(precedent->Value(anIdx) - myLeft(anIdx)) / anAbsStep;
           aMult = Min (aValue, aMult);
         }
 
         if (suivant->Value(anIdx) > myRight(anIdx))
         {
-          Standard_Real aValue = Abs(precedent->Value(anIdx) - myRight(anIdx)) / Abs(TheStep(anIdx));
+          Standard_Real aValue = Abs(precedent->Value(anIdx) - myRight(anIdx)) / anAbsStep;
           aMult = Min (aValue, aMult);
         }
       }