Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:09

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 
0041 //! Provides methods to build edges.
0042 //!
0043 //! The   methods have  the  following   syntax, where
0044 //! TheCurve is one of Lin, Circ, ...
0045 //!
0046 //! Create(C : TheCurve)
0047 //!
0048 //! Makes an edge on  the whole curve.  Add vertices
0049 //! on finite curves.
0050 //!
0051 //! Create(C : TheCurve; p1,p2 : Real)
0052 //!
0053 //! Make an edge  on the curve between parameters p1
0054 //! and p2. if p2 < p1 the edge will be REVERSED. If
0055 //! p1  or p2 is infinite the  curve will be open in
0056 //! that  direction. Vertices are created for finite
0057 //! values of p1 and p2.
0058 //!
0059 //! Create(C : TheCurve; P1, P2 : Pnt from gp)
0060 //!
0061 //! Make an edge on the curve  between the points P1
0062 //! and P2. The  points are projected on   the curve
0063 //! and the   previous method is  used. An  error is
0064 //! raised if the points are not on the curve.
0065 //!
0066 //! Create(C : TheCurve; V1, V2 : Vertex from TopoDS)
0067 //!
0068 //! Make an edge  on the curve  between the vertices
0069 //! V1 and V2. Same as the  previous but no vertices
0070 //! are created. If a vertex is  Null the curve will
0071 //! be open in this direction.
0072 class BRepBuilderAPI_MakeEdge  : public BRepBuilderAPI_MakeShape
0073 {
0074 public:
0075 
0076   DEFINE_STANDARD_ALLOC
0077 
0078   
0079   Standard_EXPORT BRepBuilderAPI_MakeEdge();
0080   
0081   Standard_EXPORT BRepBuilderAPI_MakeEdge(const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0082   
0083   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Pnt& P1, const gp_Pnt& P2);
0084   
0085   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L);
0086   
0087   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L, const Standard_Real p1, const Standard_Real p2);
0088   
0089   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L, const gp_Pnt& P1, const gp_Pnt& P2);
0090   
0091   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Lin& L, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0092   
0093   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L);
0094   
0095   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L, const Standard_Real p1, const Standard_Real p2);
0096   
0097   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L, const gp_Pnt& P1, const gp_Pnt& P2);
0098   
0099   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Circ& L, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0100   
0101   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L);
0102   
0103   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L, const Standard_Real p1, const Standard_Real p2);
0104   
0105   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L, const gp_Pnt& P1, const gp_Pnt& P2);
0106   
0107   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Elips& L, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0108   
0109   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L);
0110   
0111   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L, const Standard_Real p1, const Standard_Real p2);
0112   
0113   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L, const gp_Pnt& P1, const gp_Pnt& P2);
0114   
0115   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Hypr& L, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0116   
0117   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L);
0118   
0119   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L, const Standard_Real p1, const Standard_Real p2);
0120   
0121   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L, const gp_Pnt& P1, const gp_Pnt& P2);
0122   
0123   Standard_EXPORT BRepBuilderAPI_MakeEdge(const gp_Parab& L, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0124   
0125   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L);
0126   
0127   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, const Standard_Real p1, const Standard_Real p2);
0128   
0129   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, const gp_Pnt& P1, const gp_Pnt& P2);
0130   
0131   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0132   
0133   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Real p1, const Standard_Real p2);
0134   
0135   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom_Curve)& L, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2, const Standard_Real p1, const Standard_Real p2);
0136   
0137   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, const Handle(Geom_Surface)& S);
0138   
0139   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, const Handle(Geom_Surface)& S, const Standard_Real p1, const Standard_Real p2);
0140   
0141   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, const Handle(Geom_Surface)& S, const gp_Pnt& P1, const gp_Pnt& P2);
0142   
0143   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, const Handle(Geom_Surface)& S, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0144   
0145   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, const Handle(Geom_Surface)& S, const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Real p1, const Standard_Real p2);
0146   
0147   //! The general method to directly create an edge is to give
0148   //! -      a 3D curve C as the support (geometric domain) of the edge,
0149   //! -      two vertices V1 and V2 to limit the curve (definition of the restriction of
0150   //! the edge), and
0151   //! -      two real values p1 and p2 which are the parameters for the vertices V1 and V2
0152   //! on the curve.
0153   //! The curve may be defined as a 2d curve in the parametric space of a surface: a
0154   //! pcurve. The surface on which the edge is built is then kept at the level of the edge.
0155   //! The default tolerance will be associated with this edge.
0156   //! Rules applied to the arguments:
0157   //! For the curve:
0158   //! -      The curve must not be a 'null handle'.
0159   //! -      If the curve is a trimmed curve the basis curve is used.
0160   //! For the vertices:
0161   //! -      Vertices may be null shapes. When V1 or V2 is null the edge is open in the
0162   //! corresponding direction and the parameter value p1 or p2 must be infinite
0163   //! (remember that Precision::Infinite() defines an infinite value).
0164   //! -      The two vertices must be identical if they have the same 3D location.
0165   //! Identical vertices are used in particular when the curve is closed.
0166   //! For the parameters:
0167   //! -      The parameters must be in the parametric range of the curve (or the basis
0168   //! curve if the curve is trimmed). If this condition is not satisfied the edge is not
0169   //! built, and the Error function will return BRepAPI_ParameterOutOfRange.
0170   //! -      Parameter values must not be equal. If this condition is not satisfied (i.e.
0171   //! if | p1 - p2 | ) the edge is not built, and the Error function will return
0172   //! BRepAPI_LineThroughIdenticPoints.
0173   //! Parameter values are expected to be given in increasing order:
0174   //! C->FirstParameter()
0175   //! - If the parameter values are given in decreasing order the vertices are switched,
0176   //! i.e. the "first vertex" is on the point of parameter p2 and the "second vertex" is
0177   //! on the point of parameter p1. In such a case, to keep the original intent of the
0178   //! construction, the edge will be oriented "reversed".
0179   //! - On a periodic curve the parameter values p1 and p2 are adjusted by adding or
0180   //! subtracting the period to obtain p1 in the parametric range of the curve, and p2]
0181   //! such that [ p1 , where Period is the period of the curve.
0182   //! - A parameter value may be infinite. The edge is open in the corresponding
0183   //! direction. However the corresponding vertex must be a null shape. If this condition
0184   //! is not satisfied the edge is not built, and the Error function will return
0185   //! BRepAPI_PointWithInfiniteParameter.
0186   //! - The distance between the vertex and the point evaluated on the curve with the
0187   //! parameter, must be lower than the precision of the vertex. If this condition is not
0188   //! satisfied the edge is not built, and the Error function will return
0189   //! BRepAPI_DifferentsPointAndParameter.
0190   //! Other edge constructions
0191   //! - The parameter values can be omitted, they will be computed by projecting the
0192   //! vertices on the curve. Note that projection is the only way to evaluate the
0193   //! parameter values of the vertices on the curve: vertices must be given on the curve,
0194   //! i.e. the distance from a vertex to the curve must be less than or equal to the
0195   //! precision of the vertex. If this condition is not satisfied the edge is not built,
0196   //! and the Error function will return BRepAPI_PointProjectionFailed.
0197   //! -      3D points can be given in place of vertices. Vertices will be created from the
0198   //! points (with the default topological precision Precision::Confusion()).
0199   //! Note:
0200   //! -      Giving vertices is useful when creating a connected edge.
0201   //! -      If the parameter values correspond to the extremities of a closed curve,
0202   //! points must be identical, or at least coincident. If this condition is not
0203   //! satisfied the edge is not built, and the Error function will return
0204   //! BRepAPI_DifferentPointsOnClosedCurve.
0205   //! -      The vertices or points can be omitted if the parameter values are given. The
0206   //! points will be computed from the parameters on the curve.
0207   //! The vertices or points and the parameter values can be omitted. The first and last
0208   //! parameters of the curve will then be used.
0209   //!
0210   //! Auxiliary methods
0211   Standard_EXPORT BRepBuilderAPI_MakeEdge(const Handle(Geom2d_Curve)& L, const Handle(Geom_Surface)& S, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2, const Standard_Real p1, const Standard_Real p2);
0212   
0213   Standard_EXPORT void Init (const Handle(Geom_Curve)& C);
0214   
0215   Standard_EXPORT void Init (const Handle(Geom_Curve)& C, const Standard_Real p1, const Standard_Real p2);
0216   
0217   Standard_EXPORT void Init (const Handle(Geom_Curve)& C, const gp_Pnt& P1, const gp_Pnt& P2);
0218   
0219   Standard_EXPORT void Init (const Handle(Geom_Curve)& C, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0220   
0221   Standard_EXPORT void Init (const Handle(Geom_Curve)& C, const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Real p1, const Standard_Real p2);
0222   
0223   Standard_EXPORT void Init (const Handle(Geom_Curve)& C, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2, const Standard_Real p1, const Standard_Real p2);
0224   
0225   Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S);
0226   
0227   Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const Standard_Real p1, const Standard_Real p2);
0228   
0229   Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const gp_Pnt& P1, const gp_Pnt& P2);
0230   
0231   Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
0232   
0233   Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Real p1, const Standard_Real p2);
0234   
0235   //! Defines or redefines the arguments for the construction of an edge.
0236   //! This function is currently used after the empty constructor BRepAPI_MakeEdge().
0237   Standard_EXPORT void Init (const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2, const Standard_Real p1, const Standard_Real p2);
0238   
0239   //! Returns true if the edge is built.
0240   Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE;
0241   
0242   //! Returns the construction status
0243   //! -   BRepBuilderAPI_EdgeDone if the edge is built, or
0244   //! -   another value of the BRepBuilderAPI_EdgeError
0245   //! enumeration indicating the reason of construction failure.
0246   Standard_EXPORT BRepBuilderAPI_EdgeError Error() const;
0247   
0248 
0249   //! Returns the constructed edge.
0250   //! Exceptions StdFail_NotDone if the edge is not built.
0251   Standard_EXPORT const TopoDS_Edge& Edge();
0252   Standard_EXPORT operator TopoDS_Edge();
0253   
0254   //! Returns the first vertex of the edge. May be Null.
0255   Standard_EXPORT const TopoDS_Vertex& Vertex1() const;
0256   
0257   //! Returns the second vertex of the edge. May be Null.
0258   //!
0259   //! Warning
0260   //! The returned vertex in each function corresponds respectively to
0261   //! -   the lowest, or
0262   //! -   the highest parameter on the curve along which the edge is built.
0263   //! It does not correspond to the first or second vertex
0264   //! given at the time of the construction, if the edge is oriented reversed.
0265   //! Exceptions
0266   //! StdFail_NotDone if the edge is not built.
0267   Standard_EXPORT const TopoDS_Vertex& Vertex2() const;
0268 
0269 
0270 
0271 
0272 protected:
0273 
0274 
0275 
0276 
0277 
0278 private:
0279 
0280 
0281 
0282   BRepLib_MakeEdge myMakeEdge;
0283 
0284 
0285 };
0286 
0287 
0288 
0289 
0290 
0291 
0292 
0293 #endif // _BRepBuilderAPI_MakeEdge_HeaderFile