Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-06-12
0002 // Created by: Joelle CHAUVET
0003 // Copyright (c) 1995-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 _ChFi2d_Builder_HeaderFile
0018 #define _ChFi2d_Builder_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <ChFi2d_ConstructionError.hxx>
0024 #include <TopoDS_Face.hxx>
0025 #include <TopTools_SequenceOfShape.hxx>
0026 #include <TopTools_DataMapOfShapeShape.hxx>
0027 #include <Standard_Integer.hxx>
0028 
0029 class TopoDS_Edge;
0030 class TopoDS_Vertex;
0031 
0032 // resolve name collisions with X11 headers
0033 #ifdef Status
0034   #undef Status
0035 #endif
0036 
0037 //! This  class contains  the algorithm  used to build
0038 //! fillet on planar wire.
0039 class ChFi2d_Builder 
0040 {
0041 public:
0042 
0043   DEFINE_STANDARD_ALLOC
0044 
0045   
0046   Standard_EXPORT ChFi2d_Builder();
0047   
0048   //! The face  <F> can be build  on a closed or an open
0049   //! wire.
0050   Standard_EXPORT ChFi2d_Builder(const TopoDS_Face& F);
0051   
0052   Standard_EXPORT void Init (const TopoDS_Face& F);
0053   
0054   Standard_EXPORT void Init (const TopoDS_Face& RefFace, const TopoDS_Face& ModFace);
0055   
0056   //! Add  a fillet  of   radius  <Radius> on  the  wire
0057   //! between the two edges connected to the vertex <V>.
0058   //! <AddFillet> returns the  fillet edge. The returned
0059   //! edge has  sense only   if the status   <status> is
0060   //! <IsDone>
0061   Standard_EXPORT TopoDS_Edge AddFillet (const TopoDS_Vertex& V, const Standard_Real Radius);
0062   
0063   //! modify the fillet radius and return the new fillet
0064   //! edge. this    edge has sense  only if   the status
0065   //! <status> is <IsDone>.
0066   Standard_EXPORT TopoDS_Edge ModifyFillet (const TopoDS_Edge& Fillet, const Standard_Real Radius);
0067   
0068   //! removes the fillet <Fillet> and returns the vertex
0069   //! connecting the two adjacent edges to  this fillet.
0070   Standard_EXPORT TopoDS_Vertex RemoveFillet (const TopoDS_Edge& Fillet);
0071   
0072   //! Add a chamfer on  the  wire between the two  edges
0073   //! connected <E1> and  <E2>. <AddChamfer> returns the
0074   //! chamfer  edge. This  edge  has  sense only if  the
0075   //! status <status> is <IsDone>.
0076   Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2);
0077   
0078   //! Add  a chamfer on the   wire between the two edges
0079   //! connected to the vertex <V>. The chamfer will make
0080   //! an  angle <Ang> with the edge  <E>, and one of its
0081   //! extremities  will be on  <E>  at distance <D>. The
0082   //! returned   edge has sense   only   if the   status
0083   //! <status> is <IsDone>.
0084   //! Warning: The value of <Ang> must be expressed in Radian.
0085   Standard_EXPORT TopoDS_Edge AddChamfer (const TopoDS_Edge& E, const TopoDS_Vertex& V, const Standard_Real D, const Standard_Real Ang);
0086   
0087   //! modify the chamfer <Chamfer>  and returns  the new
0088   //! chamfer edge.
0089   //! This edge as sense only  if the status <status> is
0090   //! <IsDone>.
0091   Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2);
0092   
0093   //! modify the  chamfer <Chamfer>  and returns the new
0094   //! chamfer edge. This    edge as sense  only   if the
0095   //! status <status>   is  <IsDone>.
0096   //! Warning: The value of <Ang> must be expressed in Radian.
0097   Standard_EXPORT TopoDS_Edge ModifyChamfer (const TopoDS_Edge& Chamfer, const TopoDS_Edge& E, const Standard_Real D, const Standard_Real Ang);
0098   
0099   //! removes   the chamfer  <Chamfer>   and returns the
0100   //! vertex connecting  the two adjacent  edges to this
0101   //! chamfer.
0102   Standard_EXPORT TopoDS_Vertex RemoveChamfer (const TopoDS_Edge& Chamfer);
0103   
0104   //! returns the modified face
0105     TopoDS_Face Result() const;
0106   
0107     Standard_Boolean IsModified (const TopoDS_Edge& E) const;
0108   
0109   //! returns the list of new edges
0110     const TopTools_SequenceOfShape& FilletEdges() const;
0111   
0112     Standard_Integer NbFillet() const;
0113   
0114   //! returns the list of new edges
0115     const TopTools_SequenceOfShape& ChamferEdges() const;
0116   
0117     Standard_Integer NbChamfer() const;
0118   
0119     Standard_Boolean HasDescendant (const TopoDS_Edge& E) const;
0120   
0121   //! returns the modified edge if <E> has descendant or
0122   //! <E> in the other case.
0123     const TopoDS_Edge& DescendantEdge (const TopoDS_Edge& E) const;
0124   
0125   //! Returns the parent edge of  <E>
0126   //! Warning: If <E>is a basis edge,  the returned edge would be
0127   //! equal to <E>
0128   Standard_EXPORT const TopoDS_Edge& BasisEdge (const TopoDS_Edge& E) const;
0129   
0130     ChFi2d_ConstructionError Status() const;
0131 
0132 
0133 
0134 
0135 protected:
0136 
0137 
0138 
0139 
0140 
0141 private:
0142 
0143   
0144   //! Is internally used by <AddFillet>.
0145   //! Warning: <TrimE1>, <TrimE2>, <Fillet> has sense only if the
0146   //! status <status> is equal to <IsDone>
0147   Standard_EXPORT void ComputeFillet (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real Radius, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Fillet);
0148   
0149   //! Is internally used by  <AddChamfer>. The chamfer is
0150   //! computed  from  a  vertex,   two  edges   and  two
0151   //! distances
0152   //! Warning: <TrimE1>, <TrimE2> and <Chamfer> has sense only if
0153   //! if the status <status> is equal to <IsDone>
0154   Standard_EXPORT void ComputeChamfer (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real D1, const Standard_Real D2, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Chamfer);
0155   
0156   //! Is internally used by <AddChamfer>.  The chamfer is
0157   //! computed from   an  edge,  a  vertex,   a distance
0158   //! and an angle
0159   //! Warning: <TrimE1>,  <TrimE2>, and <Chamfer> has
0160   //! sense only   if  the status <status> is   equal to
0161   //! <IsDone>
0162   Standard_EXPORT void ComputeChamfer (const TopoDS_Vertex& V, const TopoDS_Edge& E1, const Standard_Real D, const Standard_Real Ang, const TopoDS_Edge& E2, TopoDS_Edge& TrimE1, TopoDS_Edge& TrimE2, TopoDS_Edge& Chamfer);
0163   
0164   //! Is   internally  used     by  <ComputeFillet>.
0165   //! <NewExtr1> and  <NewExtr2>  will  contains the new
0166   //! extremities of <AdjEdge1> and <AdjEdge2>
0167   //! Warning: The  returned  edge has sense   only if the status
0168   //! <status> is equal to <IsDone>
0169   //! or to one of those specific cases :
0170   //! <FirstEdgeDegenerated>
0171   //! <LastEdgeDegenerated>
0172   //! <BothEdgesDegenerated>
0173   Standard_EXPORT TopoDS_Edge BuildFilletEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge1, const TopoDS_Edge& AdjEdge2, const Standard_Real Radius, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2);
0174   
0175   //! Is   internally  used     by  <ComputeFillet>.
0176   //! <NewExtr1> and  <NewExtr2>  will  contains the new
0177   //! extremities of <AdjEdge1> and <AdjEdge2>
0178   //! Warning: The  returned  edge has sense   only if the status
0179   //! <status> is equal to <IsDone>
0180   Standard_EXPORT TopoDS_Edge BuildChamferEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge1, const TopoDS_Edge& AdjEdge2, const Standard_Real D1, const Standard_Real D2, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2);
0181   
0182   //! Is   internally  used     by  <ComputeFillet>.
0183   //! <NewExtr1> and  <NewExtr2>  will  contains the new
0184   //! extremities of <AdjEdge1> and <AdjEdge2>
0185   //! Warning: The  returned  edge has sense   only if the status
0186   //! <status> is equal to <IsDone>
0187   Standard_EXPORT TopoDS_Edge BuildChamferEdge (const TopoDS_Vertex& V, const TopoDS_Edge& AdjEdge2, const Standard_Real D, const Standard_Real Ang, const TopoDS_Edge& AdjEdge1, TopoDS_Vertex& NewExtr1, TopoDS_Vertex& NewExtr2);
0188   
0189   //! replaces in  the  new face  <newFace> <OldE1>  and
0190   //! <OldE2>  by <E1>, <Fillet> and <E2>
0191   //! or by <Fillet> and <E2> if <E1> is degenerated
0192   //! or by <E1> and <Fillet> if <E2> is degenerated
0193   //! or by <Fillet> if <E1> and <E2> are degenerated .
0194   Standard_EXPORT void BuildNewWire (const TopoDS_Edge& OldE1, const TopoDS_Edge& OldE2, const TopoDS_Edge& E1, const TopoDS_Edge& Fillet, const TopoDS_Edge& E2);
0195   
0196   //! Changes <OldExtr> of <E1> by <NewExtr>
0197   Standard_EXPORT TopoDS_Edge BuildNewEdge (const TopoDS_Edge& E1, const TopoDS_Vertex& OldExtr, const TopoDS_Vertex& NewExtr) const;
0198   
0199   //! Changes <OldExtr> of <E1> by <NewExtr>
0200   //! returns E1 and IsDegenerated = Standard_True
0201   //! if the new edge is degenerated
0202   Standard_EXPORT TopoDS_Edge BuildNewEdge (const TopoDS_Edge& E1, const TopoDS_Vertex& OldExtr, const TopoDS_Vertex& NewExtr, Standard_Boolean& IsDegenerated) const;
0203   
0204   //! Writes <NewEdge> in  <fillets> if <Id> is equal to
0205   //! 1, or in <chamfers> if <Id> is Equal to 2.
0206   //! Writes  the  modifications  in  <history> :
0207   //! <TrimE1> is given by <E1>, <TrimE2> by <E2>
0208   //! if <TrimE1> and <TrimE2> are not degenerated.
0209   Standard_EXPORT void UpDateHistory (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& TrimE1, const TopoDS_Edge& TrimE2, const TopoDS_Edge& NewEdge, const Standard_Integer Id);
0210   
0211   //! Writes the  modifications in  <history> . <TrimE1>
0212   //! is given by <E1>, <TrimE2> by <E2>.
0213   Standard_EXPORT void UpDateHistory (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const TopoDS_Edge& TrimE1, const TopoDS_Edge& TrimE2);
0214   
0215   Standard_EXPORT Standard_Boolean IsAFillet (const TopoDS_Edge& E) const;
0216   
0217   Standard_EXPORT Standard_Boolean IsAChamfer (const TopoDS_Edge& E) const;
0218 
0219 
0220   ChFi2d_ConstructionError status;
0221   TopoDS_Face refFace;
0222   TopoDS_Face newFace;
0223   TopTools_SequenceOfShape fillets;
0224   TopTools_SequenceOfShape chamfers;
0225   TopTools_DataMapOfShapeShape history;
0226 
0227 
0228 };
0229 
0230 
0231 #include <ChFi2d_Builder.lxx>
0232 
0233 
0234 
0235 
0236 
0237 #endif // _ChFi2d_Builder_HeaderFile