|
|
|||
Warning, file /include/opencascade/ShapeFix_ComposeShell.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // Created on: 1999-04-26 0002 // Created by: Andrey BETENEV 0003 // Copyright (c) 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 _ShapeFix_ComposeShell_HeaderFile 0018 #define _ShapeFix_ComposeShell_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <TopLoc_Location.hxx> 0024 #include <TopoDS_Face.hxx> 0025 #include <TopAbs_Orientation.hxx> 0026 #include <TopoDS_Shape.hxx> 0027 #include <Standard_Integer.hxx> 0028 #include <ShapeFix_Root.hxx> 0029 #include <ShapeExtend_Status.hxx> 0030 #include <ShapeFix_WireSegment.hxx> 0031 #include <NCollection_Sequence.hxx> 0032 class ShapeExtend_CompositeSurface; 0033 class ShapeAnalysis_TransferParameters; 0034 class ShapeExtend_WireData; 0035 class gp_Lin2d; 0036 class ShapeFix_WireSegment; 0037 class Geom_Surface; 0038 0039 // resolve name collisions with X11 headers 0040 #ifdef Status 0041 #undef Status 0042 #endif 0043 0044 //! This class is intended to create a shell from the composite 0045 //! surface (grid of surfaces) and set of wires. 0046 //! It may be either division of the supporting surface of the 0047 //! face, or creating a shape corresponding to face on composite 0048 //! surface which is missing in CAS.CADE but exists in some other 0049 //! systems. 0050 //! 0051 //! It splits (if necessary) original face to several ones by 0052 //! splitting lines which are joint lines on a supplied grid of 0053 //! surfaces (U- and V- isolines of the composite surface). 0054 //! There are two modes of work, which differ in the way of 0055 //! handling faces on periodic surfaces: 0056 //! 0057 //! - if ClosedMode is False (default), when splitting itself is 0058 //! done as if surface were not periodic. The periodicity of the 0059 //! underlying surface is taken into account by duplicating splitting 0060 //! lines in the periodic direction, as necessary to split all 0061 //! the wires (whole parametrical range of a face) 0062 //! In this mode, some regularization procedures are performed 0063 //! (indexation of split segments by patch numbers), and it is 0064 //! expected to be more reliable and robust in case of bad shapes 0065 //! 0066 //! - if ClosedMode is True, when everything on a periodic surfaces 0067 //! is considered as modulo period. This allows to deal with wires 0068 //! which are closed in 3d but not in 2d, with wires which may be 0069 //! shifted on several periods in 2d etc. However, this mode is 0070 //! less reliable since some regularizations do not work for it. 0071 //! 0072 //! The work is made basing on pcurves of the edges. These pcurves 0073 //! should already exist (for example, in the case of division of 0074 //! existing face), then they are taken as is. The existing pcurves 0075 //! should be assigned to one surface (face) for all edges, 0076 //! this surface (face) will be used only for accessing pcurves, 0077 //! and it may have any geometry. 0078 //! 0079 //! All the modifications are recorded in the context tool 0080 //! (ShapeBuild_ReShape). 0081 class ShapeFix_ComposeShell : public ShapeFix_Root 0082 { 0083 0084 public: 0085 //! Creates empty tool. 0086 Standard_EXPORT ShapeFix_ComposeShell(); 0087 0088 //! Initializes with composite surface, face and precision. 0089 //! Here face defines both set of wires and way of getting 0090 //! pcurves. Precision is used (together with tolerance of edges) 0091 //! for handling subtle cases, such as tangential intersections. 0092 Standard_EXPORT void Init(const occ::handle<ShapeExtend_CompositeSurface>& Grid, 0093 const TopLoc_Location& L, 0094 const TopoDS_Face& Face, 0095 const double Prec); 0096 0097 //! Returns (modifiable) flag for special 'closed' 0098 //! mode which forces ComposeShell to consider 0099 //! all pcurves on closed surface as modulo period. 0100 //! This can reduce reliability, but allows to deal 0101 //! with wires closed in 3d but open in 2d (missing seam) 0102 //! Default is False 0103 Standard_EXPORT bool& ClosedMode(); 0104 0105 //! Performs the work on already loaded data. 0106 Standard_EXPORT virtual bool Perform(); 0107 0108 //! Splits edges in the original shape by grid. 0109 //! This is a part of Perform() which does not produce any 0110 //! resulting shape; the only result is filled context 0111 //! where splittings are recorded. 0112 //! 0113 //! NOTE: If edge is split, it is replaced by wire, and 0114 //! order of edges in the wire corresponds to FORWARD orientation 0115 //! of the edge. 0116 Standard_EXPORT void SplitEdges(); 0117 0118 //! Returns resulting shell or face (or Null shape if not done) 0119 Standard_EXPORT const TopoDS_Shape& Result() const; 0120 0121 //! Queries status of last call to Perform() 0122 //! OK : nothing done (some kind of error) 0123 //! DONE1: splitting is done, at least one new face created 0124 //! DONE2: splitting is done, several new faces obtained 0125 //! FAIL1: misoriented wire encountered (handled) 0126 //! FAIL2: recoverable parity error 0127 //! FAIL3: edge with no pcurve on supporting face 0128 //! FAIL4: unrecoverable algorithm error (parity check) 0129 Standard_EXPORT bool Status(const ShapeExtend_Status status) const; 0130 0131 //! Creates new faces from the set of (closed) wires. Each wire 0132 //! is put on corresponding patch in the composite surface, 0133 //! and all pcurves on the initial (pseudo)face are reassigned to 0134 //! that surface. If several wires are one inside another, single 0135 //! face is created. 0136 Standard_EXPORT void DispatchWires(NCollection_Sequence<TopoDS_Shape>& faces, 0137 NCollection_Sequence<ShapeFix_WireSegment>& wires) const; 0138 0139 //! Sets tool for transfer parameters from 3d to 2d and vice versa. 0140 Standard_EXPORT void SetTransferParamTool( 0141 const occ::handle<ShapeAnalysis_TransferParameters>& TransferParam); 0142 0143 //! Gets tool for transfer parameters from 3d to 2d and vice versa. 0144 Standard_EXPORT occ::handle<ShapeAnalysis_TransferParameters> GetTransferParamTool() const; 0145 0146 DEFINE_STANDARD_RTTIEXT(ShapeFix_ComposeShell, ShapeFix_Root) 0147 0148 protected: 0149 //! Fill sequence of wire segments by wires from myFace 0150 //! (pre-loaded). It performs reorder so that edges in segments 0151 //! are well-ordered. The context is applied to all wires 0152 //! before using them. 0153 Standard_EXPORT void LoadWires(NCollection_Sequence<ShapeFix_WireSegment>& seqw) const; 0154 0155 //! Analyze tangencies and compute orientation code for wire segment 0156 //! between two intersections: tells if segment is on left or right side 0157 //! of cutting line, or tangent to it (by several points recomputed to 3d, 0158 //! distance is compared with tolerance of corresponding edge). 0159 Standard_EXPORT int ComputeCode(const occ::handle<ShapeExtend_WireData>& wire, 0160 const gp_Lin2d& line, 0161 const int begInd, 0162 const int endInd, 0163 const double begPar, 0164 const double endPar, 0165 const bool IsInternal = false); 0166 0167 //! Splits edges in the wire by given indices of edges and 0168 //! parameters on them. Returns resulting wire and vertices 0169 //! corresponding to splitting parameters. If two consecutive 0170 //! splitting points are too near one to another (with tolerance 0171 //! of edge), edge is divided in single point. In the same way, 0172 //! splitting which is too near to end of edge, is not applied 0173 //! (end vertex is returned instead). 0174 //! 0175 //! NOTE: If edge is split, it is replaced by wire, and 0176 //! order of edges in the wire corresponds to FORWARD orientation 0177 //! of the edge. 0178 Standard_EXPORT ShapeFix_WireSegment SplitWire(ShapeFix_WireSegment& wire, 0179 NCollection_Sequence<int>& indexes, 0180 const NCollection_Sequence<double>& values, 0181 NCollection_Sequence<TopoDS_Shape>& vertices, 0182 const NCollection_Sequence<int>& segcodes, 0183 const bool cutbyu, 0184 const int cutindex); 0185 0186 //! Split edges in the wire by cutting line. 0187 //! Wires with FORWARD or REVERSED orientation are considered 0188 //! as closed. 0189 //! 0190 //! All modifications (splitting) are recorded in context, 0191 //! except splitting of wires marked as EXTERNAL 0192 //! (they are supposed to be former cutting lines). 0193 //! 0194 //! Method fills sequences of parameters of intersection points 0195 //! of cutting line with all edges, their types, and corresponding 0196 //! vertices (including ones created during splitting edges). 0197 Standard_EXPORT bool SplitByLine(ShapeFix_WireSegment& wire, 0198 const gp_Lin2d& line, 0199 const bool cutbyu, 0200 const int cutindex, 0201 NCollection_Sequence<double>& SplitLinePar, 0202 NCollection_Sequence<int>& SplitLineCode, 0203 NCollection_Sequence<TopoDS_Shape>& SplitLineVertex); 0204 0205 //! Split edges in the sequence of wires by cutting line. 0206 //! Wires with FORWARD or REVERSED orientation are considered 0207 //! as closed. 0208 //! 0209 //! Parts of cutting line which get inside the face (defined by 0210 //! parity check of intersections with all wires) are added 0211 //! into that sequence (with orientation EXTERNAL). Each part 0212 //! is represented by one-edge wire segment with no 3d curve. 0213 //! They share common vertices with all wires they intersect. 0214 //! 0215 //! All modifications (splitting) are recorded in context, 0216 //! except splitting of wires marked as EXTERNAL 0217 //! (they are supposed to be former cutting lines). 0218 Standard_EXPORT void SplitByLine(NCollection_Sequence<ShapeFix_WireSegment>& seqw, 0219 const gp_Lin2d& line, 0220 const bool cutbyu, 0221 const int cutindex); 0222 0223 //! Split initial set of (closed) wires by grid of lines corresponding 0224 //! to joints between patches on the composite surface. 0225 //! Parts of joint lines which get inside the face are also added 0226 //! into the sequence as wires with orientation EXTERNAL. 0227 //! They share common vertices with all wires they intersect. 0228 //! All modifications (splitting) are recorded in context, 0229 //! except splitting of joint edge itself and wires marked as 0230 //! EXTERNAL (they supposed to be another joint edges). 0231 Standard_EXPORT void SplitByGrid(NCollection_Sequence<ShapeFix_WireSegment>& seqw); 0232 0233 //! Break wires into open wire segments by common vertices 0234 //! (splitting points), so that each segment is either closed and 0235 //! not touching others, or touches others at ends (have common 0236 //! vertices). 0237 //! After that, each wire segment lies on its own patch of grid. 0238 Standard_EXPORT void BreakWires(NCollection_Sequence<ShapeFix_WireSegment>& seqw); 0239 0240 //! Collect set of wire segments (already split) into closed 0241 //! wires. This is done by traversing all the segments in allowed 0242 //! directions, starting only from the REVERSED and FORWARD and 0243 //! taking EXTERNAL as necessary in fork points. Forks are detected 0244 //! by common vertices. In fork point, most left way is selected 0245 //! among all possible ways. 0246 Standard_EXPORT void CollectWires(NCollection_Sequence<ShapeFix_WireSegment>& wires, 0247 NCollection_Sequence<ShapeFix_WireSegment>& seqw); 0248 0249 //! Creates new faces on one path of grid. It dispatches given loops 0250 //! (wires) into one or several faces depending on their mutual 0251 //! position. 0252 Standard_EXPORT void MakeFacesOnPatch(NCollection_Sequence<TopoDS_Shape>& faces, 0253 const occ::handle<Geom_Surface>& surf, 0254 NCollection_Sequence<TopoDS_Shape>& loops) const; 0255 0256 TopAbs_Orientation myOrient; 0257 TopoDS_Shape myResult; 0258 int myStatus; 0259 0260 private: 0261 occ::handle<ShapeExtend_CompositeSurface> myGrid; 0262 TopLoc_Location myLoc; 0263 TopoDS_Face myFace; 0264 double myUResolution; 0265 double myVResolution; 0266 occ::handle<ShapeAnalysis_TransferParameters> myTransferParamTool; 0267 bool myInvertEdgeStatus; 0268 bool myClosedMode; 0269 bool myUClosed; 0270 bool myVClosed; 0271 double myUPeriod; 0272 double myVPeriod; 0273 }; 0274 0275 #endif // _ShapeFix_ComposeShell_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|