Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:19:43

0001 // Created on: 1993-07-06
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepBuilderAPI_MakeEdge_HeaderFile
0018 #define _BRepBuilderAPI_MakeEdge_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepLib_MakeEdge.hxx>
0025 #include <BRepBuilderAPI_MakeShape.hxx>
0026 #include <Standard_Real.hxx>
0027 #include <BRepBuilderAPI_EdgeError.hxx>
0028 class TopoDS_Vertex;
0029 class gp_Pnt;
0030 class gp_Lin;
0031 class gp_Circ;
0032 class gp_Elips;
0033 class gp_Hypr;
0034 class gp_Parab;
0035 class Geom_Curve;
0036 class Geom2d_Curve;
0037 class Geom_Surface;
0038 class TopoDS_Edge;
0039 
0040 //! Provides methods to build edges.
0041 //!
0042 //! The methods have the following syntax, where
0043 //! TheCurve is one of Lin, Circ, ...
0044 //!
0045 //! Create(C : TheCurve)
0046 //!
0047 //! Makes an edge on the whole curve. Add vertices
0048 //! on finite curves.
0049 //!
0050 //! Create(C : TheCurve; p1,p2 : Real)
0051 //!
0052 //! Make an edge on the curve between parameters p1
0053 //! and p2. if p2 < p1 the edge will be REVERSED. If
0054 //! p1 or p2 is infinite the curve will be open in
0055 //! that direction. Vertices are created for finite
0056 //! values of p1 and p2.
0057 //!
0058 //! Create(C : TheCurve; P1, P2 : Pnt from gp)
0059 //!
0060 //! Make an edge on the curve between the points P1
0061 //! and P2. The points are projected on the curve
0062 //! and the previous method is used. An error is
0063 //! raised if the points are not on the curve.
0064 //!
0065 //! Create(C : TheCurve; V1, V2 : Vertex from TopoDS)
0066 //!
0067 //! Make an edge on the curve between the vertices
0068 //! V1 and V2. Same as the previous but no vertices
0069 //! are created. If a vertex is Null the curve will
0070 //! be open in this direction.
0071 class BRepBuilderAPI_MakeEdge : public BRepBuilderAPI_MakeShape
0072 {
0073 public:
0074   DEFINE_STANDARD_ALLOC
0075 
0076   Standard_EXPORT BRepBuilderAPI_MakeEdge();
0077 
0078   Standard_EXPORT BRepBuilderAPI_MakeEdge(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0079 
0080   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Pnt& P1, const gp_Pnt& P2);
0081 
0082   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L);
0083 
0084   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L, const double p1, const double p2);
0085 
0086   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L, const gp_Pnt& P1, const gp_Pnt& P2);
0087 
0088   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin&        L,
0089                                           const TopoDS_Vertex& V1,
0090                                           const TopoDS_Vertex& V2);
0091 
0092   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L);
0093 
0094   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L, const double p1, const double p2);
0095 
0096   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L, const gp_Pnt& P1, const gp_Pnt& P2);
0097 
0098   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ&       L,
0099                                           const TopoDS_Vertex& V1,
0100                                           const TopoDS_Vertex& V2);
0101 
0102   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L);
0103 
0104   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L, const double p1, const double p2);
0105 
0106   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L, const gp_Pnt& P1, const gp_Pnt& P2);
0107 
0108   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips&      L,
0109                                           const TopoDS_Vertex& V1,
0110                                           const TopoDS_Vertex& V2);
0111 
0112   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L);
0113 
0114   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L, const double p1, const double p2);
0115 
0116   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L, const gp_Pnt& P1, const gp_Pnt& P2);
0117 
0118   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr&       L,
0119                                           const TopoDS_Vertex& V1,
0120                                           const TopoDS_Vertex& V2);
0121 
0122   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L);
0123 
0124   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L, const double p1, const double p2);
0125 
0126   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L, const gp_Pnt& P1, const gp_Pnt& P2);
0127 
0128   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab&      L,
0129                                           const TopoDS_Vertex& V1,
0130                                           const TopoDS_Vertex& V2);
0131 
0132   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom_Curve>& L);
0133 
0134   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom_Curve>& L,
0135                                           const double                   p1,
0136                                           const double                   p2);
0137 
0138   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom_Curve>& L,
0139                                           const gp_Pnt&                  P1,
0140                                           const gp_Pnt&                  P2);
0141 
0142   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom_Curve>& L,
0143                                           const TopoDS_Vertex&           V1,
0144                                           const TopoDS_Vertex&           V2);
0145 
0146   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom_Curve>& L,
0147                                           const gp_Pnt&                  P1,
0148                                           const gp_Pnt&                  P2,
0149                                           const double                   p1,
0150                                           const double                   p2);
0151 
0152   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom_Curve>& L,
0153                                           const TopoDS_Vertex&           V1,
0154                                           const TopoDS_Vertex&           V2,
0155                                           const double                   p1,
0156                                           const double                   p2);
0157 
0158   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom2d_Curve>& L,
0159                                           const occ::handle<Geom_Surface>& S);
0160 
0161   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom2d_Curve>& L,
0162                                           const occ::handle<Geom_Surface>& S,
0163                                           const double                     p1,
0164                                           const double                     p2);
0165 
0166   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom2d_Curve>& L,
0167                                           const occ::handle<Geom_Surface>& S,
0168                                           const gp_Pnt&                    P1,
0169                                           const gp_Pnt&                    P2);
0170 
0171   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom2d_Curve>& L,
0172                                           const occ::handle<Geom_Surface>& S,
0173                                           const TopoDS_Vertex&             V1,
0174                                           const TopoDS_Vertex&             V2);
0175 
0176   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom2d_Curve>& L,
0177                                           const occ::handle<Geom_Surface>& S,
0178                                           const gp_Pnt&                    P1,
0179                                           const gp_Pnt&                    P2,
0180                                           const double                     p1,
0181                                           const double                     p2);
0182 
0183   //! The general method to directly create an edge is to give
0184   //! -      a 3D curve C as the support (geometric domain) of the edge,
0185   //! -      two vertices V1 and V2 to limit the curve (definition of the restriction of
0186   //! the edge), and
0187   //! -      two real values p1 and p2 which are the parameters for the vertices V1 and V2
0188   //! on the curve.
0189   //! The curve may be defined as a 2d curve in the parametric space of a surface: a
0190   //! pcurve. The surface on which the edge is built is then kept at the level of the edge.
0191   //! The default tolerance will be associated with this edge.
0192   //! Rules applied to the arguments:
0193   //! For the curve:
0194   //! -      The curve must not be a 'null handle'.
0195   //! -      If the curve is a trimmed curve the basis curve is used.
0196   //! For the vertices:
0197   //! -      Vertices may be null shapes. When V1 or V2 is null the edge is open in the
0198   //! corresponding direction and the parameter value p1 or p2 must be infinite
0199   //! (remember that Precision::Infinite() defines an infinite value).
0200   //! -      The two vertices must be identical if they have the same 3D location.
0201   //! Identical vertices are used in particular when the curve is closed.
0202   //! For the parameters:
0203   //! -      The parameters must be in the parametric range of the curve (or the basis
0204   //! curve if the curve is trimmed). If this condition is not satisfied the edge is not
0205   //! built, and the Error function will return BRepAPI_ParameterOutOfRange.
0206   //! -      Parameter values must not be equal. If this condition is not satisfied (i.e.
0207   //! if | p1 - p2 | ) the edge is not built, and the Error function will return
0208   //! BRepAPI_LineThroughIdenticPoints.
0209   //! Parameter values are expected to be given in increasing order:
0210   //! C->FirstParameter()
0211   //! - If the parameter values are given in decreasing order the vertices are switched,
0212   //! i.e. the "first vertex" is on the point of parameter p2 and the "second vertex" is
0213   //! on the point of parameter p1. In such a case, to keep the original intent of the
0214   //! construction, the edge will be oriented "reversed".
0215   //! - On a periodic curve the parameter values p1 and p2 are adjusted by adding or
0216   //! subtracting the period to obtain p1 in the parametric range of the curve, and p2]
0217   //! such that [ p1 , where Period is the period of the curve.
0218   //! - A parameter value may be infinite. The edge is open in the corresponding
0219   //! direction. However the corresponding vertex must be a null shape. If this condition
0220   //! is not satisfied the edge is not built, and the Error function will return
0221   //! BRepAPI_PointWithInfiniteParameter.
0222   //! - The distance between the vertex and the point evaluated on the curve with the
0223   //! parameter, must be lower than the precision of the vertex. If this condition is not
0224   //! satisfied the edge is not built, and the Error function will return
0225   //! BRepAPI_DifferentsPointAndParameter.
0226   //! Other edge constructions
0227   //! - The parameter values can be omitted, they will be computed by projecting the
0228   //! vertices on the curve. Note that projection is the only way to evaluate the
0229   //! parameter values of the vertices on the curve: vertices must be given on the curve,
0230   //! i.e. the distance from a vertex to the curve must be less than or equal to the
0231   //! precision of the vertex. If this condition is not satisfied the edge is not built,
0232   //! and the Error function will return BRepAPI_PointProjectionFailed.
0233   //! -      3D points can be given in place of vertices. Vertices will be created from the
0234   //! points (with the default topological precision Precision::Confusion()).
0235   //! Note:
0236   //! -      Giving vertices is useful when creating a connected edge.
0237   //! -      If the parameter values correspond to the extremities of a closed curve,
0238   //! points must be identical, or at least coincident. If this condition is not
0239   //! satisfied the edge is not built, and the Error function will return
0240   //! BRepAPI_DifferentPointsOnClosedCurve.
0241   //! -      The vertices or points can be omitted if the parameter values are given. The
0242   //! points will be computed from the parameters on the curve.
0243   //! The vertices or points and the parameter values can be omitted. The first and last
0244   //! parameters of the curve will then be used.
0245   //!
0246   //! Auxiliary methods
0247   Standard_EXPORT BRepBuilderAPI_MakeEdge(const occ::handle<Geom2d_Curve>& L,
0248                                           const occ::handle<Geom_Surface>& S,
0249                                           const TopoDS_Vertex&             V1,
0250                                           const TopoDS_Vertex&             V2,
0251                                           const double                     p1,
0252                                           const double                     p2);
0253 
0254   Standard_EXPORT void Init(const occ::handle<Geom_Curve>& C);
0255 
0256   Standard_EXPORT void Init(const occ::handle<Geom_Curve>& C, const double p1, const double p2);
0257 
0258   Standard_EXPORT void Init(const occ::handle<Geom_Curve>& C, const gp_Pnt& P1, const gp_Pnt& P2);
0259 
0260   Standard_EXPORT void Init(const occ::handle<Geom_Curve>& C,
0261                             const TopoDS_Vertex&           V1,
0262                             const TopoDS_Vertex&           V2);
0263 
0264   Standard_EXPORT void Init(const occ::handle<Geom_Curve>& C,
0265                             const gp_Pnt&                  P1,
0266                             const gp_Pnt&                  P2,
0267                             const double                   p1,
0268                             const double                   p2);
0269 
0270   Standard_EXPORT void Init(const occ::handle<Geom_Curve>& C,
0271                             const TopoDS_Vertex&           V1,
0272                             const TopoDS_Vertex&           V2,
0273                             const double                   p1,
0274                             const double                   p2);
0275 
0276   Standard_EXPORT void Init(const occ::handle<Geom2d_Curve>& C, const occ::handle<Geom_Surface>& S);
0277 
0278   Standard_EXPORT void Init(const occ::handle<Geom2d_Curve>& C,
0279                             const occ::handle<Geom_Surface>& S,
0280                             const double                     p1,
0281                             const double                     p2);
0282 
0283   Standard_EXPORT void Init(const occ::handle<Geom2d_Curve>& C,
0284                             const occ::handle<Geom_Surface>& S,
0285                             const gp_Pnt&                    P1,
0286                             const gp_Pnt&                    P2);
0287 
0288   Standard_EXPORT void Init(const occ::handle<Geom2d_Curve>& C,
0289                             const occ::handle<Geom_Surface>& S,
0290                             const TopoDS_Vertex&             V1,
0291                             const TopoDS_Vertex&             V2);
0292 
0293   Standard_EXPORT void Init(const occ::handle<Geom2d_Curve>& C,
0294                             const occ::handle<Geom_Surface>& S,
0295                             const gp_Pnt&                    P1,
0296                             const gp_Pnt&                    P2,
0297                             const double                     p1,
0298                             const double                     p2);
0299 
0300   //! Defines or redefines the arguments for the construction of an edge.
0301   //! This function is currently used after the empty constructor BRepAPI_MakeEdge().
0302   Standard_EXPORT void Init(const occ::handle<Geom2d_Curve>& C,
0303                             const occ::handle<Geom_Surface>& S,
0304                             const TopoDS_Vertex&             V1,
0305                             const TopoDS_Vertex&             V2,
0306                             const double                     p1,
0307                             const double                     p2);
0308 
0309   //! Returns true if the edge is built.
0310   Standard_EXPORT bool IsDone() const override;
0311 
0312   //! Returns the construction status
0313   //! -   BRepBuilderAPI_EdgeDone if the edge is built, or
0314   //! -   another value of the BRepBuilderAPI_EdgeError
0315   //! enumeration indicating the reason of construction failure.
0316   Standard_EXPORT BRepBuilderAPI_EdgeError Error() const;
0317 
0318   //! Returns the constructed edge.
0319   //! Exceptions StdFail_NotDone if the edge is not built.
0320   Standard_EXPORT const TopoDS_Edge& Edge();
0321   Standard_EXPORT                    operator TopoDS_Edge();
0322 
0323   //! Returns the first vertex of the edge. May be Null.
0324   Standard_EXPORT const TopoDS_Vertex& Vertex1() const;
0325 
0326   //! Returns the second vertex of the edge. May be Null.
0327   //!
0328   //! Warning
0329   //! The returned vertex in each function corresponds respectively to
0330   //! -   the lowest, or
0331   //! -   the highest parameter on the curve along which the edge is built.
0332   //! It does not correspond to the first or second vertex
0333   //! given at the time of the construction, if the edge is oriented reversed.
0334   //! Exceptions
0335   //! StdFail_NotDone if the edge is not built.
0336   Standard_EXPORT const TopoDS_Vertex& Vertex2() const;
0337 
0338 private:
0339   BRepLib_MakeEdge myMakeEdge;
0340 };
0341 
0342 #endif // _BRepBuilderAPI_MakeEdge_HeaderFile