1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024002: Overall code and build procedure refactoring -- automatic

Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl":
- WOK-generated header files from inc and sources from drv are moved to src
- CDL files removed
- All packages are converted to nocdlpack
This commit is contained in:
abv
2015-07-12 07:42:38 +03:00
parent 543a996496
commit 42cf5bc1ca
15354 changed files with 623957 additions and 509844 deletions

View File

@@ -1,6 +1,47 @@
ShapeAnalysis_BoxBndTree.hxx
ShapeAnalysis.cxx
ShapeAnalysis.hxx
ShapeAnalysis_BoxBndTree.cxx
ShapeAnalysis_SequenceOfFreeBounds.hxx
ShapeAnalysis_HSequenceOfFreeBounds.hxx
ShapeAnalysis_DataMapOfShapeListOfReal.hxx
ShapeAnalysis_BoxBndTree.hxx
ShapeAnalysis_CheckSmallFace.cxx
ShapeAnalysis_CheckSmallFace.hxx
ShapeAnalysis_CheckSmallFace.lxx
ShapeAnalysis_Curve.cxx
ShapeAnalysis_Curve.hxx
ShapeAnalysis_DataMapIteratorOfDataMapOfShapeListOfReal.hxx
ShapeAnalysis_DataMapOfShapeListOfReal.hxx
ShapeAnalysis_Edge.cxx
ShapeAnalysis_Edge.hxx
ShapeAnalysis_FreeBoundData.cxx
ShapeAnalysis_FreeBoundData.hxx
ShapeAnalysis_FreeBoundData.lxx
ShapeAnalysis_FreeBounds.cxx
ShapeAnalysis_FreeBounds.hxx
ShapeAnalysis_FreeBounds.lxx
ShapeAnalysis_FreeBoundsProperties.cxx
ShapeAnalysis_FreeBoundsProperties.hxx
ShapeAnalysis_FreeBoundsProperties.lxx
ShapeAnalysis_Geom.cxx
ShapeAnalysis_Geom.hxx
ShapeAnalysis_HSequenceOfFreeBounds.hxx
ShapeAnalysis_SequenceOfFreeBounds.hxx
ShapeAnalysis_ShapeContents.cxx
ShapeAnalysis_ShapeContents.hxx
ShapeAnalysis_ShapeContents.lxx
ShapeAnalysis_ShapeTolerance.cxx
ShapeAnalysis_ShapeTolerance.hxx
ShapeAnalysis_Shell.cxx
ShapeAnalysis_Shell.hxx
ShapeAnalysis_Surface.cxx
ShapeAnalysis_Surface.hxx
ShapeAnalysis_Surface.lxx
ShapeAnalysis_TransferParameters.cxx
ShapeAnalysis_TransferParameters.hxx
ShapeAnalysis_TransferParametersProj.cxx
ShapeAnalysis_TransferParametersProj.hxx
ShapeAnalysis_Wire.cxx
ShapeAnalysis_Wire.hxx
ShapeAnalysis_Wire.lxx
ShapeAnalysis_WireOrder.cxx
ShapeAnalysis_WireOrder.hxx
ShapeAnalysis_WireVertex.cxx
ShapeAnalysis_WireVertex.hxx

View File

@@ -1,168 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
package ShapeAnalysis
---Purpose: This package is intended to analyze geometrical objects
-- and topological shapes. Analysis domain includes both
-- exploring geometrical and topological properties of
-- shapes and checking their conformance to Open CASCADE requirements.
-- The directions of analysis provided by tools of this package are:
-- computing quantities of subshapes,
-- computing parameters of points on curve and surface,
-- computing surface singularities,
-- checking edge and wire consistency,
-- checking edges order in the wire,
-- checking face bounds orientation,
-- checking small faces,
-- analyzing shape tolerances,
-- analyzing of free bounds of the shape.
uses
gp,
TColStd,
TCollection,
TColgp,
Bnd,
Geom,
Geom2d,
GeomAdaptor,
Extrema,
IntRes2d,
TopAbs,
TopLoc,
TopoDS,
TopTools,
ShapeExtend,
Adaptor3d
is
class Geom;
class Curve;
class Surface;
class Edge;
class Wire;
class WireOrder;
class WireVertex;
class CheckSmallFace;
class Shell;
class ShapeTolerance;
--class OverlapEdges; now it is in package OverlapShape of Products
--- Container for keeping information about
-- overlapping edges
--class CheckCoincidenceTool; now it is in package OverlapShape of Products
---Tool for checking coincidence of faces and edges
-- Class intended for analyzing shape contents
class ShapeContents;
-- Classes intended for free bounds analysis
class FreeBounds;
class FreeBoundData;
class FreeBoundsProperties;
class TransferParameters;
class TransferParametersProj;
imported SequenceOfFreeBounds;
imported transient class HSequenceOfFreeBounds;
imported DataMapOfShapeListOfReal;
imported DataMapIteratorOfDataMapOfShapeListOfReal;
--class SequenceOfOverlapEdges instantiates
--Sequence from TCollection (OverlapEdges from ShapeAnalysis);
-- now it is in package OverlapShape of Products
--class IndexedDataMapOfShapeSequenceOfOverlapEdges instantiates
--IndexedDataMap from TCollection(Shape from TopoDS,
--SequenceOfOverlapEdges from ShapeAnalysis,
--ShapeMapHasher from TopTools);
-- now it is in package OverlapShape of Products
OuterWire (face: Face from TopoDS) returns Wire from TopoDS;
---Purpose: Returns the outer wire on the face <Face>.
-- This is replacement of the method BRepTools::OuterWire
-- until it works badly.
-- Returns the first wire oriented as outer according to
-- FClass2d_Classifier. If none, last wire is returned.
TotCross2D(sewd: WireData from ShapeExtend; aFace: Face from TopoDS)
returns Real;
---Purpose: Returns a total area of 2d wire
ContourArea(theWire : Wire from TopoDS) returns Real;
--sewd: WireData from ShapeExtend) returns Real;
---Purpose: Returns a total area of 3d wire
IsOuterBound (face: Face from TopoDS) returns Boolean;
---Purpose: Returns True if <F> has outer bound.
---Remarks: This method checks only presence of outer bound, it does not
-- check mutual orientation of the bounds on a face
AdjustByPeriod(Val: Real; ToVal: Real; Period: Real)
returns Real;
---Purpose: Returns a shift required to move point
-- <Val> to the range [ToVal-Period/2,ToVal+Period/2].
-- This shift will be the divisible by Period.
-- Intended for adjusting parameters on periodic surfaces.
AdjustToPeriod(Val: Real; ValMin: Real; ValMax: Real)
returns Real;
---Purpose: Returns a shift required to move point
-- <Val> to the range [ValMin,ValMax].
-- This shift will be the divisible by Period
-- with Period = ValMax - ValMin.
-- Intended for adjusting parameters on periodic surfaces.
FindBounds (shape: Shape from TopoDS;
V1 : in out Vertex from TopoDS;
V2 : in out Vertex from TopoDS);
---Purpose: Finds the start and end vertices of the shape
-- Shape can be of the following type:
-- vertex: V1 and V2 are the same and equal to <shape>,
-- edge : V1 is start and V2 is end vertex (see ShapeAnalysis_Edge
-- methods FirstVertex and LastVertex),
-- wire : V1 is start vertex of the first edge, V2 is end vertex
-- of the last edge (also see ShapeAnalysis_Edge).
-- If wire contains no edges V1 and V2 are nullified
-- If none of the above V1 and V2 are nullified
---Remark: V1 and V2 can be of any orientation
GetFaceUVBounds(F: Face from TopoDS; Umin, Umax, Vmin, Vmax: out Real);
---Purpose: Computes exact UV bounds of all wires on the face
end ShapeAnalysis;

View File

@@ -20,52 +20,44 @@
//:s5 abv 22.04.99 Adding debug printouts in catch {} blocks
//%21 pdn 15.04.99 CTS22655
#include <ShapeAnalysis.ixx>
// PLANTAGE IsOuterBound, 15-SEP-1998
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Bnd_Box2d.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <BRepGProp.hxx>
#include <BRepTools.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_XY.hxx>
#include <Geom2d_Curve.hxx>
#include <GProp_GProps.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Builder.hxx>
#include <Precision.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <Bnd_Box2d.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeExtend_WireData.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <Precision.hxx>
#include <BRepTools.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
// PLANTAGE IsOuterBound, 15-SEP-1998
//static Standard_Integer numpb = 0;
//=======================================================================
//function : AdjustByPeriod
//purpose :
//=======================================================================
Standard_Real ShapeAnalysis::AdjustByPeriod(const Standard_Real Val,
const Standard_Real ToVal,
const Standard_Real Period)

View File

@@ -0,0 +1,152 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_HeaderFile
#define _ShapeAnalysis_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
class TopoDS_Wire;
class TopoDS_Face;
class ShapeExtend_WireData;
class TopoDS_Shape;
class TopoDS_Vertex;
class ShapeAnalysis_Geom;
class ShapeAnalysis_Curve;
class ShapeAnalysis_Surface;
class ShapeAnalysis_Edge;
class ShapeAnalysis_Wire;
class ShapeAnalysis_WireOrder;
class ShapeAnalysis_WireVertex;
class ShapeAnalysis_CheckSmallFace;
class ShapeAnalysis_Shell;
class ShapeAnalysis_ShapeTolerance;
class ShapeAnalysis_ShapeContents;
class ShapeAnalysis_FreeBounds;
class ShapeAnalysis_FreeBoundData;
class ShapeAnalysis_FreeBoundsProperties;
class ShapeAnalysis_TransferParameters;
class ShapeAnalysis_TransferParametersProj;
//! This package is intended to analyze geometrical objects
//! and topological shapes. Analysis domain includes both
//! exploring geometrical and topological properties of
//! shapes and checking their conformance to Open CASCADE requirements.
//! The directions of analysis provided by tools of this package are:
//! computing quantities of subshapes,
//! computing parameters of points on curve and surface,
//! computing surface singularities,
//! checking edge and wire consistency,
//! checking edges order in the wire,
//! checking face bounds orientation,
//! checking small faces,
//! analyzing shape tolerances,
//! analyzing of free bounds of the shape.
class ShapeAnalysis
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the outer wire on the face <Face>.
//! This is replacement of the method BRepTools::OuterWire
//! until it works badly.
//! Returns the first wire oriented as outer according to
//! FClass2d_Classifier. If none, last wire is returned.
Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& face);
//! Returns a total area of 2d wire
Standard_EXPORT static Standard_Real TotCross2D (const Handle(ShapeExtend_WireData)& sewd, const TopoDS_Face& aFace);
//! Returns a total area of 3d wire
Standard_EXPORT static Standard_Real ContourArea (const TopoDS_Wire& theWire);
//! Returns True if <F> has outer bound.
Standard_EXPORT static Standard_Boolean IsOuterBound (const TopoDS_Face& face);
//! Returns a shift required to move point
//! <Val> to the range [ToVal-Period/2,ToVal+Period/2].
//! This shift will be the divisible by Period.
//! Intended for adjusting parameters on periodic surfaces.
Standard_EXPORT static Standard_Real AdjustByPeriod (const Standard_Real Val, const Standard_Real ToVal, const Standard_Real Period);
//! Returns a shift required to move point
//! <Val> to the range [ValMin,ValMax].
//! This shift will be the divisible by Period
//! with Period = ValMax - ValMin.
//! Intended for adjusting parameters on periodic surfaces.
Standard_EXPORT static Standard_Real AdjustToPeriod (const Standard_Real Val, const Standard_Real ValMin, const Standard_Real ValMax);
//! Finds the start and end vertices of the shape
//! Shape can be of the following type:
//! vertex: V1 and V2 are the same and equal to <shape>,
//! edge : V1 is start and V2 is end vertex (see ShapeAnalysis_Edge
//! methods FirstVertex and LastVertex),
//! wire : V1 is start vertex of the first edge, V2 is end vertex
//! of the last edge (also see ShapeAnalysis_Edge).
//! If wire contains no edges V1 and V2 are nullified
//! If none of the above V1 and V2 are nullified
Standard_EXPORT static void FindBounds (const TopoDS_Shape& shape, TopoDS_Vertex& V1, TopoDS_Vertex& V2);
//! Computes exact UV bounds of all wires on the face
Standard_EXPORT static void GetFaceUVBounds (const TopoDS_Face& F, Standard_Real& Umin, Standard_Real& Umax, Standard_Real& Vmin, Standard_Real& Vmax);
protected:
private:
friend class ShapeAnalysis_Geom;
friend class ShapeAnalysis_Curve;
friend class ShapeAnalysis_Surface;
friend class ShapeAnalysis_Edge;
friend class ShapeAnalysis_Wire;
friend class ShapeAnalysis_WireOrder;
friend class ShapeAnalysis_WireVertex;
friend class ShapeAnalysis_CheckSmallFace;
friend class ShapeAnalysis_Shell;
friend class ShapeAnalysis_ShapeTolerance;
friend class ShapeAnalysis_ShapeContents;
friend class ShapeAnalysis_FreeBounds;
friend class ShapeAnalysis_FreeBoundData;
friend class ShapeAnalysis_FreeBoundsProperties;
friend class ShapeAnalysis_TransferParameters;
friend class ShapeAnalysis_TransferParametersProj;
};
#endif // _ShapeAnalysis_HeaderFile

View File

@@ -1,212 +0,0 @@
-- Created on: 1999-09-13
-- Created by: data exchange team
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class CheckSmallFace from ShapeAnalysis
---Purpose: Analysis of the face size
uses
Shape from TopoDS,
Face from TopoDS,
Pnt from gp,
Edge from TopoDS,
Compound from TopoDS,
DataMapOfShapeShape from TopTools,
DataMapOfShapeListOfReal from ShapeAnalysis,
DataMapOfShapeListOfShape from TopTools,
Status from ShapeExtend
is
Create returns CheckSmallFace from ShapeAnalysis;
---Purpose :Creates an empty tool
-- CheckShape (me : in out; S : Shape from TopoDS);
---Purpose : Checks a Shape i.e. each of its faces, records checks as
-- diagnostics in the <infos>
--
-- If <infos> has not been set before, no check is done
--
-- For faces which are in a Shell, topological data are recorded
-- to allow recovering connectivities after fixing or removing
-- the small faces or parts of faces
-- CheckFace (me : in out; F : Face from TopoDS; inshell : Boolean);
---Purpose : Enchains various checks on a face
-- inshell : to compute more informations, relevant to topology
IsSpotFace (me; F : Face from TopoDS;
spot : out Pnt from gp; spotol : out Real;
tol : Real = -1.0) returns Integer;
---Purpose : Checks if a Face is as a Spot
-- Returns 0 if not, 1 if yes, 2 if yes and all vertices are the
-- same
-- By default, considers the tolerance zone of its vertices
-- A given value <tol> may be given to check a spot of this size
-- If a Face is a Spot, its location is returned in <spot>, and
-- <spotol> returns an equivalent tolerance, which is computed as
-- half of max dimension of min-max box of the face
CheckSpotFace (me : in out; F : Face from TopoDS; tol : Real = -1.0) returns Boolean;
---Purpose : Acts as IsSpotFace, but records in <infos> a diagnostic
-- "SpotFace" with the Pnt as value (data "Location")
IsStripSupport (me: in out; F : Face; tol : Real = -1.0) returns Boolean;
---Purpose : Checks if a Face lies on a Surface which is a strip
-- So the Face is a strip. But a Face may be a strip elsewhere ..
--
-- A given value <tol> may be given to check max width
-- By default, considers the tolerance zone of its edges
-- Returns 0 if not a strip support, 1 strip in U, 2 strip in V
CheckStripEdges (me; E1, E2 : Edge from TopoDS; tol : Real;
dmax : out Real) returns Boolean;
---Purpose : Checks if two edges define a strip, i.e. distance maxi below
-- tolerance, given or some of those of E1 and E2
FindStripEdges (me: in out; F : Face from TopoDS;
E1, E2 : out Edge from TopoDS; tol : Real;dmax : out Real) returns Boolean;
---Purpose : Searchs for two and only two edges up tolerance
-- Returns True if OK, false if not 2 edges
-- If True, returns the two edges and their maximum distance
CheckSingleStrip (me : in out; F : Face from TopoDS; E1,E2 : in out Edge from TopoDS;tol : Real = -1.0)
returns Boolean;
---Purpose : Checks if a Face is a single strip, i.e. brings two great
-- edges which are confused on their whole length, possible other
-- edges are small or null length
--
-- Returns 0 if not a strip support, 1 strip in U, 2 strip in V
-- Records diagnostic in info if it is a single strip
CheckStripFace (me : in out; F : Face from TopoDS;E1,E2 : in out Edge from TopoDS; tol : Real = -1.0)
returns Boolean;
---Purpose : Checks if a Face is as a Strip
-- Returns 0 if not or non determined, 1 if in U, 2 if in V
-- By default, considers the tolerance zone of its edges
-- A given value <tol> may be given to check a strip of max this width
--
-- If a Face is determined as a Strip, it is delinited by two
-- lists of edges. These lists are recorded in diagnostic
-- Diagnostic "StripFace" brings data "Direction" (U or V),
-- "List1" , "List2" (if they could be computed)
CheckSplittingVertices (me : in out; F : Face from TopoDS; MapEdges :in out DataMapOfShapeListOfShape from TopTools;
MapParam :in out DataMapOfShapeListOfReal from ShapeAnalysis; theAllVert : in out Compound from TopoDS) returns Integer;
---Purpose : Checks if a Face brings vertices which split it, either
-- confused with non adjacent vertices, or confused with their
-- projection on non adjacent edges
-- Returns the count of found splitting vertices
-- Each vertex then brings a diagnostic "SplittingVertex",
-- with data : "Face" for the face, "Edge" for the split edge
CheckPin (me : in out; F : Face from TopoDS; whatrow,sence : in out Integer) returns Boolean;
---Purpose : Checks if a Face has a pin, which can be edited
-- No singularity : no pin, returns 0
-- If there is a pin, checked topics, with returned value :
-- - 0 : nothing to do more
-- - 1 : "smooth", i.e. not a really sharp pin
-- -> diagnostic "SmoothPin"
-- - 2 : stretched pin, i.e. is possible to relimit the face by
-- another vertex, so that this vertex still gives a pin
-- -> diagnostic "StretchedPin" with location of vertex (Pnt)
CheckTwisted (me : in out; F : Face from TopoDS; paramu,paramv : in out Real) returns Boolean;
---Purpose : Checks if a Face is twisted (apart from checking Pin, i.e. it
-- does not give information on pin, only "it is twisted")
CheckPinFace(me : in out; F : Face from TopoDS;mapEdges : in out DataMapOfShapeShape from TopTools;toler : Real = -1.0) returns Boolean;
CheckPinEdges(me; theFirstEdge: Edge from TopoDS;theSecondEdge: Edge from TopoDS; coef1,coef2 : Real;toler : Real) returns Boolean;
Status (me; status: Status from ShapeExtend) returns Boolean;
---Purpose: Returns the status of last call to Perform()
-- ShapeExtend_OK : face was OK, nothing done
-- ShapeExtend_DONE1: some wires are fixed
-- ShapeExtend_DONE2: orientation of wires fixed
-- ShapeExtend_DONE3: missing seam added
-- ShapeExtend_DONE4: small area wire removed
-- ShapeExtend_DONE5: natural bounds added
-- ShapeExtend_FAIL1: some fails during fixing wires
-- ShapeExtend_FAIL2: cannot fix orientation of wires
-- ShapeExtend_FAIL3: cannot add missing seam
-- ShapeExtend_FAIL4: cannot remove small area wire
---C++: inline
SetTolerance (me : in out; tol : Real);
---Purpose : Sets a fixed Tolerance to check small face
-- By default, local tolerance zone is considered
---C++: inline
-- SetMaxTolerance (me : in out; tol : Real);
---Purpose : Sets a fixed MaxTolerance to check small face
---C++: inline
-- SetMinTolerance (me : in out; tol : Real);
---Purpose : Sets a fixed Tolerance to check small face
-- By default, local tolerance zone is considered
---C++: inline
-- MaxTolerance (me : in out);
---Purpose : Unset fixed tolerance, comes back to local tolerance zones
---C++: inline
-- MinTolerance (me : in out);
---Purpose : Unset fixed tolerance, comes back to local tolerance zones
---C++: inline
Tolerance (me) returns Real;
---Purpose : Returns the tolerance to check small faces, negative value if
-- local tolerances zones are to be considered
---C++: inline
StatusSpot (me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusStrip(me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusPin(me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusTwisted(me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusSplitVert(me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusPinFace(me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusPinEdges(me; status: Status from ShapeExtend) returns Boolean;
---C++: inline
fields
myComp : Shape from TopoDS;
myStatus : Integer; -- error statusis
myStatusSpot : Integer;
myStatusStrip : Integer;
myStatusPin : Integer;
myStatusTwisted : Integer;
myStatusSplitVert: Integer;
myStatusPinFace : Integer;
myStatusPinEdges : Integer;
myPrecision : Real;
end CheckSmallFace;

View File

@@ -11,69 +11,62 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeAnalysis_CheckSmallFace.ixx>
#include <Standard_ErrorHandler.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TColStd_ListOfReal.hxx>
#include <ShapeExtend.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_BezierSurface.hxx>
#include <ShapeAnalysis_Curve.hxx>
//#include <GeomLProp_SLProps.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Geom_ElementarySurface.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <gp_Dir.hxx>
#include <gp_Vec.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColgp_SequenceOfXYZ.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <Precision.hxx>
#include <TopoDS_Wire.hxx>
//#include <ShapeFix_Wire.hxx>
#include <Geom_Line.hxx>
#include <TopExp.hxx>
#include <ElCLib.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <Poly_Polygon3D.hxx>
#include <Geom2d_Curve.hxx>
#include <BRep_Tool.hxx>
#include <BRepLib.hxx>
#include <GeomLib.hxx>
#include <BRepTools.hxx>
#include <ElCLib.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_ElementarySurface.hxx>
#include <Geom_Line.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <ShapeExtend_WireData.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomLib.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Poly_Polygon3D.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis_CheckSmallFace.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <ShapeExtend.hxx>
#include <ShapeExtend_WireData.hxx>
#include <Standard_ErrorHandler.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColgp_SequenceOfXYZ.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <TColStd_ListOfReal.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_ListOfShape.hxx>
//#include <GeomLProp_SLProps.hxx>
//#include <ShapeFix_Wire.hxx>
//=======================================================
//function : ShapeAnalysis_CheckSmallFace
//purpose :
//=======================================================================
ShapeAnalysis_CheckSmallFace::ShapeAnalysis_CheckSmallFace()
{
myStatusSpot = ShapeExtend::EncodeStatus ( ShapeExtend_OK );

View File

@@ -0,0 +1,210 @@
// Created on: 1999-09-13
// Created by: data exchange team
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_CheckSmallFace_HeaderFile
#define _ShapeAnalysis_CheckSmallFace_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <ShapeAnalysis_DataMapOfShapeListOfReal.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <ShapeExtend_Status.hxx>
class TopoDS_Face;
class gp_Pnt;
class TopoDS_Edge;
class TopoDS_Compound;
//! Analysis of the face size
class ShapeAnalysis_CheckSmallFace
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an empty tool
//! Checks a Shape i.e. each of its faces, records checks as
//! diagnostics in the <infos>
//!
//! If <infos> has not been set before, no check is done
//!
//! For faces which are in a Shell, topological data are recorded
//! to allow recovering connectivities after fixing or removing
//! the small faces or parts of faces
//! Enchains various checks on a face
//! inshell : to compute more informations, relevant to topology
Standard_EXPORT ShapeAnalysis_CheckSmallFace();
//! Checks if a Face is as a Spot
//! Returns 0 if not, 1 if yes, 2 if yes and all vertices are the
//! same
//! By default, considers the tolerance zone of its vertices
//! A given value <tol> may be given to check a spot of this size
//! If a Face is a Spot, its location is returned in <spot>, and
//! <spotol> returns an equivalent tolerance, which is computed as
//! half of max dimension of min-max box of the face
Standard_EXPORT Standard_Integer IsSpotFace (const TopoDS_Face& F, gp_Pnt& spot, Standard_Real& spotol, const Standard_Real tol = -1.0) const;
//! Acts as IsSpotFace, but records in <infos> a diagnostic
//! "SpotFace" with the Pnt as value (data "Location")
Standard_EXPORT Standard_Boolean CheckSpotFace (const TopoDS_Face& F, const Standard_Real tol = -1.0);
//! Checks if a Face lies on a Surface which is a strip
//! So the Face is a strip. But a Face may be a strip elsewhere ..
//!
//! A given value <tol> may be given to check max width
//! By default, considers the tolerance zone of its edges
//! Returns 0 if not a strip support, 1 strip in U, 2 strip in V
Standard_EXPORT Standard_Boolean IsStripSupport (const TopoDS_Face& F, const Standard_Real tol = -1.0);
//! Checks if two edges define a strip, i.e. distance maxi below
//! tolerance, given or some of those of E1 and E2
Standard_EXPORT Standard_Boolean CheckStripEdges (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real tol, Standard_Real& dmax) const;
//! Searchs for two and only two edges up tolerance
//! Returns True if OK, false if not 2 edges
//! If True, returns the two edges and their maximum distance
Standard_EXPORT Standard_Boolean FindStripEdges (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol, Standard_Real& dmax);
//! Checks if a Face is a single strip, i.e. brings two great
//! edges which are confused on their whole length, possible other
//! edges are small or null length
//!
//! Returns 0 if not a strip support, 1 strip in U, 2 strip in V
//! Records diagnostic in info if it is a single strip
Standard_EXPORT Standard_Boolean CheckSingleStrip (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol = -1.0);
//! Checks if a Face is as a Strip
//! Returns 0 if not or non determined, 1 if in U, 2 if in V
//! By default, considers the tolerance zone of its edges
//! A given value <tol> may be given to check a strip of max this width
//!
//! If a Face is determined as a Strip, it is delinited by two
//! lists of edges. These lists are recorded in diagnostic
//! Diagnostic "StripFace" brings data "Direction" (U or V),
//! "List1" , "List2" (if they could be computed)
Standard_EXPORT Standard_Boolean CheckStripFace (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol = -1.0);
//! Checks if a Face brings vertices which split it, either
//! confused with non adjacent vertices, or confused with their
//! projection on non adjacent edges
//! Returns the count of found splitting vertices
//! Each vertex then brings a diagnostic "SplittingVertex",
//! with data : "Face" for the face, "Edge" for the split edge
Standard_EXPORT Standard_Integer CheckSplittingVertices (const TopoDS_Face& F, TopTools_DataMapOfShapeListOfShape& MapEdges, ShapeAnalysis_DataMapOfShapeListOfReal& MapParam, TopoDS_Compound& theAllVert);
//! Checks if a Face has a pin, which can be edited
//! No singularity : no pin, returns 0
//! If there is a pin, checked topics, with returned value :
//! - 0 : nothing to do more
//! - 1 : "smooth", i.e. not a really sharp pin
//! -> diagnostic "SmoothPin"
//! - 2 : stretched pin, i.e. is possible to relimit the face by
//! another vertex, so that this vertex still gives a pin
//! -> diagnostic "StretchedPin" with location of vertex (Pnt)
Standard_EXPORT Standard_Boolean CheckPin (const TopoDS_Face& F, Standard_Integer& whatrow, Standard_Integer& sence);
//! Checks if a Face is twisted (apart from checking Pin, i.e. it
//! does not give information on pin, only "it is twisted")
Standard_EXPORT Standard_Boolean CheckTwisted (const TopoDS_Face& F, Standard_Real& paramu, Standard_Real& paramv);
Standard_EXPORT Standard_Boolean CheckPinFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& mapEdges, const Standard_Real toler = -1.0);
Standard_EXPORT Standard_Boolean CheckPinEdges (const TopoDS_Edge& theFirstEdge, const TopoDS_Edge& theSecondEdge, const Standard_Real coef1, const Standard_Real coef2, const Standard_Real toler) const;
//! Returns the status of last call to Perform()
//! ShapeExtend_OK : face was OK, nothing done
//! ShapeExtend_DONE1: some wires are fixed
//! ShapeExtend_DONE2: orientation of wires fixed
//! ShapeExtend_DONE3: missing seam added
//! ShapeExtend_DONE4: small area wire removed
//! ShapeExtend_DONE5: natural bounds added
//! ShapeExtend_FAIL1: some fails during fixing wires
//! ShapeExtend_FAIL2: cannot fix orientation of wires
//! ShapeExtend_FAIL3: cannot add missing seam
//! ShapeExtend_FAIL4: cannot remove small area wire
Standard_Boolean Status (const ShapeExtend_Status status) const;
//! Sets a fixed Tolerance to check small face
//! By default, local tolerance zone is considered
//! Sets a fixed MaxTolerance to check small face
//! Sets a fixed Tolerance to check small face
//! By default, local tolerance zone is considered
//! Unset fixed tolerance, comes back to local tolerance zones
//! Unset fixed tolerance, comes back to local tolerance zones
void SetTolerance (const Standard_Real tol);
//! Returns the tolerance to check small faces, negative value if
//! local tolerances zones are to be considered
Standard_Real Tolerance() const;
Standard_Boolean StatusSpot (const ShapeExtend_Status status) const;
Standard_Boolean StatusStrip (const ShapeExtend_Status status) const;
Standard_Boolean StatusPin (const ShapeExtend_Status status) const;
Standard_Boolean StatusTwisted (const ShapeExtend_Status status) const;
Standard_Boolean StatusSplitVert (const ShapeExtend_Status status) const;
Standard_Boolean StatusPinFace (const ShapeExtend_Status status) const;
Standard_Boolean StatusPinEdges (const ShapeExtend_Status status) const;
protected:
private:
TopoDS_Shape myComp;
Standard_Integer myStatus;
Standard_Integer myStatusSpot;
Standard_Integer myStatusStrip;
Standard_Integer myStatusPin;
Standard_Integer myStatusTwisted;
Standard_Integer myStatusSplitVert;
Standard_Integer myStatusPinFace;
Standard_Integer myStatusPinEdges;
Standard_Real myPrecision;
};
#include <ShapeAnalysis_CheckSmallFace.lxx>
#endif // _ShapeAnalysis_CheckSmallFace_HeaderFile

View File

@@ -1,187 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Curve from ShapeAnalysis
---Purpose: Analyzing tool for 2d or 3d curve.
-- Computes parameters of projected point onto a curve.
uses
XYZ from gp,
Pnt from gp,
Pnt2d from gp,
Box2d from Bnd,
Curve from Geom,
Curve from Adaptor3d,
Curve from Geom2d,
Array1OfPnt from TColgp,
SequenceOfPnt from TColgp,
SequenceOfPnt2d from TColgp
is
Project (me; C3D: Curve from Geom;
P3D: Pnt from gp;
preci: Real;
proj: out Pnt from gp;
param: out Real;
AdjustToEnds: Boolean = Standard_True)
returns Real;
---Purpose : Projects a Point on a Curve.
-- Computes the projected point and its parameter on the curve.
-- <preci> is used as 3d precision (hence, 0 will produce
-- reject unless exact confusion).
-- The number of iterations is limited.
-- If AdjustToEnds is True, point will be adjusted to the end
-- of the curve if distance is less than <preci>
--
-- Returned value is the distance between the given point and
-- computed one.
Project (me; C3D: Curve from Adaptor3d;
P3D: Pnt from gp;
preci: Real;
proj: out Pnt from gp;
param: out Real;
AdjustToEnds: Boolean = Standard_True)
returns Real;
---Purpose : Projects a Point on a Curve.
-- Computes the projected point and its parameter on the curve.
-- <preci> is used as 3d precision (hence, 0 will produce
-- reject unless exact confusion).
-- The number of iterations is limited.
--
-- Returned value is the distance between the given point and
-- computed one.
Project (me; C3D: Curve from Geom;
P3D: Pnt from gp;
preci: Real;
proj: out Pnt from gp;
param: out Real;
cf, cl: Real;
AdjustToEnds: Boolean = Standard_True)
returns Real;
---Purpose : Projects a Point on a Curve, but parameters are limited
-- between <cf> and <cl>.
-- The range [cf, cl] is extended with help of Adaptor3d on the
-- basis of 3d precision <preci>.
-- If AdjustToEnds is True, point will be adjusted to the end
-- of the curve if distance is less than <preci>
ProjectAct(me; C3D : Curve from Adaptor3d;
P3D : Pnt from gp;
preci: Real;
proj : out Pnt from gp;
param: out Real)
returns Real;
NextProject(me; paramPrev: Real;
C3D : Curve from Geom;
P3D : Pnt from gp;
preci : Real;
proj : out Pnt from gp;
param : out Real;
cf, cl : Real;
AdjustToEnds: Boolean = Standard_True)
returns Real;
---Purpose: Projects a Point on a Curve using Newton method.
-- <paramPrev> is taken as the first approximation of solution.
-- If Newton algorithm fails the method Project() is used.
-- If AdjustToEnds is True, point will be adjusted to the end
-- of the curve if distance is less than <preci>
NextProject(me; paramPrev: Real;
C3D : Curve from Adaptor3d;
P3D : Pnt from gp;
preci : Real;
proj : out Pnt from gp;
param : out Real)
returns Real;
---Purpose: Projects a Point on a Curve using Newton method.
-- <paramPrev> is taken as the first approximation of solution.
-- If Newton algorithm fails the method Project() is used.
ValidateRange (me; Crv: Curve from Geom; First, Last: out Real;
prec: Real) returns Boolean;
---Purpose: Validate parameters First and Last for the given curve
-- in order to make them valid for creation of edge.
-- This includes:
-- - limiting range [First,Last] by range of curve
-- - adjusting range [First,Last] for periodic (or closed)
-- curve if Last < First
-- Returns True if parameters are OK or are successfully
-- corrected, or False if parameters cannot be corrected.
-- In the latter case, parameters are reset to range of curve.
FillBndBox (me; C2d: Curve from Geom2d; First, Last: Real;
NPoints: Integer; Exact: Boolean;
Box: out Box2d from Bnd);
---Purpose: Computes a boundary box on segment of curve C2d from First
-- to Last. This is done by taking NPoints points from the
-- curve and, if Exact is True, by searching for exact
-- extrema. All these points are added to Box.
SelectForwardSeam (me; C1, C2: Curve from Geom2d) returns Integer;
---Purpose: Defines which pcurve (C1 or C2) should be chosen for FORWARD
-- seam edge.
---Returns: 1 for C1,
-- 2 for C2,
-- 0 if C1 and/or C2 are neither lines nor BoundedCurves, or if could
-- not analyze.
-- Warning: It is an absolute selection, hence C1 is MANDATORY on the
-- FORWARD Edge, C2 on the REVERSED. Whatever the sense of the
-- Wires and Faces which contain it.
IsPlanar (myclass; pnts : Array1OfPnt from TColgp;
Normal: in out XYZ from gp;
preci : Real = 0)
returns Boolean;
---Purpose: Checks if points are planar with given preci. If Normal has not zero
-- modulus, checks with given normal
IsPlanar (myclass; curve : Curve from Geom;
Normal: in out XYZ from gp;
preci : Real = 0)
returns Boolean;
---Purpose: Checks if curve is planar with given preci. If Normal has not zero
-- modulus, checks with given normal
GetSamplePoints (myclass; curve: Curve from Geom2d; first, last: Real;
seq: out SequenceOfPnt2d from TColgp) returns Boolean;
---Purpose: Returns sample points which will serve as linearisation
-- of the2d curve in range (first, last)
-- The distribution of sample points is consystent with
-- what is used by BRepTopAdaptor_FClass2d
GetSamplePoints (myclass; curve: Curve from Geom; first, last: Real;
seq: out SequenceOfPnt from TColgp) returns Boolean;
---Purpose: Returns sample points which will serve as linearisation
-- of the curve in range (first, last)
IsClosed (myclass; curve : Curve from Geom; preci: Real = -1) returns Boolean;
---Purpose: Tells if the Curve is closed with given precision.
-- If <preci> < 0 then Precision::Confusion is used.
IsPeriodic (myclass; curve : Curve from Geom) returns Boolean;
---Purpose: This method was implemented as fix for changes in trimmed curve
-- behaviour. For the moment trimmed curve returns false anyway.
-- So it is necessary to adapt all Data exchange tools for this behaviour.
-- Current implementation takes into account that curve may be offset.
IsPeriodic (myclass; curve : Curve from Geom2d) returns Boolean;
---Purpose: The same as for Curve3d.
end Curve;

View File

@@ -19,46 +19,46 @@
// abv 14.05.99 S4174: Adding method for exact computing of the boundary box
// gka 21.06.99 S4208: adding method NextProject(Adaptor_Curve)
// msv 30.05.00 correct IsPlanar for a conic curve
#include <ShapeAnalysis_Curve.ixx>
#include <Adaptor3d_Curve.hxx>
#include <Bnd_Box2d.hxx>
#include <ElCLib.hxx>
#include <Extrema_ExtPC.hxx>
#include <Extrema_LocateExtPC.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BoundedCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Conic.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_Geom2dCurveTool.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BoundedCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Conic.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Line.hxx>
#include <Geom_OffsetCurve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <gp_Pnt.hxx>
#include <gp_XYZ.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeExtend_ComplexCurve.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Adaptor3d_Curve.hxx>
#include <Extrema_ExtPC.hxx>
#include <ShapeAnalysis.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <Geom_Line.hxx>
#include <Geom_Conic.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_OffsetCurve.hxx>
#include <Geom_BezierCurve.hxx>
#include <ShapeExtend_ComplexCurve.hxx>
#include <Geom2d_Conic.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <Geom2dInt_Geom2dCurveTool.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom_Circle.hxx>
#include <Extrema_LocateExtPC.hxx>
#include <Geom_BoundedCurve.hxx>
//=======================================================================
//function : ProjectOnSegments
//purpose :
//=======================================================================
static void ProjectOnSegments (const Adaptor3d_Curve& AC, const gp_Pnt& P3D,
const Standard_Integer nbseg,
Standard_Real& uMin, Standard_Real& uMax,

View File

@@ -0,0 +1,166 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_Curve_HeaderFile
#define _ShapeAnalysis_Curve_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <TColgp_SequenceOfPnt.hxx>
class Geom_Curve;
class gp_Pnt;
class Adaptor3d_Curve;
class Geom2d_Curve;
class Bnd_Box2d;
class gp_XYZ;
//! Analyzing tool for 2d or 3d curve.
//! Computes parameters of projected point onto a curve.
class ShapeAnalysis_Curve
{
public:
DEFINE_STANDARD_ALLOC
//! Projects a Point on a Curve.
//! Computes the projected point and its parameter on the curve.
//! <preci> is used as 3d precision (hence, 0 will produce
//! reject unless exact confusion).
//! The number of iterations is limited.
//! If AdjustToEnds is True, point will be adjusted to the end
//! of the curve if distance is less than <preci>
//!
//! Returned value is the distance between the given point and
//! computed one.
Standard_EXPORT Standard_Real Project (const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Boolean AdjustToEnds = Standard_True) const;
//! Projects a Point on a Curve.
//! Computes the projected point and its parameter on the curve.
//! <preci> is used as 3d precision (hence, 0 will produce
//! reject unless exact confusion).
//! The number of iterations is limited.
//!
//! Returned value is the distance between the given point and
//! computed one.
Standard_EXPORT Standard_Real Project (const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Boolean AdjustToEnds = Standard_True) const;
//! Projects a Point on a Curve, but parameters are limited
//! between <cf> and <cl>.
//! The range [cf, cl] is extended with help of Adaptor3d on the
//! basis of 3d precision <preci>.
//! If AdjustToEnds is True, point will be adjusted to the end
//! of the curve if distance is less than <preci>
Standard_EXPORT Standard_Real Project (const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Real cf, const Standard_Real cl, const Standard_Boolean AdjustToEnds = Standard_True) const;
Standard_EXPORT Standard_Real ProjectAct (const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param) const;
//! Projects a Point on a Curve using Newton method.
//! <paramPrev> is taken as the first approximation of solution.
//! If Newton algorithm fails the method Project() is used.
//! If AdjustToEnds is True, point will be adjusted to the end
//! of the curve if distance is less than <preci>
Standard_EXPORT Standard_Real NextProject (const Standard_Real paramPrev, const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Real cf, const Standard_Real cl, const Standard_Boolean AdjustToEnds = Standard_True) const;
//! Projects a Point on a Curve using Newton method.
//! <paramPrev> is taken as the first approximation of solution.
//! If Newton algorithm fails the method Project() is used.
Standard_EXPORT Standard_Real NextProject (const Standard_Real paramPrev, const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param) const;
//! Validate parameters First and Last for the given curve
//! in order to make them valid for creation of edge.
//! This includes:
//! - limiting range [First,Last] by range of curve
//! - adjusting range [First,Last] for periodic (or closed)
//! curve if Last < First
//! Returns True if parameters are OK or are successfully
//! corrected, or False if parameters cannot be corrected.
//! In the latter case, parameters are reset to range of curve.
Standard_EXPORT Standard_Boolean ValidateRange (const Handle(Geom_Curve)& Crv, Standard_Real& First, Standard_Real& Last, const Standard_Real prec) const;
//! Computes a boundary box on segment of curve C2d from First
//! to Last. This is done by taking NPoints points from the
//! curve and, if Exact is True, by searching for exact
//! extrema. All these points are added to Box.
Standard_EXPORT void FillBndBox (const Handle(Geom2d_Curve)& C2d, const Standard_Real First, const Standard_Real Last, const Standard_Integer NPoints, const Standard_Boolean Exact, Bnd_Box2d& Box) const;
//! Defines which pcurve (C1 or C2) should be chosen for FORWARD
//! seam edge.
Standard_EXPORT Standard_Integer SelectForwardSeam (const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2) const;
//! Checks if points are planar with given preci. If Normal has not zero
//! modulus, checks with given normal
Standard_EXPORT static Standard_Boolean IsPlanar (const TColgp_Array1OfPnt& pnts, gp_XYZ& Normal, const Standard_Real preci = 0);
//! Checks if curve is planar with given preci. If Normal has not zero
//! modulus, checks with given normal
Standard_EXPORT static Standard_Boolean IsPlanar (const Handle(Geom_Curve)& curve, gp_XYZ& Normal, const Standard_Real preci = 0);
//! Returns sample points which will serve as linearisation
//! of the2d curve in range (first, last)
//! The distribution of sample points is consystent with
//! what is used by BRepTopAdaptor_FClass2d
Standard_EXPORT static Standard_Boolean GetSamplePoints (const Handle(Geom2d_Curve)& curve, const Standard_Real first, const Standard_Real last, TColgp_SequenceOfPnt2d& seq);
//! Returns sample points which will serve as linearisation
//! of the curve in range (first, last)
Standard_EXPORT static Standard_Boolean GetSamplePoints (const Handle(Geom_Curve)& curve, const Standard_Real first, const Standard_Real last, TColgp_SequenceOfPnt& seq);
//! Tells if the Curve is closed with given precision.
//! If <preci> < 0 then Precision::Confusion is used.
Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& curve, const Standard_Real preci = -1);
//! This method was implemented as fix for changes in trimmed curve
//! behaviour. For the moment trimmed curve returns false anyway.
//! So it is necessary to adapt all Data exchange tools for this behaviour.
//! Current implementation takes into account that curve may be offset.
Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom_Curve)& curve);
//! The same as for Curve3d.
Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom2d_Curve)& curve);
protected:
private:
};
#endif // _ShapeAnalysis_Curve_HeaderFile

View File

@@ -1,307 +0,0 @@
-- Created on: 1998-06-08
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Edge from ShapeAnalysis
---Purpose: Tool for analyzing the edge.
-- Queries geometrical representations of the edge (3d curve, pcurve
-- on the given face or surface) and topological sub-shapes (bounding
-- vertices).
-- Provides methods for analyzing geometry and topology consistency
-- (3d and pcurve(s) consistency, their adjacency to the vertices).
uses
Curve from Adaptor3d,
Pnt from gp,
Pnt2d from gp,
Vec2d from gp,
Curve from Geom2d,
Curve from Geom,
Surface from Geom,
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Location from TopLoc,
Status from ShapeExtend
is
Create returns Edge from ShapeAnalysis;
---Purpose: Empty constructor; initialises Status to OK
HasCurve3d (me; edge: Edge from TopoDS) returns Boolean;
---Purpose: Tells if the edge has a 3d curve
Curve3d (me; edge : Edge from TopoDS;
C3d : out Curve from Geom;
cf, cl: out Real;
orient: Boolean = Standard_True)
returns Boolean;
---Purpose: Returns the 3d curve and bounding parameteres for the edge
-- Returns False if no 3d curve.
-- If <orient> is True (default), takes orientation into account:
-- if the edge is reversed, cf and cl are toggled
IsClosed3d (me; edge: Edge from TopoDS) returns Boolean;
---Purpose: Gives True if the edge has a 3d curve, this curve is closed,
-- and the edge has the same vertex at start and end
HasPCurve (me; edge: Edge from TopoDS;
face: Face from TopoDS)
returns Boolean;
---Purpose: Tells if the Edge has a pcurve on the face.
HasPCurve (me; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc)
returns Boolean;
---Purpose: Tells if the edge has a pcurve on the surface (with location).
PCurve (me; edge : Edge from TopoDS;
face : Face from TopoDS;
C2d : out Curve from Geom2d;
cf, cl: out Real;
orient: Boolean = Standard_True)
returns Boolean;
PCurve (me; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc;
C2d : out Curve from Geom2d;
cf, cl : out Real;
orient : Boolean = Standard_True)
returns Boolean;
---Purpose: Returns the pcurve and bounding parameteres for the edge
-- lying on the surface.
-- Returns False if the edge has no pcurve on this surface.
-- If <orient> is True (default), takes orientation into account:
-- if the edge is reversed, cf and cl are toggled
BoundUV (me; edge : Edge from TopoDS;
face : Face from TopoDS;
first, last: out Pnt2d from gp)
returns Boolean;
BoundUV (me; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc;
first, last: out Pnt2d from gp)
returns Boolean;
---Purpose: Returns the ends of pcurve
-- Calls method PCurve with <orient> equal to True
IsSeam (me; edge: Edge from TopoDS;
face: Face from TopoDS)
returns Boolean;
IsSeam (me; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc)
returns Boolean;
---Purpose: Returns True if the edge has two pcurves on one surface
---Remark : Calls BRep_Tool::IsClosed()
FirstVertex (me; edge: Edge from TopoDS) returns Vertex from TopoDS;
---Purpose: Returns start vertex of the edge (taking edge orientation
-- into account).
---Remark: Vertex orientation is always FORWARD
LastVertex (me; edge: Edge from TopoDS) returns Vertex from TopoDS;
---Purpose: Returns end vertex of the edge (taking edge orientation
-- into account).
---Remark: Vertex orientation is always REVERSED
GetEndTangent2d (me; edge: Edge from TopoDS;
face: Face from TopoDS;
atEnd: Boolean;
pos : out Pnt2d from gp;
tang: out Vec2d from gp;
dparam: Real from Standard =0.0)
returns Boolean;
GetEndTangent2d (me; edge: Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc;
atEnd: Boolean;
pos : out Pnt2d from gp;
tang: out Vec2d from gp;
dparam: Real from Standard =0.0)
returns Boolean;
---Purpose: Returns tangent of the edge pcurve at its start (if atEnd is
-- False) or end (if True), regarding the orientation of edge.
-- If edge is REVERSED, tangent is reversed before return.
-- Returns True if pcurve is available and tangent is computed
-- and is not null, else False.
CheckVerticesWithCurve3d (me: in out; edge : Edge from TopoDS;
preci: Real = -1;
vtx : Integer = 0)
returns Boolean;
---Purpose: Checks the start and/or end vertex of the edge for matching
-- with 3d curve with the given precision.
-- <vtx> = 1 : start vertex only
-- <vtx> = 2 : end vertex only
-- <vtx> = 0 : both (default)
-- If preci < 0 the vertices are considered with their own
-- tolerances, else with the given <preci>.
---Returns: True if mismatching of the vertex to the curve was detected
-- else returns False (OK)
---Status : OK - ends of the 3d curve are comprised by checked vertices
-- FAIL1 - edge has no 3d curve
-- DONE1 - if first vertex of the edge does not comprise start of 3d curve
-- DONE2 - if last vertex of the edge does not comprise end of 3d curve
CheckVerticesWithPCurve (me: in out; edge : Edge from TopoDS;
face : Face from TopoDS;
preci: Real = -1;
vtx : Integer = 0)
returns Boolean;
CheckVerticesWithPCurve (me: in out; edge : Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc;
preci : Real = -1;
vtx : Integer = 0)
returns Boolean;
---Purpose: Checks the start and/or end vertex of the edge for matching
-- with pcurve with the given precision.
-- <vtx> = 1 : start vertex
-- <vtx> = 2 : end vertex
-- <vtx> = 0 : both
-- If preci < 0 the vertices are considered with their own
-- tolerances, else with the given <preci>.
---Returns: True if mismatching of the curves to the vertex was detected
-- else returns False (OK)
---Status : OK - ends of the 3d curve are comprised by checked vertices
-- FAIL1 - edge has no pcurve on a given (sur)face
-- DONE1 - if first vertex of the edge does not comprise start of pcurve
-- DONE2 - if last vertex of the edge does not comprise end of pcurve
CheckVertexTolerance(me: in out; edge : Edge from TopoDS;
face : Face from TopoDS;
toler1: out Real;
toler2: out Real)
returns Boolean;
CheckVertexTolerance(me: in out; edge : Edge from TopoDS;
toler1: out Real;
toler2: out Real)
returns Boolean;
---Purpose: Checks if it is necessary to increase tolerances of the edge
-- vertices to comprise the ends of 3d curve and pcurve on
-- the given face (first method) or all pcurves stored in an edge
-- (second one)
-- toler1 returns necessary tolerance for first vertex,
-- toler2 returns necessary tolerance for last vertex.
---Returns: True, if tolerances should be increased, otherwise False
---Status:
-- OK : the original tolerances are sufficient
-- DONE1: the tolerance of first vertex should be increased
-- DONE2: the tolerance of last vertex should be increased
-- FAIL1: edge has no vertice(s), no check is done
-- FAIL2: edge has no 3d curve, only pcurves are checked
-- FAIL3: edge has no pcurve on a given face, only 3d curve is checked
CheckCurve3dWithPCurve (me: in out; edge: Edge from TopoDS;
face: Face from TopoDS)
returns Boolean;
CheckCurve3dWithPCurve (me: in out; edge :Edge from TopoDS;
surface : Surface from Geom;
location: Location from TopLoc)
returns Boolean;
---Purpose: Checks mutual orientation of 3d curve and pcurve on the
-- analysis of curves bounding points
---Returns: Returns True if mismatching of orientation was detected,
-- else returns False (if OK or no curve)
---Status:
-- OK : orientations match each other (both go in the same
-- directions), or edge is closed
-- DONE1: orientations mismatch each other (curves go in
-- opposite directions)
-- FAIL1: no pcurve
-- FAIL2: no 3d curve
CheckPoints (me: in out; P1A, P1B: Pnt from gp;
P2A, P2B: Pnt from gp;
preci1, preci2: Real)
returns Boolean is private;
---Purpose: Check points by pairs (A and A, B and B) with precisions
-- (preci1 and preci2).
-- P1 are the points either from 3d curve or from vertices,
-- P2 are the points from pcurve
---Returns: False if status is OK, else True
--- Status:
-- OK : distances (P1A, P2A) and (P1B, P2B) are within
-- precisions
-- DONE1: distance (P1A, P2B) + (P1B, P2A) is less than
-- distance (P1A, P2A) + (P1B, P2B),
-- the precisions are not taken into account in this case
Status (me; status: Status from ShapeExtend) returns Boolean;
---Purpose: Returns the status (in the form of True/False) of last Check
---Returns: True if status contains bit corresponding to enumerated argument
CheckSameParameter (me: in out; edge : Edge from TopoDS;
maxdev: out Real;
NbControl: Integer = 23)
returns Boolean;
---Purpose: Checks the edge to be SameParameter.
-- Calculates the maximal deviation between 3d curve and each
-- pcurve of the edge on <NbControl> equidistant points (the same
-- algorithm as in BRepCheck; default value is 23 as in BRepCheck).
-- This deviation is returned in <maxdev> parameter.
-- If deviation is greater than tolerance of the edge (i.e.
-- incorrect flag) returns False, else returns True.
---Returns: True if edge has either SameParameter False and/or its real
-- deviation of curves is more than tolerance
---Status : OK - Edge is SameParameter with the associated tolerance
-- DONE1 - if deviation of the pcurves from 3d curve is greater
-- than tolerance of edge
-- DONE2 - if SameParameter flag in edge is False
-- FAIL1 - edge does not have 3d curve
-- FAIL2 - if some computational problems were encountered (when
-- projecting points on curves)
ComputeDeviation (myclass; CRef : Curve from Adaptor3d;
Other : Curve from Adaptor3d;
SameParameter: Boolean;
dev : in out Real;
NCONTROL : Integer)
returns Boolean;
---Purpose: Computes the maximal deviation between the two curve
-- representations.
-- dev is an input/output parameter and contains the computed
-- deviation (should be initialized with 0. for the first call).
-- Used by CheckSameParameter().
---Returns: True if the computation has been successful and False otherwise.
CheckOverlapping(me :in out; theEdge1, theEdge2 : Edge from TopoDS;
theTolOverlap:in out Real; theDomainDist : Real =0.0) returns Boolean;
---Purpose: Checks the first edge is overlapped with second edge.
-- If distance between two edges is less then theTolOverlap
-- edges is overlapped.
-- theDomainDis - length of part of edges on wich edges is overlapped.
---Status : DONE3 - edges is overlapped on whole length
-- : DONE4 - edges is overlapped on the length equal to theDomainDist
fields
myStatus: Integer is protected;
end Edge;

View File

@@ -17,43 +17,43 @@
//:s1 abv 22.04.99: PRO7226 #489490: protect against Null 3d curve
//:s4 abv 26.04.99: sim6049.igs 21677: copy of curve is necessary to get True SP
// abv 06.05.99: S4137: adding methods GetTangent2d()
#include <ShapeAnalysis_Edge.ixx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Precision.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <Adaptor3d_Curve.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <BRep_Tool.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_Builder.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_Builder.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <Extrema_LocateExtPC.hxx>
#include <ShapeExtend.hxx>
#include <TopExp.hxx>
#include <TopoDS_Vertex.hxx>
#include <Geom_Plane.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeExtend.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TopExp.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
//=======================================================================
//function : ShapeAnalysis_Edge
//purpose :
//=======================================================================
ShapeAnalysis_Edge::ShapeAnalysis_Edge()
{
myStatus = 0;//ShapeExtend::EncodeStatus (ShapeExtend_OK);

View File

@@ -0,0 +1,204 @@
// Created on: 1998-06-08
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_Edge_HeaderFile
#define _ShapeAnalysis_Edge_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <ShapeExtend_Status.hxx>
class TopoDS_Edge;
class Geom_Curve;
class TopoDS_Face;
class Geom_Surface;
class TopLoc_Location;
class Geom2d_Curve;
class gp_Pnt2d;
class TopoDS_Vertex;
class gp_Vec2d;
class gp_Pnt;
class Adaptor3d_Curve;
//! Tool for analyzing the edge.
//! Queries geometrical representations of the edge (3d curve, pcurve
//! on the given face or surface) and topological sub-shapes (bounding
//! vertices).
//! Provides methods for analyzing geometry and topology consistency
//! (3d and pcurve(s) consistency, their adjacency to the vertices).
class ShapeAnalysis_Edge
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor; initialises Status to OK
Standard_EXPORT ShapeAnalysis_Edge();
//! Tells if the edge has a 3d curve
Standard_EXPORT Standard_Boolean HasCurve3d (const TopoDS_Edge& edge) const;
//! Returns the 3d curve and bounding parameteres for the edge
//! Returns False if no 3d curve.
//! If <orient> is True (default), takes orientation into account:
//! if the edge is reversed, cf and cl are toggled
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;
//! Gives True if the edge has a 3d curve, this curve is closed,
//! and the edge has the same vertex at start and end
Standard_EXPORT Standard_Boolean IsClosed3d (const TopoDS_Edge& edge) const;
//! Tells if the Edge has a pcurve on the face.
Standard_EXPORT Standard_Boolean HasPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face) const;
//! Tells if the edge has a pcurve on the surface (with location).
Standard_EXPORT Standard_Boolean HasPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location) const;
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;
//! Returns the pcurve and bounding parameteres for the edge
//! lying on the surface.
//! Returns False if the edge has no pcurve on this surface.
//! If <orient> is True (default), takes orientation into account:
//! if the edge is reversed, cf and cl are toggled
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;
Standard_EXPORT Standard_Boolean BoundUV (const TopoDS_Edge& edge, const TopoDS_Face& face, gp_Pnt2d& first, gp_Pnt2d& last) const;
//! Returns the ends of pcurve
//! Calls method PCurve with <orient> equal to True
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;
Standard_EXPORT Standard_Boolean IsSeam (const TopoDS_Edge& edge, const TopoDS_Face& face) const;
//! Returns True if the edge has two pcurves on one surface
Standard_EXPORT Standard_Boolean IsSeam (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location) const;
//! Returns start vertex of the edge (taking edge orientation
//! into account).
Standard_EXPORT TopoDS_Vertex FirstVertex (const TopoDS_Edge& edge) const;
//! Returns end vertex of the edge (taking edge orientation
//! into account).
Standard_EXPORT TopoDS_Vertex LastVertex (const TopoDS_Edge& edge) const;
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;
//! Returns tangent of the edge pcurve at its start (if atEnd is
//! False) or end (if True), regarding the orientation of edge.
//! If edge is REVERSED, tangent is reversed before return.
//! Returns True if pcurve is available and tangent is computed
//! and is not null, else False.
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;
//! Checks the start and/or end vertex of the edge for matching
//! with 3d curve with the given precision.
//! <vtx> = 1 : start vertex only
//! <vtx> = 2 : end vertex only
//! <vtx> = 0 : both (default)
//! If preci < 0 the vertices are considered with their own
//! tolerances, else with the given <preci>.
Standard_EXPORT Standard_Boolean CheckVerticesWithCurve3d (const TopoDS_Edge& edge, const Standard_Real preci = -1, const Standard_Integer vtx = 0);
Standard_EXPORT Standard_Boolean CheckVerticesWithPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face, const Standard_Real preci = -1, const Standard_Integer vtx = 0);
//! Checks the start and/or end vertex of the edge for matching
//! with pcurve with the given precision.
//! <vtx> = 1 : start vertex
//! <vtx> = 2 : end vertex
//! <vtx> = 0 : both
//! If preci < 0 the vertices are considered with their own
//! tolerances, else with the given <preci>.
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);
Standard_EXPORT Standard_Boolean CheckVertexTolerance (const TopoDS_Edge& edge, const TopoDS_Face& face, Standard_Real& toler1, Standard_Real& toler2);
//! Checks if it is necessary to increase tolerances of the edge
//! vertices to comprise the ends of 3d curve and pcurve on
//! the given face (first method) or all pcurves stored in an edge
//! (second one)
//! toler1 returns necessary tolerance for first vertex,
//! toler2 returns necessary tolerance for last vertex.
Standard_EXPORT Standard_Boolean CheckVertexTolerance (const TopoDS_Edge& edge, Standard_Real& toler1, Standard_Real& toler2);
Standard_EXPORT Standard_Boolean CheckCurve3dWithPCurve (const TopoDS_Edge& edge, const TopoDS_Face& face);
//! Checks mutual orientation of 3d curve and pcurve on the
//! analysis of curves bounding points
Standard_EXPORT Standard_Boolean CheckCurve3dWithPCurve (const TopoDS_Edge& edge, const Handle(Geom_Surface)& surface, const TopLoc_Location& location);
//! Returns the status (in the form of True/False) of last Check
Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
//! Checks the edge to be SameParameter.
//! Calculates the maximal deviation between 3d curve and each
//! pcurve of the edge on <NbControl> equidistant points (the same
//! algorithm as in BRepCheck; default value is 23 as in BRepCheck).
//! This deviation is returned in <maxdev> parameter.
//! If deviation is greater than tolerance of the edge (i.e.
//! incorrect flag) returns False, else returns True.
Standard_EXPORT Standard_Boolean CheckSameParameter (const TopoDS_Edge& edge, Standard_Real& maxdev, const Standard_Integer NbControl = 23);
//! Computes the maximal deviation between the two curve
//! representations.
//! dev is an input/output parameter and contains the computed
//! deviation (should be initialized with 0. for the first call).
//! Used by CheckSameParameter().
Standard_EXPORT static Standard_Boolean ComputeDeviation (const Adaptor3d_Curve& CRef, const Adaptor3d_Curve& Other, const Standard_Boolean SameParameter, Standard_Real& dev, const Standard_Integer NCONTROL);
//! Checks the first edge is overlapped with second edge.
//! If distance between two edges is less then theTolOverlap
//! edges is overlapped.
//! theDomainDis - length of part of edges on wich edges is overlapped.
Standard_EXPORT Standard_Boolean CheckOverlapping (const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2, Standard_Real& theTolOverlap, const Standard_Real theDomainDist = 0.0);
protected:
Standard_Integer myStatus;
private:
//! Check points by pairs (A and A, B and B) with precisions
//! (preci1 and preci2).
//! P1 are the points either from 3d curve or from vertices,
//! P2 are the points from pcurve
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);
};
#endif // _ShapeAnalysis_Edge_HeaderFile

View File

@@ -1,138 +0,0 @@
-- Created on: 1998-08-25
-- Created by: Pavel DURANDIN <pdn@nnov.matra-dtv.fr>
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- Roman LYGIN <rln@nnov.matra-dtv.fr>
class FreeBoundData from ShapeAnalysis inherits TShared from MMgt
---Purpose: This class is intended to represent free bound and to store
-- its properties.
--
-- This class is used by ShapeAnalysis_FreeBoundsProperties
-- class when storing each free bound and its properties.
--
-- The properties stored in this class are the following:
-- - area of the contour,
-- - perimeter of the contour,
-- - ratio of average length to average width of the contour,
-- - average width of contour,
-- - notches (narrow 'V'-like sub-contours) on the contour and
-- their maximum width.
--
-- This class provides methods for setting and getting fields
-- only.
uses
Wire from TopoDS,
HSequenceOfShape from TopTools,
DataMapOfShapeReal from TopTools
is
Create returns FreeBoundData from ShapeAnalysis;
---Purpose: Empty constructor
Create (freebound: Wire from TopoDS)
returns FreeBoundData from ShapeAnalysis;
---Purpose: Creates object with contour given in the form of TopoDS_Wire
Clear (me: mutable);
---Purpose: Clears all properties of the contour.
-- Contour bound itself is not cleared.
-- Methods for setting fields
SetFreeBound (me: mutable; freebound: Wire from TopoDS);
---Purpose: Sets contour
---C++: inline
SetArea (me: mutable; area: Real);
---Purpose: Sets area of the contour
---C++: inline
SetPerimeter (me: mutable; perimeter: Real);
---Purpose: Sets perimeter of the contour
---C++: inline
SetRatio (me: mutable; ratio: Real);
---Purpose: Sets ratio of average length to average width of the contour
---C++: inline
SetWidth (me: mutable; width: Real);
---Purpose: Sets average width of the contour
---C++: inline
AddNotch (me: mutable; notch: Wire from TopoDS; width: Real);
---Purpose: Adds notch on the contour with its maximum width
-- Methods for getting fields
FreeBound (me) returns Wire from TopoDS;
---Purpose: Returns contour
---C++: inline
Area (me) returns Real;
---Purpose: Returns area of the contour
---C++: inline
Perimeter (me) returns Real;
---Purpose: Returns perimeter of the contour
---C++: inline
Ratio (me) returns Real;
---Purpose: Returns ratio of average length to average width of the contour
---C++: inline
Width (me) returns Real;
---Purpose: Returns average width of the contour
---C++: inline
NbNotches (me) returns Integer;
---Purpose: Returns number of notches on the contour
---C++: inline
Notches (me) returns HSequenceOfShape from TopTools;
---Purpose: Returns sequence of notches on the contour
---C++: inline
Notch (me; index: Integer) returns Wire from TopoDS;
---Purpose: Returns notch on the contour
---C++: inline
NotchWidth (me; index: Integer) returns Real;
---Purpose: Returns maximum width of notch specified by its rank number
-- on the contour
NotchWidth (me; notch: Wire from TopoDS) returns Real;
---Purpose: Returns maximum width of notch specified as TopoDS_Wire
-- on the contour
fields
myBound : Wire from TopoDS;
myArea : Real;
myPerimeter : Real;
myRatio : Real;
myWidth : Real;
myNotches : HSequenceOfShape from TopTools;
myNotchesParams: DataMapOfShapeReal from TopTools;
end FreeBoundData;

View File

@@ -14,15 +14,17 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeAnalysis_FreeBoundData.ixx>
#include <TopTools_HSequenceOfShape.hxx>
#include <ShapeAnalysis_FreeBoundData.hxx>
#include <Standard_Type.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_HSequenceOfShape.hxx>
//=======================================================================
//function : ShapeAnalysis_FreeBoundData
//purpose : Empty constructor
//=======================================================================
ShapeAnalysis_FreeBoundData::ShapeAnalysis_FreeBoundData()
{
myNotches = new TopTools_HSequenceOfShape();

View File

@@ -0,0 +1,148 @@
// Created on: 1998-08-25
// Created by: Pavel DURANDIN <pdn@nnov.matra-dtv.fr>
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_FreeBoundData_HeaderFile
#define _ShapeAnalysis_FreeBoundData_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Wire.hxx>
#include <Standard_Real.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopTools_DataMapOfShapeReal.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Integer.hxx>
class TopoDS_Wire;
class ShapeAnalysis_FreeBoundData;
DEFINE_STANDARD_HANDLE(ShapeAnalysis_FreeBoundData, MMgt_TShared)
//! This class is intended to represent free bound and to store
//! its properties.
//!
//! This class is used by ShapeAnalysis_FreeBoundsProperties
//! class when storing each free bound and its properties.
//!
//! The properties stored in this class are the following:
//! - area of the contour,
//! - perimeter of the contour,
//! - ratio of average length to average width of the contour,
//! - average width of contour,
//! - notches (narrow 'V'-like sub-contours) on the contour and
//! their maximum width.
//!
//! This class provides methods for setting and getting fields
//! only.
class ShapeAnalysis_FreeBoundData : public MMgt_TShared
{
public:
//! Empty constructor
Standard_EXPORT ShapeAnalysis_FreeBoundData();
//! Creates object with contour given in the form of TopoDS_Wire
Standard_EXPORT ShapeAnalysis_FreeBoundData(const TopoDS_Wire& freebound);
//! Clears all properties of the contour.
//! Contour bound itself is not cleared.
Standard_EXPORT void Clear();
//! Sets contour
void SetFreeBound (const TopoDS_Wire& freebound);
//! Sets area of the contour
void SetArea (const Standard_Real area);
//! Sets perimeter of the contour
void SetPerimeter (const Standard_Real perimeter);
//! Sets ratio of average length to average width of the contour
void SetRatio (const Standard_Real ratio);
//! Sets average width of the contour
void SetWidth (const Standard_Real width);
//! Adds notch on the contour with its maximum width
Standard_EXPORT void AddNotch (const TopoDS_Wire& notch, const Standard_Real width);
//! Returns contour
TopoDS_Wire FreeBound() const;
//! Returns area of the contour
Standard_Real Area() const;
//! Returns perimeter of the contour
Standard_Real Perimeter() const;
//! Returns ratio of average length to average width of the contour
Standard_Real Ratio() const;
//! Returns average width of the contour
Standard_Real Width() const;
//! Returns number of notches on the contour
Standard_Integer NbNotches() const;
//! Returns sequence of notches on the contour
Handle(TopTools_HSequenceOfShape) Notches() const;
//! Returns notch on the contour
TopoDS_Wire Notch (const Standard_Integer index) const;
//! Returns maximum width of notch specified by its rank number
//! on the contour
Standard_EXPORT Standard_Real NotchWidth (const Standard_Integer index) const;
//! Returns maximum width of notch specified as TopoDS_Wire
//! on the contour
Standard_EXPORT Standard_Real NotchWidth (const TopoDS_Wire& notch) const;
DEFINE_STANDARD_RTTI(ShapeAnalysis_FreeBoundData,MMgt_TShared)
protected:
private:
TopoDS_Wire myBound;
Standard_Real myArea;
Standard_Real myPerimeter;
Standard_Real myRatio;
Standard_Real myWidth;
Handle(TopTools_HSequenceOfShape) myNotches;
TopTools_DataMapOfShapeReal myNotchesParams;
};
#include <ShapeAnalysis_FreeBoundData.lxx>
#endif // _ShapeAnalysis_FreeBoundData_HeaderFile

View File

@@ -1,192 +0,0 @@
-- Created on: 1998-06-03
-- Created by: Daniel RISSER
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- Modified Mon Sep 14 10:20:25 1998 by Roman LYGIN (rln)
-- 1. Analysis of actual free bounds of the shells.
-- 2. Options to extract closed sub-wires out of closed and open
-- wires
-- 3. Improved algorithm for connecting free edges into wires
class FreeBounds from ShapeAnalysis
---Purpose: This class is intended to output free bounds of the shape
-- (free bounds are the wires consisting of edges referenced by the
-- only face).
-- This class works on two distinct types of shapes when analyzing
-- their free bounds:
-- 1. compound of faces.
-- Analyzer of sewing algorithm (BRepAlgo_Sewing) is used for
-- for forecasting free bounds that would be obtained after
-- performing sewing
-- 2. compound of shells.
-- Actual free bounds (edges shared by the only face in the shell)
-- are output in this case. ShapeAnalysis_Shell is used for that.
--
-- When connecting edges into the wires algorithm tries to build
-- wires of maximum length. Two options are provided for a user
-- to extract closed sub-contours out of closed and/or open contours.
--
-- Free bounds are returned as two compounds, one for closed and one
-- for open wires.
--
-- This class also provides some static methods for advanced use:
-- connecting edges/wires to wires, extracting closed sub-wires out
-- of wires, dispatching wires into compounds for closed and open
-- wires.
-- NOTE. Ends of the edge or wire mean hereafter their end vertices.
uses
Shape from TopoDS,
Vertex from TopoDS,
Wire from TopoDS,
Compound from TopoDS,
HSequenceOfShape from TopTools,
DataMapOfShapeShape from TopTools,
HArray1OfShape from TopTools
is
Create returns FreeBounds from ShapeAnalysis;
---Purpose: Empty constructor
Create (shape : Shape from TopoDS;
toler : Real;
splitclosed: Boolean = Standard_False;
splitopen : Boolean = Standard_True)
returns FreeBounds from ShapeAnalysis;
---Purpose: Builds forecasting free bounds of the <shape>.
-- <shape> should be a compound of faces.
-- This constructor is to be used for forecasting free edges
-- with help of sewing analyzer BRepAlgo_Sewing which is called
-- with tolerance <toler>.
-- Free edges are connected into wires only when their ends are
-- at distance less than <toler>.
-- If <splitclosed> is True extracts closed sub-wires out of
-- built closed wires.
-- If <splitopen> is True extracts closed sub-wires out of
-- built open wires.
Create (shape : Shape from TopoDS;
splitclosed: Boolean = Standard_False;
splitopen : Boolean = Standard_True;
checkinternaledges : Boolean = Standard_False)
returns FreeBounds from ShapeAnalysis;
---Purpose: Builds actual free bounds of the <shape>.
-- <shape> should be a compound of shells.
-- This constructor is to be used for getting free edges (ones
-- referenced by the only face) with help of analyzer
-- ShapeAnalysis_Shell.
-- Free edges are connected into wires only when they share the
-- same vertex.
-- If <splitclosed> is True extracts closed sub-wires out of
-- built closed wires.
-- If <splitopen> is True extracts closed sub-wires out of
-- built open wires.
GetClosedWires (me) returns Compound from TopoDS;
---Purpose: Returns compound of closed wires out of free edges.
---C++: inline
---C++: return const &
GetOpenWires (me) returns Compound from TopoDS;
---Purpose: Returns compound of open wires out of free edges.
---C++: inline
---C++: return const &
---Level: Advanced
ConnectEdgesToWires (myclass; edges : in out HSequenceOfShape from TopTools;
toler : Real;
shared: Boolean;
wires : out HSequenceOfShape from TopTools);
---Purpose: Builds sequnce of <wires> out of sequence of not sorted
-- <edges>.
-- Tries to build wires of maximum length. Building a wire is
-- stopped when no edges can be connected to it at its head or
-- at its tail.
--
-- Orientation of the edge can change when connecting.
-- If <shared> is True connection is performed only when
-- adjacent edges share the same vertex.
-- If <shared> is False connection is performed only when
-- ends of adjacent edges are at distance less than <toler>.
ConnectWiresToWires (myclass; iwires: in out HSequenceOfShape from TopTools;
toler : Real;
shared: Boolean;
owires: out HSequenceOfShape from TopTools);
ConnectWiresToWires (myclass; iwires: in out HSequenceOfShape from TopTools;
toler : Real;
shared: Boolean;
owires: out HSequenceOfShape from TopTools;
vertices: out DataMapOfShapeShape
from TopTools);
---Purpose: Builds sequnce of <owires> out of sequence of not sorted
-- <iwires>.
-- Tries to build wires of maximum length. Building a wire is
-- stopped when no wires can be connected to it at its head or
-- at its tail.
--
-- Orientation of the wire can change when connecting.
-- If <shared> is True connection is performed only when
-- adjacent wires share the same vertex.
-- If <shared> is False connection is performed only when
-- ends of adjacent wires are at distance less than <toler>.
-- Map <vertices> stores the correspondence between original
-- end vertices of the wires and new connecting vertices.
SplitWires (myclass; wires : HSequenceOfShape from TopTools;
toler : Real;
shared: Boolean;
closed: out HSequenceOfShape from TopTools;
open : out HSequenceOfShape from TopTools);
---Purpose: Extracts closed sub-wires out of <wires> and adds them
-- to <closed>, open wires remained after extraction are put
-- into <open>.
-- If <shared> is True extraction is performed only when
-- edges share the same vertex.
-- If <shared> is False connection is performed only when
-- ends of the edges are at distance less than <toler>.
DispatchWires (myclass; wires : HSequenceOfShape from TopTools;
closed: in out Compound from TopoDS;
open : in out Compound from TopoDS);
---Purpose: Dispatches sequence of <wires> into two compounds
-- <closed> for closed wires and <open> for open wires.
-- If a compound is not empty wires are added into it.
---Level: Internal
SplitWires (me: in out) is private;
fields
myWires: Compound from TopoDS;
myEdges: Compound from TopoDS;
myTolerance : Real;
myShared : Boolean;
mySplitClosed: Boolean;
mySplitOpen : Boolean;
end FreeBounds;

View File

@@ -19,49 +19,45 @@
//szv#4 S4163
// 11.01.00 svv #1: porting on DEC
#include <ShapeAnalysis_FreeBounds.ixx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_Sewing.hxx>
#include <gp_Pnt.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_BoxBndTree.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <ShapeAnalysis_Shell.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeBuild_Vertex.hxx>
#include <ShapeExtend_Explorer.hxx>
#include <ShapeExtend_WireData.hxx>
#include <TColStd_Array1OfBoolean.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeExtend_Explorer.hxx>
#include <ShapeBuild_Vertex.hxx>
#include <ShapeBuild_Edge.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeAnalysis_Shell.hxx>
#include <gp_Pnt.hxx> //ied_modif_for_compil_Nov-19-1998
#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopoDS_Shell.hxx>
#include <ShapeAnalysis_BoxBndTree.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//ied_modif_for_compil_Nov-19-1998
//=======================================================================
//function : ShapeAnalysis_FreeBounds
//purpose : Empty constructor
//=======================================================================
ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds() {}
//=======================================================================

View File

@@ -0,0 +1,176 @@
// Created on: 1998-06-03
// Created by: Daniel RISSER
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_FreeBounds_HeaderFile
#define _ShapeAnalysis_FreeBounds_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Compound.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
class TopoDS_Shape;
class TopoDS_Compound;
//! This class is intended to output free bounds of the shape
//! (free bounds are the wires consisting of edges referenced by the
//! only face).
//! This class works on two distinct types of shapes when analyzing
//! their free bounds:
//! 1. compound of faces.
//! Analyzer of sewing algorithm (BRepAlgo_Sewing) is used for
//! for forecasting free bounds that would be obtained after
//! performing sewing
//! 2. compound of shells.
//! Actual free bounds (edges shared by the only face in the shell)
//! are output in this case. ShapeAnalysis_Shell is used for that.
//!
//! When connecting edges into the wires algorithm tries to build
//! wires of maximum length. Two options are provided for a user
//! to extract closed sub-contours out of closed and/or open contours.
//!
//! Free bounds are returned as two compounds, one for closed and one
//! for open wires.
//!
//! This class also provides some static methods for advanced use:
//! connecting edges/wires to wires, extracting closed sub-wires out
//! of wires, dispatching wires into compounds for closed and open
//! wires.
//! NOTE. Ends of the edge or wire mean hereafter their end vertices.
class ShapeAnalysis_FreeBounds
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT ShapeAnalysis_FreeBounds();
//! Builds forecasting free bounds of the <shape>.
//! <shape> should be a compound of faces.
//! This constructor is to be used for forecasting free edges
//! with help of sewing analyzer BRepAlgo_Sewing which is called
//! with tolerance <toler>.
//! Free edges are connected into wires only when their ends are
//! at distance less than <toler>.
//! If <splitclosed> is True extracts closed sub-wires out of
//! built closed wires.
//! If <splitopen> is True extracts closed sub-wires out of
//! built open wires.
Standard_EXPORT ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape, const Standard_Real toler, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_True);
//! Builds actual free bounds of the <shape>.
//! <shape> should be a compound of shells.
//! This constructor is to be used for getting free edges (ones
//! referenced by the only face) with help of analyzer
//! ShapeAnalysis_Shell.
//! Free edges are connected into wires only when they share the
//! same vertex.
//! If <splitclosed> is True extracts closed sub-wires out of
//! built closed wires.
//! If <splitopen> is True extracts closed sub-wires out of
//! built open wires.
Standard_EXPORT ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_True, const Standard_Boolean checkinternaledges = Standard_False);
//! Returns compound of closed wires out of free edges.
const TopoDS_Compound& GetClosedWires() const;
//! Returns compound of open wires out of free edges.
const TopoDS_Compound& GetOpenWires() const;
//! Builds sequnce of <wires> out of sequence of not sorted
//! <edges>.
//! Tries to build wires of maximum length. Building a wire is
//! stopped when no edges can be connected to it at its head or
//! at its tail.
//!
//! Orientation of the edge can change when connecting.
//! If <shared> is True connection is performed only when
//! adjacent edges share the same vertex.
//! If <shared> is False connection is performed only when
//! ends of adjacent edges are at distance less than <toler>.
Standard_EXPORT static void ConnectEdgesToWires (Handle(TopTools_HSequenceOfShape)& edges, const Standard_Real toler, const Standard_Boolean shared, Handle(TopTools_HSequenceOfShape)& wires);
Standard_EXPORT static void ConnectWiresToWires (Handle(TopTools_HSequenceOfShape)& iwires, const Standard_Real toler, const Standard_Boolean shared, Handle(TopTools_HSequenceOfShape)& owires);
//! Builds sequnce of <owires> out of sequence of not sorted
//! <iwires>.
//! Tries to build wires of maximum length. Building a wire is
//! stopped when no wires can be connected to it at its head or
//! at its tail.
//!
//! Orientation of the wire can change when connecting.
//! If <shared> is True connection is performed only when
//! adjacent wires share the same vertex.
//! If <shared> is False connection is performed only when
//! ends of adjacent wires are at distance less than <toler>.
//! Map <vertices> stores the correspondence between original
//! end vertices of the wires and new connecting vertices.
Standard_EXPORT static void ConnectWiresToWires (Handle(TopTools_HSequenceOfShape)& iwires, const Standard_Real toler, const Standard_Boolean shared, Handle(TopTools_HSequenceOfShape)& owires, TopTools_DataMapOfShapeShape& vertices);
//! Extracts closed sub-wires out of <wires> and adds them
//! to <closed>, open wires remained after extraction are put
//! into <open>.
//! If <shared> is True extraction is performed only when
//! edges share the same vertex.
//! If <shared> is False connection is performed only when
//! ends of the edges are at distance less than <toler>.
Standard_EXPORT static void SplitWires (const Handle(TopTools_HSequenceOfShape)& wires, const Standard_Real toler, const Standard_Boolean shared, Handle(TopTools_HSequenceOfShape)& closed, Handle(TopTools_HSequenceOfShape)& open);
//! Dispatches sequence of <wires> into two compounds
//! <closed> for closed wires and <open> for open wires.
//! If a compound is not empty wires are added into it.
Standard_EXPORT static void DispatchWires (const Handle(TopTools_HSequenceOfShape)& wires, TopoDS_Compound& closed, TopoDS_Compound& open);
protected:
private:
Standard_EXPORT void SplitWires();
TopoDS_Compound myWires;
TopoDS_Compound myEdges;
Standard_Real myTolerance;
Standard_Boolean myShared;
Standard_Boolean mySplitClosed;
Standard_Boolean mySplitOpen;
};
#include <ShapeAnalysis_FreeBounds.lxx>
#endif // _ShapeAnalysis_FreeBounds_HeaderFile

View File

@@ -1,174 +0,0 @@
-- Created on: 1998-07-30
-- Created by: Pavel DURANDIN <pdn@nnov.matra-dtv.fr>
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- Roman LYGIN <rln@nnov.matra-dtv.fr>
class FreeBoundsProperties from ShapeAnalysis
---Purpose: This class is intended to calculate shape free bounds
-- properties.
-- This class provides the following functionalities:
-- - calculates area of the contour,
-- - calculates perimeter of the contour,
-- - calculates ratio of average length to average width of the
-- contour,
-- - estimates average width of contour,
-- - finds the notches (narrow 'V'-like sub-contour) on the
-- contour.
--
-- For getting free bounds this class uses
-- ShapeAnalysis_FreeBounds class.
--
-- For description of parameters used for initializing this
-- class refer to CDL of ShapeAnalysis_FreeBounds.
--
-- Properties of each contour are stored in the data structure
-- ShapeAnalysis_FreeBoundData.
uses
Shape from TopoDS,
Wire from TopoDS,
FreeBoundData from ShapeAnalysis,
HSequenceOfFreeBounds from ShapeAnalysis
is
Create returns FreeBoundsProperties from ShapeAnalysis;
---Purpose: Empty constructor
Create (shape : Shape from TopoDS;
tolerance : Real;
splitclosed: Boolean = Standard_False;
splitopen : Boolean = Standard_False)
returns FreeBoundsProperties from ShapeAnalysis;
---Purpose: Creates the object and calls corresponding Init.
-- <shape> should be a compound of faces.
Create (shape : Shape from TopoDS;
splitclosed: Boolean = Standard_False;
splitopen : Boolean = Standard_False);
---Purpose: Creates the object and calls corresponding Init.
-- <shape> should be a compound of shells.
Init (me: in out; shape : Shape from TopoDS;
tolerance : Real;
splitclosed: Boolean = Standard_False;
splitopen : Boolean = Standard_False);
---Purpose: Initializes the object with given parameters.
-- <shape> should be a compound of faces.
Init (me: in out; shape : Shape from TopoDS;
splitclosed: Boolean = Standard_False;
splitopen : Boolean = Standard_False);
---Purpose: Initializes the object with given parameters.
-- <shape> should be a compound of shells.
---Level: Public
Perform (me: in out) returns Boolean;
---Purpose: Builds and analyzes free bounds of the shape.
-- First calls ShapeAnalysis_FreeBounds for building free
-- bounds.
-- Then on each free bound computes its properties:
-- - area of the contour,
-- - perimeter of the contour,
-- - ratio of average length to average width of the contour,
-- - average width of contour,
-- - notches on the contour and for each notch
-- - maximum width of the notch.
---Returns: True - if no fails and free bounds are found,
-- False - if fail or no free bounds are found
IsLoaded (me) returns Boolean;
---Purpose: Returns True if shape is loaded
---C++: inline
Shape (me) returns Shape from TopoDS;
---Purpose: Returns shape
---C++: inline
Tolerance (me) returns Real;
---Purpose: Returns tolerance
---C++: inline
NbFreeBounds (me) returns Integer;
---Purpose: Returns number of free bounds
---C++: inline
NbClosedFreeBounds (me) returns Integer;
---Purpose: Returns number of closed free bounds
---C++: inline
NbOpenFreeBounds (me) returns Integer;
---Purpose: Returns number of open free bounds
---C++: inline
ClosedFreeBounds (me) returns HSequenceOfFreeBounds from ShapeAnalysis;
---Purpose: Returns all closed free bounds
---C++: inline
OpenFreeBounds (me) returns HSequenceOfFreeBounds from ShapeAnalysis;
---Purpose: Returns all open free bounds
---C++: inline
ClosedFreeBound (me; index: Integer) returns FreeBoundData from ShapeAnalysis;
---Purpose: Returns properties of closed free bound specified by its rank
-- number
---C++: inline
OpenFreeBound (me; index: Integer) returns FreeBoundData from ShapeAnalysis;
---Purpose: Returns properties of open free bound specified by its rank
-- number
---C++: inline
---Level: Internal
DispatchBounds (me: in out) returns Boolean;
CheckContours (me: in out; prec: Real = 0.0) returns Boolean;
CheckNotches (me: in out; prec: Real = 0.0) returns Boolean;
CheckNotches(me: in out; fbData: in out FreeBoundData from ShapeAnalysis;
prec : Real = 0.0)
returns Boolean;
CheckNotches(me: in out; freebound: Wire from TopoDS;
num : Integer;
notch : out Wire from TopoDS;
distMax : out Real;
prec : Real = 0.0)
returns Boolean;
FillProperties (me: in out; fbData: in out FreeBoundData from ShapeAnalysis;
prec : Real = 0.0)
returns Boolean;
fields
myShape : Shape from TopoDS;
myTolerance : Real;
mySplitClosed : Boolean;
mySplitOpen : Boolean;
myClosedFreeBounds: HSequenceOfFreeBounds from ShapeAnalysis;
myOpenFreeBounds : HSequenceOfFreeBounds from ShapeAnalysis;
end FreeBoundsProperties;

View File

@@ -17,29 +17,26 @@
// 25.12.98 pdn renaming of ShapeAnalysis_FreeBounds and ShapeAnalysis_Wire methods
//szv#4 S4163
#include <ShapeAnalysis_FreeBoundsProperties.ixx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeAnalysis_FreeBoundData.hxx>
#include <ShapeExtend_Explorer.hxx>
#include <ShapeExtend_WireData.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BRep_Builder.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <gp_Pnt.hxx>
#include <gp_XYZ.hxx>
#include <gp_Vec.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <Geom_Curve.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_XYZ.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_FreeBoundData.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <ShapeAnalysis_FreeBoundsProperties.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeExtend_Explorer.hxx>
#include <ShapeExtend_WireData.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#define NbControl 23

View File

@@ -0,0 +1,165 @@
// Created on: 1998-07-30
// Created by: Pavel DURANDIN <pdn@nnov.matra-dtv.fr>
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_FreeBoundsProperties_HeaderFile
#define _ShapeAnalysis_FreeBoundsProperties_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <ShapeAnalysis_HSequenceOfFreeBounds.hxx>
#include <Standard_Integer.hxx>
class TopoDS_Shape;
class ShapeAnalysis_FreeBoundData;
class TopoDS_Wire;
//! This class is intended to calculate shape free bounds
//! properties.
//! This class provides the following functionalities:
//! - calculates area of the contour,
//! - calculates perimeter of the contour,
//! - calculates ratio of average length to average width of the
//! contour,
//! - estimates average width of contour,
//! - finds the notches (narrow 'V'-like sub-contour) on the
//! contour.
//!
//! For getting free bounds this class uses
//! ShapeAnalysis_FreeBounds class.
//!
//! For description of parameters used for initializing this
//! class refer to CDL of ShapeAnalysis_FreeBounds.
//!
//! Properties of each contour are stored in the data structure
//! ShapeAnalysis_FreeBoundData.
class ShapeAnalysis_FreeBoundsProperties
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT ShapeAnalysis_FreeBoundsProperties();
//! Creates the object and calls corresponding Init.
//! <shape> should be a compound of faces.
Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape, const Standard_Real tolerance, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
//! Creates the object and calls corresponding Init.
//! <shape> should be a compound of shells.
Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
//! Initializes the object with given parameters.
//! <shape> should be a compound of faces.
Standard_EXPORT void Init (const TopoDS_Shape& shape, const Standard_Real tolerance, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
//! Initializes the object with given parameters.
//! <shape> should be a compound of shells.
Standard_EXPORT void Init (const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
//! Builds and analyzes free bounds of the shape.
//! First calls ShapeAnalysis_FreeBounds for building free
//! bounds.
//! Then on each free bound computes its properties:
//! - area of the contour,
//! - perimeter of the contour,
//! - ratio of average length to average width of the contour,
//! - average width of contour,
//! - notches on the contour and for each notch
//! - maximum width of the notch.
Standard_EXPORT Standard_Boolean Perform();
//! Returns True if shape is loaded
Standard_Boolean IsLoaded() const;
//! Returns shape
TopoDS_Shape Shape() const;
//! Returns tolerance
Standard_Real Tolerance() const;
//! Returns number of free bounds
Standard_Integer NbFreeBounds() const;
//! Returns number of closed free bounds
Standard_Integer NbClosedFreeBounds() const;
//! Returns number of open free bounds
Standard_Integer NbOpenFreeBounds() const;
//! Returns all closed free bounds
Handle(ShapeAnalysis_HSequenceOfFreeBounds) ClosedFreeBounds() const;
//! Returns all open free bounds
Handle(ShapeAnalysis_HSequenceOfFreeBounds) OpenFreeBounds() const;
//! Returns properties of closed free bound specified by its rank
//! number
Handle(ShapeAnalysis_FreeBoundData) ClosedFreeBound (const Standard_Integer index) const;
//! Returns properties of open free bound specified by its rank
//! number
Handle(ShapeAnalysis_FreeBoundData) OpenFreeBound (const Standard_Integer index) const;
Standard_EXPORT Standard_Boolean DispatchBounds();
Standard_EXPORT Standard_Boolean CheckContours (const Standard_Real prec = 0.0);
Standard_EXPORT Standard_Boolean CheckNotches (const Standard_Real prec = 0.0);
Standard_EXPORT Standard_Boolean CheckNotches (Handle(ShapeAnalysis_FreeBoundData)& fbData, const Standard_Real prec = 0.0);
Standard_EXPORT Standard_Boolean CheckNotches (const TopoDS_Wire& freebound, const Standard_Integer num, TopoDS_Wire& notch, Standard_Real& distMax, const Standard_Real prec = 0.0);
Standard_EXPORT Standard_Boolean FillProperties (Handle(ShapeAnalysis_FreeBoundData)& fbData, const Standard_Real prec = 0.0);
protected:
private:
TopoDS_Shape myShape;
Standard_Real myTolerance;
Standard_Boolean mySplitClosed;
Standard_Boolean mySplitOpen;
Handle(ShapeAnalysis_HSequenceOfFreeBounds) myClosedFreeBounds;
Handle(ShapeAnalysis_HSequenceOfFreeBounds) myOpenFreeBounds;
};
#include <ShapeAnalysis_FreeBoundsProperties.lxx>
#endif // _ShapeAnalysis_FreeBoundsProperties_HeaderFile

View File

@@ -1,50 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Geom from ShapeAnalysis
---Purpose: Analyzing tool aimed to work on primitive geometrical objects
uses
HArray2OfReal from TColStd,
Trsf from gp,
Pln from gp,
Array1OfPnt from TColgp
raises
OutOfRange from Standard
is
NearestPlane (myclass; Pnts: Array1OfPnt from TColgp;
aPln: out Pln from gp;
Dmax: out Real)
returns Boolean;
---Purpose : Builds a plane out of a set of points in array
-- Returns in <dmax> the maximal distance between the produced
-- plane and given points
PositionTrsf (myclass; coefs: HArray2OfReal from TColStd;
trsf: out Trsf from gp;
unit, prec : Real)
returns Boolean
---Purpose: Builds transfromation object out of matrix.
-- Matrix must be 3 x 4.
-- Unit is used as multiplier.
raises OutOfRange from Standard;
-- If numer of rows is greater than 3 or number of columns is
-- greater than 4
end Geom;

View File

@@ -12,10 +12,6 @@
// commercial license or contractual agreement.
//szv#4 S4163
#include <ShapeAnalysis_Geom.ixx>
#include <GProp_PGProps.hxx>
#include <GProp_PrincipalProps.hxx>
#include <gp_Dir.hxx>
#include <gp_GTrsf.hxx>
@@ -24,15 +20,17 @@
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <gp_XYZ.hxx>
#include <GProp_PGProps.hxx>
#include <GProp_PrincipalProps.hxx>
#include <ShapeAnalysis_Geom.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_OutOfRange.hxx>
//=======================================================================
//function : NearestPlane
//purpose :
//=======================================================================
Standard_Boolean ShapeAnalysis_Geom::NearestPlane(const TColgp_Array1OfPnt& Pnts,
gp_Pln& aPln, Standard_Real& Dmax)
{

View File

@@ -0,0 +1,74 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_Geom_HeaderFile
#define _ShapeAnalysis_Geom_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <Standard_Real.hxx>
#include <TColStd_HArray2OfReal.hxx>
class Standard_OutOfRange;
class gp_Pln;
class gp_Trsf;
//! Analyzing tool aimed to work on primitive geometrical objects
class ShapeAnalysis_Geom
{
public:
DEFINE_STANDARD_ALLOC
//! Builds a plane out of a set of points in array
//! Returns in <dmax> the maximal distance between the produced
//! plane and given points
Standard_EXPORT static Standard_Boolean NearestPlane (const TColgp_Array1OfPnt& Pnts, gp_Pln& aPln, Standard_Real& Dmax);
//! Builds transfromation object out of matrix.
//! Matrix must be 3 x 4.
//! Unit is used as multiplier.
Standard_EXPORT static Standard_Boolean PositionTrsf (const Handle(TColStd_HArray2OfReal)& coefs, gp_Trsf& trsf, const Standard_Real unit, const Standard_Real prec);
protected:
private:
};
#endif // _ShapeAnalysis_Geom_HeaderFile

View File

@@ -1,221 +0,0 @@
-- Created on: 1999-02-25
-- Created by: Pavel DURANDIN
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ShapeContents from ShapeAnalysis
---Purpose: Dumps shape contents
uses
Shape from TopoDS,
HSequenceOfShape from TopTools
is
Create returns ShapeContents from ShapeAnalysis;
---Purpose: Initialize fields and call ClearFlags()
Clear(me:in out);
---Purpose: Clears all accumulated statictics
ClearFlags(me:in out);
---Purpose: Clears all flags
Perform(me: in out;shape: Shape from TopoDS);
---Purpose: Counts quantities of sun-shapes in shape and
-- stores sub-shapes according to flags
--Methods for setting parameters
ModifyBigSplineMode(me: in out) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether to store faces
-- with edges if its 3D curves has more than 8192 poles.
---Default: False
ModifyIndirectMode(me: in out) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether to store faces
-- on indirect surfaces
---Default: False
ModifyOffestSurfaceMode(me: in out) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether to store faces
-- on offset surfaces.
---Default: False
ModifyTrimmed3dMode(me: in out) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether to store faces
-- with edges if ist 3D curves are trimmed curves
---Default: False
ModifyOffsetCurveMode(me: in out) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether to store faces
-- with edges if its 3D curves and pcurves are offest curves
---Default: False
ModifyTrimmed2dMode(me: in out) returns Boolean;
---C++: inline
---C++: return &
---Purpose: Returns (modifiable) the flag which defines whether to store faces
-- with edges if its pcurves are trimmed curves
---Default: False
-- Methods for fetching results
NbSolids(me) returns Integer;
---C++: inline
NbShells(me) returns Integer;
---C++: inline
NbFaces(me) returns Integer;
---C++: inline
NbWires(me) returns Integer;
---C++: inline
NbEdges(me) returns Integer;
---C++: inline
NbVertices(me) returns Integer;
---C++: inline
NbSolidsWithVoids(me) returns Integer;
---C++: inline
NbBigSplines(me) returns Integer;
---C++: inline
NbC0Surfaces(me) returns Integer;
---C++: inline
NbC0Curves(me) returns Integer;
---C++: inline
NbOffsetSurf(me) returns Integer;
---C++: inline
NbIndirectSurf(me) returns Integer;
---C++: inline
NbOffsetCurves(me) returns Integer;
---C++: inline
NbTrimmedCurve2d(me) returns Integer;
---C++: inline
NbTrimmedCurve3d(me) returns Integer;
---C++: inline
NbBSplibeSurf(me) returns Integer;
---C++: inline
NbBezierSurf(me) returns Integer;
---C++: inline
NbTrimSurf(me) returns Integer;
---C++: inline
NbWireWitnSeam(me) returns Integer;
---C++: inline
NbWireWithSevSeams(me) returns Integer;
---C++: inline
NbFaceWithSevWires(me) returns Integer;
---C++: inline
NbNoPCurve(me) returns Integer;
---C++: inline
NbFreeFaces(me) returns Integer;
---C++: inline
NbFreeWires(me) returns Integer;
---C++:inline
NbFreeEdges(me) returns Integer;
---C++: inline
NbSharedSolids(me) returns Integer;
---C++: inline
NbSharedShells(me) returns Integer;
---C++: inline
NbSharedFaces(me) returns Integer;
---C++: inline
NbSharedWires(me) returns Integer;
---C++: inline
NbSharedFreeWires(me) returns Integer;
---C++: inline
NbSharedFreeEdges(me) returns Integer;
---C++: inline
NbSharedEdges(me) returns Integer;
---C++: inline
NbSharedVertices(me) returns Integer;
---C++: inline
-- Methods for obtaining sequenses of selected shapes
BigSplineSec(me) returns HSequenceOfShape from TopTools;
---C++: inline
IndirectSec(me) returns HSequenceOfShape from TopTools;
---C++: inline
OffsetSurfaceSec(me) returns HSequenceOfShape from TopTools;
---C++: inline
Trimmed3dSec(me) returns HSequenceOfShape from TopTools;
---C++: inline
OffsetCurveSec(me) returns HSequenceOfShape from TopTools;
---C++: inline
Trimmed2dSec(me) returns HSequenceOfShape from TopTools;
---C++: inline
fields
myNbSolids: Integer;
myNbShells: Integer;
myNbFaces : Integer;
myNbWires : Integer;
myNbEdges : Integer;
myNbVertices : Integer;
myNbSolidsWithVoids: Integer;
myNbBigSplines : Integer;
myNbC0Surfaces : Integer;
myNbC0Curves : Integer;
myNbOffsetSurf : Integer;
myNbIndirectSurf : Integer;
myNbOffsetCurves : Integer;
myNbTrimmedCurve2d : Integer;
myNbTrimmedCurve3d : Integer;
myNbBSplibeSurf : Integer;
myNbBezierSurf : Integer;
myNbTrimSurf : Integer;
myNbWireWitnSeam : Integer;
myNbWireWithSevSeams: Integer;
myNbFaceWithSevWires: Integer;
myNbNoPCurve : Integer;
myNbFreeFaces : Integer;
myNbFreeWires : Integer;
myNbFreeEdges : Integer;
myNbSharedSolids: Integer;
myNbSharedShells: Integer;
myNbSharedFaces : Integer;
myNbSharedWires : Integer;
myNbSharedFreeWires:Integer;
myNbSharedFreeEdges:Integer;
myNbSharedEdges :Integer;
myNbSharedVertices :Integer;
myBigSplineMode : Boolean;
myIndirectMode : Boolean;
myOffestSurfaceMode: Boolean;
myTrimmed3dMode : Boolean;
myOffsetCurveMode : Boolean;
myTrimmed2dMode : Boolean;
myBigSplineSec : HSequenceOfShape from TopTools;
myIndirectSec : HSequenceOfShape from TopTools;
myOffsetSurfaceSec: HSequenceOfShape from TopTools;
myTrimmed3dSec : HSequenceOfShape from TopTools;
myOffsetCurveSec : HSequenceOfShape from TopTools;
myTrimmed2dSec : HSequenceOfShape from TopTools;
end ShapeContents;

View File

@@ -16,34 +16,32 @@
//szv#4 S4163
#include <ShapeAnalysis_ShapeContents.ixx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_ElementarySurface.hxx>
#include <Geom_OffsetSurface.hxx>
#include <Geom_BezierSurface.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_ElementarySurface.hxx>
#include <Geom_OffsetCurve.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <Geom_OffsetSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <ShapeAnalysis_ShapeContents.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeExtend_WireData.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
ShapeAnalysis_ShapeContents::ShapeAnalysis_ShapeContents()
{

View File

@@ -0,0 +1,222 @@
// Created on: 1999-02-25
// Created by: Pavel DURANDIN
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_ShapeContents_HeaderFile
#define _ShapeAnalysis_ShapeContents_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_HSequenceOfShape.hxx>
class TopoDS_Shape;
//! Dumps shape contents
class ShapeAnalysis_ShapeContents
{
public:
DEFINE_STANDARD_ALLOC
//! Initialize fields and call ClearFlags()
Standard_EXPORT ShapeAnalysis_ShapeContents();
//! Clears all accumulated statictics
Standard_EXPORT void Clear();
//! Clears all flags
Standard_EXPORT void ClearFlags();
//! Counts quantities of sun-shapes in shape and
//! stores sub-shapes according to flags
Standard_EXPORT void Perform (const TopoDS_Shape& shape);
//! Returns (modifiable) the flag which defines whether to store faces
//! with edges if its 3D curves has more than 8192 poles.
Standard_Boolean& ModifyBigSplineMode();
//! Returns (modifiable) the flag which defines whether to store faces
//! on indirect surfaces
Standard_Boolean& ModifyIndirectMode();
//! Returns (modifiable) the flag which defines whether to store faces
//! on offset surfaces.
Standard_Boolean& ModifyOffestSurfaceMode();
//! Returns (modifiable) the flag which defines whether to store faces
//! with edges if ist 3D curves are trimmed curves
Standard_Boolean& ModifyTrimmed3dMode();
//! Returns (modifiable) the flag which defines whether to store faces
//! with edges if its 3D curves and pcurves are offest curves
Standard_Boolean& ModifyOffsetCurveMode();
//! Returns (modifiable) the flag which defines whether to store faces
//! with edges if its pcurves are trimmed curves
Standard_Boolean& ModifyTrimmed2dMode();
Standard_Integer NbSolids() const;
Standard_Integer NbShells() const;
Standard_Integer NbFaces() const;
Standard_Integer NbWires() const;
Standard_Integer NbEdges() const;
Standard_Integer NbVertices() const;
Standard_Integer NbSolidsWithVoids() const;
Standard_Integer NbBigSplines() const;
Standard_Integer NbC0Surfaces() const;
Standard_Integer NbC0Curves() const;
Standard_Integer NbOffsetSurf() const;
Standard_Integer NbIndirectSurf() const;
Standard_Integer NbOffsetCurves() const;
Standard_Integer NbTrimmedCurve2d() const;
Standard_Integer NbTrimmedCurve3d() const;
Standard_Integer NbBSplibeSurf() const;
Standard_Integer NbBezierSurf() const;
Standard_Integer NbTrimSurf() const;
Standard_Integer NbWireWitnSeam() const;
Standard_Integer NbWireWithSevSeams() const;
Standard_Integer NbFaceWithSevWires() const;
Standard_Integer NbNoPCurve() const;
Standard_Integer NbFreeFaces() const;
Standard_Integer NbFreeWires() const;
Standard_Integer NbFreeEdges() const;
Standard_Integer NbSharedSolids() const;
Standard_Integer NbSharedShells() const;
Standard_Integer NbSharedFaces() const;
Standard_Integer NbSharedWires() const;
Standard_Integer NbSharedFreeWires() const;
Standard_Integer NbSharedFreeEdges() const;
Standard_Integer NbSharedEdges() const;
Standard_Integer NbSharedVertices() const;
Handle(TopTools_HSequenceOfShape) BigSplineSec() const;
Handle(TopTools_HSequenceOfShape) IndirectSec() const;
Handle(TopTools_HSequenceOfShape) OffsetSurfaceSec() const;
Handle(TopTools_HSequenceOfShape) Trimmed3dSec() const;
Handle(TopTools_HSequenceOfShape) OffsetCurveSec() const;
Handle(TopTools_HSequenceOfShape) Trimmed2dSec() const;
protected:
private:
Standard_Integer myNbSolids;
Standard_Integer myNbShells;
Standard_Integer myNbFaces;
Standard_Integer myNbWires;
Standard_Integer myNbEdges;
Standard_Integer myNbVertices;
Standard_Integer myNbSolidsWithVoids;
Standard_Integer myNbBigSplines;
Standard_Integer myNbC0Surfaces;
Standard_Integer myNbC0Curves;
Standard_Integer myNbOffsetSurf;
Standard_Integer myNbIndirectSurf;
Standard_Integer myNbOffsetCurves;
Standard_Integer myNbTrimmedCurve2d;
Standard_Integer myNbTrimmedCurve3d;
Standard_Integer myNbBSplibeSurf;
Standard_Integer myNbBezierSurf;
Standard_Integer myNbTrimSurf;
Standard_Integer myNbWireWitnSeam;
Standard_Integer myNbWireWithSevSeams;
Standard_Integer myNbFaceWithSevWires;
Standard_Integer myNbNoPCurve;
Standard_Integer myNbFreeFaces;
Standard_Integer myNbFreeWires;
Standard_Integer myNbFreeEdges;
Standard_Integer myNbSharedSolids;
Standard_Integer myNbSharedShells;
Standard_Integer myNbSharedFaces;
Standard_Integer myNbSharedWires;
Standard_Integer myNbSharedFreeWires;
Standard_Integer myNbSharedFreeEdges;
Standard_Integer myNbSharedEdges;
Standard_Integer myNbSharedVertices;
Standard_Boolean myBigSplineMode;
Standard_Boolean myIndirectMode;
Standard_Boolean myOffestSurfaceMode;
Standard_Boolean myTrimmed3dMode;
Standard_Boolean myOffsetCurveMode;
Standard_Boolean myTrimmed2dMode;
Handle(TopTools_HSequenceOfShape) myBigSplineSec;
Handle(TopTools_HSequenceOfShape) myIndirectSec;
Handle(TopTools_HSequenceOfShape) myOffsetSurfaceSec;
Handle(TopTools_HSequenceOfShape) myTrimmed3dSec;
Handle(TopTools_HSequenceOfShape) myOffsetCurveSec;
Handle(TopTools_HSequenceOfShape) myTrimmed2dSec;
};
#include <ShapeAnalysis_ShapeContents.lxx>
#endif // _ShapeAnalysis_ShapeContents_HeaderFile

View File

@@ -1,84 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ShapeTolerance from ShapeAnalysis
---Purpose: Tool for computing shape tolerances (minimal, maximal, average),
-- finding shape with tolerance matching given criteria,
-- setting or limitating tolerances.
uses
Shape from TopoDS,
ShapeEnum from TopAbs,
HSequenceOfShape from TopTools
is
Create returns ShapeTolerance from ShapeAnalysis;
---Purpose: Empty constructor
Tolerance (me : in out; shape: Shape from TopoDS;
mode : Integer;
type : ShapeEnum from TopAbs = TopAbs_SHAPE)
returns Real;
---Purpose: Determines a tolerance from the ones stored in a shape
-- Remark : calls InitTolerance and AddTolerance,
-- hence, can be used to start a series for cumulating tolerance
-- <mode> = 0 : returns the average value between sub-shapes,
-- <mode> > 0 : returns the maximal found,
-- <mode> < 0 : returns the minimal found.
-- <type> defines what kinds of sub-shapes to consider:
-- SHAPE (default) : all : VERTEX, EDGE, FACE,
-- VERTEX : only vertices,
-- EDGE : only edges,
-- FACE : only faces,
-- SHELL : combined SHELL + FACE, for each face (and containing
-- shell), also checks EDGE and VERTEX
OverTolerance (me; shape: Shape from TopoDS;
value: Real;
type : ShapeEnum = TopAbs_SHAPE)
returns HSequenceOfShape from TopTools;
---Purpose: Determines which shapes have a tolerance over the given value
-- <type> is interpreted as in the method Tolerance
InTolerance (me; shape : Shape from TopoDS;
valmin, valmax: Real;
type : ShapeEnum = TopAbs_SHAPE)
returns HSequenceOfShape from TopTools;
---Purpose: Determines which shapes have a tolerance within a given interval
-- <type> is interpreted as in the method Tolerance
InitTolerance (me : in out);
---Purpose: Initializes computation of cumulated tolerance
AddTolerance (me : in out; shape: Shape from TopoDS;
type : ShapeEnum from TopAbs = TopAbs_SHAPE);
---Purpose: Adds data on new Shape to compute Cumulated Tolerance
-- (prepares three computations : maximal, average, minimal)
GlobalTolerance (me; mode: Integer) returns Real;
---Purpose: Returns the computed tolerance according to the <mode>
-- <mode> = 0 : average
-- <mode> > 0 : maximal
-- <mode> < 0 : minimal
fields
myTols : Real[3];
myNbTol: Integer;
end ShapeTolerance;

View File

@@ -13,25 +13,21 @@
//#76 rln 11.03.99 S4135: compute average without weights according to tolerances
//szv#4 S4163
#include <ShapeAnalysis_ShapeTolerance.ixx>
#include <BRep_Tool.hxx>
#include <ShapeAnalysis_ShapeTolerance.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_MapOfShape.hxx>
//=======================================================================
//function : ShapeAnalysis_ShapeTolerance
//purpose :
//=======================================================================
ShapeAnalysis_ShapeTolerance::ShapeAnalysis_ShapeTolerance() : myNbTol (0)
{
}

View File

@@ -0,0 +1,105 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_ShapeTolerance_HeaderFile
#define _ShapeAnalysis_ShapeTolerance_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_HSequenceOfShape.hxx>
class TopoDS_Shape;
//! Tool for computing shape tolerances (minimal, maximal, average),
//! finding shape with tolerance matching given criteria,
//! setting or limitating tolerances.
class ShapeAnalysis_ShapeTolerance
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT ShapeAnalysis_ShapeTolerance();
//! Determines a tolerance from the ones stored in a shape
//! Remark : calls InitTolerance and AddTolerance,
//! hence, can be used to start a series for cumulating tolerance
//! <mode> = 0 : returns the average value between sub-shapes,
//! <mode> > 0 : returns the maximal found,
//! <mode> < 0 : returns the minimal found.
//! <type> defines what kinds of sub-shapes to consider:
//! SHAPE (default) : all : VERTEX, EDGE, FACE,
//! VERTEX : only vertices,
//! EDGE : only edges,
//! FACE : only faces,
//! SHELL : combined SHELL + FACE, for each face (and containing
//! shell), also checks EDGE and VERTEX
Standard_EXPORT Standard_Real Tolerance (const TopoDS_Shape& shape, const Standard_Integer mode, const TopAbs_ShapeEnum type = TopAbs_SHAPE);
//! Determines which shapes have a tolerance over the given value
//! <type> is interpreted as in the method Tolerance
Standard_EXPORT Handle(TopTools_HSequenceOfShape) OverTolerance (const TopoDS_Shape& shape, const Standard_Real value, const TopAbs_ShapeEnum type = TopAbs_SHAPE) const;
//! Determines which shapes have a tolerance within a given interval
//! <type> is interpreted as in the method Tolerance
Standard_EXPORT Handle(TopTools_HSequenceOfShape) InTolerance (const TopoDS_Shape& shape, const Standard_Real valmin, const Standard_Real valmax, const TopAbs_ShapeEnum type = TopAbs_SHAPE) const;
//! Initializes computation of cumulated tolerance
Standard_EXPORT void InitTolerance();
//! Adds data on new Shape to compute Cumulated Tolerance
//! (prepares three computations : maximal, average, minimal)
Standard_EXPORT void AddTolerance (const TopoDS_Shape& shape, const TopAbs_ShapeEnum type = TopAbs_SHAPE);
//! Returns the computed tolerance according to the <mode>
//! <mode> = 0 : average
//! <mode> > 0 : maximal
//! <mode> < 0 : minimal
Standard_EXPORT Standard_Real GlobalTolerance (const Standard_Integer mode) const;
protected:
private:
Standard_Real myTols[3];
Standard_Integer myNbTol;
};
#endif // _ShapeAnalysis_ShapeTolerance_HeaderFile

View File

@@ -1,81 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Shell from ShapeAnalysis
---Purpose: This class provides operators to analyze edges orientation
-- in the shell.
uses
Shape from TopoDS,
Compound from TopoDS,
IndexedMapOfShape from TopTools
is
Clear (me : in out);
---Purpose: Clears data about loaded shells and performed checks
LoadShells (me : in out; shape : Shape from TopoDS);
---Purpose: Adds shells contained in the <shape> to the list of loaded shells
CheckOrientedShells (me : in out; shape : Shape from TopoDS;
alsofree: Boolean = Standard_False;
checkinternaledges: Boolean = Standard_False)
returns Boolean;
---Purpose: Checks if shells fulfill orientation condition, i.e. if each
-- edge is, either present once (free edge) or twice (connected
-- edge) but with different orientations (FORWARD/REVERSED)
-- Edges which do not fulfill these conditions are bad
--
-- If <alsofree> is True free edges are considered.
-- Free edges can be queried but are not bad
IsLoaded (me; shape : Shape from TopoDS) returns Boolean;
---Purpose: Tells if a shape is loaded (only shells are checked)
NbLoaded (me) returns Integer;
---Purpose: Returns the actual number of loaded shapes (i.e. shells)
Loaded (me; num : Integer) returns Shape from TopoDS;
---Purpose: Returns a loaded shape specified by its rank number.
-- Returns null shape if <num> is out of range
HasBadEdges (me) returns Boolean;
---Purpose: Tells if at least one edge is recorded as bad
BadEdges (me) returns Compound from TopoDS;
---Purpose: Returns the list of bad edges as a Compound
-- It is empty (not null) if no edge are recorded as bad
HasFreeEdges (me) returns Boolean;
---Purpose: Tells if at least one edge is recorded as free (not connected)
FreeEdges (me) returns Compound from TopoDS;
---Purpose: Returns the list of free (not connected) edges as a Compound
-- It is empty (not null) if no edge are recorded as free
HasConnectedEdges (me) returns Boolean;
---Purpose: Tells if at least one edge is connected (shared twice or more)
fields
myShells: IndexedMapOfShape from TopTools;
myBad : IndexedMapOfShape from TopTools;
myFree : IndexedMapOfShape from TopTools;
myConex : Boolean; -- are there or not
end Shell;

View File

@@ -12,21 +12,21 @@
// commercial license or contractual agreement.
//szv#4 S4163
#include <ShapeAnalysis_Shell.ixx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <ShapeAnalysis_Shell.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void ShapeAnalysis_Shell::Clear()
{
myShells.Clear();

View File

@@ -0,0 +1,109 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_Shell_HeaderFile
#define _ShapeAnalysis_Shell_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class TopoDS_Shape;
class TopoDS_Compound;
//! This class provides operators to analyze edges orientation
//! in the shell.
class ShapeAnalysis_Shell
{
public:
DEFINE_STANDARD_ALLOC
//! Clears data about loaded shells and performed checks
Standard_EXPORT void Clear();
//! Adds shells contained in the <shape> to the list of loaded shells
Standard_EXPORT void LoadShells (const TopoDS_Shape& shape);
//! Checks if shells fulfill orientation condition, i.e. if each
//! edge is, either present once (free edge) or twice (connected
//! edge) but with different orientations (FORWARD/REVERSED)
//! Edges which do not fulfill these conditions are bad
//!
//! If <alsofree> is True free edges are considered.
//! Free edges can be queried but are not bad
Standard_EXPORT Standard_Boolean CheckOrientedShells (const TopoDS_Shape& shape, const Standard_Boolean alsofree = Standard_False, const Standard_Boolean checkinternaledges = Standard_False);
//! Tells if a shape is loaded (only shells are checked)
Standard_EXPORT Standard_Boolean IsLoaded (const TopoDS_Shape& shape) const;
//! Returns the actual number of loaded shapes (i.e. shells)
Standard_EXPORT Standard_Integer NbLoaded() const;
//! Returns a loaded shape specified by its rank number.
//! Returns null shape if <num> is out of range
Standard_EXPORT TopoDS_Shape Loaded (const Standard_Integer num) const;
//! Tells if at least one edge is recorded as bad
Standard_EXPORT Standard_Boolean HasBadEdges() const;
//! Returns the list of bad edges as a Compound
//! It is empty (not null) if no edge are recorded as bad
Standard_EXPORT TopoDS_Compound BadEdges() const;
//! Tells if at least one edge is recorded as free (not connected)
Standard_EXPORT Standard_Boolean HasFreeEdges() const;
//! Returns the list of free (not connected) edges as a Compound
//! It is empty (not null) if no edge are recorded as free
Standard_EXPORT TopoDS_Compound FreeEdges() const;
//! Tells if at least one edge is connected (shared twice or more)
Standard_EXPORT Standard_Boolean HasConnectedEdges() const;
protected:
private:
TopTools_IndexedMapOfShape myShells;
TopTools_IndexedMapOfShape myBad;
TopTools_IndexedMapOfShape myFree;
Standard_Boolean myConex;
};
#endif // _ShapeAnalysis_Shell_HeaderFile

View File

@@ -1,403 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Surface from ShapeAnalysis inherits TShared from MMgt
---Purpose: Complements standard tool Geom_Surface by providing additional
-- functionality for detection surface singularities, checking
-- spatial surface closure and computing projections of 3D points
-- onto a surface.
--
-- * The singularities
-- Each singularity stores the precision with which corresponding
-- surface iso-line is considered as degenerated.
-- The number of singularities is determined by specifying precision
-- and always not greater than 4.
--
-- * The spatial closure
-- The check for spatial closure is performed with given precision
-- (default value is Precision::Confusion).
-- If Geom_Surface says that the surface is closed, this class
-- also says this. Otherwise additional analysis is performed.
--
-- * The parameters of 3D point on the surface
-- The projection of the point is performed with given precision.
-- This class tries to find a solution taking into account possible
-- singularities.
-- Additional method for searching the solution from already built
-- one is also provided.
--
-- This tool is optimised: computes most information only once
uses
Pnt from gp,
Pnt2d from gp,
Box from Bnd,
Curve from Geom,
Surface from Geom,
Surface from GeomAdaptor,
HSurface from GeomAdaptor,
ExtPS from Extrema,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp
is
Create (S : Surface from Geom) returns Surface from ShapeAnalysis;
---Purpose: Creates an analyzer object on the basis of existing surface
Init (me : mutable; S: Surface from Geom);
---Purpose: Loads existing surface
Init (me : mutable; other: Surface from ShapeAnalysis);
---Purpose: Reads all the data from another Surface, without recomputing
SetDomain(me : mutable; U1, U2, V1, V2 : Real);
Surface (me) returns Surface from Geom;
---C++: return const &
---C++: inline
---Purpose: Returns a surface being analyzed
Adaptor3d (me : mutable) returns HSurface from GeomAdaptor;
---C++: return const &
---Purpose: Returns the Adaptor.
-- Creates it if not yet done.
TrueAdaptor3d (me) returns HSurface from GeomAdaptor;
---C++: return const &
---C++: inline
---Purpose: Returns the Adaptor (may be Null if method Adaptor() was not called)
Gap (me) returns Real;
---C++: inline
---Purpose: Returns 3D distance found by one of the following methods.
-- IsDegenerated, DegeneratedValues, ProjectDegenerated
-- (distance between 3D point and found or last (if not found)
-- singularity),
-- IsUClosed, IsVClosed (minimum value of precision to consider
-- the surface to be closed),
-- ValueOfUV (distance between 3D point and found solution).
Value (me : mutable; u,v : Real) returns Pnt from gp;
---C++: inline
---Purpose: Returns a 3D point specified by parameters in surface
-- parametrical space
Value (me : mutable; p2d : Pnt2d from gp) returns Pnt from gp;
---C++: inline
---Purpose: Returns a 3d point specified by a point in surface
-- parametrical space
ComputeSingularities (me: mutable) is private;
---Purpose: Computes singularities on the surface.
-- Computes the sizes of boundaries or singular ares of the
-- surface. Then each boundary or area is considered as
-- degenerated with precision not less than its size.
--
-- The singularities and corresponding precisions are the
-- following:
-- - ConicalSurface - one degenerated point (apex of the cone),
-- precision is 0.,
-- - ToroidalSurface - two degenerated points, precision is
-- Max (0, majorR-minorR),
-- - SphericalSurface - two degenerated points (poles),
-- precision is 0.
-- - Bounded, Surface Of Revolution, Offset - four degenerated
-- points, precisions are maximum distance between corners
-- and middle point on the boundary
--
---Remark: Considers only boundaries of the surface (i.e. does not detect
-- singularity if it is inside parametrical space)
HasSingularities (me: mutable; preci: Real) returns Boolean;
---Purpose: Returns True if the surface has singularities for the given
-- precision (i.e. if there are surface singularities with sizes
-- not greater than precision).
NbSingularities (me: mutable; preci: Real) returns Integer;
---Purpose: Returns the number of singularities for the given precision
-- (i.e. number of surface singularities with sizes not greater
-- than precision).
Singularity (me: mutable; num : Integer;
preci : out Real;
P3d : out Pnt from gp;
firstP2d, lastP2d: out Pnt2d from gp;
firstpar, lastpar: out Real;
uisodeg : out Boolean)
returns Boolean;
---Purpose: Returns the characteristics of the singularity specified by
-- its rank number <num>.
-- That means, that it is not neccessary for <num> to be in the
-- range [1, NbSingularities] but must be not greater than
-- possible (see ComputeSingularities).
-- The returned characteristics are:
-- preci: the smallest precision with which the iso-line is
-- considered as degenerated,
-- P3d: 3D point of singularity (middle point of the surface
-- iso-line),
-- firstP2d and lastP2d: first and last 2D points of the
-- iso-line in parametrical surface,
-- firstpar and lastpar: first and last parameters of the
-- iso-line in parametrical surface,
-- uisodeg: if the degenerated iso-line is U-iso (True) or
-- V-iso (False).
-- Returns False if <num> is out of range, else returns True.
---Remarks - all the singularities are sorted in ascending order by
-- precision
-- - firstP2d and lastP2d are such to define left-hand passing of
-- parametrical space
IsDegenerated (me: mutable; P3d : Pnt from gp;
preci: Real)
returns Boolean;
---Purpose: Returns True if there is at least one surface boundary which
-- is considered as degenerated with <preci> and distance
-- between P3d and corresponding singular point is less than
-- <preci>
DegeneratedValues (me: mutable; P3d : Pnt from gp;
preci : Real;
firstP2d, lastP2d: out Pnt2d from gp;
firstpar, lastpar: out Real;
forward : Boolean = Standard_True)
returns Boolean;
---Purpose: Returns True if there is at least one surface iso-line which
-- is considered as degenerated with <preci> and distance
-- between P3d and corresponding singular point is less than
-- <preci> (like IsDegenerated).
-- Returns characteristics of the first found boundary matching
-- those criteria.
---Remark : <forward> is not used
ProjectDegenerated (me: mutable; P3d : Pnt from gp;
preci : Real;
neighbour: Pnt2d from gp;
result : in out Pnt2d from gp)
returns Boolean;
---Purpose: Projects a point <P3d> on a singularity by computing
-- one of the coordinates of preliminary computed <result>.
--
-- Finds the iso-line which is considered as degenerated with
-- <preci> and
-- a. distance between P3d and corresponding singular point is
-- less than <preci> (like IsDegenerated) or
-- b. difference between already computed <result>'s coordinate
-- and iso-coordinate of the boundary is less than 2D
-- resolution (computed from <preci> by Geom_Adaptor).
-- Then sets not yet computed <result>'s coordinate taking it
-- from <neighbour> and returns True.
---Example: U-iso at Ufirst=0 is degenerated with 1e-03,
-- <neighbour> = (0, 0.5),
-- <result> = (1e-06, ?); (1e-06 - already computed, ? - not yet)
-- After, <result> will be (1e-06, 0.5): 0.5 is taken from <neighbour>
--
---Remark : This is only one method to compute the coordinate taking it
-- from neighbour point. Other methods are also possible (by
-- using tangent or C2, etc).
--
-- If the P3d is not on a singularity, no computation is done,
-- returns False and <result> remains unchanged
ProjectDegenerated (me: mutable; nbrPnt: Integer;
points: Array1OfPnt from TColgp;
pnt2d : in out Array1OfPnt2d from TColgp;
preci : Real;
direct: Boolean)
returns Boolean;
---Purpose: Checks points at the beginning (direct is True) or end
-- (direct is False) of array <points> to lie in singularity of
-- surface, and if yes, adjusts the indeterminate 2d coordinate
-- of these points by nearest point which is not in singularity.
-- Returns True if some points were adjusted.
IsDegenerated (me: mutable; p2d1, p2d2: Pnt2d from gp; tol, ratio: Real)
returns Boolean;
---Purpose: Returns True if straight pcurve going from point p2d1 to p2d2
-- is degenerate, i.e. lies in the singularity of the surface.
-- NOTE: it uses another method of detecting singularity than
-- used by ComputeSingularities() et al.!
-- For that, maximums of distances between points p2d1, p2d2
-- and 0.5*(p2d1+p2d2) and between corresponding 3d points are
-- computed.
-- The pcurve (p2d1, p2d2) is considered as degenerate if:
-- - max distance in 3d is less than <tol>
-- - max distance in 2d is at least <ratio> times greather than
-- the Resolution computed from max distance in 3d
-- (max3d < tol && max2d > ratio * Resolution(max3d))
-- NOTE: <ratio> should be >1 (e.g. 10)
Bounds (me; ufirst, ulast, vfirst, vlast: out Real);
---C++: inline
---Purpose: Returns the bounds of the surface
-- (from Bounds from Surface, but buffered)
ComputeBoundIsos(me : mutable);
---Purpose: Computes bound isos (protected against exceptions)
UIso (me: mutable; U: Real) returns Curve from Geom;
---Purpose: Returns a U-Iso. Null if not possible or failed
-- Remark : bound isos are buffered
VIso (me: mutable; V: Real) returns Curve from Geom;
---Purpose: Returns a V-Iso. Null if not possible or failed
-- Remark : bound isos are buffered
IsUClosed (me: mutable; preci: Real = -1) returns Boolean;
---Purpose: Tells if the Surface is spatially closed in U with given
-- precision. If <preci> < 0 then Precision::Confusion is used.
-- If Geom_Surface says that the surface is U-closed, this method
-- also says this. Otherwise additional analysis is performed,
-- comparing given precision with the following distances:
-- - periodic B-Splines are closed,
-- - polinomial B-Spline with boundary multiplicities degree+1
-- and Bezier - maximum distance between poles,
-- - rational B-Spline or one with boundary multiplicities not
-- degree+1 - maximum distance computed at knots and their
-- middles,
-- - surface of extrusion - distance between ends of basis
-- curve,
-- - other (RectangularTrimmed and Offset) - maximum distance
-- computed at 100 equi-distanted points.
IsVClosed (me: mutable; preci: Real = -1) returns Boolean;
---Purpose: Tells if the Surface is spatially closed in V with given
-- precision. If <preci> < 0 then Precision::Confusion is used.
-- If Geom_Surface says that the surface is V-closed, this method
-- also says this. Otherwise additional analysis is performed,
-- comparing given precision with the following distances:
-- - periodic B-Splines are closed,
-- - polinomial B-Spline with boundary multiplicities degree+1
-- and Bezier - maximum distance between poles,
-- - rational B-Spline or one with boundary multiplicities not
-- degree+1 - maximum distance computed at knots and their
-- middles,
-- - surface of revolution - distance between ends of basis
-- curve,
-- - other (RectangularTrimmed and Offset) - maximum distance
-- computed at 100 equi-distanted points.
ValueOfUV (me: mutable; P3D: Pnt from gp;
preci : Real)
returns Pnt2d from gp;
---Purpose: Computes the parameters in the surface parametrical space of
-- 3D point.
-- The result is parameters of the point projected onto the
-- surface.
-- This method enhances functionality provided by the standard
-- tool GeomAPI_ProjectPointOnSurface by treatment of cases when
-- the projected point is near to the surface boundaries and
-- when this standard tool fails.
NextValueOfUV (me: mutable; p2dPrev: Pnt2d from gp;
P3D : Pnt from gp;
preci : Real;
maxpreci:Real = -1.0)
returns Pnt2d from gp;
---Purpose: Projects a point P3D on the surface.
-- Does the same thing as ValueOfUV but tries to optimize
-- computations by taking into account previous point <p2dPrev>:
-- makes a step by UV and tries Newton algorithm.
-- If <maxpreci> >0. and distance between solution and
-- P3D is greater than <maxpreci>, that solution is considered
-- as bad, and ValueOfUV() is used.
-- If not succeded, calls ValueOfUV()
UVFromIso (me: mutable; P3D : Pnt from gp;
preci : Real;
U, V : in out Real)
returns Real;
---Purpose: Tries a refinement of an already computed couple (U,V) by
-- using projecting 3D point on iso-lines:
-- 1. boundaries of the surface,
-- 2. iso-lines passing through (U,V)
-- 3. iteratively received iso-lines passing through new U and
-- new V (number of iterations is limited by 5 in each
-- direction)
-- Returns the best resulting distance between P3D and Value(U,V)
-- in the case of success. Else, returns a very great value
UCloseVal (me) returns Real;
---C++: inline
---Purpose: Returns minimum value to consider the surface as U-closed
VCloseVal (me) returns Real;
---C++: inline
---Purpose: Returns minimum value to consider the surface as V-closed
GetBoxUF(me: mutable) returns Box from Bnd;
---C++: return const&
GetBoxUL(me: mutable) returns Box from Bnd;
---C++: return const&
GetBoxVF(me: mutable) returns Box from Bnd;
---C++: return const&
GetBoxVL(me: mutable) returns Box from Bnd;
---C++: return const&
ComputeBoxes(me: mutable) is private;
SurfaceNewton (me: mutable; p2dPrev: Pnt2d from gp;
P3D : Pnt from gp;
preci : Real;
sol :in out Pnt2d from gp)
returns Boolean is private;
SortSingularities (me: mutable) is private;
fields
mySurf : Surface from Geom is protected;
myAdSur : HSurface from GeomAdaptor is protected;
myExtPS : ExtPS from Extrema is protected; -- speed optimization
myExtSrf : Surface from GeomAdaptor is protected; -- for extrema
myExtOK : Boolean is protected; -- is theExtPS initialized?
myNbDeg : Integer is protected; -- < 0 means not yet computed
myPreci : Real [4] is protected;
myP3d : Pnt from gp [4] is protected;
myFirstP2d : Pnt2d from gp [4] is protected;
myLastP2d : Pnt2d from gp [4] is protected;
myFirstPar : Real [4] is protected;
myLastPar : Real [4] is protected;
myUIsoDeg : Boolean [4] is protected; -- True if U-iso is degenerated, False if V-iso
myIsos : Boolean is protected; -- are bound isos computed
myUF : Real is protected;
myUL : Real is protected;
myVF : Real is protected;
myVL : Real is protected;
myIsoUF : Curve from Geom is protected;
myIsoUL : Curve from Geom is protected;
myIsoVF : Curve from Geom is protected;
myIsoVL : Curve from Geom is protected;
myIsoBoxes : Boolean is protected; -- are boxes for bound isos computed
myBndUF : Box from Bnd is protected;
myBndUL : Box from Bnd is protected;
myBndVF : Box from Bnd is protected;
myBndVL : Box from Bnd is protected;
myGap : Real is protected;
myUDelt : Real is protected; -- what overparametrisation to have good ValueOfUV
myVDelt : Real is protected;
myUCloseVal: Real is protected; -- minimum value to consider the surface as U-closed
myVCloseVal: Real is protected; -- minimum value to consider the surface as V-closed
end Surface;

View File

@@ -26,43 +26,44 @@
//#4 szv S4163: optimizations
//:r9 abv 09.04.99: id_turbine-C.stp #3865: check degenerated 2d point by recomputing to 3d instead of Resolution
//:s5 abv 22.04.99 Adding debug printouts in catch {} blocks
#include <ShapeAnalysis_Surface.ixx>
#include <Adaptor3d_Curve.hxx>
#include <Adaptor3d_IsoCurve.hxx>
#include <Bnd_Box.hxx>
#include <BndLib_Add3dCurve.hxx>
#include <ElSLib.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BoundedSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_BezierSurface.hxx> //S4135
#include <Geom_ConicalSurface.hxx>
#include <Geom_OffsetSurface.hxx> //S4135
#include <Geom_Curve.hxx>
#include <Geom_OffsetSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <ElSLib.hxx>
#include <GeomAbs_SurfaceForm.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Standard_NoSuchObject.hxx>
#include <ShapeAnalysis.hxx>
#include <Adaptor3d_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Adaptor3d_IsoCurve.hxx>
#include <GeomAbs_SurfaceForm.hxx>
#include <BndLib_Add3dCurve.hxx>
#include <Standard_Type.hxx>
//S4135
//S4135
//=======================================================================
//function : ShapeAnalysis_Surface
//purpose :
//=======================================================================
ShapeAnalysis_Surface::ShapeAnalysis_Surface(const Handle(Geom_Surface)& S) :
mySurf (S),
myExtOK(Standard_False), //:30

View File

@@ -0,0 +1,367 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_Surface_HeaderFile
#define _ShapeAnalysis_Surface_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Extrema_ExtPS.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <Bnd_Box.hxx>
#include <MMgt_TShared.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
class Geom_Surface;
class GeomAdaptor_HSurface;
class Geom_Curve;
class gp_Pnt2d;
class gp_Pnt;
class Bnd_Box;
class ShapeAnalysis_Surface;
DEFINE_STANDARD_HANDLE(ShapeAnalysis_Surface, MMgt_TShared)
//! Complements standard tool Geom_Surface by providing additional
//! functionality for detection surface singularities, checking
//! spatial surface closure and computing projections of 3D points
//! onto a surface.
//!
//! * The singularities
//! Each singularity stores the precision with which corresponding
//! surface iso-line is considered as degenerated.
//! The number of singularities is determined by specifying precision
//! and always not greater than 4.
//!
//! * The spatial closure
//! The check for spatial closure is performed with given precision
//! (default value is Precision::Confusion).
//! If Geom_Surface says that the surface is closed, this class
//! also says this. Otherwise additional analysis is performed.
//!
//! * The parameters of 3D point on the surface
//! The projection of the point is performed with given precision.
//! This class tries to find a solution taking into account possible
//! singularities.
//! Additional method for searching the solution from already built
//! one is also provided.
//!
//! This tool is optimised: computes most information only once
class ShapeAnalysis_Surface : public MMgt_TShared
{
public:
//! Creates an analyzer object on the basis of existing surface
Standard_EXPORT ShapeAnalysis_Surface(const Handle(Geom_Surface)& S);
//! Loads existing surface
Standard_EXPORT void Init (const Handle(Geom_Surface)& S);
//! Reads all the data from another Surface, without recomputing
Standard_EXPORT void Init (const Handle(ShapeAnalysis_Surface)& other);
Standard_EXPORT void SetDomain (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2);
//! Returns a surface being analyzed
const Handle(Geom_Surface)& Surface() const;
//! Returns the Adaptor.
//! Creates it if not yet done.
Standard_EXPORT const Handle(GeomAdaptor_HSurface)& Adaptor3d();
//! Returns the Adaptor (may be Null if method Adaptor() was not called)
const Handle(GeomAdaptor_HSurface)& TrueAdaptor3d() const;
//! Returns 3D distance found by one of the following methods.
//! IsDegenerated, DegeneratedValues, ProjectDegenerated
//! (distance between 3D point and found or last (if not found)
//! singularity),
//! IsUClosed, IsVClosed (minimum value of precision to consider
//! the surface to be closed),
//! ValueOfUV (distance between 3D point and found solution).
Standard_Real Gap() const;
//! Returns a 3D point specified by parameters in surface
//! parametrical space
gp_Pnt Value (const Standard_Real u, const Standard_Real v);
//! Returns a 3d point specified by a point in surface
//! parametrical space
gp_Pnt Value (const gp_Pnt2d& p2d);
//! Returns True if the surface has singularities for the given
//! precision (i.e. if there are surface singularities with sizes
//! not greater than precision).
Standard_EXPORT Standard_Boolean HasSingularities (const Standard_Real preci);
//! Returns the number of singularities for the given precision
//! (i.e. number of surface singularities with sizes not greater
//! than precision).
Standard_EXPORT Standard_Integer NbSingularities (const Standard_Real preci);
//! Returns the characteristics of the singularity specified by
//! its rank number <num>.
//! That means, that it is not neccessary for <num> to be in the
//! range [1, NbSingularities] but must be not greater than
//! possible (see ComputeSingularities).
//! The returned characteristics are:
//! preci: the smallest precision with which the iso-line is
//! considered as degenerated,
//! P3d: 3D point of singularity (middle point of the surface
//! iso-line),
//! firstP2d and lastP2d: first and last 2D points of the
//! iso-line in parametrical surface,
//! firstpar and lastpar: first and last parameters of the
//! iso-line in parametrical surface,
//! uisodeg: if the degenerated iso-line is U-iso (True) or
//! V-iso (False).
//! Returns False if <num> is out of range, else returns True.
Standard_EXPORT Standard_Boolean Singularity (const Standard_Integer num, Standard_Real& preci, gp_Pnt& P3d, gp_Pnt2d& firstP2d, gp_Pnt2d& lastP2d, Standard_Real& firstpar, Standard_Real& lastpar, Standard_Boolean& uisodeg);
//! Returns True if there is at least one surface boundary which
//! is considered as degenerated with <preci> and distance
//! between P3d and corresponding singular point is less than
//! <preci>
Standard_EXPORT Standard_Boolean IsDegenerated (const gp_Pnt& P3d, const Standard_Real preci);
//! Returns True if there is at least one surface iso-line which
//! is considered as degenerated with <preci> and distance
//! between P3d and corresponding singular point is less than
//! <preci> (like IsDegenerated).
//! Returns characteristics of the first found boundary matching
//! those criteria.
Standard_EXPORT Standard_Boolean DegeneratedValues (const gp_Pnt& P3d, const Standard_Real preci, gp_Pnt2d& firstP2d, gp_Pnt2d& lastP2d, Standard_Real& firstpar, Standard_Real& lastpar, const Standard_Boolean forward = Standard_True);
//! Projects a point <P3d> on a singularity by computing
//! one of the coordinates of preliminary computed <result>.
//!
//! Finds the iso-line which is considered as degenerated with
//! <preci> and
//! a. distance between P3d and corresponding singular point is
//! less than <preci> (like IsDegenerated) or
//! b. difference between already computed <result>'s coordinate
//! and iso-coordinate of the boundary is less than 2D
//! resolution (computed from <preci> by Geom_Adaptor).
//! Then sets not yet computed <result>'s coordinate taking it
//! from <neighbour> and returns True.
Standard_EXPORT Standard_Boolean ProjectDegenerated (const gp_Pnt& P3d, const Standard_Real preci, const gp_Pnt2d& neighbour, gp_Pnt2d& result);
//! Checks points at the beginning (direct is True) or end
//! (direct is False) of array <points> to lie in singularity of
//! surface, and if yes, adjusts the indeterminate 2d coordinate
//! of these points by nearest point which is not in singularity.
//! Returns True if some points were adjusted.
Standard_EXPORT Standard_Boolean ProjectDegenerated (const Standard_Integer nbrPnt, const TColgp_Array1OfPnt& points, TColgp_Array1OfPnt2d& pnt2d, const Standard_Real preci, const Standard_Boolean direct);
//! Returns True if straight pcurve going from point p2d1 to p2d2
//! is degenerate, i.e. lies in the singularity of the surface.
//! NOTE: it uses another method of detecting singularity than
//! used by ComputeSingularities() et al.!
//! For that, maximums of distances between points p2d1, p2d2
//! and 0.5*(p2d1+p2d2) and between corresponding 3d points are
//! computed.
//! The pcurve (p2d1, p2d2) is considered as degenerate if:
//! - max distance in 3d is less than <tol>
//! - max distance in 2d is at least <ratio> times greather than
//! the Resolution computed from max distance in 3d
//! (max3d < tol && max2d > ratio * Resolution(max3d))
//! NOTE: <ratio> should be >1 (e.g. 10)
Standard_EXPORT Standard_Boolean IsDegenerated (const gp_Pnt2d& p2d1, const gp_Pnt2d& p2d2, const Standard_Real tol, const Standard_Real ratio);
//! Returns the bounds of the surface
//! (from Bounds from Surface, but buffered)
void Bounds (Standard_Real& ufirst, Standard_Real& ulast, Standard_Real& vfirst, Standard_Real& vlast) const;
//! Computes bound isos (protected against exceptions)
Standard_EXPORT void ComputeBoundIsos();
//! Returns a U-Iso. Null if not possible or failed
//! Remark : bound isos are buffered
Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U);
//! Returns a V-Iso. Null if not possible or failed
//! Remark : bound isos are buffered
Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V);
//! Tells if the Surface is spatially closed in U with given
//! precision. If <preci> < 0 then Precision::Confusion is used.
//! If Geom_Surface says that the surface is U-closed, this method
//! also says this. Otherwise additional analysis is performed,
//! comparing given precision with the following distances:
//! - periodic B-Splines are closed,
//! - polinomial B-Spline with boundary multiplicities degree+1
//! and Bezier - maximum distance between poles,
//! - rational B-Spline or one with boundary multiplicities not
//! degree+1 - maximum distance computed at knots and their
//! middles,
//! - surface of extrusion - distance between ends of basis
//! curve,
//! - other (RectangularTrimmed and Offset) - maximum distance
//! computed at 100 equi-distanted points.
Standard_EXPORT Standard_Boolean IsUClosed (const Standard_Real preci = -1);
//! Tells if the Surface is spatially closed in V with given
//! precision. If <preci> < 0 then Precision::Confusion is used.
//! If Geom_Surface says that the surface is V-closed, this method
//! also says this. Otherwise additional analysis is performed,
//! comparing given precision with the following distances:
//! - periodic B-Splines are closed,
//! - polinomial B-Spline with boundary multiplicities degree+1
//! and Bezier - maximum distance between poles,
//! - rational B-Spline or one with boundary multiplicities not
//! degree+1 - maximum distance computed at knots and their
//! middles,
//! - surface of revolution - distance between ends of basis
//! curve,
//! - other (RectangularTrimmed and Offset) - maximum distance
//! computed at 100 equi-distanted points.
Standard_EXPORT Standard_Boolean IsVClosed (const Standard_Real preci = -1);
//! Computes the parameters in the surface parametrical space of
//! 3D point.
//! The result is parameters of the point projected onto the
//! surface.
//! This method enhances functionality provided by the standard
//! tool GeomAPI_ProjectPointOnSurface by treatment of cases when
//! the projected point is near to the surface boundaries and
//! when this standard tool fails.
Standard_EXPORT gp_Pnt2d ValueOfUV (const gp_Pnt& P3D, const Standard_Real preci);
//! Projects a point P3D on the surface.
//! Does the same thing as ValueOfUV but tries to optimize
//! computations by taking into account previous point <p2dPrev>:
//! makes a step by UV and tries Newton algorithm.
//! If <maxpreci> >0. and distance between solution and
//! P3D is greater than <maxpreci>, that solution is considered
//! as bad, and ValueOfUV() is used.
//! If not succeded, calls ValueOfUV()
Standard_EXPORT gp_Pnt2d NextValueOfUV (const gp_Pnt2d& p2dPrev, const gp_Pnt& P3D, const Standard_Real preci, const Standard_Real maxpreci = -1.0);
//! Tries a refinement of an already computed couple (U,V) by
//! using projecting 3D point on iso-lines:
//! 1. boundaries of the surface,
//! 2. iso-lines passing through (U,V)
//! 3. iteratively received iso-lines passing through new U and
//! new V (number of iterations is limited by 5 in each
//! direction)
//! Returns the best resulting distance between P3D and Value(U,V)
//! in the case of success. Else, returns a very great value
Standard_EXPORT Standard_Real UVFromIso (const gp_Pnt& P3D, const Standard_Real preci, Standard_Real& U, Standard_Real& V);
//! Returns minimum value to consider the surface as U-closed
Standard_Real UCloseVal() const;
//! Returns minimum value to consider the surface as V-closed
Standard_Real VCloseVal() const;
Standard_EXPORT const Bnd_Box& GetBoxUF();
Standard_EXPORT const Bnd_Box& GetBoxUL();
Standard_EXPORT const Bnd_Box& GetBoxVF();
Standard_EXPORT const Bnd_Box& GetBoxVL();
DEFINE_STANDARD_RTTI(ShapeAnalysis_Surface,MMgt_TShared)
protected:
Handle(Geom_Surface) mySurf;
Handle(GeomAdaptor_HSurface) myAdSur;
Extrema_ExtPS myExtPS;
GeomAdaptor_Surface myExtSrf;
Standard_Boolean myExtOK;
Standard_Integer myNbDeg;
Standard_Real myPreci[4];
gp_Pnt myP3d[4];
gp_Pnt2d myFirstP2d[4];
gp_Pnt2d myLastP2d[4];
Standard_Real myFirstPar[4];
Standard_Real myLastPar[4];
Standard_Boolean myUIsoDeg[4];
Standard_Boolean myIsos;
Standard_Real myUF;
Standard_Real myUL;
Standard_Real myVF;
Standard_Real myVL;
Handle(Geom_Curve) myIsoUF;
Handle(Geom_Curve) myIsoUL;
Handle(Geom_Curve) myIsoVF;
Handle(Geom_Curve) myIsoVL;
Standard_Boolean myIsoBoxes;
Bnd_Box myBndUF;
Bnd_Box myBndUL;
Bnd_Box myBndVF;
Bnd_Box myBndVL;
Standard_Real myGap;
Standard_Real myUDelt;
Standard_Real myVDelt;
Standard_Real myUCloseVal;
Standard_Real myVCloseVal;
private:
//! Computes singularities on the surface.
//! Computes the sizes of boundaries or singular ares of the
//! surface. Then each boundary or area is considered as
//! degenerated with precision not less than its size.
//!
//! The singularities and corresponding precisions are the
//! following:
//! - ConicalSurface - one degenerated point (apex of the cone),
//! precision is 0.,
//! - ToroidalSurface - two degenerated points, precision is
//! Max (0, majorR-minorR),
//! - SphericalSurface - two degenerated points (poles),
//! precision is 0.
//! - Bounded, Surface Of Revolution, Offset - four degenerated
//! points, precisions are maximum distance between corners
//! and middle point on the boundary
Standard_EXPORT void ComputeSingularities();
Standard_EXPORT void ComputeBoxes();
Standard_EXPORT Standard_Boolean SurfaceNewton (const gp_Pnt2d& p2dPrev, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt2d& sol);
Standard_EXPORT void SortSingularities();
};
#include <ShapeAnalysis_Surface.lxx>
#endif // _ShapeAnalysis_Surface_HeaderFile

View File

@@ -1,86 +0,0 @@
-- Created on: 1999-06-21
-- Created by: Galina KULIKOVA
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class TransferParameters from ShapeAnalysis inherits TShared from MMgt
---Purpose: This tool is used for transferring parameters
-- from 3d curve of the edge to pcurve and vice versa.
--
-- Default behaviour is to trsnafer parameters with help
-- of linear transformation:
--
-- T2d = myShift + myScale * T3d
-- where
-- myScale = ( Last2d - First2d ) / ( Last3d - First3d )
-- myShift = First2d - First3d * myScale
-- [First3d, Last3d] and [First2d, Last2d] are ranges of
-- edge on curve and pcurve
--
-- This behaviour can be redefined in derived classes, for example,
-- using projection.
uses
Edge from TopoDS,
Face from TopoDS,
HSequenceOfReal from TColStd,
HArray1OfReal from TColStd
is
Create returns TransferParameters from ShapeAnalysis;
---Purpose: Creates empty tool with myShift = 0 and myScale = 1
Create(E : Edge from TopoDS; F : Face from TopoDS)
returns TransferParameters from ShapeAnalysis;
---Purpose: Creates a tool and initializes it with edge and face
Init(me : mutable;E : Edge from TopoDS; F : Face from TopoDS ) is virtual;
---Purpose: Initialize a tool with edge and face
SetMaxTolerance(me:mutable; maxtol: Real);
---Purpose: Sets maximal tolerance to use linear recomputation of
-- parameters.
Perform(me : mutable; Params: HSequenceOfReal from TColStd; To2d : Boolean)
returns HSequenceOfReal from TColStd is virtual;
---Purpose: Transfers parameters given by sequence Params from 3d curve
-- to pcurve (if To2d is True) or back (if To2d is False)
Perform(me : mutable;Param : Real; To2d : Boolean) returns Real from Standard is virtual;
---Purpose: Transfers parameter given by sequence Params from 3d curve
-- to pcurve (if To2d is True) or back (if To2d is False)
TransferRange(me: mutable; newEdge : in out Edge from TopoDS; prevPar,currPar : Real;
To2d : Boolean) is virtual;
---Purpose:Recomputes range of curves from NewEdge.
-- If Is2d equals True parameters are recomputed by curve2d else by curve3d.
IsSameRange (me) returns Boolean is virtual;
---Purpose: Returns True if 3d curve of edge and pcurve are SameRange
-- (in default implementation, if myScale == 1 and myShift == 0)
fields
myShift : Real;
myScale : Real;
myFirst : Real is protected;
myLast : Real is protected;
myFirst2d : Real;
myLast2d : Real;
myEdge : Edge from TopoDS is protected;
myFace : Face from TopoDS;
myMaxTolerance: Real is protected;
end TransferParameters;

View File

@@ -11,21 +11,23 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeAnalysis_TransferParameters.ixx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <BRep_Tool.hxx>
#include <gp.hxx>
#include <ShapeBuild_Edge.hxx>
#include <BRep_Tool.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Curve.hxx>
#include <gp.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_TransferParameters.hxx>
#include <ShapeBuild_Edge.hxx>
#include <Standard_Type.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
//=======================================================================
//function : ShapeAnalysis_TransferParameters
//purpose :
//=======================================================================
ShapeAnalysis_TransferParameters::ShapeAnalysis_TransferParameters()
{
myScale = 1.;

View File

@@ -0,0 +1,118 @@
// Created on: 1999-06-21
// Created by: Galina KULIKOVA
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_TransferParameters_HeaderFile
#define _ShapeAnalysis_TransferParameters_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Real.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <MMgt_TShared.hxx>
#include <TColStd_HSequenceOfReal.hxx>
#include <Standard_Boolean.hxx>
class TopoDS_Edge;
class TopoDS_Face;
class ShapeAnalysis_TransferParameters;
DEFINE_STANDARD_HANDLE(ShapeAnalysis_TransferParameters, MMgt_TShared)
//! This tool is used for transferring parameters
//! from 3d curve of the edge to pcurve and vice versa.
//!
//! Default behaviour is to trsnafer parameters with help
//! of linear transformation:
//!
//! T2d = myShift + myScale * T3d
//! where
//! myScale = ( Last2d - First2d ) / ( Last3d - First3d )
//! myShift = First2d - First3d * myScale
//! [First3d, Last3d] and [First2d, Last2d] are ranges of
//! edge on curve and pcurve
//!
//! This behaviour can be redefined in derived classes, for example,
//! using projection.
class ShapeAnalysis_TransferParameters : public MMgt_TShared
{
public:
//! Creates empty tool with myShift = 0 and myScale = 1
Standard_EXPORT ShapeAnalysis_TransferParameters();
//! Creates a tool and initializes it with edge and face
Standard_EXPORT ShapeAnalysis_TransferParameters(const TopoDS_Edge& E, const TopoDS_Face& F);
//! Initialize a tool with edge and face
Standard_EXPORT virtual void Init (const TopoDS_Edge& E, const TopoDS_Face& F);
//! Sets maximal tolerance to use linear recomputation of
//! parameters.
Standard_EXPORT void SetMaxTolerance (const Standard_Real maxtol);
//! Transfers parameters given by sequence Params from 3d curve
//! to pcurve (if To2d is True) or back (if To2d is False)
Standard_EXPORT virtual Handle(TColStd_HSequenceOfReal) Perform (const Handle(TColStd_HSequenceOfReal)& Params, const Standard_Boolean To2d);
//! Transfers parameter given by sequence Params from 3d curve
//! to pcurve (if To2d is True) or back (if To2d is False)
Standard_EXPORT virtual Standard_Real Perform (const Standard_Real Param, const Standard_Boolean To2d);
//! Recomputes range of curves from NewEdge.
//! If Is2d equals True parameters are recomputed by curve2d else by curve3d.
Standard_EXPORT virtual void TransferRange (TopoDS_Edge& newEdge, const Standard_Real prevPar, const Standard_Real currPar, const Standard_Boolean To2d);
//! Returns True if 3d curve of edge and pcurve are SameRange
//! (in default implementation, if myScale == 1 and myShift == 0)
Standard_EXPORT virtual Standard_Boolean IsSameRange() const;
DEFINE_STANDARD_RTTI(ShapeAnalysis_TransferParameters,MMgt_TShared)
protected:
Standard_Real myFirst;
Standard_Real myLast;
TopoDS_Edge myEdge;
Standard_Real myMaxTolerance;
private:
Standard_Real myShift;
Standard_Real myScale;
Standard_Real myFirst2d;
Standard_Real myLast2d;
TopoDS_Face myFace;
};
#endif // _ShapeAnalysis_TransferParameters_HeaderFile

View File

@@ -1,101 +0,0 @@
-- Created on: 1999-06-21
-- Created by: Galina KULIKOVA
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class TransferParametersProj from ShapeAnalysis inherits TransferParameters from ShapeAnalysis
---Purpose: This tool is used for transferring parameters
-- from 3d curve of the edge to pcurve and vice versa.
-- This tool transfers parameters with help of
-- projection points from curve 3d on curve 2d and
-- vice versa
uses
Edge from TopoDS,
Face from TopoDS,
HSequenceOfReal from TColStd,
Location from TopLoc,
Curve from Geom,
Curve from Geom2d,
CurveOnSurface from Adaptor3d,
Vertex from TopoDS
is
Create returns TransferParametersProj from ShapeAnalysis;
---Purpose: Creats empty constructor.
Create(E: Edge from TopoDS; F: Face from TopoDS)
returns TransferParametersProj from ShapeAnalysis;
---Purpose:
Init(me: mutable; E: Edge from TopoDS; F: Face from TopoDS ) is redefined;
---Purpose:
Perform(me: mutable; Papams: HSequenceOfReal from TColStd; To2d: Boolean)
returns HSequenceOfReal from TColStd is redefined;
---Purpose: Transfers parameters given by sequence Params from 3d curve
-- to pcurve (if To2d is True) or back (if To2d is False)
Perform(me: mutable; Param: Real; To2d: Boolean)
returns Real is redefined;
---Purpose:Transfers parameter given by Param from 3d curve
-- to pcurve (if To2d is True) or back (if To2d is False)
ForceProjection (me: mutable) returns Boolean;
---Purpose: Returns modifiable flag forcing projection
-- If it is False (default), projection is done only
-- if edge is not SameParameter or if tolerance of edge
-- is greater than MaxTolerance()
---C++: return &
TransferRange(me: mutable; newEdge: in out Edge from TopoDS;
prevPar: Real;
currPar: Real;
Is2d : Boolean) is redefined;
---Purpose: Recomputes range of curves from NewEdge.
-- If Is2d equals True parameters are recomputed by curve2d else by curve3d.
IsSameRange(me) returns Boolean is redefined;
---Purpose: Returns False;
--
PreformSegment(me: mutable;Param :Real; To2d :Boolean;
First :Real; Last :Real)
returns Real is private;
CopyNMVertex(myclass; theVert: Vertex from TopoDS;
toedge: Edge from TopoDS;
fromedge: Edge from TopoDS ) returns Vertex from TopoDS;
---Purpose: Make a copy of non-manifold vertex theVert
-- (i.e. create new TVertex and replace PointRepresentations for this vertex
-- from fromedge to toedge. Other representations were copied)
CopyNMVertex(myclass; theVert: Vertex from TopoDS;
toFace: Face from TopoDS;
fromFace: Face from TopoDS ) returns Vertex from TopoDS;
---Purpose: Make a copy of non-manifold vertex theVert
-- (i.e. create new TVertex and replace PointRepresentations for this vertex
-- from fromFace to toFace. Other representations were copied)
fields
myCurve : Curve from Geom;
myCurve2d : Curve from Geom2d;
myAC3d : CurveOnSurface from Adaptor3d;
myPrecision : Real;
myLocation : Location from TopLoc;
myForceProj : Boolean;
myInitOK : Boolean;
end TransferParametersProj;

View File

@@ -11,45 +11,50 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ShapeAnalysis_TransferParametersProj.ixx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <BRep_Tool.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TopLoc_Location.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_ListOfCurveRepresentation.hxx>
#include <BRep_ListOfCurveRepresentation.hxx>
#include <Precision.hxx>
#include <ShapeBuild_Edge.hxx>
#include <BRep_Builder.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <ShapeAnalysis.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <BRep_ListOfPointRepresentation.hxx>
#include <BRep_TVertex.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_ListIteratorOfListOfPointRepresentation.hxx>
#include <BRep_PointRepresentation.hxx>
#include <BRep_PointOnSurface.hxx>
#include <BRep_ListOfCurveRepresentation.hxx>
#include <BRep_ListOfPointRepresentation.hxx>
#include <BRep_PointOnCurve.hxx>
#include <BRep_PointOnCurveOnSurface.hxx>
#include <TopoDS.hxx>
#include <BRep_PointOnSurface.hxx>
#include <BRep_PointRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx>
#include <BRep_TVertex.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <ShapeBuild_Edge.hxx>
#include <Standard_Type.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
//=======================================================================
//function : ShapeAnalysis_TransferParametersProj
//purpose :
//=======================================================================
ShapeAnalysis_TransferParametersProj::ShapeAnalysis_TransferParametersProj()
{
myMaxTolerance = 1; //Precision::Infinite(); ?? pdn

View File

@@ -0,0 +1,120 @@
// Created on: 1999-06-21
// Created by: Galina KULIKOVA
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_TransferParametersProj_HeaderFile
#define _ShapeAnalysis_TransferParametersProj_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Standard_Real.hxx>
#include <TopLoc_Location.hxx>
#include <Standard_Boolean.hxx>
#include <ShapeAnalysis_TransferParameters.hxx>
#include <TColStd_HSequenceOfReal.hxx>
class Geom_Curve;
class Geom2d_Curve;
class TopoDS_Edge;
class TopoDS_Face;
class TopoDS_Vertex;
class ShapeAnalysis_TransferParametersProj;
DEFINE_STANDARD_HANDLE(ShapeAnalysis_TransferParametersProj, ShapeAnalysis_TransferParameters)
//! This tool is used for transferring parameters
//! from 3d curve of the edge to pcurve and vice versa.
//! This tool transfers parameters with help of
//! projection points from curve 3d on curve 2d and
//! vice versa
class ShapeAnalysis_TransferParametersProj : public ShapeAnalysis_TransferParameters
{
public:
//! Creats empty constructor.
Standard_EXPORT ShapeAnalysis_TransferParametersProj();
Standard_EXPORT ShapeAnalysis_TransferParametersProj(const TopoDS_Edge& E, const TopoDS_Face& F);
Standard_EXPORT virtual void Init (const TopoDS_Edge& E, const TopoDS_Face& F) Standard_OVERRIDE;
//! Transfers parameters given by sequence Params from 3d curve
//! to pcurve (if To2d is True) or back (if To2d is False)
Standard_EXPORT virtual Handle(TColStd_HSequenceOfReal) Perform (const Handle(TColStd_HSequenceOfReal)& Papams, const Standard_Boolean To2d) Standard_OVERRIDE;
//! Transfers parameter given by Param from 3d curve
//! to pcurve (if To2d is True) or back (if To2d is False)
Standard_EXPORT virtual Standard_Real Perform (const Standard_Real Param, const Standard_Boolean To2d) Standard_OVERRIDE;
//! Returns modifiable flag forcing projection
//! If it is False (default), projection is done only
//! if edge is not SameParameter or if tolerance of edge
//! is greater than MaxTolerance()
Standard_EXPORT Standard_Boolean& ForceProjection();
//! Recomputes range of curves from NewEdge.
//! If Is2d equals True parameters are recomputed by curve2d else by curve3d.
Standard_EXPORT virtual void TransferRange (TopoDS_Edge& newEdge, const Standard_Real prevPar, const Standard_Real currPar, const Standard_Boolean Is2d) Standard_OVERRIDE;
//! Returns False;
Standard_EXPORT virtual Standard_Boolean IsSameRange() const Standard_OVERRIDE;
//! Make a copy of non-manifold vertex theVert
//! (i.e. create new TVertex and replace PointRepresentations for this vertex
//! from fromedge to toedge. Other representations were copied)
Standard_EXPORT static TopoDS_Vertex CopyNMVertex (const TopoDS_Vertex& theVert, const TopoDS_Edge& toedge, const TopoDS_Edge& fromedge);
//! Make a copy of non-manifold vertex theVert
//! (i.e. create new TVertex and replace PointRepresentations for this vertex
//! from fromFace to toFace. Other representations were copied)
Standard_EXPORT static TopoDS_Vertex CopyNMVertex (const TopoDS_Vertex& theVert, const TopoDS_Face& toFace, const TopoDS_Face& fromFace);
DEFINE_STANDARD_RTTI(ShapeAnalysis_TransferParametersProj,ShapeAnalysis_TransferParameters)
protected:
private:
Standard_EXPORT Standard_Real PreformSegment (const Standard_Real Param, const Standard_Boolean To2d, const Standard_Real First, const Standard_Real Last);
Handle(Geom_Curve) myCurve;
Handle(Geom2d_Curve) myCurve2d;
Adaptor3d_CurveOnSurface myAC3d;
Standard_Real myPrecision;
TopLoc_Location myLocation;
Standard_Boolean myForceProj;
Standard_Boolean myInitOK;
};
#endif // _ShapeAnalysis_TransferParametersProj_HeaderFile

View File

@@ -1,650 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Wire from ShapeAnalysis inherits TShared from MMgt
---Purpose: This class provides analysis of a wire to be compliant to
-- CAS.CADE requirements.
--
-- The functionalities provided are the following:
-- 1. consistency of 2d and 3d edge curve senses
-- 2. connection of adjacent edges regarding to:
-- a. their vertices
-- b. their pcurves
-- c. their 3d curves
-- 3. adjacency of the edge vertices to its pcurve and 3d curve
-- 4. if a wire is closed or not (considering its 3d and 2d
-- contour)
-- 5. if a wire is outer on its face (considering pcurves)
--
--
-- This class can be used in conjunction with class
-- ShapeFix_Wire, which will fix the problems detected by this class.
--
-- The methods of the given class match to ones of the class
-- ShapeFix_Wire, e.g., CheckSmall and FixSmall.
-- This class also includes some auxilary methods
-- (e.g., CheckOuterBound, etc.),
-- which have no pair in ShapeFix_Wire.
--
-- Like methods of ShapeFix_Wire the ones of this class are
-- grouped into two levels:
-- - Public which are recommended for use (the most global
-- method is Perform),
-- - Advanced, for optional use only
--
-- For analyzing result of Public API checking methods use
-- corresponding Status... method.
-- The 'advanced' functions share the single status field which
-- contains the result of the last performed 'advanced' method.
-- It is quried by the method LastCheckStatus().
--
-- In order to prepare an analyzer, it is necessary to load a wire,
-- set face and precision.
uses
Pnt2d from gp,
Curve from Geom2d,
Surface from Geom,
Location from TopLoc,
Shape from TopoDS,
Wire from TopoDS,
Face from TopoDS,
Edge from TopoDS,
SequenceOfIntersectionPoint from IntRes2d,
SequenceOfPnt from TColgp,
SequenceOfReal from TColStd,
Status from ShapeExtend,
WireData from ShapeExtend,
WireOrder from ShapeAnalysis,
Surface from ShapeAnalysis,
IndexedMapOfShape from TopTools,
DataMapOfShapeListOfShape from TopTools,
MapOfShape from TopTools
is
Create returns Wire from ShapeAnalysis;
---Purpose: Empty constructor
Create (wire : Wire from TopoDS;
face : Face from TopoDS;
precision: Real)
returns Wire from ShapeAnalysis;
---Purpose: Creates object with standard TopoDS_Wire, face
-- and precision
Create (sbwd : WireData from ShapeExtend;
face : Face from TopoDS;
precision: Real)
returns Wire from ShapeAnalysis;
---Purpose: Creates the object with WireData object, face
-- and precision
Init (me: mutable; wire : Wire from TopoDS;
face : Face from TopoDS;
precision: Real);
---Purpose: Initializes the object with standard TopoDS_Wire, face
-- and precision
Init (me: mutable; sbwd : WireData from ShapeExtend;
face : Face from TopoDS;
precision: Real);
---Purpose: Initializes the object with WireData object, face
-- and precision
Load (me: mutable; wire: Wire from TopoDS);
---Purpose: Loads the object with standard TopoDS_Wire
Load (me: mutable; sbwd: WireData from ShapeExtend);
---Purpose: Loads the object with WireData object
---Remark : Single WireData object will be shared
SetFace (me: mutable; face : Face from TopoDS);
---Purpose: Loads the face the wire lies on
SetSurface (me: mutable; surface : Surface from Geom);
---Purpose: Loads the surface the wire lies on
SetSurface (me: mutable; surface : Surface from Geom;
location: Location from TopLoc);
---Purpose: Loads the surface the wire lies on
SetPrecision (me: mutable; precision: Real);
---Precision: Set the precision value
ClearStatuses (me: mutable);
---Purpose: Unsets all the status and distance fields
-- wire, face and precision are not cleared
IsLoaded (me) returns Boolean;
---C++: inline
---Purpose: Returns True if wire is loaded and has number of edges >0
IsReady (me) returns Boolean;
---C++: inline
---Purpose: Returns True if IsLoaded and underlying face is not null
Precision (me) returns Real;
---C++: inline
---Purpose: Returns the value of precision
WireData (me) returns WireData from ShapeExtend;
---C++: return const &
---C++: inline
---Purpose: Returns wire object being analyzed
NbEdges (me) returns Integer;
---C++: inline
---Purpose: Returns the number of edges in the wire, or 0 if it is not loaded
Face (me) returns Face from TopoDS;
---C++: return const &
---C++: inline
---Purpose: Returns the working face
Surface (me) returns Surface from ShapeAnalysis;
---C++: return const &
---C++: inline
---Purpose: Returns the working surface
---Checking methods:
---Level: Public
---Return: Check..() methods return True when and only when the situation was
-- analyzed and the specific case detected.
-- This corresponds to the flag DONE (or one of DONE#i) set in Status.
Perform (me : mutable) returns Boolean;
---Purpose: Performs all the checks in the following order :
-- CheckOrder, CheckSmall, CheckConected, CheckEdgeCurves,
-- CheckDegenerated, CheckSelfIntersection, CheckLacking,
-- CheckClosed
-- Returns: True if at least one method returned True;
-- For deeper analysis use Status...(status) methods
CheckOrder (me: mutable; isClosed: Boolean = Standard_True;
mode3d: Boolean = Standard_True) returns Boolean;
---Purpose: Calls CheckOrder and returns False if wire is already
-- ordered (tail-to-head), True otherwise
-- Flag <isClosed> defines if the wire is closed or not
-- Flag <mode3d> defines which mode is used (3d or 2d)
CheckConnected (me : mutable; prec : Real = 0.0) returns Boolean;
---Purpose: Calls to CheckConnected for each edge
-- Returns: True if at least one pair of disconnected edges (not sharing the
-- same vertex) was detected
CheckSmall (me : mutable; precsmall : Real = 0.0) returns Boolean;
---Purpose: Calls to CheckSmall for each edge
-- Returns: True if at least one small edge was detected
CheckEdgeCurves (me : mutable) returns Boolean;
---Purpose: Checks edges geometry (consitency of 2d and 3d senses, adjasment
-- of curves to the vertices, etc.).
-- The order of the checks :
-- Call ShapeAnalysis_Wire to check:
-- ShapeAnalysis_Edge::CheckCurve3dWithPCurve (1),
-- ShapeAnalysis_Edge::CheckVertcesWithPCurve (2),
-- ShapeAnalysis_Edge::CheckVertcesWithCurve3d (3),
-- CheckSeam (4)
-- Additional:
-- CheckGap3d (5),
-- CheckGap2d (6),
-- ShapeAnalysis_Edge::CheckSameParameter (7)
-- Returns: True if at least one check returned True
-- Remark: The numbers in brackets show with what DONEi or FAILi
-- the status can be queried
CheckDegenerated (me : mutable) returns Boolean;
---Purpose: Calls to CheckDegenerated for each edge
-- Returns: True if at least one incorrect degenerated edge was detected
CheckClosed (me : mutable; prec : Real = 0.0) returns Boolean;
---Purpose: Checks if wire is closed, performs CheckConnected,
-- CheckDegenerated and CheckLacking for the first and the last edges
-- Returns: True if at least one check returned True
-- Status:
-- FAIL1 or DONE1: see CheckConnected
-- FAIL2 or DONE2: see CheckDegenerated
CheckSelfIntersection (me : mutable) returns Boolean;
---Purpose: Checks self-intersection of the wire (considering pcurves)
-- Looks for self-intersecting edges and each pair of intersecting
-- edges.
-- Warning: It does not check each edge with any other one (only each two
-- adjacent edges)
-- The order of the checks :
-- CheckSelfIntersectingEdge, CheckIntersectingEdges
-- Returns: True if at least one check returned True
-- Status: FAIL1 or DONE1 - see CheckSelfIntersectingEdge
-- FAIL2 or DONE2 - see CheckIntersectingEdges
CheckLacking (me : mutable) returns Boolean;
---Purpose: Calls to CheckLacking for each edge
-- Returns: True if at least one lacking edge was detected
CheckGaps3d (me : mutable) returns Boolean;
---Purpose:
---Returns:
CheckGaps2d (me : mutable) returns Boolean;
---Purpose:
---Returns:
CheckCurveGaps (me : mutable) returns Boolean;
---Purpose:
---Returns:
---Level: Advanced
---Status: For analyzing the status of the last performed method use method
-- Status(status)
--
-- All the Check...() methods below return False if the problem was
-- not detected. If so, Status(ShapeExtend_OK) returns True.
CheckOrder (me: mutable; sawo: out WireOrder from ShapeAnalysis;
isClosed: Boolean = Standard_True;
mode3d: Boolean = Standard_True)
returns Boolean;
---Purpose: Analyzes the order of the edges in the wire,
-- uses class WireOrder for that purpose.
-- Flag <isClosed> defines if the wire is closed or not
-- Flag <mode3d> defines which mode is used (3d or 2d)
-- Returns False if wire is already ordered (tail-to-head),
-- True otherwise.
-- Use returned WireOrder object for deeper analysis.
-- Status:
-- OK : the same edges orientation, the same edges sequence
-- DONE1: the same edges orientation, not the same edges sequence
-- DONE2: as DONE1 and gaps more than myPrecision
-- DONE3: not the same edges orientation (some need to be reversed)
-- DONE4: as DONE3 and gaps more than myPrecision
-- FAIL : algorithm failed (could not detect order)
CheckConnected (me : mutable; num: Integer; prec: Real = 0.0) returns Boolean;
---Purpose: Checks connected edges (num-th and preceeding).
-- Tests with starting preci from <SBWD> or with <prec> if
-- it is greater.
-- Considers Vertices.
-- Returns: False if edges are connected by the common vertex, else True
-- Status :
-- OK : Vertices (end of num-1 th edge and start on num-th one)
-- are already the same
-- DONE1 : Absolutely confused (gp::Resolution)
-- DONE2 : Confused at starting <preci> from <SBWD>
-- DONE3 : Confused at <prec> but not <preci>
-- FAIL1 : Not confused
-- FAIL2 : Not confused but confused with <preci> if reverse num-th edge
CheckSmall (me : mutable; num : Integer;
precsmall: Real = 0.0)
returns Boolean;
---Purpose: Checks if an edge has a length not greater than myPreci or
-- precsmall (if it is smaller)
-- Returns: False if its length is greater than precision
-- Status:
-- OK : edge is not small or degenerated
-- DONE1: edge is small, vertices are the same
-- DONE2: edge is small, vertices are not the same
-- FAIL : no 3d curve and pcurve
CheckSeam (me : mutable; num : Integer;
C1, C2: out Curve from Geom2d;
cf, cl: out Real)
returns Boolean;
---Purpose: Checks if a seam pcurves are correct oriented
-- Returns: False (status OK) if given edge is not a seam or if it is OK
-- C1 - current pcurve for FORWARD edge,
-- C2 - current pcurve for REVERSED edge (if returns True they
-- should be swapped for the seam),
-- cf, cl - first and last parameters on curves
-- Status:
-- OK : Pcurves are correct or edge is not seam
-- DONE : Seam pcurves should be swapped
CheckSeam (me : mutable; num: Integer) returns Boolean;
---Purpose: Checks if a seam pcurves are correct oriented
-- See previous functions for details
CheckDegenerated (me: mutable; num: Integer; dgnr1, dgnr2: out Pnt2d from gp)
returns Boolean;
---Purpose: Checks for degenerated edge between two adjacent ones.
-- Fills parameters dgnr1 and dgnr2 with points in paramterical
-- space that correspond to the singularity (either gap that
-- needs to be filled by degenerated edge or that already filled)
-- Returns: False if no singularity or edge is already degenerated,
-- otherwise True
-- Status:
-- OK : No surface singularity, or edge is already degenerated
-- DONE1: Degenerated edge should be inserted (gap in 2D)
-- DONE2: Edge <num> should be made degenerated (recompute pcurve
-- and set the flag)
-- FAIL1: One of edges neighbouring to degenerated one has
-- no pcurve
-- FAIL2: Edge marked as degenerated and has no pcurve
-- but singularity is not detected
CheckDegenerated (me: mutable; num: Integer)
returns Boolean;
---Purpose: Checks for degenerated edge between two adjacent ones.
-- Remark : Calls previous function
-- Status : See the function above for details
CheckGap3d (me : mutable; num : Integer = 0) returns Boolean;
---Purpose: Checks gap between edges in 3D (3d curves).
-- Checks the distance between ends of 3d curves of the num-th
-- and preceeding edge.
-- The distance can be queried by MinDistance3d.
--
-- Returns: True if status is DONE
-- Status:
-- OK : Gap is less than myPrecision
-- DONE : Gap is greater than myPrecision
-- FAIL : No 3d curve(s) on the edge(s)
CheckGap2d (me : mutable; num : Integer = 0) returns Boolean;
---Purpose: Checks gap between edges in 2D (pcurves).
-- Checks the distance between ends of pcurves of the num-th
-- and preceeding edge.
-- The distance can be queried by MinDistance2d.
--
-- Returns: True if status is DONE
-- Status:
-- OK : Gap is less than parametric precision out of myPrecision
-- DONE : Gap is greater than parametric precision out of myPrecision
-- FAIL : No pcurve(s) on the edge(s)
CheckCurveGap (me : mutable; num : Integer = 0) returns Boolean;
---Purpose: Checks gap between points on 3D curve and points on surface
-- generated by pcurve of the num-th edge.
-- The distance can be queried by MinDistance3d.
--
-- Returns: True if status is DONE
-- Status:
-- OK : Gap is less than myPrecision
-- DONE : Gap is greater than myPrecision
-- FAIL : No 3d curve(s) on the edge(s)
CheckSelfIntersectingEdge (me: mutable; num: Integer;
points2d: out SequenceOfIntersectionPoint from IntRes2d;
points3d: out SequenceOfPnt from TColgp)
returns Boolean;
---Purpose: Checks if num-th edge is self-intersecting.
-- Self-intersection is reported only if intersection point lies outside
-- of both end vertices of the edge.
-- Returns: True if edge is self-intersecting.
-- If returns True it also fills the sequences of intersection points
-- and corresponding 3d points (only that are not enclosed by a vertices)
-- Status:
-- FAIL1 : No pcurve
-- FAIL2 : No vertices
-- DONE1 : Self-intersection found
CheckSelfIntersectingEdge (me: mutable; num: Integer)
returns Boolean;
-- Purpose: Checks num-th edge to be self-intersecting.
-- Remark : Calls the previous method
-- Status : See the function above for details
CheckIntersectingEdges (me : mutable; num: Integer;
points2d: out SequenceOfIntersectionPoint from IntRes2d;
points3d: out SequenceOfPnt from TColgp;
errors: out SequenceOfReal from TColStd)
returns Boolean;
---Purpose: Checks two adjacent edges for intersecting.
-- Intersection is reported only if intersection point is not enclosed
-- by the common end vertex of the edges.
-- Returns: True if intersection is found.
-- If returns True it also fills the sequences of intersection points,
-- corresponding 3d points, and errors for them (half-distances between
-- intersection points in 3d calculated from one and from another edge)
-- Status:
-- FAIL1 : No pcurve
-- FAIL2 : No vertices
-- DONE1 : Self-intersection found
CheckIntersectingEdges (me: mutable; num: Integer)
returns Boolean;
---Purpose: Checks two adjacent edges for intersecting.
-- Remark : Calls the previous method
-- Status : See the function above for details
CheckIntersectingEdges(me: mutable; num1: Integer; num2: Integer;
points2d: out SequenceOfIntersectionPoint from IntRes2d;
points3d: out SequenceOfPnt from TColgp;
errors: out SequenceOfReal from TColStd)
returns Boolean;
---Purpose: Checks i-th and j-th edges for intersecting.
-- Remark : See the previous method for details
CheckIntersectingEdges(me: mutable; num1: Integer; num2: Integer)
returns Boolean;
---Purpose: Checks i-th and j-th edges for intersecting.
-- Remark : Calls previous method.
-- Status : See the function above for details
CheckLacking (me: mutable; num: Integer; Tolerance: Real;
p2d1, p2d2: out Pnt2d from gp) returns Boolean;
---Purpose: Checks if there is a gap in 2d between edges, not comprised by
-- the tolerance of their common vertex.
-- If <Tolerance> is greater than 0. and less than tolerance of
-- the vertex, then this value is used for check.
-- Returns: True if not closed gap was detected
-- p2d1 and p2d2 are the endpoint of <num-1>th edge and start of
-- the <num>th edge in 2d.
-- Status:
-- OK: No edge is lacking (3d and 2d connection)
-- FAIL1: edges have no vertices (at least one of them)
-- FAIL2: edges are neither connected by common vertex, nor have
-- coincided vertices
-- FAIL1: edges have no pcurves
-- DONE1: the gap is detected which cannot be closed by the tolerance
-- of the common vertex (or with value of <Tolerance>)
-- DONE2: is set (together with DONE1) if gap is detected and the
-- vector (p2d2 - p2d1) goes in direction opposite to the pcurves
-- of the edges (if angle is more than 0.9*PI).
CheckLacking (me : mutable; num: Integer; Tolerance: Real = 0.0) returns Boolean;
---Purpose: Checks if there is a gap in 2D between edges and not comprised by vertex tolerance
-- The value of SBWD.thepreci is used.
-- Returns: False if no edge should be inserted
-- Status:
-- OK : No edge is lacking (3d and 2d connection)
-- DONE1 : The vertex tolerance should be increased only (2d gap is
-- small)
-- DONE2 : Edge can be inserted (3d and 2d gaps are large enough)
CheckOuterBound (me: mutable; APIMake: Boolean = Standard_True)
returns Boolean;
---Purpose: Checks if wire defines an outer bound on the face
-- Uses ShapeAnalysis::IsOuterBound for analysis
-- If <APIMake> is True uses BRepAPI_MakeWire to build the
-- wire, if False (to be used only when edges share common
-- vertices) uses BRep_Builder to build the wire
--
---Returns: False if wire is an outer bound, else returns True
-- Status:
-- OK : If it is an outer wire
-- DONE : If not
CheckNotchedEdges(me : mutable; num : Integer;
shortNum : out Integer;
param : out Real;
Tolerance: Real = 0.0) returns Boolean;
---Purpose: Detects a notch
CheckSmallArea (me: mutable; theWire : Wire from TopoDS; theIsOuterWire : Boolean)
returns Boolean;
---Purpose: Checks if wire has parametric area less than precision.
CheckShapeConnect (me : mutable; shape : Shape from TopoDS; prec: Real = 0.0)
returns Boolean;
---Purpose: Checks with what orientation <shape> (wire or edge) can be
-- connected to the wire.
-- Tests distances with starting <preci> from <SBWD> (close confusion),
-- but if given <prec> is greater, tests with <prec> (coarse confusion).
-- The smallest found distance can be returned by MinDistance3d
--
-- Returns: False if status is FAIL (see below)
-- Status:
-- DONE1 : If <shape> follows <SBWD>, direct sense (normal)
-- DONE2 : If <shape> follows <SBWD>, but if reversed
-- DONE3 : If <shape> preceeds <SBWD>, direct sense
-- DONE4 : If <shape> preceeds <SBWD>, but if reversed
-- FAIL1 : If <shape> is neither an edge nor a wire
-- FAIL2 : If <shape> cannot be connected to <SBWD>
--
-- DONE5 : To the tail of <SBWD> the <shape> is closer with
-- direct sense
-- DONE6 : To the head of <SBWD> the <shape> is closer with
-- direct sense
--
-- Remark: Statuses DONE1 - DONE4, FAIL1 - FAIL2 are basic and
-- describe the nearest connection of the <shape> to <SBWD>.
-- Statuses DONE5 and DONE6 are advanced and are to be used when
-- analyzing with what sense (direct or reversed) the <shape>
-- should be connected to <SBWD>:
-- For tail of <SBWD> if DONE4 is True <shape> should be direct,
-- otherwise reversed.
-- For head of <SBWD> if DONE5 is True <shape> should be direct,
-- otherwise reversed.
CheckShapeConnect (me : mutable; tailhead: out Real;
tailtail: out Real;
headtail: out Real;
headhead: out Real;
shape : Shape from TopoDS;
prec : Real = 0.0)
returns Boolean;
---Purpose: The same as previous CheckShapeConnect but is more advanced.
-- It returns the distances between each end of <sbwd> and each
-- end of <shape>. For example, <tailhead> stores distance
-- between tail of <sbwd> and head of <shape>
-- Remark: First method CheckShapeConnect calls this one
CheckLoop (me : mutable; aMapLoopVertices : out IndexedMapOfShape from TopTools;
aMapVertexEdges :out DataMapOfShapeListOfShape from TopTools;
aMapSmallEdges : out MapOfShape from TopTools;
aMapSeemEdges : out MapOfShape from TopTools) returns Boolean;
---Purpose: Checks existance of loop on wire and return vertices wich are loop vertices
-- (vertices belonging to a few pairs of edges)
CheckTail(me : mutable;
theEdge1: in Edge from TopoDS;
theEdge2: in Edge from TopoDS;
theMaxSine: in Real;
theMaxWidth: in Real;
theMaxTolerance: in Real;
theEdge11: out Edge from TopoDS;
theEdge12: out Edge from TopoDS;
theEdge21: out Edge from TopoDS;
theEdge22: out Edge from TopoDS) returns Boolean;
---Status after checking :
---Level : Public
-- Querying the status of perfomed API checking procedures
StatusOrder (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusConnected (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusEdgeCurves (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusDegenerated (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusClosed (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusSmall (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusSelfIntersection (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusLacking (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusGaps3d (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusGaps2d (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusCurveGaps (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
StatusLoop (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
---Level : Advanced
LastCheckStatus (me; Status: Status from ShapeExtend) returns Boolean;
---C++: inline
---Purpose: Querying the status of the LAST perfomed 'Advanced' checking procedure
---Querying fields
MinDistance3d (me) returns Real;
---C++: inline
---Purpose: Returns the last lowest distance in 3D computed by
-- CheckOrientation, CheckConnected, CheckContinuity3d,
-- CheckVertex, CheckNewVertex
MinDistance2d (me) returns Real;
---C++: inline
---Purpose: Returns the last lowest distance in 2D-UV computed by
-- CheckContinuity2d
MaxDistance3d (me) returns Real;
---C++: inline
---Purpose: Returns the last maximal distance in 3D computed by
-- CheckOrientation, CheckConnected, CheckContinuity3d,
-- CheckVertex, CheckNewVertex, CheckSameParameter
MaxDistance2d (me) returns Real;
---C++: inline
---Purpose: Returns the last maximal distance in 2D-UV computed by
-- CheckContinuity2d
fields
myWire: WireData from ShapeExtend is protected;
myFace: Face from TopoDS is protected;
mySurf: Surface from ShapeAnalysis is protected;
myPrecision : Real is protected;
myMin3d: Real is protected; -- lower computed distance 3d
myMin2d: Real is protected; -- lower computed distance 2d
myMax3d: Real is protected; -- upper computed distance 3d
myMax2d: Real is protected; -- upper computed distance 2d
-- statuses corresponding to API methods, queried by Status..(status) methods
myStatusOrder: Integer is protected;
myStatusConnected: Integer is protected;
myStatusEdgeCurves: Integer is protected;
myStatusDegenerated: Integer is protected;
myStatusClosed: Integer is protected;
myStatusSmall: Integer is protected;
myStatusSelfIntersection: Integer is protected;
myStatusLacking: Integer is protected;
myStatusGaps3d: Integer is protected; -- szvsh
myStatusGaps2d: Integer is protected; -- szvsh
myStatusCurveGaps: Integer is protected; -- szvsh
myStatusLoop : Integer is protected;
myStatus: Integer is protected; -- for internal use, queried by LastCheckStatus(status) method
end Wire;

View File

@@ -32,69 +32,66 @@
//:s1 abv 22.04.99: PRO7226 #489490: ensure fixing of degenerated edge
//#9 smh 14.12.99 BUC60615 Using tolerance of verteces during checking degenerated edge.
#include <ShapeAnalysis_Wire.ixx>
#include <Precision.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <GProp_GProps.hxx>
#include <IntRes2d_Domain.hxx>
#include <IntRes2d_Transition.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_IntersectionSegment.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <BRepGProp.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Bnd_Array1OfBox2d.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <ShapeExtend.hxx>
#include <BRepGProp.hxx>
#include <BRepTools.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <gp_Pnt2d.hxx>
#include <GProp_GProps.hxx>
#include <IntRes2d_Domain.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_IntersectionSegment.hxx>
#include <IntRes2d_Transition.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <TopoDS.hxx>
#include <Precision.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Bnd_Array1OfBox2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <Bnd_Box2d.hxx>
//szvsh addition
#include <BRepGProp.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GProp_GProps.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <TopoDS_Wire.hxx>
#include <ShapeAnalysis.hxx>
#include <ShapeAnalysis_TransferParametersProj.hxx>
#include <ShapeAnalysis_Wire.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <ShapeBuild_Edge.hxx>
#include <Geom_Plane.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <ShapeExtend.hxx>
#include <ShapeExtend_WireData.hxx>
#include <Standard_Type.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TopExp.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopExp.hxx>
#include <TopTools_ListOfShape.hxx>
//szvsh addition
//=======================================================================
//function : ShapeAnalysis_Wire
//purpose :
//=======================================================================
ShapeAnalysis_Wire::ShapeAnalysis_Wire()
{
ClearStatuses();

View File

@@ -0,0 +1,560 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_Wire_HeaderFile
#define _ShapeAnalysis_Wire_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Face.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <IntRes2d_SequenceOfIntersectionPoint.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <ShapeExtend_Status.hxx>
class ShapeExtend_WireData;
class ShapeAnalysis_Surface;
class TopoDS_Wire;
class TopoDS_Face;
class Geom_Surface;
class TopLoc_Location;
class ShapeAnalysis_WireOrder;
class Geom2d_Curve;
class gp_Pnt2d;
class TopoDS_Shape;
class TopoDS_Edge;
class ShapeAnalysis_Wire;
DEFINE_STANDARD_HANDLE(ShapeAnalysis_Wire, MMgt_TShared)
//! This class provides analysis of a wire to be compliant to
//! CAS.CADE requirements.
//!
//! The functionalities provided are the following:
//! 1. consistency of 2d and 3d edge curve senses
//! 2. connection of adjacent edges regarding to:
//! a. their vertices
//! b. their pcurves
//! c. their 3d curves
//! 3. adjacency of the edge vertices to its pcurve and 3d curve
//! 4. if a wire is closed or not (considering its 3d and 2d
//! contour)
//! 5. if a wire is outer on its face (considering pcurves)
//!
//! This class can be used in conjunction with class
//! ShapeFix_Wire, which will fix the problems detected by this class.
//!
//! The methods of the given class match to ones of the class
//! ShapeFix_Wire, e.g., CheckSmall and FixSmall.
//! This class also includes some auxilary methods
//! (e.g., CheckOuterBound, etc.),
//! which have no pair in ShapeFix_Wire.
//!
//! Like methods of ShapeFix_Wire the ones of this class are
//! grouped into two levels:
//! - Public which are recommended for use (the most global
//! method is Perform),
//! - Advanced, for optional use only
//!
//! For analyzing result of Public API checking methods use
//! corresponding Status... method.
//! The 'advanced' functions share the single status field which
//! contains the result of the last performed 'advanced' method.
//! It is quried by the method LastCheckStatus().
//!
//! In order to prepare an analyzer, it is necessary to load a wire,
//! set face and precision.
class ShapeAnalysis_Wire : public MMgt_TShared
{
public:
//! Empty constructor
Standard_EXPORT ShapeAnalysis_Wire();
//! Creates object with standard TopoDS_Wire, face
//! and precision
Standard_EXPORT ShapeAnalysis_Wire(const TopoDS_Wire& wire, const TopoDS_Face& face, const Standard_Real precision);
//! Creates the object with WireData object, face
//! and precision
Standard_EXPORT ShapeAnalysis_Wire(const Handle(ShapeExtend_WireData)& sbwd, const TopoDS_Face& face, const Standard_Real precision);
//! Initializes the object with standard TopoDS_Wire, face
//! and precision
Standard_EXPORT void Init (const TopoDS_Wire& wire, const TopoDS_Face& face, const Standard_Real precision);
//! Initializes the object with WireData object, face
//! and precision
Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& sbwd, const TopoDS_Face& face, const Standard_Real precision);
//! Loads the object with standard TopoDS_Wire
Standard_EXPORT void Load (const TopoDS_Wire& wire);
//! Loads the object with WireData object
Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd);
//! Loads the face the wire lies on
Standard_EXPORT void SetFace (const TopoDS_Face& face);
//! Loads the surface the wire lies on
Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& surface);
//! Loads the surface the wire lies on
Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& surface, const TopLoc_Location& location);
Standard_EXPORT void SetPrecision (const Standard_Real precision);
//! Unsets all the status and distance fields
//! wire, face and precision are not cleared
Standard_EXPORT void ClearStatuses();
//! Returns True if wire is loaded and has number of edges >0
Standard_Boolean IsLoaded() const;
//! Returns True if IsLoaded and underlying face is not null
Standard_Boolean IsReady() const;
//! Returns the value of precision
Standard_Real Precision() const;
//! Returns wire object being analyzed
const Handle(ShapeExtend_WireData)& WireData() const;
//! Returns the number of edges in the wire, or 0 if it is not loaded
Standard_Integer NbEdges() const;
//! Returns the working face
const TopoDS_Face& Face() const;
//! Returns the working surface
const Handle(ShapeAnalysis_Surface)& Surface() const;
//! Performs all the checks in the following order :
//! CheckOrder, CheckSmall, CheckConected, CheckEdgeCurves,
//! CheckDegenerated, CheckSelfIntersection, CheckLacking,
//! CheckClosed
//! Returns: True if at least one method returned True;
//! For deeper analysis use Status...(status) methods
Standard_EXPORT Standard_Boolean Perform();
//! Calls CheckOrder and returns False if wire is already
//! ordered (tail-to-head), True otherwise
//! Flag <isClosed> defines if the wire is closed or not
//! Flag <mode3d> defines which mode is used (3d or 2d)
Standard_EXPORT Standard_Boolean CheckOrder (const Standard_Boolean isClosed = Standard_True, const Standard_Boolean mode3d = Standard_True);
//! Calls to CheckConnected for each edge
//! Returns: True if at least one pair of disconnected edges (not sharing the
//! same vertex) was detected
Standard_EXPORT Standard_Boolean CheckConnected (const Standard_Real prec = 0.0);
//! Calls to CheckSmall for each edge
//! Returns: True if at least one small edge was detected
Standard_EXPORT Standard_Boolean CheckSmall (const Standard_Real precsmall = 0.0);
//! Checks edges geometry (consitency of 2d and 3d senses, adjasment
//! of curves to the vertices, etc.).
//! The order of the checks :
//! Call ShapeAnalysis_Wire to check:
//! ShapeAnalysis_Edge::CheckCurve3dWithPCurve (1),
//! ShapeAnalysis_Edge::CheckVertcesWithPCurve (2),
//! ShapeAnalysis_Edge::CheckVertcesWithCurve3d (3),
//! CheckSeam (4)
//! Additional:
//! CheckGap3d (5),
//! CheckGap2d (6),
//! ShapeAnalysis_Edge::CheckSameParameter (7)
//! Returns: True if at least one check returned True
//! Remark: The numbers in brackets show with what DONEi or FAILi
//! the status can be queried
Standard_EXPORT Standard_Boolean CheckEdgeCurves();
//! Calls to CheckDegenerated for each edge
//! Returns: True if at least one incorrect degenerated edge was detected
Standard_EXPORT Standard_Boolean CheckDegenerated();
//! Checks if wire is closed, performs CheckConnected,
//! CheckDegenerated and CheckLacking for the first and the last edges
//! Returns: True if at least one check returned True
//! Status:
//! FAIL1 or DONE1: see CheckConnected
//! FAIL2 or DONE2: see CheckDegenerated
Standard_EXPORT Standard_Boolean CheckClosed (const Standard_Real prec = 0.0);
//! Checks self-intersection of the wire (considering pcurves)
//! Looks for self-intersecting edges and each pair of intersecting
//! edges.
//! Warning: It does not check each edge with any other one (only each two
//! adjacent edges)
//! The order of the checks :
//! CheckSelfIntersectingEdge, CheckIntersectingEdges
//! Returns: True if at least one check returned True
//! Status: FAIL1 or DONE1 - see CheckSelfIntersectingEdge
//! FAIL2 or DONE2 - see CheckIntersectingEdges
Standard_EXPORT Standard_Boolean CheckSelfIntersection();
//! Calls to CheckLacking for each edge
//! Returns: True if at least one lacking edge was detected
Standard_EXPORT Standard_Boolean CheckLacking();
Standard_EXPORT Standard_Boolean CheckGaps3d();
Standard_EXPORT Standard_Boolean CheckGaps2d();
Standard_EXPORT Standard_Boolean CheckCurveGaps();
//! Analyzes the order of the edges in the wire,
//! uses class WireOrder for that purpose.
//! Flag <isClosed> defines if the wire is closed or not
//! Flag <mode3d> defines which mode is used (3d or 2d)
//! Returns False if wire is already ordered (tail-to-head),
//! True otherwise.
//! Use returned WireOrder object for deeper analysis.
//! Status:
//! OK : the same edges orientation, the same edges sequence
//! DONE1: the same edges orientation, not the same edges sequence
//! DONE2: as DONE1 and gaps more than myPrecision
//! DONE3: not the same edges orientation (some need to be reversed)
//! DONE4: as DONE3 and gaps more than myPrecision
//! FAIL : algorithm failed (could not detect order)
Standard_EXPORT Standard_Boolean CheckOrder (ShapeAnalysis_WireOrder& sawo, const Standard_Boolean isClosed = Standard_True, const Standard_Boolean mode3d = Standard_True);
//! Checks connected edges (num-th and preceeding).
//! Tests with starting preci from <SBWD> or with <prec> if
//! it is greater.
//! Considers Vertices.
//! Returns: False if edges are connected by the common vertex, else True
//! Status :
//! OK : Vertices (end of num-1 th edge and start on num-th one)
//! are already the same
//! DONE1 : Absolutely confused (gp::Resolution)
//! DONE2 : Confused at starting <preci> from <SBWD>
//! DONE3 : Confused at <prec> but not <preci>
//! FAIL1 : Not confused
//! FAIL2 : Not confused but confused with <preci> if reverse num-th edge
Standard_EXPORT Standard_Boolean CheckConnected (const Standard_Integer num, const Standard_Real prec = 0.0);
//! Checks if an edge has a length not greater than myPreci or
//! precsmall (if it is smaller)
//! Returns: False if its length is greater than precision
//! Status:
//! OK : edge is not small or degenerated
//! DONE1: edge is small, vertices are the same
//! DONE2: edge is small, vertices are not the same
//! FAIL : no 3d curve and pcurve
Standard_EXPORT Standard_Boolean CheckSmall (const Standard_Integer num, const Standard_Real precsmall = 0.0);
//! Checks if a seam pcurves are correct oriented
//! Returns: False (status OK) if given edge is not a seam or if it is OK
//! C1 - current pcurve for FORWARD edge,
//! C2 - current pcurve for REVERSED edge (if returns True they
//! should be swapped for the seam),
//! cf, cl - first and last parameters on curves
//! Status:
//! OK : Pcurves are correct or edge is not seam
//! DONE : Seam pcurves should be swapped
Standard_EXPORT Standard_Boolean CheckSeam (const Standard_Integer num, Handle(Geom2d_Curve)& C1, Handle(Geom2d_Curve)& C2, Standard_Real& cf, Standard_Real& cl);
//! Checks if a seam pcurves are correct oriented
//! See previous functions for details
Standard_EXPORT Standard_Boolean CheckSeam (const Standard_Integer num);
//! Checks for degenerated edge between two adjacent ones.
//! Fills parameters dgnr1 and dgnr2 with points in paramterical
//! space that correspond to the singularity (either gap that
//! needs to be filled by degenerated edge or that already filled)
//! Returns: False if no singularity or edge is already degenerated,
//! otherwise True
//! Status:
//! OK : No surface singularity, or edge is already degenerated
//! DONE1: Degenerated edge should be inserted (gap in 2D)
//! DONE2: Edge <num> should be made degenerated (recompute pcurve
//! and set the flag)
//! FAIL1: One of edges neighbouring to degenerated one has
//! no pcurve
//! FAIL2: Edge marked as degenerated and has no pcurve
//! but singularity is not detected
Standard_EXPORT Standard_Boolean CheckDegenerated (const Standard_Integer num, gp_Pnt2d& dgnr1, gp_Pnt2d& dgnr2);
//! Checks for degenerated edge between two adjacent ones.
//! Remark : Calls previous function
//! Status : See the function above for details
Standard_EXPORT Standard_Boolean CheckDegenerated (const Standard_Integer num);
//! Checks gap between edges in 3D (3d curves).
//! Checks the distance between ends of 3d curves of the num-th
//! and preceeding edge.
//! The distance can be queried by MinDistance3d.
//!
//! Returns: True if status is DONE
//! Status:
//! OK : Gap is less than myPrecision
//! DONE : Gap is greater than myPrecision
//! FAIL : No 3d curve(s) on the edge(s)
Standard_EXPORT Standard_Boolean CheckGap3d (const Standard_Integer num = 0);
//! Checks gap between edges in 2D (pcurves).
//! Checks the distance between ends of pcurves of the num-th
//! and preceeding edge.
//! The distance can be queried by MinDistance2d.
//!
//! Returns: True if status is DONE
//! Status:
//! OK : Gap is less than parametric precision out of myPrecision
//! DONE : Gap is greater than parametric precision out of myPrecision
//! FAIL : No pcurve(s) on the edge(s)
Standard_EXPORT Standard_Boolean CheckGap2d (const Standard_Integer num = 0);
//! Checks gap between points on 3D curve and points on surface
//! generated by pcurve of the num-th edge.
//! The distance can be queried by MinDistance3d.
//!
//! Returns: True if status is DONE
//! Status:
//! OK : Gap is less than myPrecision
//! DONE : Gap is greater than myPrecision
//! FAIL : No 3d curve(s) on the edge(s)
Standard_EXPORT Standard_Boolean CheckCurveGap (const Standard_Integer num = 0);
//! Checks if num-th edge is self-intersecting.
//! Self-intersection is reported only if intersection point lies outside
//! of both end vertices of the edge.
//! Returns: True if edge is self-intersecting.
//! If returns True it also fills the sequences of intersection points
//! and corresponding 3d points (only that are not enclosed by a vertices)
//! Status:
//! FAIL1 : No pcurve
//! FAIL2 : No vertices
//! DONE1 : Self-intersection found
Standard_EXPORT Standard_Boolean CheckSelfIntersectingEdge (const Standard_Integer num, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d);
Standard_EXPORT Standard_Boolean CheckSelfIntersectingEdge (const Standard_Integer num);
//! Checks two adjacent edges for intersecting.
//! Intersection is reported only if intersection point is not enclosed
//! by the common end vertex of the edges.
//! Returns: True if intersection is found.
//! If returns True it also fills the sequences of intersection points,
//! corresponding 3d points, and errors for them (half-distances between
//! intersection points in 3d calculated from one and from another edge)
//! Status:
//! FAIL1 : No pcurve
//! FAIL2 : No vertices
//! DONE1 : Self-intersection found
Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d, TColStd_SequenceOfReal& errors);
//! Checks two adjacent edges for intersecting.
//! Remark : Calls the previous method
//! Status : See the function above for details
Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num);
//! Checks i-th and j-th edges for intersecting.
//! Remark : See the previous method for details
Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num1, const Standard_Integer num2, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d, TColStd_SequenceOfReal& errors);
//! Checks i-th and j-th edges for intersecting.
//! Remark : Calls previous method.
//! Status : See the function above for details
Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num1, const Standard_Integer num2);
//! Checks if there is a gap in 2d between edges, not comprised by
//! the tolerance of their common vertex.
//! If <Tolerance> is greater than 0. and less than tolerance of
//! the vertex, then this value is used for check.
//! Returns: True if not closed gap was detected
//! p2d1 and p2d2 are the endpoint of <num-1>th edge and start of
//! the <num>th edge in 2d.
//! Status:
//! OK: No edge is lacking (3d and 2d connection)
//! FAIL1: edges have no vertices (at least one of them)
//! FAIL2: edges are neither connected by common vertex, nor have
//! coincided vertices
//! FAIL1: edges have no pcurves
//! DONE1: the gap is detected which cannot be closed by the tolerance
//! of the common vertex (or with value of <Tolerance>)
//! DONE2: is set (together with DONE1) if gap is detected and the
//! vector (p2d2 - p2d1) goes in direction opposite to the pcurves
//! of the edges (if angle is more than 0.9*PI).
Standard_EXPORT Standard_Boolean CheckLacking (const Standard_Integer num, const Standard_Real Tolerance, gp_Pnt2d& p2d1, gp_Pnt2d& p2d2);
//! Checks if there is a gap in 2D between edges and not comprised by vertex tolerance
//! The value of SBWD.thepreci is used.
//! Returns: False if no edge should be inserted
//! Status:
//! OK : No edge is lacking (3d and 2d connection)
//! DONE1 : The vertex tolerance should be increased only (2d gap is
//! small)
//! DONE2 : Edge can be inserted (3d and 2d gaps are large enough)
Standard_EXPORT Standard_Boolean CheckLacking (const Standard_Integer num, const Standard_Real Tolerance = 0.0);
//! Checks if wire defines an outer bound on the face
//! Uses ShapeAnalysis::IsOuterBound for analysis
//! If <APIMake> is True uses BRepAPI_MakeWire to build the
//! wire, if False (to be used only when edges share common
//! vertices) uses BRep_Builder to build the wire
Standard_EXPORT Standard_Boolean CheckOuterBound (const Standard_Boolean APIMake = Standard_True);
//! Detects a notch
Standard_EXPORT Standard_Boolean CheckNotchedEdges (const Standard_Integer num, Standard_Integer& shortNum, Standard_Real& param, const Standard_Real Tolerance = 0.0);
//! Checks if wire has parametric area less than precision.
Standard_EXPORT Standard_Boolean CheckSmallArea (const TopoDS_Wire& theWire, const Standard_Boolean theIsOuterWire);
//! Checks with what orientation <shape> (wire or edge) can be
//! connected to the wire.
//! Tests distances with starting <preci> from <SBWD> (close confusion),
//! but if given <prec> is greater, tests with <prec> (coarse confusion).
//! The smallest found distance can be returned by MinDistance3d
//!
//! Returns: False if status is FAIL (see below)
//! Status:
//! DONE1 : If <shape> follows <SBWD>, direct sense (normal)
//! DONE2 : If <shape> follows <SBWD>, but if reversed
//! DONE3 : If <shape> preceeds <SBWD>, direct sense
//! DONE4 : If <shape> preceeds <SBWD>, but if reversed
//! FAIL1 : If <shape> is neither an edge nor a wire
//! FAIL2 : If <shape> cannot be connected to <SBWD>
//!
//! DONE5 : To the tail of <SBWD> the <shape> is closer with
//! direct sense
//! DONE6 : To the head of <SBWD> the <shape> is closer with
//! direct sense
//!
//! Remark: Statuses DONE1 - DONE4, FAIL1 - FAIL2 are basic and
//! describe the nearest connection of the <shape> to <SBWD>.
//! Statuses DONE5 and DONE6 are advanced and are to be used when
//! analyzing with what sense (direct or reversed) the <shape>
//! should be connected to <SBWD>:
//! For tail of <SBWD> if DONE4 is True <shape> should be direct,
//! otherwise reversed.
//! For head of <SBWD> if DONE5 is True <shape> should be direct,
//! otherwise reversed.
Standard_EXPORT Standard_Boolean CheckShapeConnect (const TopoDS_Shape& shape, const Standard_Real prec = 0.0);
//! The same as previous CheckShapeConnect but is more advanced.
//! It returns the distances between each end of <sbwd> and each
//! end of <shape>. For example, <tailhead> stores distance
//! between tail of <sbwd> and head of <shape>
//! Remark: First method CheckShapeConnect calls this one
Standard_EXPORT Standard_Boolean CheckShapeConnect (Standard_Real& tailhead, Standard_Real& tailtail, Standard_Real& headtail, Standard_Real& headhead, const TopoDS_Shape& shape, const Standard_Real prec = 0.0);
//! Checks existance of loop on wire and return vertices wich are loop vertices
//! (vertices belonging to a few pairs of edges)
Standard_EXPORT Standard_Boolean CheckLoop (TopTools_IndexedMapOfShape& aMapLoopVertices, TopTools_DataMapOfShapeListOfShape& aMapVertexEdges, TopTools_MapOfShape& aMapSmallEdges, TopTools_MapOfShape& aMapSeemEdges);
Standard_EXPORT Standard_Boolean CheckTail (const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2, const Standard_Real theMaxSine, const Standard_Real theMaxWidth, const Standard_Real theMaxTolerance, TopoDS_Edge& theEdge11, TopoDS_Edge& theEdge12, TopoDS_Edge& theEdge21, TopoDS_Edge& theEdge22);
Standard_Boolean StatusOrder (const ShapeExtend_Status Status) const;
Standard_Boolean StatusConnected (const ShapeExtend_Status Status) const;
Standard_Boolean StatusEdgeCurves (const ShapeExtend_Status Status) const;
Standard_Boolean StatusDegenerated (const ShapeExtend_Status Status) const;
Standard_Boolean StatusClosed (const ShapeExtend_Status Status) const;
Standard_Boolean StatusSmall (const ShapeExtend_Status Status) const;
Standard_Boolean StatusSelfIntersection (const ShapeExtend_Status Status) const;
Standard_Boolean StatusLacking (const ShapeExtend_Status Status) const;
Standard_Boolean StatusGaps3d (const ShapeExtend_Status Status) const;
Standard_Boolean StatusGaps2d (const ShapeExtend_Status Status) const;
Standard_Boolean StatusCurveGaps (const ShapeExtend_Status Status) const;
Standard_Boolean StatusLoop (const ShapeExtend_Status Status) const;
//! Querying the status of the LAST perfomed 'Advanced' checking procedure
Standard_Boolean LastCheckStatus (const ShapeExtend_Status Status) const;
//! Returns the last lowest distance in 3D computed by
//! CheckOrientation, CheckConnected, CheckContinuity3d,
//! CheckVertex, CheckNewVertex
Standard_Real MinDistance3d() const;
//! Returns the last lowest distance in 2D-UV computed by
//! CheckContinuity2d
Standard_Real MinDistance2d() const;
//! Returns the last maximal distance in 3D computed by
//! CheckOrientation, CheckConnected, CheckContinuity3d,
//! CheckVertex, CheckNewVertex, CheckSameParameter
Standard_Real MaxDistance3d() const;
//! Returns the last maximal distance in 2D-UV computed by
//! CheckContinuity2d
Standard_Real MaxDistance2d() const;
DEFINE_STANDARD_RTTI(ShapeAnalysis_Wire,MMgt_TShared)
protected:
Handle(ShapeExtend_WireData) myWire;
TopoDS_Face myFace;
Handle(ShapeAnalysis_Surface) mySurf;
Standard_Real myPrecision;
Standard_Real myMin3d;
Standard_Real myMin2d;
Standard_Real myMax3d;
Standard_Real myMax2d;
Standard_Integer myStatusOrder;
Standard_Integer myStatusConnected;
Standard_Integer myStatusEdgeCurves;
Standard_Integer myStatusDegenerated;
Standard_Integer myStatusClosed;
Standard_Integer myStatusSmall;
Standard_Integer myStatusSelfIntersection;
Standard_Integer myStatusLacking;
Standard_Integer myStatusGaps3d;
Standard_Integer myStatusGaps2d;
Standard_Integer myStatusCurveGaps;
Standard_Integer myStatusLoop;
Standard_Integer myStatus;
private:
};
#include <ShapeAnalysis_Wire.lxx>
#endif // _ShapeAnalysis_Wire_HeaderFile

View File

@@ -1,154 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class WireOrder from ShapeAnalysis
---Purpose: This class is intended to control and, if possible, redefine
-- the order of a list of edges which define a wire
-- Edges are not given directly, but as their bounds (start,end)
--
-- This allows to use this tool, either on existing wire, or on
-- data just taken from a file (coordinates are easy to get)
--
-- It can work, either in 2D, or in 3D, but not miscible
-- Warning about tolerance : according to the mode (2D/3D), it
-- must be given as 2D or 3D (i.e. metric) tolerance, uniform
-- on the whole list
--
-- Two phases : firstly add the couples (start,end)
-- secondly perform then get the result
uses
XY from gp,
XYZ from gp,
HSequenceOfXYZ from TColgp,
HArray1OfInteger from TColStd
raises
TypeMismatch from Standard
is
Create returns WireOrder from ShapeAnalysis;
---Purpose: Empty constructor
Create(mode3d: Boolean; tol: Real) returns WireOrder from ShapeAnalysis;
---Purpose : Creates a WireOrder in 3D (if mode3d is True) or 2D (if False)
-- with a tolerance
SetMode(me : in out; mode3d: Boolean; tol : Real);
---Purpose : Sets new values. Clears the connexion list
-- If <mode3d> changes, also clears the edge list (else, doesnt)
Tolerance(me) returns Real;
---Purpose : Returns the working tolerance
Clear(me: in out);
---Purpose : Clears the list of edges, but not mode and tol
Add(me: in out; start3d, end3d: XYZ from gp)
---Purpose : Adds a couple of points 3D (start,end)
raises TypeMismatch;
-- Error if initial mode was 2D
Add(me: in out; start2d, end2d: XY from gp)
---Purpose : Adds a couple of points 2D (start,end)
raises TypeMismatch;
-- Error if initial mode was 3D
NbEdges(me) returns Integer;
---Purpose : Returns the count of added couples of points (one per edges)
KeepLoopsMode(me: in out) returns Boolean;
---C++: return&
---Purpose : If this mode is True method perform does not sort edges of
-- different loops. The resulting order is first loop, second
-- one etc...
Perform(me: in out; closed: Boolean = Standard_True);
---Purpose : Computes the better order
-- If <closed> is True (D) considers also closure
-- Optimised if the couples were already in order
-- The criterium is : two couples in order if distance between
-- end-prec and start-cur is less then starting tolerance <tol>
-- Else, the smallest distance is reached
-- Gap corresponds to a smallest distance greater than <tol>
IsDone(me) returns Boolean;
---Purpose : Tells if Perform has been done
-- Else, the following methods returns original values
Status(me) returns Integer;
---Purpose : Returns the status of the order (0 if not done) :
-- 0 : all edges are direct and in sequence
-- 1 : all edges are direct but some are not in sequence
-- 2 : in addition, unresolved gaps remain
-- -1 : some edges are reversed, but no gap remain
-- -2 : some edges are reversed and some gaps remain
-- -10 : COULD NOT BE RESOLVED, Failure on Reorder
-- gap : regarding starting <tol>
Ordered(me; n: Integer) returns Integer;
---Purpose : Returns the number of original edge which correspond to the
-- newly ordered number <n>
-- Warning : the returned value is NEGATIVE if edge should be reversed
XYZ(me; num: Integer; start3d, end3d : out XYZ from gp);
---Purpose : Returns the values of the couple <num>, as 3D values
XY(me; num: Integer; start2d, end2d: out XY from gp);
---Purpose : Returns the values of the couple <num>, as 2D values
Gap(me; num : Integer = 0) returns Real;
---Purpose : Returns the gap between a couple and its preceeding
-- <num> is considered ordered
-- If <num> = 0 (D), returns the greatest gap found
SetChains(me : in out; gap : Real);
---Purpose : Determines the chains inside which successive edges have a gap
-- less than a given value. Queried by NbChains and Chain
NbChains(me) returns Integer;
---Purpose : Returns the count of computed chains
Chain(me; num: Integer; n1,n2: out Integer);
---Purpose : Returns, for the chain n0 num, starting and ending numbers of
-- edges. In the list of ordered edges (see Ordered for originals)
SetCouples(me: in out; gap: Real);
---Purpose : Determines the couples of edges for which end and start fit
-- inside a given gap. Queried by NbCouples and Couple
NbCouples(me) returns Integer;
---Purpose : Returns the count of computed couples
Couple(me; num: Integer; n1, n2: out Integer);
---Purpose : Returns, for the couple n0 num, the two implied edges
-- In the list of ordered edges
fields
myKeepLoops : Boolean from Standard;
myOrd : HArray1OfInteger from TColStd;
myChains : HArray1OfInteger from TColStd;
myCouples : HArray1OfInteger from TColStd;
myXYZ : HSequenceOfXYZ from TColgp;
myTol : Real;
myGap : Real;
myStat : Integer;
myMode : Boolean;
end WireOrder;

View File

@@ -15,26 +15,24 @@
// pdn 11.03.99 S4135 changing reordering algorithm in order to make it independent on tolerance
//szv#4 S4163
// pdn 09.05.99: S4174: preserve order of edges for complete torus
#include <ShapeAnalysis_WireOrder.ixx>
#include <Precision.hxx>
#include <Standard_TypeMismatch.hxx>
#include <TColgp_Array1OfXYZ.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_Array1OfBoolean.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <gp_Pnt.hxx>
#include <TColStd_SequenceOfTransient.hxx>
#include <gp_XY.hxx>
#include <gp_XYZ.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis_WireOrder.hxx>
#include <Standard_TypeMismatch.hxx>
#include <TColgp_Array1OfXYZ.hxx>
#include <TColStd_Array1OfBoolean.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_SequenceOfTransient.hxx>
//=======================================================================
//function : ShapeAnalysis_WireOrder
//purpose :
//=======================================================================
ShapeAnalysis_WireOrder::ShapeAnalysis_WireOrder()
: myKeepLoops(Standard_False) , myGap (0.) , myStat (0) , myMode (Standard_True)
{

View File

@@ -0,0 +1,179 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_WireOrder_HeaderFile
#define _ShapeAnalysis_WireOrder_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColgp_HSequenceOfXYZ.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
class Standard_TypeMismatch;
class gp_XYZ;
class gp_XY;
//! This class is intended to control and, if possible, redefine
//! the order of a list of edges which define a wire
//! Edges are not given directly, but as their bounds (start,end)
//!
//! This allows to use this tool, either on existing wire, or on
//! data just taken from a file (coordinates are easy to get)
//!
//! It can work, either in 2D, or in 3D, but not miscible
//! Warning about tolerance : according to the mode (2D/3D), it
//! must be given as 2D or 3D (i.e. metric) tolerance, uniform
//! on the whole list
//!
//! Two phases : firstly add the couples (start,end)
//! secondly perform then get the result
class ShapeAnalysis_WireOrder
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT ShapeAnalysis_WireOrder();
//! Creates a WireOrder in 3D (if mode3d is True) or 2D (if False)
//! with a tolerance
Standard_EXPORT ShapeAnalysis_WireOrder(const Standard_Boolean mode3d, const Standard_Real tol);
//! Sets new values. Clears the connexion list
//! If <mode3d> changes, also clears the edge list (else, doesnt)
Standard_EXPORT void SetMode (const Standard_Boolean mode3d, const Standard_Real tol);
//! Returns the working tolerance
Standard_EXPORT Standard_Real Tolerance() const;
//! Clears the list of edges, but not mode and tol
Standard_EXPORT void Clear();
//! Adds a couple of points 3D (start,end)
Standard_EXPORT void Add (const gp_XYZ& start3d, const gp_XYZ& end3d);
//! Adds a couple of points 2D (start,end)
Standard_EXPORT void Add (const gp_XY& start2d, const gp_XY& end2d);
//! Returns the count of added couples of points (one per edges)
Standard_EXPORT Standard_Integer NbEdges() const;
//! If this mode is True method perform does not sort edges of
//! different loops. The resulting order is first loop, second
//! one etc...
Standard_EXPORT Standard_Boolean& KeepLoopsMode();
//! Computes the better order
//! If <closed> is True (D) considers also closure
//! Optimised if the couples were already in order
//! The criterium is : two couples in order if distance between
//! end-prec and start-cur is less then starting tolerance <tol>
//! Else, the smallest distance is reached
//! Gap corresponds to a smallest distance greater than <tol>
Standard_EXPORT void Perform (const Standard_Boolean closed = Standard_True);
//! Tells if Perform has been done
//! Else, the following methods returns original values
Standard_EXPORT Standard_Boolean IsDone() const;
//! Returns the status of the order (0 if not done) :
//! 0 : all edges are direct and in sequence
//! 1 : all edges are direct but some are not in sequence
//! 2 : in addition, unresolved gaps remain
//! -1 : some edges are reversed, but no gap remain
//! -2 : some edges are reversed and some gaps remain
//! -10 : COULD NOT BE RESOLVED, Failure on Reorder
//! gap : regarding starting <tol>
Standard_EXPORT Standard_Integer Status() const;
//! Returns the number of original edge which correspond to the
//! newly ordered number <n>
//! Warning : the returned value is NEGATIVE if edge should be reversed
Standard_EXPORT Standard_Integer Ordered (const Standard_Integer n) const;
//! Returns the values of the couple <num>, as 3D values
Standard_EXPORT void XYZ (const Standard_Integer num, gp_XYZ& start3d, gp_XYZ& end3d) const;
//! Returns the values of the couple <num>, as 2D values
Standard_EXPORT void XY (const Standard_Integer num, gp_XY& start2d, gp_XY& end2d) const;
//! Returns the gap between a couple and its preceeding
//! <num> is considered ordered
//! If <num> = 0 (D), returns the greatest gap found
Standard_EXPORT Standard_Real Gap (const Standard_Integer num = 0) const;
//! Determines the chains inside which successive edges have a gap
//! less than a given value. Queried by NbChains and Chain
Standard_EXPORT void SetChains (const Standard_Real gap);
//! Returns the count of computed chains
Standard_EXPORT Standard_Integer NbChains() const;
//! Returns, for the chain n0 num, starting and ending numbers of
//! edges. In the list of ordered edges (see Ordered for originals)
Standard_EXPORT void Chain (const Standard_Integer num, Standard_Integer& n1, Standard_Integer& n2) const;
//! Determines the couples of edges for which end and start fit
//! inside a given gap. Queried by NbCouples and Couple
Standard_EXPORT void SetCouples (const Standard_Real gap);
//! Returns the count of computed couples
Standard_EXPORT Standard_Integer NbCouples() const;
//! Returns, for the couple n0 num, the two implied edges
//! In the list of ordered edges
Standard_EXPORT void Couple (const Standard_Integer num, Standard_Integer& n1, Standard_Integer& n2) const;
protected:
private:
Standard_Boolean myKeepLoops;
Handle(TColStd_HArray1OfInteger) myOrd;
Handle(TColStd_HArray1OfInteger) myChains;
Handle(TColStd_HArray1OfInteger) myCouples;
Handle(TColgp_HSequenceOfXYZ) myXYZ;
Standard_Real myTol;
Standard_Real myGap;
Standard_Integer myStat;
Standard_Boolean myMode;
};
#endif // _ShapeAnalysis_WireOrder_HeaderFile

View File

@@ -1,159 +0,0 @@
-- Created on: 1998-06-03
-- Created by: data exchange team
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- szv#4 S4163
class WireVertex from ShapeAnalysis
---Purpose: Analyzes and records status of vertices in a Wire
--
-- The Wire has formerly been loaded in a ShapeExtend_WireData
-- For each Vertex, a status and some data can be attached
-- (case found, position and parameters)
-- Then, these informations can be used to fix problems
uses
XYZ from gp,
HArray1OfXYZ from TColgp,
HArray1OfInteger from TColStd,
HArray1OfReal from TColStd,
Wire from TopoDS,
WireData from ShapeExtend
is
Create returns WireVertex;
---Purpose: Empty constructor
Init (me: in out; wire: Wire from TopoDS; preci : Real);
Init (me: in out; swbd: WireData from ShapeExtend; preci : Real);
Load (me: in out; wire: Wire from TopoDS);
Load (me: in out; sbwd: WireData from ShapeExtend);
SetPrecision (me: in out; preci: Real);
---Purpose: Sets the precision for work
-- Analysing: for each Vertex, comparison between the end of the
-- preceeding edge and the start of the following edge
-- Each Vertex rank corresponds to the End Vertex of the Edge of
-- same rank, in the ShapeExtend_WireData. I.E. for Vertex <num>,
-- Edge <num> is the preceeding one, <num+1> is the following one
Analyze (me: in out);
SetSameVertex (me: in out; num: Integer);
---Purpose: Records status "Same Vertex" (logically) on Vertex <num>
SetSameCoords (me: in out; num: Integer);
---Purpose: Records status "Same Coords" (at the Vertices Tolerances)
SetClose (me: in out; num: Integer);
---Purpose: Records status "Close Coords" (at the Precision of <me>)
SetEnd (me: in out; num : Integer;
pos : XYZ from gp;
ufol: Real);
---Purpose: <num> is the End of preceeding Edge, and its projection on the
-- following one lies on it at the Precision of <me>
-- <ufol> gives the parameter on the following edge
SetStart (me: in out; num : Integer;
pos : XYZ from gp;
upre: Real);
---Purpose: <num> is the Start of following Edge, its projection on the
-- preceeding one lies on it at the Precision of <me>
-- <upre> gives the parameter on the preceeding edge
SetInters (me: in out; num : Integer;
pos : XYZ from gp;
upre,ufol: Real);
---Purpose: <num> is the Intersection of both Edges
-- <upre> is the parameter on preceeding edge, <ufol> on
-- following edge
SetDisjoined (me: in out; num: Integer);
---Purpose: <num> cannot be said as same vertex
IsDone (me) returns Boolean;
---Purpose: Returns True if analysis was performed, else returns False
Precision (me) returns Real;
---Purpose: Returns precision value used in analysis
NbEdges (me) returns Integer;
---Purpose: Returns the number of edges in analyzed wire (i.e. the
-- length of all arrays)
WireData (me) returns WireData from ShapeExtend;
---Purpose: Returns analyzed wire
---C++ : return const &
Status (me; num: Integer) returns Integer;
---Purpose: Returns the recorded status for a vertex
-- More detail by method Data
Position (me; num: Integer) returns XYZ from gp;
UPrevious(me; num: Integer) returns Real; --szv#4:S4163:12Mar99 was Interger
UFollowing(me; num: Integer) returns Real; --szv#4:S4163:12Mar99 was Interger
Data(me; num : Integer;
pos : out XYZ from gp;
upre,ufol: out Real)
returns Integer;
---Purpose: Returns the recorded status for a vertex
-- With its recorded position and parameters on both edges
-- These values are relevant regarding the status:
-- Status Meaning Position Preceeding Following
-- 0 Same no no no
-- 1 SameCoord no no no
-- 2 Close no no no
-- 3 End yes no yes
-- 4 Start yes yes no
-- 5 Inters yes yes yes
-- -1 Disjoined no no no
NextStatus (me; stat: Integer; num : Integer = 0) returns Integer;
---Purpose: For a given status, returns the rank of the vertex which
-- follows <num> and has the same status. 0 if no more
-- Acts as an iterator, starts on the first one
NextCriter(me; crit: Integer; num : Integer = 0) returns Integer;
---Purpose: For a given criter, returns the rank of the vertex which
-- follows <num> and has the same status. 0 if no more
-- Acts as an iterator, starts on the first one
-- Criters are:
-- 0: same vertex (status 0)
-- 1: a solution exists (status >= 0)
-- 2: same coords (i.e. same params) (status 0 1 2)
-- 3: same coods but not same vertex (status 1 2)
-- 4: redefined coords (status 3 4 5)
-- -1: no solution (status -1)
fields
myWire: WireData from ShapeExtend;
myStat: HArray1OfInteger from TColStd;
myPos : HArray1OfXYZ from TColgp;
myUPre: HArray1OfReal from TColStd;
myUFol: HArray1OfReal from TColStd;
myPreci: Real;
myDone: Boolean;
end WireVertex;

View File

@@ -12,26 +12,25 @@
// commercial license or contractual agreement.
//szv#4 S4163
#include <ShapeAnalysis_WireVertex.ixx>
#include <BRep_Tool.hxx>
#include <Geom_Curve.hxx>
#include <gp_Pnt.hxx>
#include <gp_XYZ.hxx>
#include <Precision.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeAnalysis_WireVertex.hxx>
#include <ShapeExtend_WireData.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <gp_Pnt.hxx> //ied_modif_for_compil_Nov-19-1998
//ied_modif_for_compil_Nov-19-1998
//=======================================================================
//function : ShapeAnalysis_WireVertex
//purpose :
//=======================================================================
ShapeAnalysis_WireVertex::ShapeAnalysis_WireVertex()
{
myDone = Standard_False;

View File

@@ -0,0 +1,179 @@
// Created on: 1998-06-03
// Created by: data exchange team
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _ShapeAnalysis_WireVertex_HeaderFile
#define _ShapeAnalysis_WireVertex_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColgp_HArray1OfXYZ.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class ShapeExtend_WireData;
class TopoDS_Wire;
class gp_XYZ;
//! Analyzes and records status of vertices in a Wire
//!
//! The Wire has formerly been loaded in a ShapeExtend_WireData
//! For each Vertex, a status and some data can be attached
//! (case found, position and parameters)
//! Then, these informations can be used to fix problems
class ShapeAnalysis_WireVertex
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT ShapeAnalysis_WireVertex();
Standard_EXPORT void Init (const TopoDS_Wire& wire, const Standard_Real preci);
Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& swbd, const Standard_Real preci);
Standard_EXPORT void Load (const TopoDS_Wire& wire);
Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd);
//! Sets the precision for work
//! Analysing: for each Vertex, comparison between the end of the
//! preceeding edge and the start of the following edge
//! Each Vertex rank corresponds to the End Vertex of the Edge of
//! same rank, in the ShapeExtend_WireData. I.E. for Vertex <num>,
//! Edge <num> is the preceeding one, <num+1> is the following one
Standard_EXPORT void SetPrecision (const Standard_Real preci);
Standard_EXPORT void Analyze();
//! Records status "Same Vertex" (logically) on Vertex <num>
Standard_EXPORT void SetSameVertex (const Standard_Integer num);
//! Records status "Same Coords" (at the Vertices Tolerances)
Standard_EXPORT void SetSameCoords (const Standard_Integer num);
//! Records status "Close Coords" (at the Precision of <me>)
Standard_EXPORT void SetClose (const Standard_Integer num);
//! <num> is the End of preceeding Edge, and its projection on the
//! following one lies on it at the Precision of <me>
//! <ufol> gives the parameter on the following edge
Standard_EXPORT void SetEnd (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real ufol);
//! <num> is the Start of following Edge, its projection on the
//! preceeding one lies on it at the Precision of <me>
//! <upre> gives the parameter on the preceeding edge
Standard_EXPORT void SetStart (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre);
//! <num> is the Intersection of both Edges
//! <upre> is the parameter on preceeding edge, <ufol> on
//! following edge
Standard_EXPORT void SetInters (const Standard_Integer num, const gp_XYZ& pos, const Standard_Real upre, const Standard_Real ufol);
//! <num> cannot be said as same vertex
Standard_EXPORT void SetDisjoined (const Standard_Integer num);
//! Returns True if analysis was performed, else returns False
Standard_EXPORT Standard_Boolean IsDone() const;
//! Returns precision value used in analysis
Standard_EXPORT Standard_Real Precision() const;
//! Returns the number of edges in analyzed wire (i.e. the
//! length of all arrays)
Standard_EXPORT Standard_Integer NbEdges() const;
//! Returns analyzed wire
Standard_EXPORT const Handle(ShapeExtend_WireData)& WireData() const;
//! Returns the recorded status for a vertex
//! More detail by method Data
Standard_EXPORT Standard_Integer Status (const Standard_Integer num) const;
Standard_EXPORT gp_XYZ Position (const Standard_Integer num) const;
Standard_EXPORT Standard_Real UPrevious (const Standard_Integer num) const;
Standard_EXPORT Standard_Real UFollowing (const Standard_Integer num) const;
//! Returns the recorded status for a vertex
//! With its recorded position and parameters on both edges
//! These values are relevant regarding the status:
//! Status Meaning Position Preceeding Following
//! 0 Same no no no
//! 1 SameCoord no no no
//! 2 Close no no no
//! 3 End yes no yes
//! 4 Start yes yes no
//! 5 Inters yes yes yes
//! -1 Disjoined no no no
Standard_EXPORT Standard_Integer Data (const Standard_Integer num, gp_XYZ& pos, Standard_Real& upre, Standard_Real& ufol) const;
//! For a given status, returns the rank of the vertex which
//! follows <num> and has the same status. 0 if no more
//! Acts as an iterator, starts on the first one
Standard_EXPORT Standard_Integer NextStatus (const Standard_Integer stat, const Standard_Integer num = 0) const;
//! For a given criter, returns the rank of the vertex which
//! follows <num> and has the same status. 0 if no more
//! Acts as an iterator, starts on the first one
//! Criters are:
//! 0: same vertex (status 0)
//! 1: a solution exists (status >= 0)
//! 2: same coords (i.e. same params) (status 0 1 2)
//! 3: same coods but not same vertex (status 1 2)
//! 4: redefined coords (status 3 4 5)
//! -1: no solution (status -1)
Standard_EXPORT Standard_Integer NextCriter (const Standard_Integer crit, const Standard_Integer num = 0) const;
protected:
private:
Handle(ShapeExtend_WireData) myWire;
Handle(TColStd_HArray1OfInteger) myStat;
Handle(TColgp_HArray1OfXYZ) myPos;
Handle(TColStd_HArray1OfReal) myUPre;
Handle(TColStd_HArray1OfReal) myUFol;
Standard_Real myPreci;
Standard_Boolean myDone;
};
#endif // _ShapeAnalysis_WireVertex_HeaderFile