]> OCCT Git - occt-copy.git/commitdiff
0029115: [Regression] GeomAdaptor mistakenly reports non-periodic curves to be periodic CR29115_6
authornbv <nbv@opencascade.com>
Wed, 21 Feb 2018 14:31:37 +0000 (17:31 +0300)
committernbv <nbv@opencascade.com>
Tue, 11 Dec 2018 06:23:34 +0000 (09:23 +0300)
1. Adaptors' and trimmed curves' periodicity is always got from the basis geometry (independently of trim boundaries).

2. Section "Periodicity concept" has been added in Doxigen-documentation.

3. The methods  IsPeriodic(), IsU(V)Periodic() of classes Geom(2d)_TrimmedCurve(RectangularTrimmedSurface) have changed their behavior. Periodicity of basis curve is taken into account only (trim boundaries are ignored).

4. Currently, the methods Period(), U(V)Period() are overridden in classes inherited from Geom(2d)_Curve(Surface) and Adaptor(2d)_Curve(Surface), which IsPeriodic (IsU(V)Periodic()) can return TRUE in. In basis classes, such methods throw exceptions.

5. Method GeomLib::IsClosed(...) has been added in order to check of closure of 3D/2D curve with some tolerance. At the same time, IntTools_Tools::IsClosed(...) method has been removed.

6. Methods GeomLib::IsTrimAllowed(...), GeomLib::IsUTrimAllowed(...) and GeomLib::IsVTrimAllowed(...) have been created.

7. Method ShapeAnalysis_Curve::IsPeriodic(...) has been removed.

8. 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.

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

10. The DRAW-commands "curveperiod" and "surfaceperiod" have been created. Please see help-system to obtain the information about these commands.

11. Several DRAW-commands have been created to provide work with adapters. They are defined in the file GeomliteTest_AdaptorCommands.cxx. Currently they allow reading the following adapter's properties: periodicity, closure and resolution.

12. New test cases have been created.

207 files changed:
dox/user_guides/draw_test_harness/draw_test_harness.md
dox/user_guides/modeling_data/modeling_data.md
src/Adaptor2d/Adaptor2d_Curve2d.hxx
src/Adaptor2d/Adaptor2d_HCurve2d.hxx
src/Adaptor2d/Adaptor2d_Line2d.cxx
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.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_CurveTessellator.cxx
src/BRepMesh/BRepMesh_DefaultRangeSplitter.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.cxx
src/BiTgte/BiTgte_CurveOnEdge.hxx
src/BiTgte/BiTgte_CurveOnVertex.cxx
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_BSplineCurve.cxx
src/Geom/Geom_BSplineCurve.hxx
src/Geom/Geom_BSplineSurface.cxx
src/Geom/Geom_BSplineSurface.hxx
src/Geom/Geom_BezierCurve.hxx
src/Geom/Geom_Circle.hxx
src/Geom/Geom_ConicalSurface.cxx
src/Geom/Geom_ConicalSurface.hxx
src/Geom/Geom_Curve.cxx
src/Geom/Geom_Curve.hxx
src/Geom/Geom_CylindricalSurface.hxx
src/Geom/Geom_Ellipse.hxx
src/Geom/Geom_Hyperbola.hxx
src/Geom/Geom_Line.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_SphericalSurface.hxx
src/Geom/Geom_Surface.cxx
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_ToroidalSurface.hxx
src/Geom/Geom_TrimmedCurve.cxx
src/Geom/Geom_TrimmedCurve.hxx
src/Geom2d/Geom2d_BSplineCurve.cxx
src/Geom2d/Geom2d_BSplineCurve.hxx
src/Geom2d/Geom2d_BezierCurve.hxx
src/Geom2d/Geom2d_Circle.hxx
src/Geom2d/Geom2d_Curve.cxx
src/Geom2d/Geom2d_Curve.hxx
src/Geom2d/Geom2d_Ellipse.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.cxx
src/GeomAdaptor/GeomAdaptor_SurfaceOfLinearExtrusion.hxx
src/GeomAdaptor/GeomAdaptor_SurfaceOfRevolution.cxx
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.cxx
src/GeomPlate/GeomPlate_Surface.hxx
src/GeomProjLib/GeomProjLib.cxx
src/GeometryTest/GeometryTest_CurveCommands.cxx
src/GeometryTest/GeometryTest_SurfaceCommands.cxx
src/GeomliteTest/FILES
src/GeomliteTest/GeomliteTest.cxx
src/GeomliteTest/GeomliteTest.hxx
src/GeomliteTest/GeomliteTest_AdaptorCommands.cxx [new file with mode: 0644]
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_ComputeApprox.cxx
src/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx
src/ProjLib/ProjLib_ProjectOnPlane.hxx
src/ProjLib/ProjLib_ProjectedCurve.hxx
src/QABugs/QABugs_20.cxx
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
tests/adaptors/begin [new file with mode: 0644]
tests/adaptors/end [new file with mode: 0644]
tests/adaptors/grids.list [new file with mode: 0644]
tests/adaptors/parse.rules [new file with mode: 0644]
tests/adaptors/properties/A01 [new file with mode: 0644]
tests/adaptors/properties/B01 [new file with mode: 0644]
tests/adaptors/properties/C01 [new file with mode: 0644]
tests/adaptors/properties/D01 [new file with mode: 0644]
tests/adaptors/properties/E01 [new file with mode: 0644]
tests/adaptors/properties/F01 [new file with mode: 0644]
tests/adaptors/properties/F02 [new file with mode: 0644]
tests/adaptors/properties/F03 [new file with mode: 0644]
tests/adaptors/resolution/A1 [new file with mode: 0644]
tests/adaptors/resolution/A2 [new file with mode: 0644]
tests/adaptors/resolution/A3 [new file with mode: 0644]
tests/bugs/modalg_7/bug29115_1 [new file with mode: 0644]
tests/bugs/modalg_7/bug29115_2 [new file with mode: 0644]
tests/bugs/modalg_7/bug29115_3 [new file with mode: 0644]
tests/bugs/modalg_7/bug29115_4 [new file with mode: 0644]
tests/bugs/modalg_7/bug29115_5 [new file with mode: 0644]
tests/geometry/geomperiodic/A1 [new file with mode: 0644]
tests/geometry/geomperiodic/A2 [new file with mode: 0644]
tests/geometry/geomperiodic/B1 [new file with mode: 0644]
tests/geometry/geomperiodic/B2 [new file with mode: 0644]
tests/geometry/geomperiodic/B3 [new file with mode: 0644]
tests/geometry/geomperiodic/B4 [new file with mode: 0644]
tests/geometry/geomperiodic/B5 [new file with mode: 0644]
tests/geometry/grids.list

index 78447f534c65228ffbb82f0c922ef2b09e56faab..a1baa42897794cab24003be797edec4530c86588 100644 (file)
@@ -4380,6 +4380,7 @@ The following topics are covered in the nine sections of this chapter:
   * **Curve and surface modification** deals with the commands used to modify the definition of curves and surfaces, most of which concern modifications to bezier and bspline curves.
   * **Geometric transformations** covers translation, rotation, mirror image and point scaling transformations.
   * **Curve and Surface Analysis** deals with the commands used to compute points, derivatives and curvatures.
+  * **Adaptor commands** deals with the commands providing work with (curve and surface) adaptors.
   * **Intersections** presents intersections of surfaces and curves.
   * **Approximations** deals with creating curves and surfaces from a set of points.
   * **Constraints** concerns construction of 2d circles and lines by constraints such as tangency.
@@ -5385,6 +5386,8 @@ pscale s 0 0 0 2
   * **parameters** to compute (u,v) values for a point on a surface.
   * **proj** and **2dproj** to project a point on a curve or a surface.
   * **surface_radius** to compute the curvature on a surface.
+  * **curveperiod** to check whether the curve is periodic and to compute its period.
+  * **surfaceperiod** to check whether the surface is periodic in U- and V-directions and to compute its period in correspond direction.
 
 @subsubsection occt_draw_6_6_1  coord
 
@@ -5524,6 +5527,258 @@ surface_radius c pi 3 c1 c2
 == Min Radius of Curvature : infinite 
 ~~~~~
 
+@subsubsection occt_draw_6_6_8  curveperiod
+
+Syntax:
+~~~~~
+curveperiod curve
+~~~~~
+
+where "curve" is a 2D- or 3D-curve.
+
+Checks if the curve is periodic and returns (in this case) its period. 
+
+**Example 1** 
+
+~~~~~
+# Create some 3D-curve
+ellipse c1 0 0 0 0 1 1 100 40
+
+# Check its periodicity
+curveperiod c1
+# c1 is periodic with the period 6.2831853071795862
+~~~~~
+
+**Example 2** 
+
+~~~~~
+# Create 2D B-spline curve
+2dbsplinecurve c1 2 6 -2.0943951023932 1 0 2 2.0943951023932 2 4.18879020478639 2 6.28318530717959 2 8.37758040957278 1 100 0 1 100 173 0.5 -50 87 1 -200 0 0.5 -50 -87 1 100 -173 0.5 100 0 1 
+
+# Check its periodicity
+curveperiod c1
+# c1 is not periodic
+
+# Make it periodic
+setperiodic c1 
+
+# Check its periodicity
+curveperiod c1
+#c1 is periodic with the period 6.2831853071795898
+~~~~~
+
+@subsubsection occt_draw_6_6_9 surfaceperiod
+
+Syntax:
+~~~~~
+surfaceperiod surface
+~~~~~
+
+Checks if the surface is periodic (in U- and V-direction) and returns (if that is true) its period.
+
+**Example 1** 
+
+~~~~~
+# Create some surface
+sphere ss 100
+trim st ss 0 pi -1 1
+
+# Check its periodicity
+surfaceperiod st
+# st is U-periodic with U-period 6.2831853071795862
+# st is not V-periodic
+~~~~~
+
+**Example 2** 
+
+~~~~~
+# Create some surface
+torus s1 100 20
+
+# Check its periodicity
+surfaceperiod s1
+# s1 is U-periodic with U-period 6.2831853071795862
+# s1 is V-periodic with V-period 6.2831853071795862
+~~~~~
+
+@subsection occt_draw_6_6a Adaptor commands
+
+This group of Draw-commands allows obtaining (in Draw) some properties of curves/surfaces, which can be read via adapters in C++ code only (e.g. curve's or surface's resolution).
+
+Here is the list of these commands:
+
+* **nulifyadaptors** clears all earlier created adaptors;
+* **makeadaptor** creates new adaptor.
+* **adaptorproperties** returns the property of all existing adaptors.
+
+@subsubsection occt_draw_6_6a_1 nulifyadaptors
+
+Syntax:
+~~~~~
+nulifyadaptors
+~~~~~
+
+Clears all earlier created adaptors.
+
+See example @ref occt_draw_6_6a_3 "below".
+
+@subsubsection occt_draw_6_6a_2 makeadaptor
+
+Syntax:
+~~~~~
+makeadaptor argument
+~~~~~
+
+where argument can be
+
+- 3D/2D-curve;
+- Surface;
+- Edge;
+- Face;
+- Compound, containing edge and face. Moreover, the edge must have 2D-curve on the face.
+
+Creates new adaptor. If adaptor with such type already exists the new adaptor will replace the existing one.
+
+See example @ref occt_draw_6_6a_3 "below".
+
+@subsubsection occt_draw_6_6a_3 adaptorproperties
+
+Syntax:
+~~~~~
+adaptorproperties <set of properties>
+~~~~~
+
+Returns the properties of all created adaptors. Currently the following properties are supported:
+
+- <b><i>-isperiodic</i></b> - Returns **IsPeriodic()** property and the period.
+- <b><i>-isclosed</i></b> - Returns **IsClosed()** property.
+- <b><i>-resolution</i></b> - Returns a value of resolution (see Examples 3 and 6).
+
+**Example 1** 
+
+~~~~~
+# Create some 2D-curve
+circle c 0 0 20
+
+# Nulify all already created adaptors
+nulifyadaptors 
+# All adapters have been nullified successful.
+
+# Create new adaptor
+makeadaptor c 
+# OK: Adaptor2d_Curve2d has been created.
+
+# Check it
+adaptorproperties -isclosed 
+# Adaptor2d_Curve2d is closed
+~~~~~
+
+**Example 2** 
+
+~~~~~
+# Create some 3D-curve
+bsplinecurve cc 4 3 0 5 3.1415926535897931 3 6.2831853071795862 5 0 20 100 1 -14.1421356237309 20 106.594586144012 1 -34.9044110322929 0 116.276194167748 1 -14.1421356237311 -20 106.594586144013 1 14.142135623731 -20 93.4054138559873 1 34.904411032293 0 83.7238058322526 1 14.1421356237309 20 93.4054138559873 1 0 20 100 1 
+
+# Nulify all already created adaptors
+nulifyadaptors 
+# All adapters have been nullified successful.
+
+# Create new adaptor
+makeadaptor cc 
+# OK: Adaptor3d_Curve has been created.
+
+# Check it
+adaptorproperties -isperiodic -isclosed 
+# Adaptor3d_Curve is not periodic
+# Adaptor3d_Curve is closed
+~~~~~
+
+**Example 3** 
+
+~~~~~
+# Create some surface
+sphere ss 68 
+
+# Nulify all already created adaptors
+nulifyadaptors 
+# All adapters have been nullified successful.
+
+# Create new adaptor
+makeadaptor bs 
+# OK: Adaptor3d_Surface has been created.
+
+# Get sphere's resolution from 1.0e-7
+adaptorproperties -resolution 1.0e-7 
+# Adaptor3d_Surface: UResolution = 1.4705882352941176e-009; VResolution = 1.4705882352941176e-009
+~~~~~
+
+**Example 4** 
+
+~~~~~
+# Obtain some edge
+box b 1 1 1 
+explode b e 
+
+# Nulify all already created adaptors
+nulifyadaptors 
+# All adapters have been nullified successful.
+
+# Create new adaptor
+makeadaptor b_1 
+# OK: Adaptor3d_Curve has been created.
+
+# Check it
+adaptorproperties -isperiodic 
+# Adaptor3d_Curve is not periodic
+
+adaptorproperties -isclosed 
+# Adaptor3d_Curve is not closed
+~~~~~
+
+**Example 5** 
+
+~~~~~
+# Obtain some face
+pcylinder f 20 200 
+explode f f 
+
+# Nulify all already created adaptors
+nulifyadaptors 
+# All adapters have been nullified successful.
+
+# Create new adaptor
+makeadaptor f_1 
+# OK: Adaptor3d_Curve has been created.
+
+# Check it
+adaptorproperties -isperiodic -isclosed 
+# Adaptor3d_Surface is U-periodic with U-period 6.2831853071795862
+# Adaptor3d_Surface is not V-periodic
+# Adaptor3d_Surface is U-closed
+# Adaptor3d_Surface is not V-closed
+~~~~~
+
+**Example 6** 
+
+~~~~~
+# Obtain compound edge+face
+pcone co 0 10 10 
+explode co f 
+explode co_1 e 
+compound co_1_2 co_1 cm 
+
+# Nulify all already created adaptors
+nulifyadaptors 
+# All adapters have been nullified successful.
+
+# Create new adaptor
+makeadaptor cm 
+# OK: Adaptor2d_Curve2d has been created.
+
+# Get curve's resolution from 1.0e-3
+adaptorproperties -resolution 1.0e-3
+# Adaptor2d_Curve2d::Resolution = 0.001
+~~~~~
 
 @subsection occt_draw_6_7  Intersections
 
index 5c31123d4840aa8e98b92b73f0a55d0e3f774446..9f4be2bdbaf60c20fd1789f0c4b1ab21b6e2a341 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 Periodicity concept
+
+@subsection occt_modat_4per_1 Mathematical definition
+
+In math, the following definition of periodicity is applied:
+
+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 periodic B-spline 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::IsTrimAllowed(...)** 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 their 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, a surface 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 biperiodic 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).
+
+Also, it should be noticed that any surface always has rectangular domain. I.e. the surface domain always has such form: \f$ \mathfrak{D}_{S} = \left \{ (U, V) | U_{1}\leq U \leq U_{2}, V_{1}\leq V \leq V_{2} \right \} \f$, where \f$ U_{1} \f$, \f$ U_{2} \f$, \f$ V_{1} \f$ and \f$ V_{2} \f$ are four independent (on each other) numbers (they can apply infinite values).
+
+Having taken into account this remark, periodicity of some 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}, V_{0}\in \mathfrak{D}_{S})\f$, the univariate function of real variable \f$ F(U)=S(U,V_{0} ) \f$ is periodic.</b>
+
+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}, U_{0}\in \mathfrak{D}_{S})\f$, the univariate function of real variable \f$ F(V)=S(U_{0}, V) \f$ is periodic.</b>
+
+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".
+
+The methods analogical to **GeomLib::IsTrimAllowed(...)** that can be applied to a surface are called **GeomLib::IsUTrimAllowed(...)** and **GeomLib::IsVTrimAllowed(...)**.
+
+@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 (UCS) 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 with \f$ U \f$ period is equal to \f$ 2\pi \f$. 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::IsVTrimAllowed(...)** method). We recommend 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::IsVTrimAllowed(...)** 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::IsVTrimAllowed(...)** 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 their surfaces only. All remarks about curve's adaptor are fair to surfaces.
+
+@subsection occt_modat_4per_7 Methods IsPeriodic(), IsUPeriodic(), IsVPeriodic(), Period(), UPeriod() and VPeriod()
+
+Periodicity can be checked with methods IsPeriodic(), IsUPeriodic() and IsVPeriodic(), which are overriden for curves, surfaces and adaptors.
+
+For periodic elements (curves/surfaces/adaptors) methods Period(), UPeriod() and VPeriod() return their period value. For not periodic elements, it throws an exception "Standard_NotImplemented".
 
 @section occt_modat_5 Topology
 
index c845bcef7a349a576bb2e31f429d979652b8268a..e65dbc9c18eda8498f7ba1f8757d89610bee60de 100644 (file)
@@ -86,8 +86,10 @@ public:
   
   Standard_EXPORT virtual Standard_Boolean IsClosed() const;
   
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT virtual Standard_Boolean IsPeriodic() const;
   
+  //! Returns the period of the curve
   Standard_EXPORT virtual Standard_Real Period() const;
   
   //! Computes the point of parameter U on the curve.
index 1e2f8157517db006f51761455ecc992df63ed17e..039661b26aca3ca2c92bf0b19cb70ac372e9171f 100644 (file)
@@ -76,9 +76,11 @@ public:
   
     Standard_Boolean IsClosed() const;
   
-    Standard_Boolean IsPeriodic() const;
+  //! Returns true if the curve in this adapter is periodic 
+  Standard_Boolean IsPeriodic() const;
   
-    Standard_Real Period() const;
+  //! Returns the period of 2D-adapter's curve
+  Standard_Real Period() const;
   
     gp_Pnt2d Value (const Standard_Real U) const;
   
index d9c117832d85728ba1a4891eb062762d9159209a..843a2c2b41dfce66a12ba4d08faba6b368a989b7 100644 (file)
@@ -166,16 +166,6 @@ Standard_Boolean Adaptor2d_Line2d::IsPeriodic() const
   return Standard_False;
 }
 
-//=======================================================================
-//function : Period
-//purpose  : 
-//=======================================================================
-
-Standard_Real Adaptor2d_Line2d::Period() const 
-{
-  throw Standard_NoSuchObject();
-}
-
 //=======================================================================
 //function : Value
 //purpose  : 
index f365e50804a89da34007039447684700b57b6108..3bb60483df6d67ec07d538f17aa23677f263b6c2 100644 (file)
@@ -87,10 +87,9 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Always returns FALSE
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
-  
   Standard_EXPORT gp_Pnt2d Value (const Standard_Real X) const Standard_OVERRIDE;
   
   Standard_EXPORT void D0 (const Standard_Real X, gp_Pnt2d& P) const Standard_OVERRIDE;
index b1b1c356f30f757c6bffc78f79f268c2a2a7e82a..358adb62fd52c499db99c7ef0b24b0b95e61fbe0 100644 (file)
@@ -105,8 +105,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of the curve
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 49b02da158fb08c5ab37101734ecacc94290ea96..155cdb4deedf9f8c9d6aa5ed5a3ea9737a1a5bbd 100644 (file)
@@ -106,7 +106,6 @@ Handle(Adaptor3d_HCurve) Adaptor3d_Curve::Trim(const Standard_Real , const Stand
   throw Standard_NotImplemented("Adaptor3d_Curve::Trim");
 }
 
-
 //=======================================================================
 //function : IsClosed
 //purpose  : 
index de882dc430913009e2f71bd38c8babd1019af3a4..cad77f24a21222aced1ea536205b9c8fed7baa5a 100644 (file)
@@ -88,8 +88,10 @@ public:
   
   Standard_EXPORT virtual Standard_Boolean IsClosed() const;
   
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT virtual Standard_Boolean IsPeriodic() const;
   
+  //! Returns the period of the curve
   Standard_EXPORT virtual Standard_Real Period() const;
   
   //! Computes the point of parameter U on the curve.
index c7431f67a4d2e6376f5f7c8e371a8f58ae868e3a..7b2d308fcb39cbc34684c9588d2a957484ab431b 100644 (file)
@@ -112,8 +112,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of the curve
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 3e4e321af0a363ec2f586937d67f79a00a1f7f62..65ea0bbdbdf234fe1f9ff0e2318d308231bd63d6 100644 (file)
@@ -93,8 +93,10 @@ public:
   
     Standard_Boolean IsClosed() const;
   
+    //! Returns true if the curve in this adapter is periodic 
     Standard_Boolean IsPeriodic() const;
   
+    //! Returns the period of the adapter's curve
     Standard_Real Period() const;
   
     gp_Pnt Value (const Standard_Real U) const;
index 80fd5f8199bea3c17ea453af5c5bbdcc44554de6..9ed745d8577422fc946a146ad7d3291b8b4c9323 100644 (file)
@@ -95,12 +95,16 @@ public:
   
     Standard_Boolean IsVClosed() const;
   
+    //! Returns true if the surface in this adapter is U periodic 
     Standard_Boolean IsUPeriodic() const;
   
+    //! Returns U period of U-periodic surface
     Standard_Real UPeriod() const;
   
+    //! Returns true if the surface in this adapter is V periodic 
     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..1e6107ab1a3eb3e6d7c8a697276fab22de054e49 100644 (file)
@@ -114,8 +114,11 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the surface (returned by Surface() method) is periodic
+  //! along specified direction.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  // Returns the period value along specified direction.
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 42adac71bbfe31532fd1cb12ee7c678ae6331473..4f628492f65ad925ad212d4506c78644d71d23ac 100644 (file)
@@ -179,7 +179,6 @@ Handle(Adaptor3d_HSurface) Adaptor3d_Surface::VTrim(const Standard_Real , const
   throw Standard_NotImplemented("Adaptor3d_Surface::VTrim");
 }
 
-
 //=======================================================================
 //function : IsUClosed
 //purpose  : 
index 1f5c3061eeb170f355f9e6df5b18b0295627ca86..ab963e3d4845f2e792e5856b9b67f497e15d7c69 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
@@ -117,12 +117,16 @@ public:
   
   Standard_EXPORT virtual Standard_Boolean IsVClosed() const;
   
+  //! Returns TRUE if the surface is U periodic
   Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const;
   
+  //! Returns U period of the surface
   Standard_EXPORT virtual Standard_Real UPeriod() const;
   
+  //! Returns TRUE if the surface is V periodic
   Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
   
+  //! Returns V period of the surface
   Standard_EXPORT virtual Standard_Real VPeriod() const;
   
   //! Computes the point of parameters U,V on the surface.
index b65d4aaf05fdb33bba28b8b1d8ccad3d0b7153fa..4a00a843af0bd7c981e2c46e9791bdb0ef40a5f7 100644 (file)
@@ -1580,9 +1580,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;
@@ -1602,21 +1600,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 8db49a549de56e612ffdb1d14cb87018ebaa1e2e..17082d3752c79393f702144e6731b6d213a471b0 100644 (file)
@@ -110,14 +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 06653d1605f84f005ac66d7b9bc6c3da44fc5c03..5dcd0739aac4907ed7470c19d49b98092c680823 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,59 +97,17 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
   //
   aS->Bounds(aUmin, aUmax, aVmin, aVmax);
   //
-  bIsUPeriodic=aS->IsUPeriodic();
-  bIsVPeriodic=aS->IsVPeriodic();
+  const Standard_Boolean bIsUPeriodic = aS->IsUPeriodic() && aS->IsUClosed();
+  const Standard_Boolean bIsVPeriodic = aS->IsVPeriodic() && aS->IsVClosed();
   //
-  anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0.;
-  anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.;
-  //
-  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 && !bIsVPeriodic)
+  {
+    return;
   }
+
+  const Standard_Real anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0.;
+  const Standard_Real anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.;
+
   //
   //---------------------------------------------------
   C2D1=BRep_Tool::CurveOnSurface(aSp, aF, a, b);
index e4068ac95c6912fbd4baee905e6879fe8faea9d1..551afef2e3a5a319da12364fbda57dc521f307a0 100644 (file)
@@ -288,11 +288,6 @@ const TopoDS_Wire& BRepAdaptor_CompCurve::Wire() const
 {
   return Standard_False;
 
-}
-
- Standard_Real BRepAdaptor_CompCurve::Period() const
-{
-  return (TLast - TFirst);
 }
 
  gp_Pnt BRepAdaptor_CompCurve::Value(const Standard_Real U) const
index e009fea951f00ee53d42516c1c48548080374bdf..2426fff3f538e204ce6a42f9417a30171d9875d2 100644 (file)
@@ -113,10 +113,9 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Always returns FALSE
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
-  
   //! Computes the point of parameter U on the curve
   Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
   
index 640505d6f7bacb0561d9b240d97f5e3ea9c106ba..c81f70f2d9265ed7ccffe78044dc29c1f9e999ff 100644 (file)
@@ -149,8 +149,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of the curve
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve
index 70858bf8faa77e87c245a2791feb62e60d400fed..ebc5bad8f6af55479586fde545386eeaa6075b22 100644 (file)
@@ -145,12 +145,16 @@ public:
   
     Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
+    //! Returns TRUE if the surface is U-periodic
     Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
+    //! Returns U period of the surface
     Standard_Real UPeriod() const Standard_OVERRIDE;
   
+    //! Returns TRUE if the surface is V-periodic
     Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+    //! Returns V period of the surface
     Standard_Real VPeriod() const Standard_OVERRIDE;
   
   //! Computes the point of parameters U,V on the surface.
index 40a6277af98a44a0c16b9e22313d711d2fae24c2..b8648203e646459ab340979368621db7e8b9329d 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 6aa8c2dd49845827fd3030ee4f6178010b14e307..ca0491007b4e22874d6549d40118d375fb3370a3 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);
 //
@@ -470,7 +473,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());
@@ -502,13 +504,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)
@@ -588,33 +590,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::IsUTrimAllowed(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::IsVTrimAllowed(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 9bc292a9e4fcbd68635e705b5d5f3805cbf8a78d..f110d420d8194fc0c064e40796ea31d6296d41fb 100644 (file)
@@ -193,6 +193,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();
@@ -233,6 +235,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();
@@ -369,6 +373,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 847d877329ca4c75fe377ce99b5a53f83df4f270..a47bb03a6122d51c92751158f8098f53932df51a 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 da087a47c37829a10b6a62a98ab8795721ddf169..9db5d15f4070417e235935c2c4e2ad51231caaab 100644 (file)
@@ -213,15 +213,20 @@ 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(),
@@ -319,15 +324,20 @@ 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(),
@@ -368,7 +378,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 f6006c5d3889c4a30f0851218d7087dbf9a89bcf..d6100e85dff790ae461ed0870a626b8f7c624a93 100644 (file)
@@ -1283,30 +1283,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::IsTrimAllowed(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 d7e73f0f2693479955511c811f0599d0c994f04a..4757a816a9fa0e0b2d901a1bf1227e95979554b5 100644 (file)
@@ -233,6 +233,8 @@ Standard_Boolean BRepMesh_CurveTessellator::Value (
         aSurface->GetType() != GeomAbs_BezierSurface  &&
         aSurface->GetType() != GeomAbs_OtherSurface)
     {
+      // For trimmed cone/cylinder.
+      // Return independently of the fact whether the surface trimmed.
       return Standard_True;
     }
 
index a3307f36e5810eea773900fedbe9083053789d43..11092e71b8ed44edeeea18c8120f1b5c1d9b20bc 100644 (file)
@@ -53,7 +53,8 @@ void BRepMesh_DefaultRangeSplitter::AdjustRange()
 {
   const Handle(BRepAdaptor_HSurface)& aSurface = GetSurface();
   updateRange(aSurface->FirstUParameter(), aSurface->LastUParameter(),
-              aSurface->IsUPeriodic(), myRangeU.first, myRangeU.second);
+              aSurface->IsUPeriodic() && aSurface->IsUClosed(),
+              myRangeU.first, myRangeU.second);
 
   if (myRangeU.second < myRangeU.first)
   {
@@ -62,7 +63,8 @@ void BRepMesh_DefaultRangeSplitter::AdjustRange()
   }
 
   updateRange(aSurface->FirstVParameter(), aSurface->LastVParameter(),
-              aSurface->IsVPeriodic(), myRangeV.first, myRangeV.second);
+              aSurface->IsVPeriodic() && aSurface->IsVClosed(),
+              myRangeV.first, myRangeV.second);
 
   if (myRangeV.second < myRangeV.first)
   {
index 8d4d0c83c3c727456ed541ed64612bccdb3367d1..f4edec3d1b7b2dd0799dc43686a63d62132db7ad 100644 (file)
@@ -951,6 +951,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 e8965ecf7145174e26a011eb03a9e28b872034ca..62efc05461ee922116545dd12b2732fbaa6fcd86 100644 (file)
@@ -252,11 +252,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.
   //---------------
@@ -908,7 +905,7 @@ static Standard_Boolean AreConnex(const TopoDS_Wire& W1,
 
   if (V11.IsSame(V21) || V11.IsSame(V22) ||
       V12.IsSame(V21) || V12.IsSame(V22))
-    return Standard_True;
+      return Standard_True;
 
   return Standard_False;
 }
@@ -1248,8 +1245,8 @@ static TopoDS_Edge Glue(const TopoDS_Edge& E1,
 //=======================================================================
 
 static void CheckIntersFF(const BOPDS_PDS& pDS,
-                          const TopoDS_Edge& RefEdge,
-                          TopTools_IndexedMapOfShape& TrueEdges)
+                                     const TopoDS_Edge& RefEdge,
+                                     TopTools_IndexedMapOfShape& TrueEdges)
 {
   BOPDS_VectorOfInterfFF& aFFs = pDS->InterfFF();
   Standard_Integer aNb = aFFs.Length();
@@ -1260,33 +1257,33 @@ static void CheckIntersFF(const BOPDS_PDS& pDS,
   BB.MakeCompound(Edges);
   
   for (i = 0; i < aNb; ++i) 
-  {
-    BOPDS_InterfFF& aFFi=aFFs(i);
-    const BOPDS_VectorOfCurve& aBCurves=aFFi.Curves();
-      Standard_Integer aNbCurves = aBCurves.Length();
-    
-    for (j = 0; j < aNbCurves; ++j) 
     {
-      const BOPDS_Curve& aBC=aBCurves(j);
-      const BOPDS_ListOfPaveBlock& aSectEdges = aBC.PaveBlocks();
-      
-      BOPDS_ListIteratorOfListOfPaveBlock aPBIt;
-      aPBIt.Initialize(aSectEdges);
+      BOPDS_InterfFF& aFFi=aFFs(i);
+      const BOPDS_VectorOfCurve& aBCurves=aFFi.Curves();
+      Standard_Integer aNbCurves = aBCurves.Length();
       
-      for (; aPBIt.More(); aPBIt.Next())
-      {
-        const Handle(BOPDS_PaveBlock)& aPB = aPBIt.Value();
-        Standard_Integer nSect = aPB->Edge();
-        const TopoDS_Edge& anEdge = *(TopoDS_Edge*)&pDS->Shape(nSect);
+      for (j = 0; j < aNbCurves; ++j) 
+       {
+          const BOPDS_Curve& aBC=aBCurves(j);
+          const BOPDS_ListOfPaveBlock& aSectEdges = aBC.PaveBlocks();
+         
+          BOPDS_ListIteratorOfListOfPaveBlock aPBIt;
+          aPBIt.Initialize(aSectEdges);
+         
+         for (; aPBIt.More(); aPBIt.Next())
+           {
+              const Handle(BOPDS_PaveBlock)& aPB = aPBIt.Value();
+              Standard_Integer nSect = aPB->Edge();
+              const TopoDS_Edge& anEdge = *(TopoDS_Edge*)&pDS->Shape(nSect);
         BB.Add(Edges, anEdge);
-        nbe++;
-      }
+             nbe++;
+           }
+       }
     }
-  }
 
   if (nbe == 0)
     return;
-  
+
   TopTools_ListOfShape CompList;
   BOPTools_AlgoTools::MakeConnexityBlocks(Edges, TopAbs_VERTEX, TopAbs_EDGE, CompList);
 
@@ -1294,115 +1291,115 @@ static void CheckIntersFF(const BOPDS_PDS& pDS,
   if (CompList.Extent() == 1)
     NearestCompound = CompList.First();
   else
-  {
+    {
     BRepAdaptor_Curve BAcurve(RefEdge);
     gp_Pnt Pref = BAcurve.Value((BAcurve.FirstParameter()+BAcurve.LastParameter())/2);
     TopoDS_Vertex Vref = BRepLib_MakeVertex(Pref);
     Standard_Real MinDist = RealLast();
     TopTools_ListIteratorOfListOfShape itl(CompList);
     for (; itl.More(); itl.Next())
-    {
+       {
       const TopoDS_Shape& aCompound = itl.Value();
-      
+
       BRepExtrema_DistShapeShape Projector(Vref, aCompound);
       if (!Projector.IsDone() || Projector.NbSolution() == 0)
         continue;
-      
+
       Standard_Real aDist = Projector.Value();
       if (aDist < MinDist)
-      {
+    {
         MinDist = aDist;
         NearestCompound = aCompound;
       }
     }
-  }
+       }
 
   TopExp::MapShapes(NearestCompound, TopAbs_EDGE, TrueEdges);
-}
-
+               }
+  
 //=======================================================================
 //function : AssembleEdge
 //purpose  : 
 //=======================================================================
 
 static TopoDS_Edge AssembleEdge(const BOPDS_PDS& pDS,
-                                const TopoDS_Face& F1,
-                                const TopoDS_Face& F2,
-                                const Standard_Boolean addPCurve1,
-                                const Standard_Boolean addPCurve2,
-                                const TopTools_SequenceOfShape& EdgesForConcat)
+                               const TopoDS_Face& F1,
+                               const TopoDS_Face& F2,
+                               const Standard_Boolean addPCurve1,
+                               const Standard_Boolean addPCurve2,
+                               const TopTools_SequenceOfShape& EdgesForConcat)
 {
   TopoDS_Edge NullEdge;
   TopoDS_Edge CurEdge = TopoDS::Edge( EdgesForConcat(1) );
   Standard_Real aGlueTol = Precision::Confusion();
   
   for (Standard_Integer j = 2; j <= EdgesForConcat.Length(); j++)
-  {
-    TopoDS_Edge anEdge = TopoDS::Edge( EdgesForConcat(j) );
-    Standard_Boolean After = Standard_False;
-    TopoDS_Vertex Vfirst, Vlast;
+    {
+      TopoDS_Edge anEdge = TopoDS::Edge( EdgesForConcat(j) );
+      Standard_Boolean After = Standard_False;
+      TopoDS_Vertex Vfirst, Vlast;
     Standard_Boolean AreClosedWire = AreClosed( CurEdge, anEdge );
     if (AreClosedWire)
-    {
-      TopoDS_Vertex V1, V2;
-      TopExp::Vertices( CurEdge, V1, V2 );
+       {
+         TopoDS_Vertex V1, V2;
+         TopExp::Vertices( CurEdge, V1, V2 );
       Standard_Boolean IsAutonomV1 = IsAutonomVertex( V1, pDS, F1, F2 );
       Standard_Boolean IsAutonomV2 = IsAutonomVertex( V2, pDS, F1, F2 );
       if (IsAutonomV1)
-      {
-        After = Standard_False;
-        Vfirst = Vlast = V2;
-      }
+           {
+             After = Standard_False;
+             Vfirst = Vlast = V2;
+           }
       else if (IsAutonomV2)
-      {
-        After = Standard_True;
-        Vfirst = Vlast = V1;
-      }
+           {
+             After = Standard_True;
+             Vfirst = Vlast = V1;
+           }
       else
         return NullEdge;
-    }
-    else
-    {
-      TopoDS_Vertex CV, V11, V12, V21, V22;
-      TopExp::CommonVertex( CurEdge, anEdge, CV );
+       }
+      else
+       {
+         TopoDS_Vertex CV, V11, V12, V21, V22;
+         TopExp::CommonVertex( CurEdge, anEdge, CV );
       Standard_Boolean IsAutonomCV = IsAutonomVertex( CV, pDS, F1, F2 );
       if (IsAutonomCV)
       {
-        aGlueTol = BRep_Tool::Tolerance(CV);
-        TopExp::Vertices( CurEdge, V11, V12 );
-        TopExp::Vertices( anEdge,  V21, V22 );
-        if (V11.IsSame(CV) && V21.IsSame(CV))
-        {
-          Vfirst = V22;
-          Vlast  = V12;
-        }
-        else if (V11.IsSame(CV) && V22.IsSame(CV))
-        {
-          Vfirst = V21;
-          Vlast  = V12;
-        }
-        else if (V12.IsSame(CV) && V21.IsSame(CV))
-        {
-          Vfirst = V11;
-          Vlast  = V22;
-        }
-        else
-        {
-          Vfirst = V11;
-          Vlast  = V21;
-        }
+          aGlueTol = BRep_Tool::Tolerance(CV);
+         TopExp::Vertices( CurEdge, V11, V12 );
+         TopExp::Vertices( anEdge,  V21, V22 );
+         if (V11.IsSame(CV) && V21.IsSame(CV))
+           {
+             Vfirst = V22;
+             Vlast  = V12;
+           }
+         else if (V11.IsSame(CV) && V22.IsSame(CV))
+           {
+             Vfirst = V21;
+             Vlast  = V12;
+           }
+         else if (V12.IsSame(CV) && V21.IsSame(CV))
+           {
+             Vfirst = V11;
+             Vlast  = V22;
+           }
+         else
+           {
+             Vfirst = V11;
+             Vlast  = V21;
+           }
       }
       else
         return NullEdge;
-    } //end of else (open wire)
-    
-    TopoDS_Edge NewEdge = Glue(CurEdge, anEdge, Vfirst, Vlast, After,
-                               F1, addPCurve1, F2, addPCurve2, aGlueTol);
+       } //end of else (open wire)
+      
+      TopoDS_Edge NewEdge = Glue(CurEdge, anEdge, Vfirst, Vlast, After,
+                                 F1, addPCurve1, F2, addPCurve2, aGlueTol);
     if (NewEdge.IsNull())
       return NullEdge;
     else
       CurEdge = NewEdge;
-  } //end of for (Standard_Integer j = 2; j <= EdgesForConcat.Length(); j++)
+    } //end of for (Standard_Integer j = 2; j <= EdgesForConcat.Length(); j++)
   
   return CurEdge;
 }
@@ -1500,24 +1497,14 @@ 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);
-        
        Standard_Real aTolEdge = BRep_Tool::Tolerance(anEdge);
                
         if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, F1)) {
           Handle(Geom2d_Curve) aC2d = aBC.Curve().FirstCurve2d();
-          if(!aC3DETrim.IsNull()) {
+          if (!aC3DE.IsNull()) {
                Handle(Geom2d_Curve) aC2dNew;
-               
-               if(aC3DE->IsPeriodic()) {
                   BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, f, l,  aC2d, aC2dNew, aContext);
-                 }
-               else {
-                  BOPTools_AlgoTools2D::AdjustPCurveOnFace(F1, aC3DETrim, aC2d, aC2dNew, aContext); 
-                 }
                aC2d = aC2dNew;
              }
              BB.UpdateEdge(anEdge, aC2d, F1, aTolEdge);
@@ -1525,15 +1512,9 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
         
         if (!BOPTools_AlgoTools2D::HasCurveOnSurface(anEdge, F2)) {
           Handle(Geom2d_Curve) aC2d = aBC.Curve().SecondCurve2d();
-          if(!aC3DETrim.IsNull()) {
+          if (!aC3DE.IsNull()) {
                Handle(Geom2d_Curve) aC2dNew;
-               
-               if(aC3DE->IsPeriodic()) {
                   BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, f, l,  aC2d, aC2dNew, aContext);
-                 }
-               else {
-                  BOPTools_AlgoTools2D::AdjustPCurveOnFace(F2, aC3DETrim, aC2d, aC2dNew, aContext); 
-                 }
                aC2d = aC2dNew;
              }
              BB.UpdateEdge(anEdge, aC2d, F2, aTolEdge);
@@ -1582,11 +1563,11 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
   if (L1.Extent() > 1 && (!isEl1 || !isEl2)) {
     TopTools_SequenceOfShape eseq;
     TopTools_SequenceOfShape EdgesForConcat;
-    
+
     if (!TrueEdges.IsEmpty())
-    {
-      for (i = TrueEdges.Extent(); i >= 1; i--)
-        EdgesForConcat.Append( TrueEdges(i) );
+      {
+       for (i = TrueEdges.Extent(); i >= 1; i--)
+         EdgesForConcat.Append( TrueEdges(i) );
       TopoDS_Edge AssembledEdge =
         AssembleEdge( pDS, F1, F2, addPCurve1, addPCurve2, EdgesForConcat );
       if (AssembledEdge.IsNull())
@@ -1594,145 +1575,145 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
           eseq.Append( TrueEdges(i) );
       else
         eseq.Append(AssembledEdge);
-    }
+      }
     else
-    {
-      TopTools_SequenceOfShape wseq;
-      TopTools_SequenceOfShape edges;
-      TopTools_ListIteratorOfListOfShape itl(L1);
-      for (; itl.More(); itl.Next())
-        edges.Append( itl.Value() );
-      while (!edges.IsEmpty())
       {
-        TopoDS_Edge anEdge = TopoDS::Edge( edges.First() );
+       TopTools_SequenceOfShape wseq;
+       TopTools_SequenceOfShape edges;
+       TopTools_ListIteratorOfListOfShape itl(L1);
+       for (; itl.More(); itl.Next())
+         edges.Append( itl.Value() );
+       while (!edges.IsEmpty())
+         {
+           TopoDS_Edge anEdge = TopoDS::Edge( edges.First() );
         TopoDS_Wire aWire, resWire;
         BB.MakeWire(aWire);
         BB.Add( aWire, anEdge );
-        TColStd_SequenceOfInteger Candidates;
-        for (k = 1; k <= wseq.Length(); k++)
-        {
-          resWire = TopoDS::Wire(wseq(k));
+           TColStd_SequenceOfInteger Candidates;
+           for (k = 1; k <= wseq.Length(); k++)
+             {
+               resWire = TopoDS::Wire(wseq(k));
           if (AreConnex( resWire, aWire ))
-          {
-            Candidates.Append( 1 );
-            break;
-          }
-        }
-        if (Candidates.IsEmpty())
-        {
-          wseq.Append( aWire );
-          edges.Remove(1);
-        }
-        else
-        {
-          for (j = 2; j <= edges.Length(); j++)
-          {
-            anEdge = TopoDS::Edge( edges(j) );
+                 {
+                   Candidates.Append( 1 );
+                   break;
+                 }
+             }
+           if (Candidates.IsEmpty())
+             {
+               wseq.Append( aWire );
+               edges.Remove(1);
+             }
+           else
+             {
+               for (j = 2; j <= edges.Length(); j++)
+                 {
+                   anEdge = TopoDS::Edge( edges(j) );
             aWire.Nullify();
             BB.MakeWire(aWire);
             BB.Add( aWire, anEdge );
             if (AreConnex( resWire, aWire ))
-              Candidates.Append( j );
-          }
-          Standard_Integer minind = 1;
-          if (Candidates.Length() > 1)
-          {
-            Standard_Real MinAngle = RealLast();
-            for (j = 1; j <= Candidates.Length(); j++)
-            {
-              anEdge = TopoDS::Edge( edges(Candidates(j)) );
-              Standard_Real anAngle = AngleWireEdge( resWire, anEdge );
-              if (anAngle < MinAngle)
-              {
-                MinAngle = anAngle;
-                minind = j;
-              }
-            }
-          }
+                     Candidates.Append( j );
+                 }
+               Standard_Integer minind = 1;
+               if (Candidates.Length() > 1)
+                 {
+                   Standard_Real MinAngle = RealLast();
+                   for (j = 1; j <= Candidates.Length(); j++)
+                     {
+                       anEdge = TopoDS::Edge( edges(Candidates(j)) );
+                       Standard_Real anAngle = AngleWireEdge( resWire, anEdge );
+                       if (anAngle < MinAngle)
+                         {
+                           MinAngle = anAngle;
+                           minind = j;
+                         }
+                     }
+                 }
           BB.Add( resWire, TopoDS::Edge(edges(Candidates(minind))) );
           wseq(k) = resWire;
-          edges.Remove(Candidates(minind));
-        }
-      } //end of while (!edges.IsEmpty())
-      
-      for (i = 1; i <= wseq.Length(); i++)
-      {
-        TopoDS_Wire aWire = TopoDS::Wire(wseq(i));
-        TopTools_SequenceOfShape aLocalEdgesForConcat;
-        if (aWire.Closed())
-        {
-          TopoDS_Vertex StartVertex;
-          TopoDS_Edge StartEdge;
-          Standard_Boolean StartFound = Standard_False;
-          TopTools_ListOfShape Elist;
-          
-          TopoDS_Iterator itw(aWire);
-          for (; itw.More(); itw.Next())
-          {
-            TopoDS_Edge anEdge = TopoDS::Edge(itw.Value());
-            if (StartFound)
-              Elist.Append(anEdge);
-            else
-            {
-              TopoDS_Vertex V1, V2;
-              TopExp::Vertices( anEdge, V1, V2 );
-              if (!IsAutonomVertex( V1, pDS ))
-              {
-                StartVertex = V2;
-                StartEdge = anEdge;
-                StartFound = Standard_True;
-              }
-              else if (!IsAutonomVertex( V2, pDS ))
-              {
-                StartVertex = V1;
-                StartEdge = anEdge;
-                StartFound = Standard_True;
-              }
-              else
-                Elist.Append(anEdge);
-            }
-          } //end of for (; itw.More(); itw.Next())
-          if (!StartFound)
-          {
-            itl.Initialize(Elist);
-            StartEdge = TopoDS::Edge(itl.Value());
-            Elist.Remove(itl);
-            TopoDS_Vertex V1, V2;
-            TopExp::Vertices( StartEdge, V1, V2 );
-            StartVertex = V1;
-          }
-          aLocalEdgesForConcat.Append( StartEdge );
-          while (!Elist.IsEmpty())
-          {
-            for (itl.Initialize(Elist); itl.More(); itl.Next())
-            {
-              TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
-              TopoDS_Vertex V1, V2;
-              TopExp::Vertices( anEdge, V1, V2 );
-              if (V1.IsSame(StartVertex))
-              {
-                StartVertex = V2;
-                aLocalEdgesForConcat.Append( anEdge );
-                Elist.Remove(itl);
-                break;
-              }
-              else if (V2.IsSame(StartVertex))
-              {
-                StartVertex = V1;
-                aLocalEdgesForConcat.Append( anEdge );
-                Elist.Remove(itl);
-                break;
-              }
-            }
-          } //end of while (!Elist.IsEmpty())
-        } //end of if (aWire.Closed())
-        else
-        {
-          BRepTools_WireExplorer Wexp( aWire );
-          for (; Wexp.More(); Wexp.Next())
-            aLocalEdgesForConcat.Append( Wexp.Current() );
-        }
+               edges.Remove(Candidates(minind));
+             }
+         } //end of while (!edges.IsEmpty())
        
+       for (i = 1; i <= wseq.Length(); i++)
+         {
+           TopoDS_Wire aWire = TopoDS::Wire(wseq(i));
+           TopTools_SequenceOfShape aLocalEdgesForConcat;
+           if (aWire.Closed())
+             {
+               TopoDS_Vertex StartVertex;
+               TopoDS_Edge StartEdge;
+               Standard_Boolean StartFound = Standard_False;
+               TopTools_ListOfShape Elist;
+               
+               TopoDS_Iterator itw(aWire);
+               for (; itw.More(); itw.Next())
+                 {
+                   TopoDS_Edge anEdge = TopoDS::Edge(itw.Value());
+                   if (StartFound)
+                     Elist.Append(anEdge);
+                   else
+                     {
+                       TopoDS_Vertex V1, V2;
+                       TopExp::Vertices( anEdge, V1, V2 );
+                        if (!IsAutonomVertex( V1, pDS ))
+                         {
+                           StartVertex = V2;
+                           StartEdge = anEdge;
+                           StartFound = Standard_True;
+                         }
+                        else if (!IsAutonomVertex( V2, pDS ))
+                         {
+                           StartVertex = V1;
+                           StartEdge = anEdge;
+                           StartFound = Standard_True;
+                         }
+                       else
+                         Elist.Append(anEdge);
+                     }
+                 } //end of for (; itw.More(); itw.Next())
+               if (!StartFound)
+                 {
+                   itl.Initialize(Elist);
+                   StartEdge = TopoDS::Edge(itl.Value());
+                   Elist.Remove(itl);
+                   TopoDS_Vertex V1, V2;
+                   TopExp::Vertices( StartEdge, V1, V2 );
+                   StartVertex = V1;
+                 }
+                aLocalEdgesForConcat.Append( StartEdge );
+               while (!Elist.IsEmpty())
+                 {
+                   for (itl.Initialize(Elist); itl.More(); itl.Next())
+                     {
+                       TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
+                       TopoDS_Vertex V1, V2;
+                       TopExp::Vertices( anEdge, V1, V2 );
+                       if (V1.IsSame(StartVertex))
+                         {
+                           StartVertex = V2;
+                            aLocalEdgesForConcat.Append( anEdge );
+                           Elist.Remove(itl);
+                           break;
+                         }
+                       else if (V2.IsSame(StartVertex))
+                         {
+                           StartVertex = V1;
+                            aLocalEdgesForConcat.Append( anEdge );
+                           Elist.Remove(itl);
+                           break;
+                         }
+                     }
+                 } //end of while (!Elist.IsEmpty())
+             } //end of if (aWire.Closed())
+             else
+             {
+               BRepTools_WireExplorer Wexp( aWire );
+               for (; Wexp.More(); Wexp.Next())
+                  aLocalEdgesForConcat.Append( Wexp.Current() );
+             }
+           
         TopoDS_Edge AssembledEdge =
           AssembleEdge( pDS, F1, F2, addPCurve1, addPCurve2, aLocalEdgesForConcat );
         if (AssembledEdge.IsNull())
@@ -1740,56 +1721,56 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
             eseq.Append( aLocalEdgesForConcat(j) );
         else
           eseq.Append( AssembledEdge );
-      }
-    } //end of else (when TrueEdges is empty)
+         }
+      } //end of else (when TrueEdges is empty)
     
     if (eseq.Length() < L1.Extent())
-    {
-      L1.Clear();
-      L2.Clear();
-      for (i = 1; i <= eseq.Length(); i++)
       {
+       L1.Clear();
+       L2.Clear();
+       for (i = 1; i <= eseq.Length(); i++)
+         {
         TopoDS_Shape aShape = eseq(i);
-        TopoDS_Edge anEdge = TopoDS::Edge(eseq(i));
-        BRepLib::SameParameter(anEdge, aSameParTol, Standard_True);
-        Standard_Real EdgeTol = BRep_Tool::Tolerance(anEdge);
+           TopoDS_Edge anEdge = TopoDS::Edge(eseq(i));
+           BRepLib::SameParameter(anEdge, aSameParTol, Standard_True);
+           Standard_Real EdgeTol = BRep_Tool::Tolerance(anEdge);
 #ifdef OCCT_DEBUG
-        cout<<"Tolerance of glued E =      "<<EdgeTol<<endl;
+           cout<<"Tolerance of glued E =      "<<EdgeTol<<endl;
 #endif
-        if (EdgeTol > 1.e-2)
-          continue;
-        
-        if (EdgeTol >= 1.e-4)
-        {
-          ReconstructPCurves(anEdge);
-          BRepLib::SameParameter(anEdge, aSameParTol, Standard_True);
+           if (EdgeTol > 1.e-2)
+             continue;
+
+           if (EdgeTol >= 1.e-4)
+             {
+               ReconstructPCurves(anEdge);
+               BRepLib::SameParameter(anEdge, aSameParTol, Standard_True);
 #ifdef OCCT_DEBUG
-          cout<<"After projection tol of E = "<<BRep_Tool::Tolerance(anEdge)<<endl;
+               cout<<"After projection tol of E = "<<BRep_Tool::Tolerance(anEdge)<<endl;
 #endif
-        }
-        
-        OrientSection( anEdge, F1, F2, O1, O2 );
-        if (Side == TopAbs_OUT)
-        {
-          O1 = TopAbs::Reverse(O1);
-          O2 = TopAbs::Reverse(O2);
-        }
-        
-        L1.Append( anEdge.Oriented(O1) );
-        L2.Append( anEdge.Oriented(O2) );
+             }
+
+           OrientSection( anEdge, F1, F2, O1, O2 );
+           if (Side == TopAbs_OUT)
+             {
+               O1 = TopAbs::Reverse(O1);
+               O2 = TopAbs::Reverse(O2);
+             }
+           
+           L1.Append( anEdge.Oriented(O1) );
+           L2.Append( anEdge.Oriented(O2) );
+         }
       }
-    }
   } //end of if (L1.Extent() > 1)
-  
+
   else
-  {
-    TopTools_ListIteratorOfListOfShape itl(L1);
-    for (; itl.More(); itl.Next())
     {
-      const TopoDS_Edge& anEdge = TopoDS::Edge( itl.Value() );
-      BRepLib::SameParameter(anEdge, aSameParTol, Standard_True);
+      TopTools_ListIteratorOfListOfShape itl(L1);
+      for (; itl.More(); itl.Next())
+       {
+         const TopoDS_Edge& anEdge = TopoDS::Edge( itl.Value() );
+         BRepLib::SameParameter(anEdge, aSameParTol, Standard_True);
+       }
     }
-  }
 }
 
 //=======================================================================
@@ -3091,8 +3072,8 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
   Standard_Real coeff;
   if (ExtensionMode == 1)
   {
-    UU1 = VV1 = - TheInfini;
-    UU2 = VV2 =   TheInfini;
+  UU1 = VV1 = - TheInfini;
+  UU2 = VV2 =   TheInfini;
     coeff = 0.25;
   }
   else
index 3c55eaa6337d79242f887fca065b79b9b251acdd..3340c1cdf1ef1df999a5c69fc5c98bb58448dedd 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 7572bdc0e82e95562413bd032f3c670f9f1adb1c..36aa90594ab550b0d07569d27d9c3d0bf8d9f98d 100644 (file)
@@ -63,6 +63,7 @@
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopTools_SequenceOfShape.hxx>
+#include <GeomLib.hxx>
 #include <GeomLib_CheckCurveOnSurface.hxx>
 #include <errno.h>
 
@@ -1020,12 +1021,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::IsTrimAllowed(C3d, first, last))
   {
     first = Max(first, C3d->FirstParameter());
     last = Min(last, C3d->LastParameter());
   }
-  if(!C2d->IsPeriodic())
+
+  if (!GeomLib::IsTrimAllowed(C2d, first, last))
   {
     first = Max(first, C2d->FirstParameter());
     last = Min(last, C2d->LastParameter());
index 1a8de56f7eef9eb96abe02d947e59b54bed32b4a..bf6fb26b5f09fcf6bea1745a51631ccef0c17a83 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::IsTrimAllowed(C2d, f2d, l2d))
+    {
       if(fc - f2d > Precision::PConfusion()) f2d = fc;
       if(l2d - lc > Precision::PConfusion()) l2d = lc;
     }
index 6bc92499cd7d64ca2dae82aedb7ba34f69c2daf8..8e23cfa483a7d99e9bb6b5fb4641d909252a9c20 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::IsTrimAllowed(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 e11288421e8aed778f80e857e0e8d6e99a089f83..a1030101379b55588a34f6ed2797f162e95096f9 100644 (file)
@@ -178,29 +178,6 @@ Standard_Boolean BiTgte_CurveOnEdge::IsClosed() const
   throw Standard_NotImplemented("BiTgte_CurveOnEdge");
 }
 
-
-//=======================================================================
-//function : 
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean BiTgte_CurveOnEdge::IsPeriodic() const
-{
-  throw Standard_NotImplemented("BiTgte_CurveOnEdge");
-}
-
-
-//=======================================================================
-//function : 
-//purpose  : 
-//=======================================================================
-
-Standard_Real BiTgte_CurveOnEdge::Period() const
-{
-  throw Standard_NotImplemented("BiTgte_CurveOnEdge");
-}
-
-
 //=======================================================================
 //function : 
 //purpose  : 
index 2dd590986cdae73af305cc1544a3e02223346a24..8f52b1e57f49e9d9f15d2e810db0357d364f2c1b 100644 (file)
@@ -87,10 +87,6 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
-  
-  Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
-  
   //! Computes the point of parameter U on the curve.
   Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
   
index 2bdf0a204e1bd09f8c4ff0e147e6928c08f96084..60a57be5472b0106818275d50d68ca4d44724a47 100644 (file)
@@ -151,29 +151,6 @@ Standard_Boolean BiTgte_CurveOnVertex::IsClosed() const
   throw Standard_NotImplemented("BiTgte_CurveOnVertex");
 }
 
-
-//=======================================================================
-//function : 
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean BiTgte_CurveOnVertex::IsPeriodic() const
-{
-  throw Standard_NotImplemented("BiTgte_CurveOnVertex");
-}
-
-
-//=======================================================================
-//function : 
-//purpose  : 
-//=======================================================================
-
-Standard_Real BiTgte_CurveOnVertex::Period() const
-{
-  throw Standard_NotImplemented("BiTgte_CurveOnVertex");
-}
-
-
 //=======================================================================
 //function : 
 //purpose  : 
index 914bdd52a5feaa34159c254ce14198fb2699e06d..c703d974afc296a1936dc581edc2a7b3d7afc5c7 100644 (file)
@@ -86,10 +86,6 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
-  
-  Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
-  
   //! Computes the point of parameter U on the curve.
   Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE;
   
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..115521a308027568feeefbb41c63887e2a7c6f36 100644 (file)
@@ -1398,7 +1398,16 @@ Standard_Boolean Bisector_BisecAna::IsClosed() const
 //=============================================================================
 Standard_Boolean Bisector_BisecAna::IsPeriodic() const 
 {
-  return thebisector->BasisCurve()->IsPeriodic(); 
+  return thebisector->IsPeriodic();
+}
+
+//=============================================================================
+//function : Period
+//purpose  :
+//=============================================================================
+Standard_Real Bisector_BisecAna::Period() const
+{
+  return thebisector->Period();
 }
 
 //=============================================================================
index fbc0b8a21d94824097d851c14e0a8c385cc3f196..0766593379875f5d84e1e56bc93cf5dd9ce32ab7 100644 (file)
@@ -104,8 +104,12 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the value of the period
+  Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
+
   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
   
   Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE;
index 8340c0f76c11b58c0aedbebf6a8f4c65db0f7cbc..00bd8a39c2623be86fe4bbac5247e568b1e909b3 100644 (file)
@@ -127,6 +127,7 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns FALSE
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns the point of parameter U.
index a748e7e4f5f36ccbef22ceea7cc8d35d1ecd825e..b3b02425d37846ddb1a592f8a999e192292675f3 100644 (file)
@@ -132,6 +132,7 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns FALSE
   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 1d92766f8e50922cc4251483216224976a5e0beb..414d96ff5235453ae84a14b413ac40d39ceaaf35 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::IsUTrimAllowed(S, uu1, uu2))
+    {
+      uu1 = Max(uu1,u1);
+      uu2 = Min(uu2,u2);
+    }
+    if (!GeomLib::IsVTrimAllowed(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) {
@@ -2967,9 +2984,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();
@@ -3979,7 +3993,7 @@ void ChFi3d_PerformElSpine(Handle(ChFiDS_HElSpine)& HES,
   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;
@@ -4322,7 +4336,7 @@ void ChFi3d_PerformElSpine(Handle(ChFiDS_HElSpine)& HES,
     }       
   }
   // 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..dcd0efbe8d9759aab5230094fe2acc18e78c5db2 100644 (file)
@@ -161,6 +161,19 @@ Standard_Boolean ChFiDS_ElSpine::IsPeriodic() const
   return periodic;
 }
 
+//=======================================================================
+//function : IsClosed
+//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 24b28a75850faa233bc60a3a9c400233b9035f87..460f31c7348b068e635cc41540c77989161f3442 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 969c8b64ce6d5f52afcb948897169cc86d651199..f8c559b41c61e2f0b4aae0284c7bb9a7ccec8d7d 100644 (file)
@@ -313,7 +313,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 c2c07e7bcc98b0748caecca894eb69876773f67f..ec46687d980c5b7235d2c279938d94d6cbc0e21c 100644 (file)
@@ -1147,22 +1147,40 @@ void Geom_BSplineCurve::UpdateKnots()
 }
 
 //=======================================================================
-//function : Normalizes the parameters if the curve is periodic
-//purpose  : that is compute the cache so that it is valid
+//function : PeriodicNormalization
+//purpose  : Normalizes the parameters if the curve is periodic
+//            that is compute the cache so that it is valid
+//          (analog of ElCLib::InPeriod(...) method)
 //=======================================================================
-
-void Geom_BSplineCurve::PeriodicNormalization(Standard_Real&  Parameter) const 
+void Geom_BSplineCurve::PeriodicNormalization(Standard_Real& theParameter) const
 {
-  Standard_Real Period ;
+  if (!periodic)
+    return;
 
-  if (periodic) {
-    Period = flatknots->Value(flatknots->Upper() - deg) - flatknots->Value (deg + 1) ;
-    while (Parameter > flatknots->Value(flatknots->Upper()-deg)) {
-      Parameter -= Period ;
-    }
-    while (Parameter < flatknots->Value((deg + 1))) {
-      Parameter +=  Period ;
-    }
+  const Standard_Real aPeriod = Period();
+  const Standard_Real aFPar = FirstParameter();
+  const Standard_Real aLPar = LastParameter();
+
+  if ((aFPar <= theParameter) && (theParameter <= aLPar))
+  {
+    // Already normalized
+    return;
   }
+
+  theParameter = Max(aFPar, theParameter +
+                     aPeriod*Ceiling((aFPar - theParameter) / aPeriod));
 }
 
+//=======================================================================
+//function : Period
+//purpose  :
+//=======================================================================
+Standard_Real Geom_BSplineCurve::Period() const
+{
+  if (!periodic)
+    throw Standard_NotImplemented("Geom_BSplineCurve::Period");
+
+  const Standard_Real aFPar = FirstParameter();
+  const Standard_Real aLPar = LastParameter();
+  return (aLPar - aFPar);
+}
index dc28c43f1bde78092d9a86c6dc198d5ebd257061..a8c80cb6249def9519b64da7fa3b328f331f28f5 100644 (file)
@@ -464,6 +464,8 @@ public:
   //! Returns True if the curve is periodic.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of this curve
+  Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
 
   //! Returns True if the weights are not identical.
   //! The tolerance criterion is Epsilon of the class Real.
index 8bbd8cb76eb173a251714ab384a6a450d15f2b23..3e15b6c4062eb2f51db57327b577a5c4df611a50 100644 (file)
@@ -1444,3 +1444,32 @@ void Geom_BSplineSurface::SetWeightRow
   Rational(Weights, urational, vrational);
 }
 
+//=======================================================================
+//function : UPeriod
+//purpose  : 
+//=======================================================================
+Standard_Real Geom_BSplineSurface::UPeriod() const
+{
+  if (!uperiodic)
+    throw Standard_NotImplemented("Geom_BSplineSurface::UPeriod");
+
+  const Standard_Real aFPar = ufknots->Value(udeg + 1);
+  const Standard_Real aLpar = ufknots->Value(ufknots->Upper() - udeg);
+
+  return (aLpar - aFPar);
+}
+
+//=======================================================================
+//function : VPeriod
+//purpose  : 
+//=======================================================================
+Standard_Real Geom_BSplineSurface::VPeriod() const
+{
+  if (!vperiodic)
+    throw Standard_NotImplemented("Geom_BSplineSurface::VPeriod");
+
+  const Standard_Real aFPar = vfknots->Value(vdeg + 1);
+  const Standard_Real aLpar = vfknots->Value(vfknots->Upper() - vdeg);
+
+  return (aLpar - aFPar);
+}
index 9a54bf071dbdd0a4e219cd3e2cf590120054208c..d4d26d95d7f75b66375965dfad60ab54798193c3 100644 (file)
@@ -819,6 +819,11 @@ public:
   //! surface using the function SetVPeriodic.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns U period of this surface
+  Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
+
+  //! Returns V-period of this surface
+  Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
 
   //! Returns False if for each column of weights all the weights
   //! are identical.
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 4b75cb1f3591bae4637b1102774028ffa09a75d3..111a3a0a716e0207336be5431cc9fa6b5f836f74 100644 (file)
@@ -123,9 +123,15 @@ public:
   //! returns True.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! returns True.
+  //! Returns TRUE.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
-  
+
+  //! Returns 2*PI
+  Standard_Real Period() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  }
+
   //! Returns in P the point of parameter U.
   //! P = C + R * Cos (U) * XDir + R * Sin (U) * YDir
   //! where C is the center of the circle , XDir the XDirection and
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 5db22203b8138d2ae7c0c00f8b04046cc11c1a13..41bae8d76499964e3e3202daf7ae6a30933b6c4b 100644 (file)
@@ -182,7 +182,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
@@ -225,6 +227,12 @@ public:
   //! Returns False.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns 2*PI
+  Standard_Real UPeriod() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  };
+
   //! Builds the U isoparametric line of this cone. The
   //! origin of this line is on the reference plane of this
   //! cone (i.e. the plane defined by the origin, "X Direction"
index 6f0ba329a54f03220f4de6cc3e671c9b05075c97..dffd630661ee577b040204f1dbe35b96c368ff7c 100644 (file)
@@ -21,7 +21,7 @@
 #include <gp_Pnt.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_Vec.hxx>
-#include <Standard_NoSuchObject.hxx>
+#include <Standard_NotImplemented.hxx>
 #include <Standard_RangeError.hxx>
 #include <Standard_Type.hxx>
 
@@ -49,10 +49,7 @@ Handle(Geom_Curve) Geom_Curve::Reversed () const
 
 Standard_Real Geom_Curve::Period() const
 {
-  Standard_NoSuchObject_Raise_if
-    ( !IsPeriodic(),"Geom_Curve::Period");
-
-  return ( LastParameter() - FirstParameter());
+  throw Standard_NotImplemented("Geom_Curve::Period");
 }
 
 //=======================================================================
index 4cacecc422f0b72628779e5e413486c77af0b034..2bd5cb8ec4a8a501dd675df878226b17e1a03a8c 100644 (file)
@@ -137,29 +137,14 @@ public:
   //! Some Curves such as OffsetCurve can be closed or not. These curves
   //! are considered as closed if the distance between the first point
   //! and the last point of the curve is lower or equal to the Resolution
-  //! from package gp wich is a fixed criterion independant of the
+  //! from package gp, which is a fixed criterion independent of the
   //! 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 
   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 curve.
   Standard_EXPORT virtual Standard_Real Period() const;
   
   //! It is the global continuity of the curve
index 8f4ae4dabc9dae6a61d1e91b21496cc1db4f5dc5..f776ad22de44e1c8301e78d7af37a5d89f0d37c6 100644 (file)
@@ -164,6 +164,11 @@ public:
   //! Returns False.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns 2*PI
+  Standard_Real UPeriod() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  };
 
   //! The UIso curve is a Line. The location point of this line is
   //! on the placement plane (XAxis, YAxis) of the surface.
index 845c1a76b68af25092b8ea89edc4cd9708268659..59d28e6313feb093f2e189a8454a5ec2a3995675 100644 (file)
@@ -188,9 +188,15 @@ public:
   //! return True.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! return True.
+  //! Returns TRUE.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns 2*PI
+  Standard_Real Period() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  }
+
   //! Returns in P the point of parameter U.
   //! P = C + MajorRadius * Cos (U) * XDir + MinorRadius * Sin (U) * YDir
   //! where C is the center of the ellipse , XDir the direction of
index 19023092b074d06f256fa4baa1e64f4b7e6fa0da..ac50d85b0c3af68b4276ad07726ba054b73b9cf0 100644 (file)
@@ -151,7 +151,7 @@ public:
   //! Returns False.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! return False for an hyperbola.
+  //! Returns FALSE
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
 
index 77355dbec8908c75d83ddb57bf60ffd7c05690f2..5e080f32884dc8abeee719cffedea4a38607dae2 100644 (file)
@@ -113,7 +113,7 @@ public:
   //! returns False
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! returns False
+  //! returns FALSE
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
   //! Returns GeomAbs_CN, which is the global continuity of any line.
index 5bdffddbf0d0b99584ed2516cf8f553f0649b27e..31a1e5414ed221a2942faba63661080825d80f63 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();
 }
 
@@ -149,6 +152,9 @@ Standard_Boolean Geom_OffsetCurve::IsPeriodic () const
 
 Standard_Real Geom_OffsetCurve::Period () const
 {
+  if (!IsPeriodic())
+    throw Standard_NotImplemented("Geom_OffsetCurve::Period");
+
   return basisCurve->Period();
 }
 
index a195a85e92ad4c305f482b76e8018e4086b2885a..4280c4803b1bfe9b8f631eb645ba4aed1545c0af 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. Otherwise, returns FALSE.
+  //! 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..c57b90771eadef8b764328035d7bf5e6f51f50bb 100644 (file)
@@ -639,6 +639,13 @@ 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 (but currently, continuity in both direction is checked)
+
+  if (basisSurf->Continuity() == GeomAbs_C0)
+    return Standard_False;
+
   return basisSurf->IsUPeriodic();
 }
 
@@ -659,6 +666,13 @@ 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 (but currently, continuity in both direction is checked)
+
+  if (basisSurf->Continuity() == GeomAbs_C0)
+    return Standard_False;
+
   return basisSurf->IsVPeriodic();
 }
 
index c568f3abac5440cd19ab42b7fda374e88617fa21..b1d5ca888a04f6795e16868da4b21c43e73dee75 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, continuity in both direction is 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, continuity in both direction is 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 827a4686738b8edf38bb904ee617614235d7bea7..b73e6503eadc85751c9143bcac48d58c40d38775 100644 (file)
@@ -164,6 +164,12 @@ public:
   //! Returns False.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns 2*PI
+  Standard_Real UPeriod() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  };
+
   //! Computes the U isoparametric curve.
   //! The U isoparametric curves of the surface are defined by the
   //! section of the spherical surface with plane obtained by rotation
index d01f1a9979c81d59491a44deb2d03dd1d40cd540..d58d0bc3020b4ec1ede178f37799b34d0b974991 100644 (file)
@@ -23,7 +23,7 @@
 #include <gp_Pnt.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_Vec.hxx>
-#include <Standard_NoSuchObject.hxx>
+#include <Standard_NotImplemented.hxx>
 #include <Standard_RangeError.hxx>
 #include <Standard_Type.hxx>
 
@@ -86,12 +86,7 @@ gp_GTrsf2d Geom_Surface::ParametricTransformation(const gp_Trsf&) const
 
 Standard_Real Geom_Surface::UPeriod() const
 {
-  Standard_NoSuchObject_Raise_if
-    ( !IsUPeriodic(),"Geom_Surface::UPeriod");
-
-  Standard_Real U1, U2, V1, V2;
-  Bounds(U1,U2,V1,V2);
-  return ( U2 - U1);
+  throw Standard_NotImplemented("Geom_Surface::UPeriod");
 }
 
 
@@ -102,12 +97,7 @@ Standard_Real Geom_Surface::UPeriod() const
 
 Standard_Real Geom_Surface::VPeriod() const
 {
-  Standard_NoSuchObject_Raise_if
-    ( !IsVPeriodic(),"Geom_Surface::VPeriod");
-
-  Standard_Real U1, U2, V1, V2;
-  Bounds(U1,U2,V1,V2);
-  return ( V2 - V1);
+  throw Standard_NotImplemented("Geom_Surface::VPeriod");
 }
 
 //=======================================================================
index 187c3b47d9b53e2cb35b522b5514af087621857a..885bb1f4cc3522105d15f72fabb56fcf76685553 100644 (file)
@@ -175,33 +175,16 @@ 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 
   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.
+  //! Returns U period of the surface
   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
   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.
+  //! Returns V period of the surface
   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..bb3f5ee4fc5aac6cbc06bb4ee0b6aeda4e003413 100644 (file)
@@ -157,9 +157,12 @@ public:
   //! surface of linear extrusion is periodic.
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
-  //! IsVPeriodic always returns false.
+  //! Always returns FALSE.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of the basis curve
+  Standard_EXPORT 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..ea19537b3719e545a243597ef39c1932f8aed1c5 100644 (file)
@@ -247,9 +247,18 @@ 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 2*PI
+  Standard_Real UPeriod() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  };
+
+  //! Returns the period of the basis curve
+  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 6c22fcafdb646adaf86d79079ebd6217b36db7c2..3766ef8e909aa65cdaf8ceeb41e3244f32ff8ce6 100644 (file)
@@ -188,6 +188,18 @@ public:
   //! Returns True.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns 2*PI
+  Standard_Real UPeriod() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  };
+
+    //! Returns 2*PI
+  Standard_Real VPeriod() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  }
+
   //! Computes the U isoparametric curve.
   //!
   //! For a toroidal surface the UIso curve is a circle.
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..50887635d5ece093699102d803649b11144bdb48 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. Otherwise, returns FALSE.
   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 b4cc7df96e076d6065c07a7ad87d1dc64d4254b9..c89bfb0faf6f42bb8289986f3d5f0bef8356cc79 100644 (file)
@@ -1265,22 +1265,40 @@ void Geom2d_BSplineCurve::UpdateKnots()
 }
 
 //=======================================================================
-//function : Normalizes the parameters if the curve is periodic
-//purpose  : that is compute the cache so that it is valid
+//function : PeriodicNormalization
+//purpose  : Normalizes the parameters if the curve is periodic
+//            that is compute the cache so that it is valid
+//          (analog of ElCLib::InPeriod(...) method)
 //=======================================================================
-
-void Geom2d_BSplineCurve::PeriodicNormalization(Standard_Real&  Parameter) const 
+void Geom2d_BSplineCurve::PeriodicNormalization(Standard_Real& theParameter) const 
 {
-  Standard_Real Period ;
+  if (!periodic)
+    return;
 
-  if (periodic) {
-    Period = flatknots->Value(flatknots->Upper() - deg) - flatknots->Value (deg + 1) ;
-    while (Parameter > flatknots->Value(flatknots->Upper()-deg)) {
-      Parameter -= Period ;
-    }
-    while (Parameter < flatknots->Value((deg + 1))) {
-      Parameter +=  Period ;
-    }
+  const Standard_Real aPeriod = Period();
+  const Standard_Real aFPar = FirstParameter();
+  const Standard_Real aLPar = LastParameter();
+
+  if ((aFPar <= theParameter) && (theParameter <= aLPar))
+  {
+    // Already normalized
+    return;
   }
+
+  theParameter = Max(aFPar, theParameter +
+                     aPeriod*Ceiling((aFPar - theParameter) / aPeriod));
 }
 
+//=======================================================================
+//function : Period
+//purpose  :
+//=======================================================================
+Standard_Real Geom2d_BSplineCurve::Period() const
+{
+  if (!periodic)
+    throw Standard_NotImplemented("Geom2d_BSplineCurve::Period");
+
+  const Standard_Real aFPar = FirstParameter();
+  const Standard_Real aLPar = LastParameter();
+  return (aLPar - aFPar);
+}
index 948a01f849f0d8cdec03136cb06fae22b94ce546..c5020161254edba733df63d06768e7055d27cdb8 100644 (file)
@@ -539,6 +539,9 @@ public:
   //! Returns True if the curve is periodic.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of this curve
+  Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
+
 
   //! Returns True if the weights are not identical.
   //! The tolerance criterion is Epsilon of the class Real.
index 0d61dc4b45881f9daca8e9559b8348dd6f94da3f..cc33547542c1610fb1187c2b7b7044e63d8302b3 100644 (file)
@@ -214,8 +214,7 @@ public:
   Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
   
 
-  //! Returns False. A BezierCurve cannot be periodic in this
-  //! package
+  //! Returns FALSE. A BezierCurve cannot be periodic.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
 
index 76e55766e4d752a0deb44407dc782840e4c89195..4279b15ffcfa5d5b0de3f4ec4381a45a09f5c21f 100644 (file)
@@ -121,9 +121,15 @@ public:
   //! returns True.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! returns True. The period of a circle is 2.*Pi.
+  //! Returns TRUE.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
-  
+
+  //! Returns 2*PI
+  Standard_Real Period() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  }
+
   //! Returns in P the point of parameter U.
   //! P = C + R * Cos (U) * XDir + R * Sin (U) * YDir
   //! where C is the center of the circle , XDir the XDirection and
index 59ed0848ebcca04d753791d018c3457b9c2221ea..17a56a1875047d0d3852f8da5e1fb528468a5821 100644 (file)
@@ -21,7 +21,7 @@
 #include <gp_Pnt2d.hxx>
 #include <gp_Trsf2d.hxx>
 #include <gp_Vec2d.hxx>
-#include <Standard_NoSuchObject.hxx>
+#include <Standard_NotImplemented.hxx>
 #include <Standard_RangeError.hxx>
 #include <Standard_Type.hxx>
 
@@ -70,10 +70,7 @@ Standard_Real Geom2d_Curve::ParametricTransformation(const gp_Trsf2d& ) const
 
 Standard_Real Geom2d_Curve::Period() const
 {
-  Standard_NoSuchObject_Raise_if
-    ( !IsPeriodic(),"Geom2d_Curve::Period");
-
-  return ( LastParameter() - FirstParameter());
+  throw Standard_NotImplemented("Geom2d_Curve::Period");
 }
 
 
index 844993b2bbfba594441fd6ea1daf112810d0a2c9..1099fc5c13a8f4e9c4c3632c1abaeb58b093a289 100644 (file)
@@ -136,25 +136,10 @@ 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 
   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 curve
   Standard_EXPORT virtual Standard_Real Period() const;
   
 
index 78ff674e61d353aaf8d4776f414a15f0cb8be3f2..c24a374b9198f9dd0aad73e2c4b23edf4310d1d5 100644 (file)
@@ -209,9 +209,15 @@ public:
   //! return True.
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
-  //! return True.
+  //! Returns TRUE.
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns 2*PI
+  Standard_Real Period() const Standard_OVERRIDE
+  {
+    return (M_PI + M_PI);
+  }
+
   //! Returns in P the point of parameter U.
   //! P = C + MajorRadius * Cos (U) * XDir + MinorRadius * Sin (U) * YDir
   //! where C is the center of the ellipse , XDir the direction of
index 2c4ea9536c2695af6bd1844995c79979f73f4e25..a2f762d49b269052d8923b79a9fd1826514fa416 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();
 }
 
@@ -342,6 +345,9 @@ Standard_Boolean Geom2d_OffsetCurve::IsPeriodic () const
 
 Standard_Real Geom2d_OffsetCurve::Period() const
 {
+  if (!IsPeriodic())
+    throw Standard_NotImplemented("Geom2d_OffsetCurve::Period");
+
   return basisCurve->Period();
 }
 
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 a230c342f64269401fd26dec73042b3c24f6b89b..9e0827f91c4c56ad120bb130b666a1123c30059e 100644 (file)
@@ -105,8 +105,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of the curve
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve
@@ -177,12 +179,6 @@ public:
 
 protected:
 
-
-
-
-
-private:
-
   Standard_EXPORT GeomAbs_Shape LocalContinuity (const Standard_Real U1, const Standard_Real U2) const;
   
   Standard_EXPORT void load (const Handle(Geom2d_Curve)& C, const Standard_Real UFirst, const Standard_Real ULast);
@@ -195,6 +191,12 @@ private:
   void RebuildCache (const Standard_Real theParameter) const;
 
 
+
+
+private:
+
+
+
   Handle(Geom2d_Curve) myCurve;
   GeomAbs_CurveType myTypeCurve;
   Standard_Real myFirst;
index 84bd040e18622062917363c4aac2f010a3a63064..9922cfe852a76af97133a193cefedc34695c2105 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::IsTrimAllowed(Curv, U1, U2))
+    {
       if (U1 < Curv->FirstParameter())
        U1 =  Curv->FirstParameter();
       if (U2 > Curv->LastParameter())
index 6e138872a689a3b4b57744e7b5bc3210e94d24ef..3d94c7fe7017c3586e92aa2396c60f050de81812 100644 (file)
@@ -109,8 +109,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! returns the period of the curve
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve
index 2f0d4838c3e49cad4beada9282aa7f0547888c62..99d733f675e529b2b90142039ed67d736cb78820 100644 (file)
@@ -124,12 +124,16 @@ public:
   
   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the surface is U-periodic
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
+  //! Returns U period of the surface
   Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the surface is V-periodic
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns V period of the surface
   Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
   
   //! Computes the point of parameters U,V on the surface.
index 9c64c3c1eb59c3ff33829bf875c0aca7620722e8..2c948fca3eb7695bbaaba829d8b69e44c13c5e90 100644 (file)
@@ -267,16 +267,6 @@ Standard_Boolean GeomAdaptor_SurfaceOfLinearExtrusion::IsVPeriodic() const
   return Standard_False;
 }
 
-//=======================================================================
-//function : VPeriod
-//purpose  : 
-//=======================================================================
-
-Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::VPeriod() const 
-{
-  throw Standard_DomainError("GeomAdaptor_SurfaceOfLinearExtrusion::VPeriod");
-}
-
 //=======================================================================
 //function : UResolution
 //purpose  : 
index c67e10f8e93ad99b085eabcc99be2ef50e21a86f..a1ede0392e28a4c164157adcbfcebae675cb495e 100644 (file)
@@ -116,14 +116,16 @@ public:
   
   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
+  //! IsUPeriodic returns true if the "basis curve" of this
+  //! surface of linear extrusion is periodic.
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of the basis curve
   Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
   
+  //! Always returns FALSE
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
-
   //! Returns the parametric U  resolution corresponding
   //! to the real space resolution <R3d>.
   Standard_EXPORT Standard_Real UResolution (const Standard_Real R3d) const Standard_OVERRIDE;
index d8fdd70710533faf4791d2091edc4d55062c3da0..01a70aeff4ee6bd5fef02d158b11637cf6a94c96 100644 (file)
@@ -347,7 +347,7 @@ Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsUPeriodic() const
 
 Standard_Real GeomAdaptor_SurfaceOfRevolution::UPeriod() const
 {
-  return 2*M_PI;
+  return (M_PI*M_PI);
 }
 
 //=======================================================================
@@ -357,7 +357,7 @@ Standard_Real GeomAdaptor_SurfaceOfRevolution::UPeriod() const
 
 Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsVPeriodic() const
 {
-  return myBasisCurve->IsPeriodic();
+  return (myBasisCurve->IsPeriodic() && myBasisCurve->IsClosed());
 }
 
 //=======================================================================
index 405d1a94af2c711b97a81749d2f50e50eecc1dce..887bf81c45c5190cb0e7492debad503d0d702ee4 100644 (file)
@@ -129,12 +129,17 @@ public:
   
   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
   
+  //! Always returns TRUE
   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
   
+  //! Returns 2*PI
   Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
   
+  //! IsVPeriodic returns true if the meridian of this
+  //! surface of revolution is periodic and is closed.
   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of the basis curve
   Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
 
   //! Returns the parametric U  resolution corresponding
index ff694b03865ff0d45ad4b47ae49d5cb749ca6a40..1501f9fff199fe7d3434a730ab9e141c41108fa0 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::IsTrimAllowed(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..f14fb51dc82d93d4e14804b5422e255bdd585b6f 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;
+
+  //! Returns TRUE if the curve is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! returns the period of the curve
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 4d004faca3f62f8d97e9277d1557ef083250366a..5dd19206127c3ea9b9741f532ccbb15297748451 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,148 @@ Standard_Boolean GeomLib::IsBzVClosed (const Handle(Geom_BezierSurface)& S,
   return CompareWeightPoles(aPF, 0, aPL, 0, Tol2);
 }
 
+//=======================================================================
+//function : IsUTrimAllowed
+//purpose  : 
+//=======================================================================
+Standard_Boolean GeomLib::IsUTrimAllowed(const GeomAdaptor_Surface& theS,
+                                         const Standard_Real theNewUFirst,
+                                         const Standard_Real theNewULast)
+{
+  const Handle(Geom_Surface) &aSurf = theS.Surface();
+
+  Standard_Real anIsoParameter = theS.FirstVParameter();
+  if (Precision::IsInfinite(anIsoParameter))
+    anIsoParameter = theS.LastVParameter();
+
+  if (Precision::IsInfinite(anIsoParameter))
+    anIsoParameter = 0.0;
+  
+  Handle(Geom_Curve) aC = aSurf->VIso(anIsoParameter);
+
+  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 (IsTrimAllowed(aC, theNewUFirst, theNewULast));
+}
+
+//=======================================================================
+//function : IsVTrimAllowed
+//purpose  : 
+//=======================================================================
+Standard_Boolean GeomLib::IsVTrimAllowed(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 IsVTrimAllowed(GeomAdaptor_Surface(aOS->BasisSurface()),
+                          theNewVFirst, theNewVLast);
+  }
+
+  Standard_Real anIsoParameter = theS.FirstUParameter();
+  if (Precision::IsInfinite(anIsoParameter))
+    anIsoParameter = theS.LastUParameter();
+
+  if (Precision::IsInfinite(anIsoParameter))
+    anIsoParameter = 0.0;
+
+  Handle(Geom_Curve) aC = aSurf->UIso(anIsoParameter);
+
+  if (aC.IsNull())
+    return Standard_False;
+
+  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 (!IsTrimAllowed(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 Standard_Real aParTol = aCurv->Resolution(Precision::Confusion());
+
+      const Standard_Real aParF = theNewVFirst + aParTol,
+                          aParL = theNewVLast - aParTol;
+
+      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)
+      {
+        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..f08af33cec9da6ca1eb1ad0c56aa48ca6bb40de6 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <Standard_Real.hxx>
 #include <GeomAbs_Shape.hxx>
+#include <Precision.hxx>
 #include <Standard_Integer.hxx>
 #include <Standard_Boolean.hxx>
 #include <TColgp_Array1OfPnt.hxx>
@@ -34,6 +35,7 @@ class gp_Ax2;
 class Geom2d_Curve;
 class gp_GTrsf2d;
 class Adaptor3d_CurveOnSurface;
+class GeomAdaptor_Surface;
 class Geom_BoundedCurve;
 class gp_Pnt;
 class gp_Vec;
@@ -54,7 +56,6 @@ class GeomLib_Tool;
 class GeomLib_PolyFunc;
 class GeomLib_LogSample;
 
-
 //! Geom    Library.    This   package   provides   an
 //! implementation of  functions for basic computation
 //! on geometric entity from packages Geom and Geom2d.
@@ -193,6 +194,71 @@ public:
   Standard_EXPORT static void IsClosed(const Handle(Geom_Surface)& S, const Standard_Real Tol,
                                        Standard_Boolean& isUClosed, Standard_Boolean& isVClosed);
 
+  //! This method determines 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)& theCurve,
+                                                   const Standard_Real theTol)
+  {
+    const Standard_Real aFPar = theCurve->FirstParameter(),
+                        aLPar = theCurve->LastParameter();
+
+    if (Precision::IsInfinite(aFPar) || Precision::IsInfinite(aLPar))
+      return Standard_False;
+
+    return (theCurve->Value(aFPar).SquareDistance(theCurve->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 IsTrimAllowed(const Handle(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
+                                IsUTrimAllowed(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
+                                IsVTrimAllowed(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 89f8219728edbb7f061252f2c8dad5cfaddd738f..bbec677f67f547935066a2592414ac1fcbdd7002 100644 (file)
@@ -162,18 +162,6 @@ Standard_Boolean GeomPlate_Surface::IsUPeriodic() const
   return Standard_False;
 }
 
-
-//=======================================================================
-//function : UPeriod
-//purpose  : 
-//=======================================================================
-
-Standard_Real GeomPlate_Surface::UPeriod() const 
-{ 
- return Standard_False;
-}
-
-
 //=======================================================================
 //function : IsVPeriodic
 //purpose  : 
@@ -184,18 +172,6 @@ Standard_Boolean GeomPlate_Surface::IsVPeriodic() const
   return  Standard_False;
 }
 
-
-//=======================================================================
-//function : VPeriod
-//purpose  : 
-//=======================================================================
-
-Standard_Real GeomPlate_Surface::VPeriod() const 
-{ 
-  return Standard_False;
-}
-
-
 //=======================================================================
 //function : UIso
 //purpose  : 
index 86dc118282d5f7ca51e827820c063a2f1adee4f0..2823d738fca09fcd329801b96ec756c36959c2af 100644 (file)
@@ -149,37 +149,12 @@ 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.
-  //! raises if the surface is not vperiodic.
-  Standard_EXPORT virtual Standard_Real VPeriod() const Standard_OVERRIDE;
-  
   //! Computes the U isoparametric curve.
   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
   
index d8c61cd84ab443af9e326b930b643d6f5532d841..3a6eb432c75c9c5d9f4c2e5335506cd60afcc75f 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::IsTrimAllowed(G2dC, U1, U2))
     {
       U1 = Max(U1, G2dC->FirstParameter());
       U2 = Min(U2, G2dC->LastParameter());
     }
+
     G2dC = new Geom2d_TrimmedCurve( G2dC, U1, U2);
   }
 
index 5e6ad444c7ec77e2c831f4b8f02e9a91c363f3d8..c9fa7623607b55491a5eea7113b9730d594b9794 100644 (file)
@@ -1771,6 +1771,57 @@ static Standard_Integer GetCurveContinuity( Draw_Interpretor& theDI,
   return 0;
 }
 
+//=======================================================================
+//function : IsPeriodic
+//purpose  : Checks if the curve is periodic and returns the period
+//=======================================================================
+static Standard_Integer IsPeriodic(Draw_Interpretor& theDI,
+                                   Standard_Integer theNArg,
+                                   const char** theArgv)
+{
+  if (theNArg != 2)
+  {
+    theDI << "Use: " << theArgv[0] << " {curve or 2dcurve} \n";
+    return 1;
+  }
+
+  Handle(Geom2d_Curve) aGC2d;
+  Handle(Geom_Curve) aGC3d = DrawTrSurf::GetCurve(theArgv[1]);
+  if (aGC3d.IsNull())
+  {
+    aGC2d = DrawTrSurf::GetCurve2d(theArgv[1]);
+    if (aGC2d.IsNull())
+    {
+      theDI << "Argument is not a 2D or 3D curve!\n";
+      return 1;
+    }
+    else
+    {
+      if (aGC2d->IsPeriodic())
+      {
+        theDI << theArgv[1] << " is periodic with the period " << aGC2d->Period() << "\n";
+      }
+      else
+      {
+        theDI << theArgv[1] << " is not periodic\n";
+      }
+    }
+  }
+  else
+  {
+    if (aGC3d->IsPeriodic())
+    {
+      theDI << theArgv[1] << " is periodic with the period " << aGC3d->Period() << "\n";
+    }
+    else
+    {
+      theDI << theArgv[1] << " is not periodic\n";
+    }
+  }
+
+  return 0;
+}
+
 //=======================================================================
 //function : CurveCommands
 //purpose  : 
@@ -1878,6 +1929,11 @@ void  GeometryTest::CurveCommands(Draw_Interpretor& theCommands)
                  __FILE__,
                  GetCurveContinuity,g);
 
+  theCommands.Add("curveperiod",
+                 "curveperiod {curve or 2dcurve}: \n\tReturns the period of the curve (or the information about not-periodic state)",
+                 __FILE__,
+                  IsPeriodic, g);
+
 
 }
 
index 5b5636ffa9ec9e2ed52a3034b335ac2d62ed9afe..569bad58238f79d9bf81877e0d01fa5f402d39eb 100644 (file)
@@ -371,6 +371,47 @@ static Standard_Integer GetSurfaceContinuity( Draw_Interpretor& theDI,
   return 0;
 }
 
+//=======================================================================
+//function : IsPeriodic
+//purpose  : Checks if the surface is periodic and returns the period
+//=======================================================================
+static Standard_Integer IsPeriodic(Draw_Interpretor& theDI,
+                                   Standard_Integer theNArg,
+                                   const char** theArgv)
+{
+  if (theNArg != 2)
+  {
+    theDI << "Use: " << theArgv[0] << " surface \n";
+    return 1;
+  }
+
+  Handle(Geom_Surface) aGS1 = DrawTrSurf::GetSurface(theArgv[1]);
+  if (aGS1.IsNull())
+  {
+    theDI << "Argument is not a surface!\n";
+    return 1;
+  }
+
+  if (aGS1->IsUPeriodic())
+  {
+    theDI << theArgv[1] << " is U-periodic with U-period " << aGS1->UPeriod() << "\n";
+  }
+  else
+  {
+    theDI << theArgv[1] << " is not U-periodic\n";
+  }
+
+  if (aGS1->IsVPeriodic())
+  {
+    theDI << theArgv[1] << " is V-periodic with V-period " << aGS1->VPeriod() << "\n";
+  }
+  else
+  {
+    theDI << theArgv[1] << " is not V-periodic\n";
+  }
+
+  return 0;
+}
 
 //=======================================================================
 //function : SurfaceCommands
@@ -425,6 +466,10 @@ void  GeometryTest::SurfaceCommands(Draw_Interpretor& theCommands)
                  __FILE__,
                  GetSurfaceContinuity,g);
 
+ theCommands.Add("surfaceperiod",
+                 "surfaceperiod surface: \n\tReturns the period of the surface (or the information about not-periodic state)",
+                 __FILE__,
+                 IsPeriodic, g);
 
 }
 
index 0c17d289a714c96327fe0366ff1513b5cb7e020b..0a2681e0eeb9cd86e1328ce63dc8c67b577c98e2 100755 (executable)
@@ -5,3 +5,4 @@ GeomliteTest_ApproxCommands.cxx
 GeomliteTest_CurveCommands.cxx
 GeomliteTest_ModificationCommands.cxx
 GeomliteTest_SurfaceCommands.cxx
+GeomliteTest_AdaptorCommands.cxx
\ No newline at end of file
index c7a11e366a32cb8656d306cb926df1b90f1836a3..17f535f419215a2595ed225820c46b9b1fedec8d 100644 (file)
@@ -31,6 +31,7 @@ void GeomliteTest::AllCommands(Draw_Interpretor& theCommands)
   GeomliteTest::ApproxCommands(theCommands);
   GeomliteTest::API2dCommands(theCommands);
   GeomliteTest::ModificationCommands(theCommands);
+  GeomliteTest::AdaptorCommands(theCommands);
 
   // define the TCL variable Draw_GEOMETRY
   //char* com = "set Draw_GEOMETRY 1";
index c9395e27d633a2cd0d1674668350014d3bc0a014..65b670fc0dff84bbffd886f30eee9fd8f8bdf786 100644 (file)
@@ -57,6 +57,8 @@ public:
   //! - Surface extension by length
   Standard_EXPORT static void ModificationCommands (Draw_Interpretor& I);
 
+  //! Defines commands to work with 3d/2d adapters of curve or surface.
+  Standard_EXPORT static void AdaptorCommands(Draw_Interpretor& theCommands);
 
 
 
diff --git a/src/GeomliteTest/GeomliteTest_AdaptorCommands.cxx b/src/GeomliteTest/GeomliteTest_AdaptorCommands.cxx
new file mode 100644 (file)
index 0000000..74e6fb1
--- /dev/null
@@ -0,0 +1,472 @@
+// Created on: 2018-03-26
+// Created by: Nikolai BUKHALOV
+// Copyright (c) 1999-2018 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <memory>
+
+#include <GeomliteTest.hxx>
+
+#include <Adaptor2d_Curve2d.hxx>
+#include <Adaptor3d_Curve.hxx>
+#include <Adaptor3d_Surface.hxx>
+#include <Adaptor2d_HCurve2d.hxx>
+#include <Adaptor3d_HCurve.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <Draw.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <DrawTrSurf.hxx>
+#include <DBRep.hxx>
+#include <GeomAdaptor_HCurve.hxx>
+#include <GeomAdaptor_HSurface.hxx>
+#include <Geom2dAdaptor_HCurve.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <BRepAdaptor_HCurve.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <BRepAdaptor_HCurve2d.hxx>
+
+
+namespace AdaptorTypes
+{
+  static Handle(Adaptor2d_HCurve2d) anAHC2d;
+  static Handle(Adaptor3d_HCurve) anAHC3d;
+  static Handle(Adaptor3d_HSurface) anAHS3d;
+}
+
+//=======================================================================
+//function : NulifyAdaptors
+//purpose  : 
+//=======================================================================
+static void NulifyAdaptors()
+{
+  AdaptorTypes::anAHC2d.Nullify();
+  AdaptorTypes::anAHC3d.Nullify();
+  AdaptorTypes::anAHS3d.Nullify();
+}
+
+//=======================================================================
+//function : MakeGeneralAdaptor
+//purpose  : 
+//=======================================================================
+static Standard_Integer Nulify(Draw_Interpretor& theDI,
+                               Standard_Integer /*theNArg*/,
+                               const char** /*theArgVal*/)
+{
+  try
+  {
+    NulifyAdaptors();
+  }
+  catch (Standard_Failure)
+  {
+    theDI << "Error: not all adapters have been nullified.\n";
+  }
+
+  theDI << "All adapters have been nullified successful.\n";
+
+  return 0;
+}
+
+//=======================================================================
+//function : MakeGeneralAdaptor
+//purpose  : 
+//=======================================================================
+static Standard_Integer MakeGeneralAdaptor(Draw_Interpretor& theDI,
+                                           Standard_Integer theNArg,
+                                           const char** theArgVal)
+{
+  if (theNArg < 2)
+  {
+    theDI << "Use: " << theArgVal[0] << " <arg>\n";
+    theDI << "  * -- <arg> - argument for adapter creation. It can be:\n";
+    theDI << "    - 3D/2D-curve;\n"
+             "    - Surface;\n"
+             "    - Edge;\n"
+             "    - Face;\n"
+             "    - Compound of edge+face (the edge must have 2D-curve on the face)\n";
+    return 1;
+  }
+
+  TopoDS_Edge anE;
+  TopoDS_Face aF;
+  const Handle(Geom_Geometry) aG = DrawTrSurf::Get(theArgVal[1]);
+  const Handle(Geom2d_Curve) aC2d = DrawTrSurf::GetCurve2d(theArgVal[1]);
+
+  if (aG.IsNull() && aC2d.IsNull())
+  {
+    TopoDS_Shape aShape = DBRep::Get(theArgVal[1]);
+    if (aShape.IsNull())
+    {
+      theDI << "Error: Please set arguments (curve, surface or shape) to adapter creation.\n";
+      return 1;
+    }
+
+    TopExp_Explorer anExp(aShape, TopAbs_FACE);
+    if (anExp.More())
+    {
+      aF = TopoDS::Face(anExp.Current());
+    }
+
+    anExp.Init(aShape, TopAbs_EDGE, TopAbs_FACE);
+    if (anExp.More())
+    {
+      anE = TopoDS::Edge(anExp.Current());
+    }
+  }
+
+  if (!aC2d.IsNull() || (!aF.IsNull() && !anE.IsNull()))
+  {
+    if (!aC2d.IsNull())
+    {
+      AdaptorTypes::anAHC2d = new Geom2dAdaptor_HCurve(aC2d);
+      if (AdaptorTypes::anAHC2d)
+      {
+        theDI << "OK: Adaptor2d_Curve2d has been created.\n";
+      }
+      else
+      {
+        theDI << "Error: Wrong type of adapter.\n";
+        return 1;
+      }
+    }
+    else
+    {
+      AdaptorTypes::anAHC2d = new BRepAdaptor_HCurve2d(BRepAdaptor_Curve2d(anE, aF));
+      if (AdaptorTypes::anAHC2d)
+      {
+        theDI << "OK: Adaptor2d_Curve2d has been created.\n";
+      }
+      else
+      {
+        theDI << "Error: Wrong type of adapter.\n";
+        return 1;
+      }
+    }
+
+    return 0;
+  }
+  
+  if (!aG.IsNull())
+  {
+    const Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast(aG);
+    if (!aC.IsNull())
+    {
+      AdaptorTypes::anAHC3d = new GeomAdaptor_HCurve(aC);
+      if (AdaptorTypes::anAHC3d)
+      {
+        theDI << "OK: Adaptor3d_Curve has been created.\n";
+      }
+      else
+      {
+        theDI << "Error: Wrong type of adapter.\n";
+        return 1;
+      }
+    }
+    else
+    {
+      const Handle(Geom_Surface) aS = Handle(Geom_Surface)::DownCast(aG);
+      if (!aS.IsNull())
+      {
+        AdaptorTypes::anAHS3d = new GeomAdaptor_HSurface(aS);
+        if (AdaptorTypes::anAHS3d)
+        {
+          theDI << "OK: Adaptor3d_Surface has been created.\n";
+        }
+        else
+        {
+          theDI << "Error: Wrong type of adapter.\n";
+          return 1;
+        }
+      }
+      else
+      {
+        theDI << "Error: Please set arguments (curve, surface or shape) to adapter creation.\n";
+        return 1;
+      }
+    }
+  }
+  else //if(aG.IsNull())
+  {
+    if (!anE.IsNull())
+    {
+      if (!aF.IsNull())
+      {
+        AdaptorTypes::anAHC3d = new BRepAdaptor_HCurve(BRepAdaptor_Curve(anE, aF));
+      }
+      else
+      {
+        AdaptorTypes::anAHC3d = new BRepAdaptor_HCurve(BRepAdaptor_Curve(anE));
+      }
+
+      if (AdaptorTypes::anAHC3d)
+      {
+        theDI << "OK: Adaptor3d_Curve has been created.\n";
+      }
+      else
+      {
+        theDI << "Error: Wrong type of adapter.\n";
+        return 1;
+      }
+    }
+    else
+    {
+      AdaptorTypes::anAHS3d = new BRepAdaptor_HSurface(BRepAdaptor_Surface(aF));
+      if (AdaptorTypes::anAHS3d)
+      {
+        theDI << "OK: Adaptor3d_Surface has been created.\n";
+      }
+      else
+      {
+        theDI << "Error: Wrong type of adapter.\n";
+        return 1;
+      }
+    }
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : CheckPeriodic
+//purpose  : 
+//=======================================================================
+void CheckPeriodic(Draw_Interpretor& theDI)
+{
+  if (!AdaptorTypes::anAHC2d.IsNull())
+  {
+    if (AdaptorTypes::anAHC2d->IsPeriodic())
+    {
+      theDI << "Adaptor2d_Curve2d is periodic with period " << AdaptorTypes::anAHC2d->Period() << "\n";
+    }
+    else
+    {
+      theDI << "Adaptor2d_Curve2d is not periodic\n";
+    }
+
+    return;
+  }
+
+  if (!AdaptorTypes::anAHC3d.IsNull())
+  {
+    if (AdaptorTypes::anAHC3d->IsPeriodic())
+    {
+      theDI << "Adaptor3d_Curve is periodic with period " << AdaptorTypes::anAHC3d->Period() << "\n";
+    }
+    else
+    {
+      theDI << "Adaptor3d_Curve is not periodic\n";
+    }
+
+    return;
+  }
+
+  if (AdaptorTypes::anAHS3d->IsUPeriodic())
+  {
+    theDI << "Adaptor3d_Surface is U-periodic with U-period " << AdaptorTypes::anAHS3d->UPeriod() << "\n";
+  }
+  else
+  {
+    theDI << "Adaptor3d_Surface is not U-periodic\n";
+  }
+
+  if (AdaptorTypes::anAHS3d->IsVPeriodic())
+  {
+    theDI << "Adaptor3d_Surface is U-periodic with V-period " << AdaptorTypes::anAHS3d->VPeriod() << "\n";
+  }
+  else
+  {
+    theDI << "Adaptor3d_Surface is not V-periodic\n";
+  }
+}
+
+//=======================================================================
+//function : CheckPeriodic
+//purpose  : 
+//=======================================================================
+void CheckClosed(Draw_Interpretor& theDI)
+{
+  if (!AdaptorTypes::anAHC2d.IsNull())
+  {
+    if (AdaptorTypes::anAHC2d->IsClosed())
+    {
+      theDI << "Adaptor2d_Curve2d is closed\n";
+    }
+    else
+    {
+      theDI << "Adaptor2d_Curve2d is not closed\n";
+    }
+
+    return;
+  }
+
+  if (!AdaptorTypes::anAHC3d.IsNull())
+  {
+    if (AdaptorTypes::anAHC3d->IsClosed())
+    {
+      theDI << "Adaptor3d_Curve is closed\n";
+    }
+    else
+    {
+      theDI << "Adaptor3d_Curve is not closed\n";
+    }
+
+    return;
+  }
+
+  if (AdaptorTypes::anAHS3d->IsUClosed())
+  {
+    theDI << "Adaptor3d_Surface is U-closed\n";
+  }
+  else
+  {
+    theDI << "Adaptor3d_Surface is not U-closed\n";
+  }
+
+  if (AdaptorTypes::anAHS3d->IsVClosed())
+  {
+    theDI << "Adaptor3d_Surface is V-closed\n";
+  }
+  else
+  {
+    theDI << "Adaptor3d_Surface is not V-closed\n";
+  }
+}
+
+//=======================================================================
+//function : GetResolution
+//purpose  : 
+//=======================================================================
+void GetResolution(Draw_Interpretor& theDI, Standard_Real theValue)
+{
+  if (!AdaptorTypes::anAHC2d.IsNull())
+  {
+    theDI << "Adaptor2d_Curve2d::Resolution = " << 
+      AdaptorTypes::anAHC2d->Resolution(theValue) << "\n";
+    return;
+  }
+
+  if (!AdaptorTypes::anAHC3d.IsNull())
+  {
+    theDI << "Adaptor3d_Curve::Resolution = " << 
+      AdaptorTypes::anAHC3d->Resolution(theValue) << "\n";
+
+    return;
+  }
+
+  const Standard_Real aUR = AdaptorTypes::anAHS3d->UResolution(theValue);
+  const Standard_Real aVR = AdaptorTypes::anAHS3d->VResolution(theValue);
+
+  theDI << "Adaptor3d_Surface: UResolution = " << aUR << "; VResolution = " << aVR << "\n";
+}
+
+//=======================================================================
+//function : GetAdaptorProperty
+//purpose  : 
+//=======================================================================
+static Standard_Integer GetAdaptorProperty(Draw_Interpretor& theDI,
+                                           Standard_Integer theNArg,
+                                           const char** theArgVal)
+{
+  if (theNArg == 1)
+  {
+    theDI << "Use: " << theArgVal[0] << " <set of properties>\n";
+    theDI << "  -isperiodic - Returns IsPeriodic() property and the period;\n";
+    theDI << "  -isclosed - Returns Adaptor::IsClosed();\n";
+    theDI << "  -resolution <Value> - Returns a value of resolution;\n";
+
+    return 1;
+  }
+
+  if (AdaptorTypes::anAHC2d.IsNull() &&
+      AdaptorTypes::anAHC3d.IsNull() &&
+      AdaptorTypes::anAHS3d.IsNull())
+  {
+    theDI << "Adapter is not initialized. Use \"makeadaptor\"-DRAW-command.\n";
+    return 1;
+  }
+
+  for (Standard_Integer i = 1; i < theNArg; i++)
+  {
+    if (theArgVal[i][0] != '-')
+    {
+      theDI << "Error: " << theArgVal[i] << " is not an option\n";
+      return 1;
+    }
+
+    Standard_Boolean isFound = Standard_False;
+
+    if (!strcmp("-isperiodic", theArgVal[i]))
+    {
+      CheckPeriodic(theDI);
+      isFound = Standard_True;
+    }
+
+    if (!strcmp("-isclosed", theArgVal[i]))
+    {
+      CheckClosed(theDI);
+      isFound = Standard_True;
+    }
+
+    if (!strcmp("-resolution", theArgVal[i]))
+    {
+      const Standard_Real aT = Draw::Atof(theArgVal[++i]);
+      GetResolution(theDI, aT);
+      isFound = Standard_True;
+    }
+
+    if (isFound)
+      continue;
+
+    theDI << "Error: Unknown option " << theArgVal[i] << "\n";
+    return 1;
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : AdaptorCommands
+//purpose  : 
+//=======================================================================
+void  GeomliteTest::AdaptorCommands(Draw_Interpretor& theCommands)
+{
+  static Standard_Boolean loaded = Standard_False;
+  if (loaded) return;
+  loaded = Standard_True;
+
+  const char* g;
+
+  g = "Work with adapters";
+
+  theCommands.Add("makeadaptor",
+                  "use \"makeadaptor\" w/o any arguments to get help",
+                  __FILE__,
+                  MakeGeneralAdaptor, g);
+
+  theCommands.Add("nulifyadaptors",
+                  "Use: nulifyadaptors",
+                  __FILE__,
+                  Nulify, g);
+
+  theCommands.Add("adaptorproperties",
+                  "Use: \"adaptorproperties\" <set of properties>",
+                  __FILE__,
+                  GetAdaptorProperty, g);
+
+}
+
+
+
index 5d3a3e3ca802563595c04391e85b08ce6b8e15f2..fdff604e93058d30a040657a02cf3cf03e9c2ca5 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/Periodicity concept ").
+  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/Periodicity concept ").
+  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..964e620f20af504cb8099ab8cc9ae73e30ec621d 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/Periodicity concept ").
     Standard_Boolean IsPeriodic() const;
   
+    //! Returns the period of the periodic curve.
+    //! (please see the documentation, the section
+    //! " /User Guides/Modeling Data/Periodicity concept ").
     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..83c2e66f46efe40265d6cd5945f28538fb1c14a1 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/Periodicity concept ").
+  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/Periodicity concept ").
+  Standard_Real UPeriod() const;
+  
+  //! Returns true if the surface is V-periodic 
+  //! (please see the documentation, the section
+  //! " /User Guides/Modeling Data/Periodicity concept ").
+  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/Periodicity concept ").
+  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 02da3925398582d030085f916f3af2677496ffd6..d94220436739961ca627a80e7b10764962c84285 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);
@@ -1292,21 +1295,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 f749781335956a6b86597eb940374c57861f4494..77f7fc383541421c78f48b5b1c768bc9c982540e 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>
@@ -1429,11 +1430,8 @@ 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);
 
     NCollection_List<gp_Pnt> aListOfCriticalPoints;
 
index 054467b1eb9ce8e7df646402771311072df65ba8..2fa30d5617b021c0e1492ce3ac683503d7ffbd08 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>
@@ -1587,10 +1588,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() ||
@@ -1996,33 +1994,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];
@@ -2057,7 +2035,8 @@ void AdjustOnPeriodic(const Handle(Adaptor3d_HSurface)& Surf1,
         bIsNull=Standard_False;
         bIsPeriod=Standard_False;
         //
-        if (!bIsPeriodic[k]) {
+        if(aPeriod[k] == 0.0)
+        {
           continue;
         }
         //
@@ -2162,10 +2141,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 7cda071df3abc5954722042e067c22e9f6bba7f8..fafe28e9fbc70b4e53ef6cbcbb6e80961124d8f5 100644 (file)
@@ -1020,16 +1020,19 @@ Standard_Boolean IntPatch_SpecialPoints::
   //    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 f3200190ac574a85fcc8e21cf261a8d45dc2d6ac..60b339f54833e276d3a69c0a209c5ac335360579 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>
 
@@ -1466,10 +1467,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 759e5dda91a3101afa25754edbd3240c87b05ed5..5c18df924d53d52b607361d57bc1f0d914e3ddf4 100644 (file)
@@ -1879,8 +1879,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) ||
@@ -1891,6 +1891,9 @@ Handle(Geom_Curve) MakeBSpline  (const Handle(IntPatch_WLine)& WL,
     enlarge=Standard_True;
   }
   //
+
+  Standard_Real aPar1 = theumin, aPar2 = theumax;
+
   if(!isuperiodic && enlarge) {
 
     if(!Precision::IsInfinite(theumin) &&
@@ -1906,6 +1909,25 @@ Handle(Geom_Curve) MakeBSpline  (const Handle(IntPatch_WLine)& WL,
     else
       theumax = usup;
   }
+
+  if (theumin > theumax)
+  {
+    // It is possible if the face is out
+    // of the surface's domain. E.g.
+    // uinf == 0, usup == 1 and initial values
+    // theumin == -0.5 and theumax == -0.2.
+    // "delta" is a small value (~ 1.0e-7)
+    //
+    // After this correction, 
+    // theumin == 0, theumax = -0.2.
+    //
+    //See testgrid bugs modalg_4 bug6272*
+
+    theumin = aPar1;
+    theumax = aPar2;
+  }
+  //
+  aPar1 = thevmin, aPar2 = thevmax;
   //
   if(!isvperiodic && enlarge) {
     if(!Precision::IsInfinite(thevmin) &&
@@ -1923,6 +1945,23 @@ Handle(Geom_Curve) MakeBSpline  (const Handle(IntPatch_WLine)& WL,
       thevmax = vsup;
     }
   }
+
+  if (thevmin > thevmax)
+  {
+    // It is possible if the face is out
+    // of the surface's domain. E.g.
+    // uinf == 0, usup == 1 and initial values
+    // theumin == -0.5 and theumax == -0.2.
+    // "delta" is a small value (~ 1.0e-7)
+    //
+    // After this correction, 
+    // theumin == 0, theumax = -0.2.
+    //
+    //See testgrid bugs modalg_4 bug6272*
+
+    thevmin = aPar1;
+    thevmax = aPar2;
+  }
   //
   if(isuperiodic || isvperiodic) {
     Standard_Boolean correct = Standard_False;
@@ -2719,10 +2758,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 e3b9e756f52bc33d426a67ea7bc40d99774302e5..b00d7eb068edd763d4ed82ff941e28bc6b396537 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 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 c104aa09ee32a410583b3ef091035cbde6651091..6f164b9ffe855bdd91f338766f8089e613625a7e 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..495a27129953da24e15f443fd8112f0214d5f79f 100644 (file)
@@ -120,8 +120,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the projection result is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! Returns the period of the projection result
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index c788587cd3cfefb2c9ddc93dff1fd0f3682102b8..3bc0a38735536f6abf585e70d749871886da2ac8 100644 (file)
@@ -146,8 +146,10 @@ public:
   
   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
   
+  //! Returns TRUE if the projection result is periodic
   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
   
+  //! returns the period of the projection result
   Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE;
   
   //! Computes the point of parameter U on the curve.
index 33a58bf43f2d1a0586bf8d0e74cb9f4e98fb3cb9..fc249ca7d46808655331da26205611214c6f1fd7 100644 (file)
@@ -3024,6 +3024,83 @@ static Standard_Integer OCC29311 (Draw_Interpretor& theDI, Standard_Integer theA
   return 0;
 }
 
+//=======================================================================
+//function : OCC29115c
+//purpose  : 
+//=======================================================================
+#include <GeomLib.hxx>
+static Standard_Integer OCC29115c(Draw_Interpretor&theDI, Standard_Integer, const char** theArgV)
+{
+  const Standard_Real aUf = Draw::Atof(theArgV[2]),
+                      aUl = Draw::Atof(theArgV[3]);
+  const Handle(Geom2d_Curve) aC2d = DrawTrSurf::GetCurve2d(theArgV[1]);
+
+  if (!aC2d.IsNull())
+  {
+    if (GeomLib::IsTrimAllowed(aC2d, aUf, aUl))
+    {
+      theDI << "Trimm is possible.\n";
+    }
+    else
+    {
+      theDI << "Trimm is not possible.\n";
+    }
+
+    return 0;
+  }
+
+  const Handle(Geom_Curve) aC3d = DrawTrSurf::GetCurve(theArgV[1]);
+
+  if (aC3d.IsNull())
+    return 1;
+
+  if (GeomLib::IsTrimAllowed(aC3d, aUf, aUl))
+  {
+    theDI << "Trimm is possible.\n";
+  }
+  else
+  {
+    theDI << "Trimm is not possible.\n";
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC29115s
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC29115s(Draw_Interpretor&theDI, Standard_Integer, const char** theArgV)
+{
+  const Standard_Real aUf = Draw::Atof(theArgV[2]),
+                      aUl = Draw::Atof(theArgV[3]),
+                      aVf = Draw::Atof(theArgV[4]),
+                      aVl = Draw::Atof(theArgV[5]);
+
+  const Handle(Geom_Surface) aS = DrawTrSurf::GetSurface(theArgV[1]);
+  const GeomAdaptor_Surface anAS(aS);
+
+  if (GeomLib::IsUTrimAllowed(anAS, aUf, aUl))
+  {
+    theDI << "U-trimm is possible.\n";
+  }
+  else
+  {
+    theDI << "U-trimm is not possible.\n";
+  }
+
+  if (GeomLib::IsVTrimAllowed(anAS, aVf, aVl))
+  {
+    theDI << "V-trimm is possible.\n";
+  }
+  else
+  {
+    theDI << "V-trimm is not possible.\n";
+  }
+
+  return 0;
+}
+
 void QABugs::Commands_20(Draw_Interpretor& theCommands) {
   const char *group = "QABugs";
 
@@ -3064,5 +3141,8 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
   theCommands.Add("OCC29807", "OCC29807 surface1 surface2 u1 v1 u2 v2", __FILE__, OCC29807, group);
   theCommands.Add("OCC29311", "OCC29311 shape counter nbiter: check performance of OBB calculation", __FILE__, OCC29311, group);
 
+  theCommands.Add("OCC29115c", "OCC29115c curve Uf Ul <step file name>", __FILE__, OCC29115c, group);
+  theCommands.Add("OCC29115s", "OCC29115s surface Uf Ul Vf Vl", __FILE__, OCC29115s, group);
+
   return;
 }
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..feea2b79ddfa0848f2c5cd2b70b30382bb25dcf7 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::IsTrimAllowed(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..f1166b5aa06ca39c09a56b9b0a6754c4e2293e29 100644 (file)
@@ -441,10 +441,11 @@ void ShapeFix_EdgeProjAux::Init2d (const Standard_Real preci)
   }
 
   //pdn adjust parameters in periodic case
-  if(parU || parV) {
+  if ((parU && theSurface->IsUPeriodic()) || (parV && theSurface->IsVPeriodic()))
+  {
     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 +579,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 4bb06b163c000b0666f112bdd908b3e12d5a5863..fc84ef259f5b2be35b58537ee30888cbb3b286dd 100644 (file)
@@ -1374,9 +1374,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();
@@ -1385,7 +1389,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 d764aaa26c9f91f0fbaf4e20a467a6caa16ec7e3..791c97fc53a254023c1a8f3682e2137de8c1cda3 100644 (file)
@@ -226,11 +226,11 @@ Standard_Boolean  StepToTopoDS_GeometricTool::UpdateParam3d(
   const Handle(Geom_Curve)& theCurve,
   Standard_Real& w1,
   Standard_Real& w2,
 const Standard_Real preci)
+ const Standard_Real preci)
 {
   // w1 et/ou w2 peuvent etre en dehors des bornes naturelles de la courbe.
   // On donnera alors la valeur en bout a w1 et/ou w2
-
+  
   Standard_Real cf = theCurve->FirstParameter();
   Standard_Real cl = theCurve->LastParameter();
 
@@ -266,9 +266,9 @@ 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()
+    ElCLib::AdjustPeriodic(cf,cl,Precision::PConfusion(),w1,w2); //:a7 abv 11 Feb 98: preci -> PConfusion()
   }
   else if (theCurve->IsClosed())
   {
@@ -319,16 +319,16 @@ Standard_Boolean  StepToTopoDS_GeometricTool::UpdateParam3d(
   // The curve is closed within the 3D tolerance
   else if (theCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
   {
-    Handle(Geom_BSplineCurve) aBSpline =
+    Handle(Geom_BSplineCurve) aBSpline = 
       Handle(Geom_BSplineCurve)::DownCast(theCurve);
     if (aBSpline->StartPoint().Distance(aBSpline->EndPoint()) <= preci)
     {
-      //:S4136 <= BRepAPI::Precision()) {
-            // l'un des points projecte se trouve sur l'origine du parametrage
-            // de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
-            // DANGER precision 3d applique a une espace 1d
-
-            // w2 = cf au lieu de w2 = cl
+//:S4136       <= BRepAPI::Precision()) {
+      // l'un des points projecte se trouve sur l'origine du parametrage
+      // de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
+      // DANGER precision 3d applique a une espace 1d
+      
+      // w2 = cf au lieu de w2 = cl
       if (Abs(w2 - cf) < Precision::PConfusion())
       {
         w2 = cl;
@@ -344,11 +344,11 @@ Standard_Boolean  StepToTopoDS_GeometricTool::UpdateParam3d(
       else
       {
 #ifdef OCCT_DEBUG
-        cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
+       cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
 #endif
-        Standard_Real tmp = w1;
-        w1 = w2;
-        w2 = tmp;
+       Standard_Real tmp = w1;
+       w1 = w2;
+       w2 = tmp;
       }
     }
     //abv 15.03.00 #72 bm1_pe_t4 protection of exceptions in draw
@@ -357,11 +357,11 @@ Standard_Boolean  StepToTopoDS_GeometricTool::UpdateParam3d(
 #ifdef OCCT_DEBUG
       cout << "Warning: parameter range is bad; curve reversed" << endl;
 #endif
-      w1 = theCurve->ReversedParameter(w1);
-      w2 = theCurve->ReversedParameter(w2);
+      w1 = theCurve->ReversedParameter ( w1 );
+      w2 = theCurve->ReversedParameter ( w2 );
       theCurve->Reverse();
     }
-    //:j9 abv 11 Dec 98: PRO7747 #4875, after :j8:    else 
+//:j9 abv 11 Dec 98: PRO7747 #4875, after :j8:    else 
     if (w1 == w2)
     {  //gka 10.07.1998 file PRO7656 entity 33334
       w1 = cf;
@@ -383,8 +383,8 @@ Standard_Boolean  StepToTopoDS_GeometricTool::UpdateParam3d(
 #ifdef OCCT_DEBUG
       cout << "Warning: parameter range is bad; curve reversed" << endl;
 #endif
-      w1 = theCurve->ReversedParameter(w1);
-      w2 = theCurve->ReversedParameter(w2);
+      w1 = theCurve->ReversedParameter ( w1 );
+      w2 = theCurve->ReversedParameter ( w2 );
       theCurve->Reverse();
     }
     //pdn 11.01.99 #144 bm1_pe_t4 protection of exceptions in draw
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 5f76fea777488e1b61a193c5b3c6b8a1fe5daa4f..f5e37c8f928467f69aec8d82c36efdcf49a56c6d 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);
         }
       }
diff --git a/tests/adaptors/begin b/tests/adaptors/begin
new file mode 100644 (file)
index 0000000..51f57ac
--- /dev/null
@@ -0,0 +1,43 @@
+if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
+    pload TOPTEST
+    pload AISV
+}
+# To prevent loops limit to 10 minutes
+cpulimit 60
+
+if { [info exists imagedir] == 0 } {
+   set imagedir .
+}
+
+if { [info exists test_image ] == 0 } {
+   set test_image photo
+}
+
+proc compare {r1 r2 tol} {
+       if {$r1 - $r2  >= $tol} {
+               puts "Error : evalution" 
+       }
+       if {$r2 - $r1  >= $tol} {
+               puts "Error : evalution" 
+       }
+} 
+
+proc comparepnt2d {p1 p2 tol} {
+       upvar $p1 pp1
+       upvar $p2 pp2
+       coord pp1 x1 y1
+       coord pp2 x2 y2
+       compare [dval x1] [dval x2] $tol
+       compare [dval y1] [dval y2] $tol
+}
+
+proc comparepnt3d {p1 p2 tol} {
+       upvar $p1 pp1
+       upvar $p2 pp2
+       coord pp1 x1 y1 z1
+       coord pp2 x2 y2 z2
+       compare [dval x1] [dval x2] $tol
+       compare [dval y1] [dval y2] $tol
+       compare [dval z1] [dval z2] $tol
+}
+
diff --git a/tests/adaptors/end b/tests/adaptors/end
new file mode 100644 (file)
index 0000000..57901e2
--- /dev/null
@@ -0,0 +1,2 @@
+# to end a test script
+puts "TEST COMPLETED"
diff --git a/tests/adaptors/grids.list b/tests/adaptors/grids.list
new file mode 100644 (file)
index 0000000..3257f2a
--- /dev/null
@@ -0,0 +1,2 @@
+001 properties
+002 resolution
\ No newline at end of file
diff --git a/tests/adaptors/parse.rules b/tests/adaptors/parse.rules
new file mode 100644 (file)
index 0000000..2e8d896
--- /dev/null
@@ -0,0 +1 @@
+OK /Relative error of mass computation/ message from vprops
\ No newline at end of file
diff --git a/tests/adaptors/properties/A01 b/tests/adaptors/properties/A01
new file mode 100644 (file)
index 0000000..529ad85
--- /dev/null
@@ -0,0 +1,26 @@
+circle c 0 0 20
+
+set ExpPeriodic "Adaptor2d_Curve2d is periodic with period 6.2831853071795862"
+set ExpClosed "Adaptor2d_Curve2d is closed"
+
+nulifyadaptors
+makeadaptor c
+set logp [adaptorproperties -isperiodic]
+set logc [adaptorproperties -isclosed]
+set logpc [adaptorproperties -isperiodic -isclosed]
+
+if { ![regexp $ExpPeriodic $logp] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logc] } {
+  puts "Error: the adaptor is not closed"
+}
+
+if { ![regexp $ExpPeriodic $logpc] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logpc] } {
+  puts "Error: the adaptor is not closed"
+}
diff --git a/tests/adaptors/properties/B01 b/tests/adaptors/properties/B01
new file mode 100644 (file)
index 0000000..4b8bb5f
--- /dev/null
@@ -0,0 +1,26 @@
+bsplinecurve cc 4 3 0 5 3.1415926535897931 3 6.2831853071795862 5 0 20 100 1 -14.1421356237309 20 106.594586144012 1 -34.9044110322929 0 116.276194167748 1 -14.1421356237311 -20 106.594586144013 1 14.142135623731 -20 93.4054138559873 1 34.904411032293 0 83.7238058322526 1 14.1421356237309 20 93.4054138559873 1 0 20 100 1 
+
+set ExpPeriodic "Adaptor3d_Curve is not periodic"
+set ExpClosed "Adaptor3d_Curve is closed"
+
+nulifyadaptors
+makeadaptor cc
+set logp [adaptorproperties -isperiodic]
+set logc [adaptorproperties -isclosed]
+set logpc [adaptorproperties -isperiodic -isclosed]
+
+if { ![regexp $ExpPeriodic $logp] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logc] } {
+  puts "Error: the adaptor is not closed"
+}
+
+if { ![regexp $ExpPeriodic $logpc] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logpc] } {
+  puts "Error: the adaptor is not closed"
+}
diff --git a/tests/adaptors/properties/C01 b/tests/adaptors/properties/C01
new file mode 100644 (file)
index 0000000..085a32f
--- /dev/null
@@ -0,0 +1,28 @@
+sphere s 100
+convert bs s
+trim bs bs 0 6 -1 1
+
+set ExpPeriodic "Adaptor3d_Surface is U-periodic with U-period 6.2831853071795862\nAdaptor3d_Surface is not V-periodic"
+set ExpClosed "Adaptor3d_Surface is not U-closed\nAdaptor3d_Surface is not V-closed"
+
+nulifyadaptors
+makeadaptor bs
+set logp [adaptorproperties -isperiodic]
+set logc [adaptorproperties -isclosed]
+set logpc [adaptorproperties -isperiodic -isclosed]
+
+if { ![regexp $ExpPeriodic $logp] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logc] } {
+  puts "Error: the adaptor is not closed"
+}
+
+if { ![regexp $ExpPeriodic $logpc] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logpc] } {
+  puts "Error: the adaptor is not closed"
+}
diff --git a/tests/adaptors/properties/D01 b/tests/adaptors/properties/D01
new file mode 100644 (file)
index 0000000..6c5be6c
--- /dev/null
@@ -0,0 +1,29 @@
+box b 1 1 1
+explode b e
+
+set ExpPeriodic "Adaptor3d_Curve is not periodic"
+set ExpClosed "Adaptor3d_Curve is not closed"
+
+nulifyadaptors
+makeadaptor b_1
+
+set logp [adaptorproperties -isperiodic]
+set logc [adaptorproperties -isclosed]
+set logpc [adaptorproperties -isperiodic -isclosed]
+
+if { ![regexp $ExpPeriodic $logp] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logc] } {
+  puts "Error: the adaptor is not closed"
+}
+
+if { ![regexp $ExpPeriodic $logpc] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logpc] } {
+  puts "Error: the adaptor is not closed"
+}
+
diff --git a/tests/adaptors/properties/E01 b/tests/adaptors/properties/E01
new file mode 100644 (file)
index 0000000..23d8b6e
--- /dev/null
@@ -0,0 +1,28 @@
+pcylinder f 20 200
+explode f f
+
+set ExpPeriodic "Adaptor3d_Surface is U-periodic with U-period 6.2831853071795862\nAdaptor3d_Surface is not V-periodic"
+set ExpClosed "Adaptor3d_Surface is U-closed\nAdaptor3d_Surface is not V-closed"
+
+nulifyadaptors
+makeadaptor f_1
+
+set logp [adaptorproperties -isperiodic]
+set logc [adaptorproperties -isclosed]
+set logpc [adaptorproperties -isperiodic -isclosed]
+
+if { ![regexp $ExpPeriodic $logp] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logc] } {
+  puts "Error: the adaptor is not closed"
+}
+
+if { ![regexp $ExpPeriodic $logpc] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logpc] } {
+  puts "Error: the adaptor is not closed"
+}
diff --git a/tests/adaptors/properties/F01 b/tests/adaptors/properties/F01
new file mode 100644 (file)
index 0000000..2f8a7fc
--- /dev/null
@@ -0,0 +1,37 @@
+pcone co 0 10 10
+explode co f
+
+mksurface ss co_1
+
+if {! [regexp "ConicalSurface" [dump ss] ] } {
+  puts "Error: Wrong face has been chosen"
+}
+
+explode co_1 e
+compound co_1_1 co_1 cm
+
+set ExpPeriodic "Adaptor2d_Curve2d is not periodic"
+set ExpClosed "Adaptor2d_Curve2d is not closed"
+
+nulifyadaptors
+makeadaptor cm
+
+set logp [adaptorproperties -isperiodic]
+set logc [adaptorproperties -isclosed]
+set logpc [adaptorproperties -isperiodic -isclosed]
+
+if { ![regexp $ExpPeriodic $logp] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logc] } {
+  puts "Error: the adaptor is not closed"
+}
+
+if { ![regexp $ExpPeriodic $logpc] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logpc] } {
+  puts "Error: the adaptor is not closed"
+}
diff --git a/tests/adaptors/properties/F02 b/tests/adaptors/properties/F02
new file mode 100644 (file)
index 0000000..dc776c3
--- /dev/null
@@ -0,0 +1,37 @@
+pcone co 0 10 10
+explode co f
+
+mksurface ss co_1
+
+if {! [regexp "ConicalSurface" [dump ss] ] } {
+  puts "Error: Wrong face has been chosen"
+}
+
+explode co_1 e
+compound co_1_2 co_1 cm
+
+set ExpPeriodic "Adaptor2d_Curve2d is not periodic"
+set ExpClosed "Adaptor2d_Curve2d is not closed"
+
+nulifyadaptors
+makeadaptor cm
+
+set logp [adaptorproperties -isperiodic]
+set logc [adaptorproperties -isclosed]
+set logpc [adaptorproperties -isperiodic -isclosed]
+
+if { ![regexp $ExpPeriodic $logp] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logc] } {
+  puts "Error: the adaptor is not closed"
+}
+
+if { ![regexp $ExpPeriodic $logpc] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logpc] } {
+  puts "Error: the adaptor is not closed"
+}
diff --git a/tests/adaptors/properties/F03 b/tests/adaptors/properties/F03
new file mode 100644 (file)
index 0000000..911c8c3
--- /dev/null
@@ -0,0 +1,39 @@
+pcone co 0 10 10
+explode co f
+
+mksurface ss co_1
+
+if {! [regexp "ConicalSurface" [dump ss] ] } {
+  puts "Error: Wrong face has been chosen"
+}
+
+explode co_1 e
+
+# Degenerated edge
+compound co_1_3 co_1 cm
+
+set ExpPeriodic "Adaptor2d_Curve2d is not periodic"
+set ExpClosed "Adaptor2d_Curve2d is not closed"
+
+nulifyadaptors
+makeadaptor cm
+
+set logp [adaptorproperties -isperiodic]
+set logc [adaptorproperties -isclosed]
+set logpc [adaptorproperties -isperiodic -isclosed]
+
+if { ![regexp $ExpPeriodic $logp] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logc] } {
+  puts "Error: the adaptor is not closed"
+}
+
+if { ![regexp $ExpPeriodic $logpc] } {
+  puts "Error: the adaptor is not periodic"
+}
+
+if { ![regexp $ExpClosed $logpc] } {
+  puts "Error: the adaptor is not closed"
+}
diff --git a/tests/adaptors/resolution/A1 b/tests/adaptors/resolution/A1
new file mode 100644 (file)
index 0000000..9daa8c0
--- /dev/null
@@ -0,0 +1,10 @@
+circle cc 0 0 0 20
+
+nulifyadaptors
+makeadaptor cc
+
+set log [adaptorproperties -resolution 1.0e-5]
+
+regexp {Adaptor3d_Curve::Resolution = +([-0-9.+eE]+)} ${log} full ResC
+
+checkreal {Circle resolution} $ResC 5.0e-007 0.0 0.1
diff --git a/tests/adaptors/resolution/A2 b/tests/adaptors/resolution/A2
new file mode 100644 (file)
index 0000000..d1570bd
--- /dev/null
@@ -0,0 +1,10 @@
+circle cc 0 0 15
+
+nulifyadaptors
+makeadaptor cc
+
+set log [adaptorproperties -resolution 6.5e-4]
+
+regexp {Adaptor2d_Curve2d::Resolution = +([-0-9.+eE]+)} ${log} full ResC
+
+checkreal {Circle resolution} $ResC 4.3333333336723763e-005 1.0e-6 0.0
diff --git a/tests/adaptors/resolution/A3 b/tests/adaptors/resolution/A3
new file mode 100644 (file)
index 0000000..291d991
--- /dev/null
@@ -0,0 +1,11 @@
+sphere ss 68
+
+nulifyadaptors
+makeadaptor ss
+
+set log [adaptorproperties -resolution 1.0e-7]
+
+regexp {Adaptor3d_Surface: UResolution = +([-0-9.+eE]+); VResolution = +([-0-9.+eE]+)} ${log} full URes VRes
+
+checkreal {Sphere U-resolution} $URes 1.4705882352941176e-009 0.0 0.1
+checkreal {Sphere V-resolution} $VRes 1.4705882352941176e-009 0.0 0.1
diff --git a/tests/bugs/modalg_7/bug29115_1 b/tests/bugs/modalg_7/bug29115_1
new file mode 100644 (file)
index 0000000..82b2086
--- /dev/null
@@ -0,0 +1,44 @@
+puts "========"
+puts "OCC29115"
+puts "========"
+puts ""
+#################################################
+# [Regression] GeomAdaptor mistakenly reports non-periodic curves to be periodic
+#################################################
+
+pload QAcommands
+
+circle c1 0 0 0 10
+circle c2 0 0 0 10
+
+if { ! [regexp "Trimm is possible" [OCC29115c c1 0 pi] ] } {
+  puts "Error in \"c1 0 pi\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c1 5*pi 11*pi/2] ] } {
+  puts "Error in \"c1 5*pi 11*pi/2\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c1 100*pi 102*pi] ] } {
+  puts "Error in \"c1 100*pi 102*pi\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is not possible" [OCC29115c c1 50*pi 55*pi] ] } {
+  puts "Error in \"c1 50*pi 55*pi\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c2 0 pi] ] } {
+  puts "Error in \"c2 0 pi\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c2 5*pi 11*pi/2] ] } {
+  puts "Error in \"c2 5*pi 11*pi/2\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c2 100*pi 102*pi] ] } {
+  puts "Error in \"c2 100*pi 102*pi\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is not possible" [OCC29115c c2 50*pi 55*pi] ] } {
+  puts "Error in \"c2 50*pi 55*pi\"-bounds computation "
+}
diff --git a/tests/bugs/modalg_7/bug29115_2 b/tests/bugs/modalg_7/bug29115_2
new file mode 100644 (file)
index 0000000..deafad4
--- /dev/null
@@ -0,0 +1,44 @@
+puts "========"
+puts "OCC29115"
+puts "========"
+puts ""
+#################################################
+# [Regression] GeomAdaptor mistakenly reports non-periodic curves to be periodic
+#################################################
+
+pload QAcommands
+
+bsplinecurve c1 3 3 0 4 0.5 2 1 4 2 2 2 1 3 3 3 1 4 4 4 1 5 5 5 1 6 6 6 1 7 7 7 1
+2dbsplinecurve c2 3 3 0 4 0.5 2 1 4 2 2 1 3 3 1 4 4 1 5 5 1 6 6 1 7 7 1
+
+if { ! [regexp "Trimm is possible" [OCC29115c c1 0 0.1] ] } {
+  puts "Error in \"c1 0 0.1\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c1 0.6 0.78] ] } {
+  puts "Error in \"c1 0.6 0.78\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c1 0.5 1] ] } {
+  puts "Error in \"c1 0.5 1\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is not possible" [OCC29115c c1 0.8 1.5] ] } {
+  puts "Error in \"c1 0.8 1.5\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c2 0 0.1] ] } {
+  puts "Error in \"c2 0 0.1\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c2 0.6 0.78] ] } {
+  puts "Error in \"c2 0.6 0.78\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is possible" [OCC29115c c2 0.5 1] ] } {
+  puts "Error in \"c2 0.5 1\"-bounds computation "
+}
+
+if { ! [regexp "Trimm is not possible" [OCC29115c c2 0.8 1.5] ] } {
+  puts "Error in \"c2 0.8 1.5\"-bounds computation "
+}
diff --git a/tests/bugs/modalg_7/bug29115_3 b/tests/bugs/modalg_7/bug29115_3
new file mode 100644 (file)
index 0000000..e9d4f7e
--- /dev/null
@@ -0,0 +1,24 @@
+puts "========"
+puts "OCC29115"
+puts "========"
+puts ""
+#################################################
+# [Regression] GeomAdaptor mistakenly reports non-periodic curves to be periodic
+#################################################
+
+pload QAcommands
+
+sphere sp 100
+offset s1 sp 10
+
+if { ! [regexp "U-trimm is possible.\nV-trimm is possible." [OCC29115s s1 0 2*pi -1 1] ] } {
+  puts "Error in \"s1 0 2*pi -1 1\"-bounds computation "
+}
+
+if { ! [regexp "U-trimm is not possible.\nV-trimm is possible." [OCC29115s s1 pi 5*pi -1 1] ] } {
+  puts "Error in \"s1 pi 5*pi -1 1\"-bounds computation "
+}
+
+if { ! [regexp "U-trimm is possible.\nV-trimm is not possible." [OCC29115s s1 0 2*pi 1 2] ] } {
+  puts "Error in \"s1 0 2*pi 1 2\"-bounds computation "
+}
diff --git a/tests/bugs/modalg_7/bug29115_4 b/tests/bugs/modalg_7/bug29115_4
new file mode 100644 (file)
index 0000000..470c738
--- /dev/null
@@ -0,0 +1,19 @@
+puts "========"
+puts "OCC29115"
+puts "========"
+puts ""
+#################################################
+# [Regression] GeomAdaptor mistakenly reports non-periodic curves to be periodic
+#################################################
+
+pload QAcommands
+
+cone s1 45 100
+
+if { ! [regexp "U-trimm is possible.\nV-trimm is possible." [OCC29115s s1 0 2*pi 0 150] ] } {
+  puts "Error in \"s1 0 2*pi -1 1\"-bounds computation "
+}
+
+if { ! [regexp "U-trimm is possible.\nV-trimm is not possible." [OCC29115s s1 0 2*pi -150 0] ] } {
+  puts "Error in \"s1 0 2*pi 1 2\"-bounds computation "
+}
diff --git a/tests/bugs/modalg_7/bug29115_5 b/tests/bugs/modalg_7/bug29115_5
new file mode 100644 (file)
index 0000000..d369d53
--- /dev/null
@@ -0,0 +1,47 @@
+puts "========"
+puts "OCC29115"
+puts "========"
+puts ""
+#################################################
+# [Regression] GeomAdaptor mistakenly reports non-periodic curves to be periodic
+#################################################
+
+pload QAcommands
+
+bsplinecurve c1 4 3 0 5 3.1415926535897931 3 6.2831853071795862 5 0 20 100 1 -14.1421356237309 20 106.594586144012 1 -34.9044110322929 0 116.276194167748 1 -14.1421356237311 -20 106.594586144013 1 14.142135623731 -20 93.4054138559873 1 34.904411032293 0 83.7238058322526 1 14.1421356237309 20 93.4054138559873 1 0 20 100 1 
+
+revsurf s1 c1 -0.654999286110387, 8.14738225247612, 100.305431183199 0.906307787036651, -3.94430452610506e-031, -0.422618261740697 
+
+setperiodic c1
+
+revsurf s2 c1 -0.654999286110387, 8.14738225247612, 100.305431183199 0.906307787036651, -3.94430452610506e-031, -0.422618261740697 
+
+## 
+if { ! [regexp "U-trimm is possible.\nV-trimm is possible." [OCC29115s s1 0 2*pi 0 1] ] } {
+  puts "Error in \"s1 0 2*pi 0 1\"-bounds computation "
+}
+
+if { ! [regexp "U-trimm is possible.\nV-trimm is possible." [OCC29115s s2 0 2*pi 0 1] ] } {
+  puts "Error in \"s2 0 2*pi 0 1\"-bounds computation "
+}
+
+##
+
+if { ! [regexp "U-trimm is possible.\nV-trimm is not possible." [OCC29115s s1 10*pi 12*pi -0.2 1] ] } {
+  puts "Error in \"s1 10*pi 12*pi -0.2 1\"-bounds computation "
+}
+
+if { ! [regexp "U-trimm is possible.\nV-trimm is possible." [OCC29115s s2 10*pi 12*pi -0.2 1] ] } {
+  puts "Error in \"s2 10*pi 12*pi -0.2 1\"-bounds computation "
+}
+
+##
+
+if { ! [regexp "U-trimm is not possible.\nV-trimm is not possible." [OCC29115s s1 -pi 2*pi 0.5 1.5] ] } {
+  puts "Error in \"s1 -pi 2*pi 0.5 1.5\"-bounds computation "
+}
+
+if { ! [regexp "U-trimm is not possible.\nV-trimm is not possible." [OCC29115s s2 -pi 2*pi 0.5 1.5] ] } {
+  puts "Error in \"s2 -pi 2*pi 0.5 1.5\"-bounds computation "
+}
+
diff --git a/tests/geometry/geomperiodic/A1 b/tests/geometry/geomperiodic/A1
new file mode 100644 (file)
index 0000000..2585631
--- /dev/null
@@ -0,0 +1,17 @@
+ellipse c1 0 0 0 0 1 1 100 40
+
+if { ![regexp {is periodic} [curveperiod c1] ] } {
+  puts "Error: the periodic curve is detected to be not periodic"
+} else {
+  puts "OK. The curve is true periodic"
+}
+
+trim c2 c1 0 2
+
+dump c2
+
+if { ![regexp {is periodic} [curveperiod c2] ] } {
+  puts "Error: the trimmed curve must be periodic"
+} else {
+  puts "OK. The trimmed curve is true periodic"
+}
diff --git a/tests/geometry/geomperiodic/A2 b/tests/geometry/geomperiodic/A2
new file mode 100644 (file)
index 0000000..52e85ce
--- /dev/null
@@ -0,0 +1,41 @@
+2dbsplinecurve c1 2 6 -2.0943951023932 1 0 2 2.0943951023932 2 4.18879020478639 2 6.28318530717959 2 8.37758040957278 1 100 0 1 100 173 0.5 -50 87 1 -200 0 0.5 -50 -87 1 100 -173 0.5 100 0 1
+
+dump c1
+
+if { [regexp {is not periodic} [curveperiod c1] ] } {
+  puts "OK. The curve is not periodic"
+} else {
+  puts "Error: the not periodic curve is detected to be periodic"
+}
+
+setperiodic c1
+dump c1
+
+if { ![regexp {is periodic} [curveperiod c1] ] } {
+  puts "Error: the periodic curve is detected to be not periodic"
+} else {
+  puts "OK. The curve is true periodic"
+}
+
+trim c2 c1 0 6
+
+# Trim operation does not affect the periodicity
+if { ![regexp {is periodic} [curveperiod c2] ] } {
+  puts "Error: the periodic curve is detected to be not periodic"
+} else {
+  puts "OK. The curve is true periodic"
+}
+
+setnotperiodic c1
+if { [regexp {is not periodic} [curveperiod c1] ] } {
+  puts "OK. The curve is not periodic"
+} else {
+  puts "Error: the not periodic curve is detected to be periodic"
+}
+
+# setnotperiodic command works with B-spline curve only.
+# As result, trimmed curves (even based on B-splines)
+# sent as arguments result in TCL-exceptions
+
+#setnotperiodic c2 -- INCORRECT OPERATION
+
diff --git a/tests/geometry/geomperiodic/B1 b/tests/geometry/geomperiodic/B1
new file mode 100644 (file)
index 0000000..5af5096
--- /dev/null
@@ -0,0 +1,80 @@
+pcylinder cy 100 200
+nurbsconvert bc cy
+
+explode bc f
+
+mksurface s1 bc_1
+mksurface s2 bc_2
+mksurface s3 bc_3
+
+set log1 [surfaceperiod s1]
+set log2 [surfaceperiod s2]
+set log3 [surfaceperiod s3]
+
+if { ![regexp {is U-periodic} $log1 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true periodic"
+}
+
+if { [regexp {is not V-periodic} $log1 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
+
+if { [regexp {is not U-periodic} $log2 ] } {
+  puts "OK. The surface is not U-periodic"
+} else {
+  puts "Error: the not U-periodic surface is detected to be U-periodic"
+}
+
+if { [regexp {is not V-periodic} $log2 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
+
+if { [regexp {is not U-periodic} $log3 ] } {
+  puts "OK. The surface is not U-periodic"
+} else {
+  puts "Error: the not U-periodic surface is detected to be U-periodic"
+}
+
+if { [regexp {is not V-periodic} $log3 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
+
+# Trim operation does not affect the periodicity
+
+trimu st1 s1 3 5
+if { ![regexp {is U-periodic} [surfaceperiod st1] ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true periodic"
+}
+
+setunotperiodic s1
+if { [regexp {is not U-periodic} [surfaceperiod s1] ] } {
+  puts "OK. The surface is not U-periodic"
+} else {
+  puts "Error: the not U-periodic surface is detected to be U-periodic"
+}
+
+# Not closed surface is not converted. It has to stay periodic
+setunotperiodic st1
+if { ![regexp {is U-periodic} [surfaceperiod st1] ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true periodic"
+}
+
+viso c1 st1 50
+
+if { ![regexp {is periodic} [curveperiod c1] ] } {
+  puts "Error: the periodic curve is detected to be not periodic"
+} else {
+  puts "OK. The curve is true periodic"
+}
diff --git a/tests/geometry/geomperiodic/B2 b/tests/geometry/geomperiodic/B2
new file mode 100644 (file)
index 0000000..b7c6830
--- /dev/null
@@ -0,0 +1,32 @@
+ellipse c1 0 0 0 0 0 1 1 0 0 100 30
+trim c2 c1 1.5 4.5
+extsurf s1 c2 0 0 1
+trim s2 s1 2 3 -100 100
+
+set log1 [surfaceperiod s1]
+set log2 [surfaceperiod s2]
+
+if { ![regexp {is U-periodic} $log1 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true periodic"
+}
+
+if { [regexp {is not V-periodic} $log1 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
+
+if { ![regexp {is U-periodic} $log2 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true periodic"
+}
+
+if { [regexp {is not V-periodic} $log2 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
+
diff --git a/tests/geometry/geomperiodic/B3 b/tests/geometry/geomperiodic/B3
new file mode 100644 (file)
index 0000000..d73d43a
--- /dev/null
@@ -0,0 +1,91 @@
+bsplinecurve c1 4 3 0 5 3.1415926535897931 3 6.2831853071795862 5 0 20 100 1 -14.1421356237309 20 106.594586144012 1 -34.9044110322929 0 116.276194167748 1 -14.1421356237311 -20 106.594586144013 1 14.142135623731 -20 93.4054138559873 1 34.904411032293 0 83.7238058322526 1 14.1421356237309 20 93.4054138559873 1 0 20 100 1 
+
+if { [regexp {is not periodic} [curveperiod c1] ] } {
+  puts "OK. The curve is not periodic"
+} else {
+  puts "Error: the not periodic curve is detected to be periodic"
+}
+
+setperiodic c1
+
+if { ![regexp {is periodic} [curveperiod c1] ] } {
+  puts "Error: the periodic curve is detected to be not periodic"
+} else {
+  puts "OK. The curve is true periodic"
+}
+
+trim c2 c1 2 5
+
+if { ![regexp {is periodic} [curveperiod c2] ] } {
+  puts "Error: the periodic curve is detected to be not periodic"
+} else {
+  puts "OK. The curve is true periodic"
+}
+
+revsurf s1 c1 -0.654999286110526 48.1473822524761 100.305431183199 0.906307787036651 0 -0.422618261740697 
+revsurf s2 c2 -0.654999286110526 48.1473822524761 100.305431183199 0.906307787036651 0 -0.422618261740697 
+
+trim st1 s1 pi 2*pi 3 4
+trim st2 s2 pi 2*pi 3 4
+
+# The surfaces st1 and st2 take the same locus.
+
+set logS1 [surfaceperiod s1]
+set logS2 [surfaceperiod s2]
+set logST1 [surfaceperiod st1]
+set logST2 [surfaceperiod st2]
+
+# s1 is a surface of revolution based on closed curve.
+# Therefore, it is U- and V-periodic.
+
+if { ![regexp {is U-periodic} $logS1 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { ![regexp {is V-periodic} $logS1 ] } {
+  puts "Error: the V-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true V-periodic"
+}
+
+# s2 is a surface of revolution based on not closed curve.
+# Therefore, it is U-periodic and is not V-periodic.
+if { ![regexp {is U-periodic} $logS2 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { [regexp {is not V-periodic} $logS2 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
+
+# Trim operation does not affect the periodicity
+
+if { ![regexp {is U-periodic} $logST1 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { ![regexp {is V-periodic} $logST1 ] } {
+  puts "Error: the V-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true V-periodic"
+}
+
+if { ![regexp {is U-periodic} $logST2 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { [regexp {is not V-periodic} $logST2 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
diff --git a/tests/geometry/geomperiodic/B4 b/tests/geometry/geomperiodic/B4
new file mode 100644 (file)
index 0000000..6a8aa93
--- /dev/null
@@ -0,0 +1,94 @@
+bsplinecurve c1 4 3 0 5 3.1415926535897931 3 6.2831853071795862 5 0 20 100 1 -14.1421356237309 20 106.594586144012 1 -34.9044110322929 0 116.276194167748 1 -14.1421356237311 -20 106.594586144013 1 14.142135623731 -20 93.4054138559873 1 34.904411032293 0 83.7238058322526 1 14.1421356237309 20 93.4054138559873 1 0 20 100 1 
+
+if { [regexp {is not periodic} [curveperiod c1] ] } {
+  puts "OK. The curve is not periodic"
+} else {
+  puts "Error: the not periodic curve is detected to be periodic"
+}
+
+setperiodic c1
+point pp 1 1 1
+offsetcurve co c1 -1 pp
+
+if { ![regexp {is periodic} [curveperiod co] ] } {
+  puts "Error: the periodic curve is detected to be not periodic"
+} else {
+  puts "OK. The curve is true periodic"
+}
+
+trim c2 co 2 5
+
+if { ![regexp {is periodic} [curveperiod c2] ] } {
+  puts "Error: the periodic curve is detected to be not periodic"
+} else {
+  puts "OK. The curve is true periodic"
+}
+
+revsurf s1 co -0.654999286110526 48.1473822524761 100.305431183199 0.906307787036651 0 -0.422618261740697 
+revsurf s2 c2 -0.654999286110526 48.1473822524761 100.305431183199 0.906307787036651 0 -0.422618261740697 
+
+trim st1 s1 pi 2*pi 3 4
+trim st2 s2 pi 2*pi 3 4
+
+# The surfaces st1 and st2 take the same locus.
+
+set logS1 [surfaceperiod s1]
+set logS2 [surfaceperiod s2]
+set logST1 [surfaceperiod st1]
+set logST2 [surfaceperiod st2]
+
+# s1 is a surface of revolution based on the offset curve.
+# Currently, offset from B-spline curve is always detected as not-closed.
+# Therefore, s1 is U-periodic and is not V-periodic.
+
+if { ![regexp {is U-periodic} $logS1 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { ![regexp {is not V-periodic} $logS1 ] } {
+  puts "Error: the V-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true V-periodic"
+}
+
+# s2 is a surface of revolution based on not closed curve.
+# Therefore, it is U-periodic and is not V-periodic.
+if { ![regexp {is U-periodic} $logS2 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { [regexp {is not V-periodic} $logS2 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
+
+# Trim operation does not affect the periodicity
+
+if { ![regexp {is U-periodic} $logST1 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { ![regexp {is not V-periodic} $logST1 ] } {
+  puts "Error: the V-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true V-periodic"
+}
+
+if { ![regexp {is U-periodic} $logST2 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { [regexp {is not V-periodic} $logST2 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
diff --git a/tests/geometry/geomperiodic/B5 b/tests/geometry/geomperiodic/B5
new file mode 100644 (file)
index 0000000..290445e
--- /dev/null
@@ -0,0 +1,29 @@
+sphere ss 100
+trim st ss 0 pi -1 1
+
+set log1 [surfaceperiod ss]
+set log2 [surfaceperiod st]
+
+if { ![regexp {is U-periodic} $log1 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { [regexp {is not V-periodic} $log1 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
+
+if { ![regexp {is U-periodic} $log2 ] } {
+  puts "Error: the U-periodic surface is detected to be not periodic"
+} else {
+  puts "OK. The surface is true U-periodic"
+}
+
+if { [regexp {is not V-periodic} $log2 ] } {
+  puts "OK. The surface is not V-periodic"
+} else {
+  puts "Error: the not V-periodic surface is detected to be V-periodic"
+}
index b91d9cc11bed4d15b0a7d3a0b97da39d45528736..e5dd7255346b0b5e947dc6ed9dddc499f59ddda4 100644 (file)
@@ -12,4 +12,5 @@
 012 parabola
 013 project
 014 revsurf
-015 2dpolygon
\ No newline at end of file
+015 2dpolygon
+016 geomperiodic
\ No newline at end of file