Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:54

0001 // Created on: 1998-06-08
0002 // Created by: data exchange team
0003 // Copyright (c) 1998-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 _ShapeAnalysis_Edge_HeaderFile
0018 #define _ShapeAnalysis_Edge_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <ShapeExtend_Status.hxx>
0026 class TopoDS_Edge;
0027 class Geom_Curve;
0028 class TopoDS_Face;
0029 class Geom_Surface;
0030 class TopLoc_Location;
0031 class Geom2d_Curve;
0032 class gp_Pnt2d;
0033 class TopoDS_Vertex;
0034 class gp_Vec2d;
0035 class gp_Pnt;
0036 
0037 // resolve name collisions with X11 headers
0038 #ifdef Status
0039   #undef Status
0040 #endif
0041 
0042 //! Tool for analyzing the edge.
0043 //! Queries geometrical representations of the edge (3d curve, pcurve
0044 //! on the given face or surface) and topological sub-shapes (bounding
0045 //! vertices).
0046 //! Provides methods for analyzing geometry and topology consistency
0047 //! (3d and pcurve(s) consistency, their adjacency to the vertices).
0048 class ShapeAnalysis_Edge 
0049 {
0050 public:
0051 
0052   DEFINE_STANDARD_ALLOC
0053 
0054   
0055   //! Empty constructor; initialises Status to OK
0056   Standard_EXPORT ShapeAnalysis_Edge();
0057   
0058   //! Tells if the edge has a 3d curve
0059   Standard_EXPORT Standard_Boolean HasCurve3d (const TopoDS_Edge& edge) const;
0060   
0061   //! Returns the 3d curve and bounding parameteres for the edge
0062   //! Returns False if no 3d curve.
0063   //! If <orient> is True (default), takes orientation into account:
0064   //! if the edge is reversed, cf and cl are toggled
0065   Standard_EXPORT Standard_Boolean Curve3d (const TopoDS_Edge& edge, Handle(Geom_Curve)& C3d, Standard_Real& cf, Standard_Real& cl, const Standard_Boolean orient = Standard_True) const;
0066   
0067   //! Gives True if the edge has a 3d curve, this curve is closed,
0068   //! and the edge has the same vertex at start and end
0069   Standard_EXPORT Standard_Boolean IsClosed3d (const TopoDS_Edge& edge) const;
0070   
0071   //! Tells if the Edge has a pcurve on the face.
0072   Standard_EXPORT Standard_Boolean HasPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face) const;
0073   
0074   //! Tells if the edge has a pcurve on the surface (with location).
0075   Standard_EXPORT Standard_Boolean HasPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location) const;
0076   
0077   Standard_EXPORT Standard_Boolean PCurve (const TopoDS_Edge& edge, const TopoDS_Face& face, Handle(Geom2d_Curve)& C2d, Standard_Real& cf, Standard_Real& cl, const Standard_Boolean orient = Standard_True) const;
0078   
0079   //! Returns the pcurve and bounding parameteres for the edge
0080   //! lying on the surface.
0081   //! Returns False if the edge has no pcurve on this surface.
0082   //! If <orient> is True (default), takes orientation into account:
0083   //! if the edge is reversed, cf and cl are toggled
0084   Standard_EXPORT Standard_Boolean PCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, Handle(Geom2d_Curve)& C2d, Standard_Real& cf, Standard_Real& cl, const Standard_Boolean orient = Standard_True) const;
0085   
0086   Standard_EXPORT Standard_Boolean BoundUV (const TopoDS_Edge& edge, const TopoDS_Face& face, gp_Pnt2d& first, gp_Pnt2d& last) const;
0087   
0088   //! Returns the ends of pcurve
0089   //! Calls method PCurve with <orient> equal to True
0090   Standard_EXPORT Standard_Boolean BoundUV (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, gp_Pnt2d& first, gp_Pnt2d& last) const;
0091   
0092   Standard_EXPORT Standard_Boolean IsSeam (const TopoDS_Edge& edge, const TopoDS_Face& face) const;
0093   
0094   //! Returns True if the edge has two pcurves on one surface
0095   Standard_EXPORT Standard_Boolean IsSeam (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location) const;
0096   
0097   //! Returns start vertex of the edge (taking edge orientation
0098   //! into account).
0099   Standard_EXPORT TopoDS_Vertex FirstVertex (const TopoDS_Edge& edge) const;
0100   
0101   //! Returns end vertex of the edge (taking edge orientation
0102   //! into account).
0103   Standard_EXPORT TopoDS_Vertex LastVertex (const TopoDS_Edge& edge) const;
0104   
0105   Standard_EXPORT Standard_Boolean GetEndTangent2d (const TopoDS_Edge& edge, const TopoDS_Face& face, const Standard_Boolean atEnd, gp_Pnt2d& pos, gp_Vec2d& tang, const Standard_Real dparam = 0.0) const;
0106   
0107   //! Returns tangent of the edge pcurve at its start (if atEnd is
0108   //! False) or end (if True), regarding the orientation of edge.
0109   //! If edge is REVERSED, tangent is reversed before return.
0110   //! Returns True if pcurve is available and tangent is computed
0111   //! and is not null, else False.
0112   Standard_EXPORT Standard_Boolean GetEndTangent2d (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, const Standard_Boolean atEnd, gp_Pnt2d& pos, gp_Vec2d& tang, const Standard_Real dparam = 0.0) const;
0113   
0114   //! Checks the start and/or end vertex of the edge for matching
0115   //! with 3d curve with the given precision.
0116   //! <vtx> = 1 : start vertex only
0117   //! <vtx> = 2 : end vertex only
0118   //! <vtx> = 0 : both (default)
0119   //! If preci < 0 the vertices are considered with their own
0120   //! tolerances, else with the given <preci>.
0121   Standard_EXPORT Standard_Boolean CheckVerticesWithCurve3d (const TopoDS_Edge& edge, const Standard_Real preci = -1, const Standard_Integer vtx = 0);
0122   
0123   Standard_EXPORT Standard_Boolean CheckVerticesWithPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face, const Standard_Real preci = -1, const Standard_Integer vtx = 0);
0124   
0125   //! Checks the start and/or end vertex of the edge for matching
0126   //! with pcurve with the given precision.
0127   //! <vtx> = 1 : start vertex
0128   //! <vtx> = 2 : end vertex
0129   //! <vtx> = 0 : both
0130   //! If preci < 0 the vertices are considered with their own
0131   //! tolerances, else with the given <preci>.
0132   Standard_EXPORT Standard_Boolean CheckVerticesWithPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location, const Standard_Real preci = -1, const Standard_Integer vtx = 0);
0133   
0134   Standard_EXPORT Standard_Boolean CheckVertexTolerance (const TopoDS_Edge& edge, const TopoDS_Face& face, Standard_Real& toler1, Standard_Real& toler2);
0135   
0136   //! Checks if it is necessary to increase tolerances of the edge
0137   //! vertices to comprise the ends of 3d curve and pcurve on
0138   //! the given face (first method) or all pcurves stored in an edge
0139   //! (second one)
0140   //! toler1 returns necessary tolerance for first vertex,
0141   //! toler2 returns necessary tolerance for last vertex.
0142   Standard_EXPORT Standard_Boolean CheckVertexTolerance (const TopoDS_Edge& edge, Standard_Real& toler1, Standard_Real& toler2);
0143   
0144   Standard_EXPORT Standard_Boolean CheckCurve3dWithPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face);
0145   
0146   //! Checks mutual orientation of 3d curve and pcurve on the
0147   //! analysis of curves bounding points
0148   Standard_EXPORT Standard_Boolean CheckCurve3dWithPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location);
0149   
0150   //! Returns the status (in the form of True/False) of last Check
0151   Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
0152   
0153   //! Checks the edge to be SameParameter.
0154   //! Calculates the maximal deviation between 3d curve and each
0155   //! pcurve of the edge on <NbControl> equidistant points (the same
0156   //! algorithm as in BRepCheck; default value is 23 as in BRepCheck).
0157   //! This deviation is returned in <maxdev> parameter.
0158   //! If deviation is greater than tolerance of the edge (i.e.
0159   //! incorrect flag) returns False, else returns True.
0160   Standard_EXPORT Standard_Boolean CheckSameParameter (const TopoDS_Edge& edge, Standard_Real& maxdev, const Standard_Integer NbControl = 23);
0161 
0162   //! Checks the edge to be SameParameter.
0163   //! Calculates the maximal deviation between 3d curve and each
0164   //! pcurve of the edge on <NbControl> equidistant points (the same
0165   //! algorithm as in BRepCheck; default value is 23 as in BRepCheck).
0166   //! This deviation is returned in <maxdev> parameter.
0167   //! If deviation is greater than tolerance of the edge (i.e.
0168   //! incorrect flag) returns False, else returns True.
0169   Standard_EXPORT Standard_Boolean CheckSameParameter (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace, Standard_Real& theMaxdev, const Standard_Integer theNbControl = 23);
0170 
0171   //! Checks possibility for pcurve thePC to have range [theFirst, theLast] (edge range)
0172   //! having respect to real first, last parameters of thePC 
0173   Standard_EXPORT Standard_Boolean CheckPCurveRange (const Standard_Real theFirst, const Standard_Real theLast,
0174                                                      const Handle(Geom2d_Curve)& thePC);
0175   
0176   //! Checks the first edge is overlapped with second edge.
0177   //! If distance between two edges is less then theTolOverlap
0178   //! edges are overlapped.
0179   //! theDomainDis - length of part of edges on which edges are overlapped.
0180   Standard_EXPORT Standard_Boolean CheckOverlapping (const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2, Standard_Real& theTolOverlap, const Standard_Real theDomainDist = 0.0);
0181 
0182 
0183 
0184 
0185 protected:
0186 
0187 
0188 
0189   Standard_Integer myStatus;
0190 
0191 
0192 private:
0193 
0194   
0195   //! Check points by pairs (A and A, B and B) with precisions
0196   //! (preci1 and preci2).
0197   //! P1 are the points either from 3d curve or from vertices,
0198   //! P2 are the points from pcurve
0199   Standard_EXPORT Standard_Boolean CheckPoints (const gp_Pnt& P1A, const gp_Pnt& P1B, const gp_Pnt& P2A, const gp_Pnt& P2B, const Standard_Real preci1, const Standard_Real preci2);
0200 
0201 
0202 
0203 
0204 };
0205 
0206 
0207 
0208 
0209 
0210 
0211 
0212 #endif // _ShapeAnalysis_Edge_HeaderFile