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