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.
* **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.
* **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
== 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
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
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.
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;
return Standard_False;
}
-//=======================================================================
-//function : Period
-//purpose :
-//=======================================================================
-
-Standard_Real Adaptor2d_Line2d::Period() const
-{
- throw Standard_NoSuchObject();
-}
-
//=======================================================================
//function : Value
//purpose :
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;
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.
throw Standard_NotImplemented("Adaptor3d_Curve::Trim");
}
-
//=======================================================================
//function : IsClosed
//purpose :
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.
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.
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;
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;
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);
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.
throw Standard_NotImplemented("Adaptor3d_Surface::VTrim");
}
-
//=======================================================================
//function : IsUClosed
//purpose :
//! 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
//! 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
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.
//
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;
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);
//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,
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
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;
//
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);
{
return Standard_False;
-}
-
- Standard_Real BRepAdaptor_CompCurve::Period() const
-{
- return (TLast - TFirst);
}
gp_Pnt BRepAdaptor_CompCurve::Value(const Standard_Real U) const
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;
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
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.
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()) {
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.
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);
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);
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);
#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>
#include <Geom_Plane.hxx>
#include <Extrema_ExtSS.hxx>
#include <GeomAdaptor_Surface.hxx>
+#include <GeomAdaptor_HSurface.hxx>
+
//
static Standard_Boolean CanUseEdges(const Adaptor3d_Surface& BS);
//
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());
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)
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;
}
}
}
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();
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();
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();
}
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);
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);
// 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(),
// 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(),
if ( myKPart == 1)
myCont = GeomAbs_G1;
- if ( (Type1 == GeomAbs_Plane) && (Type2 == GeomAbs_Plane)) {
+ if ((GAS1.GetType() == GeomAbs_Plane) && (GAS2.GetType() == GeomAbs_Plane))
+ {
myKPart = 2;
}
}
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
+#include <GeomLib.hxx>
#include <stdio.h>
#ifdef OCCT_DEBUG
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();
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()));
}
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;
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;
else {
V2 = VV1;
V1 = VV2;
- Standard_Real x = p1;
- p1 = p2;
- p2 = x;
+ std::swap(p1, p2);
}
// check range
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);
}
}
+ 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
// 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),
aSurface->GetType() != GeomAbs_BezierSurface &&
aSurface->GetType() != GeomAbs_OtherSurface)
{
+ // For trimmed cone/cylinder.
+ // Return independently of the fact whether the surface trimmed.
return Standard_True;
}
{
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)
{
}
updateRange(aSurface->FirstVParameter(), aSurface->LastVParameter(),
- aSurface->IsVPeriodic(), myRangeV.first, myRangeV.second);
+ aSurface->IsVPeriodic() && aSurface->IsVClosed(),
+ myRangeV.first, myRangeV.second);
if (myRangeV.second < myRangeV.first)
{
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))
{
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.
//---------------
if (V11.IsSame(V21) || V11.IsSame(V22) ||
V12.IsSame(V21) || V12.IsSame(V22))
- return Standard_True;
+ return Standard_True;
return Standard_False;
}
//=======================================================================
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();
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);
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;
}
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);
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);
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())
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())
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);
+ }
}
- }
}
//=======================================================================
Standard_Real coeff;
if (ExtensionMode == 1)
{
- UU1 = VV1 = - TheInfini;
- UU2 = VV2 = TheInfini;
+ UU1 = VV1 = - TheInfini;
+ UU2 = VV2 = TheInfini;
coeff = 0.25;
}
else
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();
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_SequenceOfShape.hxx>
+#include <GeomLib.hxx>
#include <GeomLib_CheckCurveOnSurface.hxx>
#include <errno.h>
//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());
#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>
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;
}
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;
}
}
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 :
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;
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 :
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;
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;
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;
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);
//=============================================================================
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();
}
//=============================================================================
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;
Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
+ //! Returns FALSE
Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
//! Returns the point of parameter U.
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
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())
{
// 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));
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;
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);
}
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();
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;
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) {
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) {
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();
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;
}
}
// 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
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;
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())
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();
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 );
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
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;
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);
#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>
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)
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);
}
}
- 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.;
for (Standard_Integer i = 2; i <= NbPoles; i++) {
dis.DrawTo(CPoles(i));
}
- if (C->IsPeriodic())
+ if (C->IsPeriodic() && C->IsClosed())
dis.DrawTo(CPoles(1));
}
//=======================================================================
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();
}
//=======================================================================
//!
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);
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();
}
//=======================================================================
-//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);
+}
//! 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.
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);
+}
//! 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.
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;
//! 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
//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);
}
//! 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
//! 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"
#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>
Standard_Real Geom_Curve::Period() const
{
- Standard_NoSuchObject_Raise_if
- ( !IsPeriodic(),"Geom_Curve::Period");
-
- return ( LastParameter() - FirstParameter());
+ throw Standard_NotImplemented("Geom_Curve::Period");
}
//=======================================================================
//! 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
//! 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.
//! 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
//! 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;
//! 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.
Standard_Boolean Geom_OffsetCurve::IsPeriodic () const
{
+ if (basisCurve->Continuity() == GeomAbs_C0)
+ return Standard_False;
+
return basisCurve->IsPeriodic();
}
Standard_Real Geom_OffsetCurve::Period () const
{
+ if (!IsPeriodic())
+ throw Standard_NotImplemented("Geom_OffsetCurve::Period");
+
return basisCurve->Period();
}
//! 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.
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();
}
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();
}
//! 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.
if ( U1 == U2)
throw Standard_ConstructionError("Geom_RectangularTrimmedSurface::U1==U2");
- if (basisSurf->IsUPeriodic()) {
+ if (IsUPeriodic()) {
UsameSense = USense;
// set uTrim1 in the range Udeb , Ufin
if ( V1 == V2)
throw Standard_ConstructionError("Geom_RectangularTrimmedSurface::V1==V2");
- if (basisSurf->IsVPeriodic()) {
+ if (IsVPeriodic()) {
VsameSense = VSense;
// set vTrim1 in the range Vdeb , Vfin
Standard_Boolean Geom_RectangularTrimmedSurface::IsUPeriodic () const
{
- if (basisSurf->IsUPeriodic() && !isutrimmed)
- return Standard_True;
- return Standard_False;
+ return basisSurf->IsUPeriodic();
}
Standard_Boolean Geom_RectangularTrimmedSurface::IsVPeriodic () const
{
- if (basisSurf->IsVPeriodic() && !isvtrimmed)
- return Standard_True;
- return Standard_False;
+ return basisSurf->IsVPeriodic();
}
//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());
}
//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());
}
//=======================================================================
//! 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.
//! 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
#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>
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");
}
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");
}
//=======================================================================
//! 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.
return basisCurve->IsPeriodic ();
}
+//=======================================================================
+//function : UPeriod
+//purpose :
+//=======================================================================
+Standard_Real Geom_SurfaceOfLinearExtrusion::UPeriod() const
+{
+ return basisCurve->Period();
+}
+
//=======================================================================
//function : IsVClosed
//purpose :
//! 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
//purpose :
//=======================================================================
-Standard_Boolean Geom_SurfaceOfRevolution::IsUPeriodic () const {
-
+Standard_Boolean Geom_SurfaceOfRevolution::IsUPeriodic () const
+{
return Standard_True;
}
//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
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.
//! 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.
Standard_Real Udeb = basisCurve->FirstParameter();
Standard_Real Ufin = basisCurve->LastParameter();
- if (basisCurve->IsPeriodic()) {
+ if (IsPeriodic()) {
sameSense = Sense;
// set uTrim1 in the range Udeb , Ufin
Standard_Boolean Geom_TrimmedCurve::IsClosed () const
{
- return ( StartPoint().Distance(EndPoint()) <= gp::Resolution());
+ return ( StartPoint().SquareDistance(EndPoint()) <= gp::Resolution());
}
//=======================================================================
Standard_Boolean Geom_TrimmedCurve::IsPeriodic () const
{
- //return basisCurve->IsPeriodic();
- return Standard_False;
+ return basisCurve->IsPeriodic();
}
//! 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;
}
//=======================================================================
-//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);
+}
//! 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.
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;
//! 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
#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>
Standard_Real Geom2d_Curve::Period() const
{
- Standard_NoSuchObject_Raise_if
- ( !IsPeriodic(),"Geom2d_Curve::Period");
-
- return ( LastParameter() - FirstParameter());
+ throw Standard_NotImplemented("Geom2d_Curve::Period");
}
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;
//! 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
Standard_Boolean Geom2d_OffsetCurve::IsPeriodic () const
{
+ if (basisCurve->Continuity() == GeomAbs_C0)
+ return Standard_False;
+
return basisCurve->IsPeriodic();
}
Standard_Real Geom2d_OffsetCurve::Period() const
{
+ if (!IsPeriodic())
+ throw Standard_NotImplemented("Geom2d_OffsetCurve::Period");
+
return basisCurve->Period();
}
//! 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.
Standard_Real Udeb = basisCurve->FirstParameter();
Standard_Real Ufin = basisCurve->LastParameter();
- if (basisCurve->IsPeriodic()) {
+ if (IsPeriodic()) {
sameSense = Sense;
// set uTrim1 in the range Udeb , Ufin
//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());
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean Geom2d_TrimmedCurve::IsPeriodic () const
+Standard_Boolean Geom2d_TrimmedCurve::IsPeriodic() const
{
- //return basisCurve->IsPeriodic();
- return Standard_False;
+ return basisCurve->IsPeriodic();
}
//=======================================================================
//! 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;
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
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);
void RebuildCache (const Standard_Real theParameter) const;
+
+
+private:
+
+
+
Handle(Geom2d_Curve) myCurve;
GeomAbs_CurveType myTypeCurve;
Standard_Real myFirst;
#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>
// 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())
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
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.
return Standard_False;
}
-//=======================================================================
-//function : VPeriod
-//purpose :
-//=======================================================================
-
-Standard_Real GeomAdaptor_SurfaceOfLinearExtrusion::VPeriod() const
-{
- throw Standard_DomainError("GeomAdaptor_SurfaceOfLinearExtrusion::VPeriod");
-}
-
//=======================================================================
//function : UResolution
//purpose :
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;
Standard_Real GeomAdaptor_SurfaceOfRevolution::UPeriod() const
{
- return 2*M_PI;
+ return (M_PI*M_PI);
}
//=======================================================================
Standard_Boolean GeomAdaptor_SurfaceOfRevolution::IsVPeriodic() const
{
- return myBasisCurve->IsPeriodic();
+ return (myBasisCurve->IsPeriodic() && myBasisCurve->IsClosed());
}
//=======================================================================
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
#include <GeomConvert.hxx>
#include <GeomConvert_ApproxCurve.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
+#include <GeomLib.hxx>
#include <GeomLProp.hxx>
#include <gp.hxx>
#include <gp_Ax3.hxx>
// 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())
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());
}
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());
}
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;
}
return myHCurve->Period();
}
+Standard_Boolean GeomFill_SnglrFunc::IsClosed() const
+{
+ return myHCurve->IsClosed();
+}
gp_Pnt GeomFill_SnglrFunc::Value(const Standard_Real U) const
{
//! 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.
#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>
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())
{
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,
#include <Standard_Real.hxx>
#include <GeomAbs_Shape.hxx>
+#include <Precision.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <TColgp_Array1OfPnt.hxx>
class Geom2d_Curve;
class gp_GTrsf2d;
class Adaptor3d_CurveOnSurface;
+class GeomAdaptor_Surface;
class Geom_BoundedCurve;
class gp_Pnt;
class gp_Vec;
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.
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.
return Standard_False;
}
-
-//=======================================================================
-//function : UPeriod
-//purpose :
-//=======================================================================
-
-Standard_Real GeomPlate_Surface::UPeriod() const
-{
- return Standard_False;
-}
-
-
//=======================================================================
//function : IsVPeriodic
//purpose :
return Standard_False;
}
-
-//=======================================================================
-//function : VPeriod
-//purpose :
-//=======================================================================
-
-Standard_Real GeomPlate_Surface::VPeriod() const
-{
- return Standard_False;
-}
-
-
//=======================================================================
//function : UIso
//purpose :
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;
#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>
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);
}
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 :
__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);
+
}
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
__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);
}
GeomliteTest_CurveCommands.cxx
GeomliteTest_ModificationCommands.cxx
GeomliteTest_SurfaceCommands.cxx
+GeomliteTest_AdaptorCommands.cxx
\ No newline at end of file
GeomliteTest::ApproxCommands(theCommands);
GeomliteTest::API2dCommands(theCommands);
GeomliteTest::ModificationCommands(theCommands);
+ GeomliteTest::AdaptorCommands(theCommands);
// define the TCL variable Draw_GEOMETRY
//char* com = "set Draw_GEOMETRY 1";
//! - 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);
--- /dev/null
+// 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);
+
+}
+
+
+
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);
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);
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.
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);
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);
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;
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);
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;
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);
//-- 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));
}
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);
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);
#include <IntPatch_PrmPrmIntersection.hxx>
#include <IntPatch_WLine.hxx>
#include <IntPatch_WLineTool.hxx>
+#include <IntSurf.hxx>
#include <ProjLib_ProjectOnPlane.hxx>
#include <Geom_Plane.hxx>
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;
#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>
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() ||
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];
bIsNull=Standard_False;
bIsPeriod=Standard_False;
//
- if (!bIsPeriodic[k]) {
+ if(aPeriod[k] == 0.0)
+ {
continue;
}
//
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))
//-- 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 {
// 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;
#include <ElCLib.hxx>
#include <ElSLib.hxx>
#include <IntPatch_SpecialPoints.hxx>
+#include <IntSurf.hxx>
#include <NCollection_IncAllocator.hxx>
#include <TopAbs_State.hxx>
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()};
}
}
//
- isuperiodic = anAdaptorSurface.IsUPeriodic();
- isvperiodic = anAdaptorSurface.IsVPeriodic();
+ isuperiodic = (anAdaptorSurface.IsUPeriodic() && anAdaptorSurface.IsUClosed());
+ isvperiodic = (anAdaptorSurface.IsVPeriodic() && anAdaptorSurface.IsVClosed());
//
aType=anAdaptorSurface.GetType();
if((aType==GeomAbs_BezierSurface) ||
enlarge=Standard_True;
}
//
+
+ Standard_Real aPar1 = theumin, aPar2 = theumax;
+
if(!isuperiodic && enlarge) {
if(!Precision::IsInfinite(theumin) &&
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) &&
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;
// 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);
#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>
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 :
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;
}
//! 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
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);
}
}
- 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);
}
}
- 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);
}
}
- 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);
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()) )
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()) )
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();
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());
// 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;
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);
}
}
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;
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;
//
//
//=======================================================================
-//classn : ProjLib_Function
+//class : ProjLib_Function
//purpose :
//=======================================================================
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();
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;
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;
}
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
// 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
{
}
if(U0 > Usup)
{
- if(!uperiod)
+ if (uperiod == 0.0)
U0 = Usup;
else
{
}
if(V0 < Vinf)
{
- if(!vperiod)
+ if(vperiod == 0.0)
V0 = Vinf;
else
{
}
if(V0 > Vsup)
{
- if(!vperiod)
+ if(vperiod == 0.0)
V0 = Vsup;
else
{
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.
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.
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;
}
}
- 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());
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;
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.
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.
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";
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;
}
}
}
- // 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) {
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();
-}
//! 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:
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,
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();
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();
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;
#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>
}
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>
#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>
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
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.
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++)
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),
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),
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;
}
//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);
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()) {
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();
}
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;
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;
{
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);
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;
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);
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)
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)
//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();
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();
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())
{
// 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;
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
#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;
#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
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);
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; }
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);
}
}
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 :
// 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;
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;
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);
}
}
--- /dev/null
+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
+}
+
--- /dev/null
+# to end a test script
+puts "TEST COMPLETED"
--- /dev/null
+001 properties
+002 resolution
\ No newline at end of file
--- /dev/null
+OK /Relative error of mass computation/ message from vprops
\ No newline at end of file
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
+
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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 "
+}
--- /dev/null
+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 "
+}
--- /dev/null
+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 "
+}
--- /dev/null
+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 "
+}
--- /dev/null
+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 "
+}
+
--- /dev/null
+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"
+}
--- /dev/null
+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
+
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
+
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
--- /dev/null
+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"
+}
012 parabola
013 project
014 revsurf
-015 2dpolygon
\ No newline at end of file
+015 2dpolygon
+016 geomperiodic
\ No newline at end of file