mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
6
src/IntPatch/FILES
Executable file
6
src/IntPatch/FILES
Executable file
@@ -0,0 +1,6 @@
|
||||
IntPatch_ImpImpIntersection_0.gxx
|
||||
IntPatch_ImpImpIntersection_1.gxx
|
||||
IntPatch_ImpImpIntersection_2.gxx
|
||||
IntPatch_ImpImpIntersection_3.gxx
|
||||
IntPatch_ImpImpIntersection_4.gxx
|
||||
IntPatch_ImpImpIntersection_5.gxx
|
162
src/IntPatch/IntPatch.cdl
Executable file
162
src/IntPatch/IntPatch.cdl
Executable file
@@ -0,0 +1,162 @@
|
||||
-- File: IntPatch.cdl
|
||||
-- Created: Wed May 6 13:58:00 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: OPEN CASCADE 1992
|
||||
|
||||
|
||||
package IntPatch
|
||||
|
||||
---Purpose: Intersection between two patches.
|
||||
-- The class PatchIntersection implements the algorithmes
|
||||
-- of intersection.
|
||||
-- The classes IntPoint, PointOnDomain, Line, ILin, a.s.o...
|
||||
-- describe the results of the algorithmes.
|
||||
|
||||
---Level: Internal
|
||||
--
|
||||
-- All the methods of the classes of this package are Internal.
|
||||
--
|
||||
|
||||
uses Standard, MMgt, StdFail, GeomAbs, TopAbs, TCollection, TColStd, math,
|
||||
gp, TColgp, IntAna,IntSurf, IntImp, IntStart, IntWalk, Bnd, Intf,
|
||||
Adaptor2d,Adaptor3d, Geom2d, Geom, Precision
|
||||
|
||||
is
|
||||
|
||||
class ALineToWLine;
|
||||
|
||||
class Point;
|
||||
|
||||
deferred class Line;
|
||||
|
||||
class GLine; -- inherits Line from IntPatch
|
||||
|
||||
class ALine; -- inherits Line from IntPatch
|
||||
|
||||
class WLine; -- inherits Line from IntPatch
|
||||
|
||||
class RLine; -- inherits Line from IntPatch
|
||||
|
||||
class ArcFunction;
|
||||
|
||||
-- implicite/implicite
|
||||
|
||||
class ImpImpIntersection;
|
||||
|
||||
|
||||
-- commun implicite/parametree et parametree/parametree
|
||||
|
||||
deferred class Polygo;
|
||||
|
||||
class PolyLine; -- inherits Polygo from IntPatch
|
||||
|
||||
class PolyArc; -- inherits Polygo from IntPatch
|
||||
|
||||
class PolygoTool;
|
||||
|
||||
class RstInt;
|
||||
|
||||
|
||||
-- implicite/parametre
|
||||
|
||||
class ImpPrmIntersection;
|
||||
|
||||
|
||||
-- parametre/parametre
|
||||
|
||||
class Polyhedron;
|
||||
|
||||
class PolyhedronTool;
|
||||
|
||||
class PrmPrmIntersection_T3Bits;
|
||||
|
||||
class PrmPrmIntersection;
|
||||
|
||||
|
||||
-- algorithme general
|
||||
|
||||
enumeration IType is
|
||||
-- type of the line of intersection
|
||||
|
||||
Lin, -- pour conflit avec deferred class Line
|
||||
Circle,
|
||||
Ellipse,
|
||||
Parabola,
|
||||
Hyperbola,
|
||||
Analytic,
|
||||
Walking,
|
||||
Restriction
|
||||
end IType;
|
||||
|
||||
class HInterTool;
|
||||
|
||||
class HCurve2dTool;
|
||||
|
||||
class LineConstructor;
|
||||
|
||||
class Intersection;
|
||||
|
||||
|
||||
class SequenceOfPoint instantiates Sequence from TCollection (Point from IntPatch);
|
||||
|
||||
class SequenceOfLine instantiates Sequence from TCollection (Line from IntPatch);
|
||||
|
||||
class TheSurfFunction instantiates ZerImpFunc from IntImp
|
||||
(HSurface from Adaptor3d,
|
||||
HSurfaceTool from Adaptor3d,
|
||||
Quadric from IntSurf,
|
||||
QuadricTool from IntSurf);
|
||||
|
||||
class TheIWalking instantiates IWalking from IntWalk
|
||||
(PathPoint from IntSurf,
|
||||
PathPointTool from IntSurf,
|
||||
SequenceOfPathPoint from IntSurf,
|
||||
InteriorPoint from IntSurf,
|
||||
InteriorPointTool from IntSurf,
|
||||
SequenceOfInteriorPoint from IntSurf,
|
||||
HSurface from Adaptor3d,
|
||||
HSurfaceTool from Adaptor3d,
|
||||
TheSurfFunction from IntPatch);
|
||||
|
||||
class TheSearchInside instantiates SearchInside from IntStart
|
||||
(HSurface from Adaptor3d,
|
||||
HSurfaceTool from Adaptor3d,
|
||||
TopolTool from Adaptor3d,
|
||||
HInterTool from IntPatch,
|
||||
TheSurfFunction from IntPatch);
|
||||
|
||||
class TheSOnBounds instantiates SearchOnBoundaries from IntStart(
|
||||
HVertex from Adaptor3d,
|
||||
HCurve2d from Adaptor2d,
|
||||
HCurve2dTool from IntPatch,
|
||||
HInterTool from IntPatch,
|
||||
TopolTool from Adaptor3d,
|
||||
ArcFunction from IntPatch);
|
||||
|
||||
class TheInterfPolyhedron instantiates InterferencePolyhedron from Intf(
|
||||
Polyhedron from IntPatch,
|
||||
PolyhedronTool from IntPatch,
|
||||
Polyhedron from IntPatch,
|
||||
PolyhedronTool from IntPatch);
|
||||
|
||||
class ThePWalkingInter instantiates PWalking from IntWalk(
|
||||
HSurface from Adaptor3d,
|
||||
HSurfaceTool from Adaptor3d);
|
||||
|
||||
class SearchPnt instantiates InterferencePolygon2d from Intf
|
||||
(Polygo, PolygoTool, Polygo, PolygoTool);
|
||||
|
||||
class CSFunction instantiates ZerCOnSSParFunc from IntImp
|
||||
(HSurface from Adaptor3d,
|
||||
HSurfaceTool from Adaptor3d,
|
||||
HCurve2d from Adaptor2d,
|
||||
HCurve2dTool from IntPatch);
|
||||
|
||||
class CurvIntSurf instantiates IntCS from IntImp
|
||||
(HSurface from Adaptor3d,
|
||||
HSurfaceTool from Adaptor3d,
|
||||
HCurve2d from Adaptor2d,
|
||||
HCurve2dTool from IntPatch,
|
||||
CSFunction from IntPatch);
|
||||
|
||||
end IntPatch;
|
263
src/IntPatch/IntPatch_ALine.cdl
Executable file
263
src/IntPatch/IntPatch_ALine.cdl
Executable file
@@ -0,0 +1,263 @@
|
||||
-- File: IntPatch_ALine.cdl
|
||||
-- Created: Mon Apr 6 11:17:45 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: OPEN CASCADE 1992
|
||||
|
||||
|
||||
class ALine from IntPatch
|
||||
|
||||
|
||||
inherits Line from IntPatch
|
||||
|
||||
|
||||
---Purpose: Implementation of an intersection line described by a
|
||||
-- parametrised curve.
|
||||
|
||||
|
||||
uses
|
||||
Point from IntPatch,
|
||||
SequenceOfPoint from IntPatch,
|
||||
TypeTrans from IntSurf,
|
||||
Situation from IntSurf,
|
||||
Pnt from gp,
|
||||
Vec from gp,
|
||||
Curve from IntAna
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create(C: Curve from IntAna; Tang: Boolean from Standard;
|
||||
Trans1,Trans2: TypeTrans from IntSurf)
|
||||
|
||||
---Purpose: Creates an analytic intersection line
|
||||
-- when the transitions are In or Out.
|
||||
|
||||
returns mutable ALine from IntPatch;
|
||||
|
||||
|
||||
Create(C: Curve from IntAna; Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf)
|
||||
|
||||
---Purpose: Creates an analytic intersection line
|
||||
-- when the transitions are Touch.
|
||||
|
||||
returns mutable ALine from IntPatch;
|
||||
|
||||
|
||||
Create(C: Curve from IntAna; Tang: Boolean from Standard)
|
||||
|
||||
---Purpose: Creates an analytic intersection line
|
||||
-- when the transitions are Undecided.
|
||||
|
||||
returns mutable ALine from IntPatch;
|
||||
|
||||
|
||||
AddVertex(me: mutable; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: To add a vertex in the list.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Replace(me: mutable; Index: Integer from Standard; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: Replaces the element of range Index in the list
|
||||
-- of points.
|
||||
|
||||
---C++: inline
|
||||
|
||||
raises OutOfRange from Standard
|
||||
--- The exception OutOfRange is raised when Index <= 0
|
||||
-- or Index > NbVertex.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetFirstPoint(me: mutable; IndFirst: Integer from Standard) is static;
|
||||
|
||||
---C++: inline
|
||||
|
||||
|
||||
SetLastPoint(me: mutable; IndLast: Integer from Standard) is static;
|
||||
|
||||
---C++: inline
|
||||
|
||||
|
||||
FirstParameter(me; IsIncluded: in out Boolean from Standard)
|
||||
|
||||
---Purpose: Returns the first parameter on the intersection line.
|
||||
-- If IsIncluded returns True, Value and D1 methods can
|
||||
-- be call with a parameter equal to FirstParamater.
|
||||
-- Otherwise, the parameter must be greater than
|
||||
-- FirstParameter.
|
||||
|
||||
returns Real from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
LastParameter(me; IsIncluded: in out Boolean from Standard)
|
||||
|
||||
---Purpose: Returns the last parameter on the intersection line.
|
||||
-- If IsIncluded returns True, Value and D1 methods can
|
||||
-- be call with a parameter equal to LastParamater.
|
||||
-- Otherwise, the parameter must be less than LastParameter.
|
||||
|
||||
returns Real from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Value(me: mutable; U: Real from Standard)
|
||||
|
||||
---Purpose: Returns the point of parameter U on the analytic
|
||||
-- intersection line.
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
-- The exception DomainError is raised when U is outside the bounds
|
||||
-- FirstParameter,LastParameter.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
D1(me: mutable; U: Real from Standard;
|
||||
P: out Pnt from gp; Du: out Vec from gp)
|
||||
|
||||
---Purpose: Returns Standard_True when the derivative at parameter U
|
||||
-- is defined on the analytic intersection line.
|
||||
-- In that case, Du is the derivative.
|
||||
-- Returns Standard_False when it is not possible to
|
||||
-- evaluate the derivative.
|
||||
-- In both cases, P is the point at parameter U on the
|
||||
-- intersection.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
-- The exception DomainError is raised when U is outside the bounds
|
||||
-- FirstParameter,LastParameter.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FindParameter(me; P: Pnt from gp; Para: out Real from Standard)
|
||||
|
||||
---Purpose: Tries to find the parameter of the point P on the curve.
|
||||
-- If the method returns False, the "projection" is
|
||||
-- impossible, and the value of Para is not significant.
|
||||
-- If the method returns True, Para is the parameter of the
|
||||
-- nearest intersection between the curve and the iso-theta
|
||||
-- containing P.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasFirstPoint(me)
|
||||
|
||||
---Purpose: Returns True if the line has a known First point.
|
||||
-- This point is given by the method FirstPoint().
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasLastPoint(me)
|
||||
|
||||
---Purpose: Returns True if the line has a known Last point.
|
||||
-- This point is given by the method LastPoint().
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FirstPoint(me)
|
||||
|
||||
---Purpose: Returns the IntPoint corresponding to the FirstPoint.
|
||||
-- An exception is raised when HasFirstPoint returns False.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
LastPoint(me)
|
||||
|
||||
---Purpose: Returns the IntPoint corresponding to the LastPoint.
|
||||
-- An exception is raised when HasLastPoint returns False.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbVertex(me)
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Vertex(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the vertex of range Index on the line.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises OutOfRange from Standard
|
||||
--- The exception OutOfRange is raised if Index <= 0 or
|
||||
-- Index > NbVertex.
|
||||
|
||||
is static;
|
||||
|
||||
ComputeVertexParameters(me: mutable; Tol: Real from Standard)
|
||||
|
||||
---Purpose: Set the parameters of all the vertex on the line.
|
||||
-- if a vertex is already in the line,
|
||||
-- its parameter is modified
|
||||
-- else a new point in the line is inserted.
|
||||
is static;
|
||||
|
||||
|
||||
Curve(me)
|
||||
|
||||
returns Curve from IntAna
|
||||
---C++: return const&
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
curv : Curve from IntAna;
|
||||
fipt : Boolean from Standard;
|
||||
lapt : Boolean from Standard;
|
||||
indf : Integer from Standard;
|
||||
indl : Integer from Standard;
|
||||
svtx : SequenceOfPoint from IntPatch;
|
||||
|
||||
end ALine;
|
645
src/IntPatch/IntPatch_ALine.cxx
Executable file
645
src/IntPatch/IntPatch_ALine.cxx
Executable file
@@ -0,0 +1,645 @@
|
||||
// File: IntPatch_ALine.cxx
|
||||
// Created: Mon Apr 6 11:17:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <IntPatch_ALine.ixx>
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
IntPatch_ALine::IntPatch_ALine (const IntAna_Curve& C,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_TypeTrans Trans1,
|
||||
const IntSurf_TypeTrans Trans2) :
|
||||
IntPatch_Line(Tang,Trans1,Trans2),
|
||||
fipt(Standard_False),lapt(Standard_False)
|
||||
|
||||
{
|
||||
typ = IntPatch_Analytic;
|
||||
curv = C;
|
||||
}
|
||||
|
||||
|
||||
IntPatch_ALine::IntPatch_ALine (const IntAna_Curve& C,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_Situation Situ1,
|
||||
const IntSurf_Situation Situ2) :
|
||||
IntPatch_Line(Tang,Situ1,Situ2),
|
||||
fipt(Standard_False),lapt(Standard_False)
|
||||
|
||||
{
|
||||
typ = IntPatch_Analytic;
|
||||
curv = C;
|
||||
}
|
||||
|
||||
|
||||
IntPatch_ALine::IntPatch_ALine (const IntAna_Curve& C,
|
||||
const Standard_Boolean Tang) :
|
||||
IntPatch_Line(Tang),
|
||||
fipt(Standard_False),lapt(Standard_False)
|
||||
|
||||
{
|
||||
typ = IntPatch_Analytic;
|
||||
curv = C;
|
||||
}
|
||||
|
||||
const IntAna_Curve& IntPatch_ALine::Curve() const {
|
||||
return(curv);
|
||||
}
|
||||
|
||||
|
||||
#define PCONFUSION 0.00001
|
||||
|
||||
|
||||
void IntPatch_ALine::AddVertex (const IntPatch_Point& VTXj) {
|
||||
#if 0
|
||||
Standard_Integer n = NbVertex();
|
||||
if(n>=1) {
|
||||
Standard_Real par = VTXj.ParameterOnLine();
|
||||
|
||||
for(int i=1; i<=n ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXj.IsOnDomS1()==Standard_False) && (VTXj.IsOnDomS2()==Standard_False)) {
|
||||
if((VTXi.IsOnDomS1()==Standard_False) && (VTXi.IsOnDomS2()==Standard_False)) {
|
||||
if(Abs(par-VTXi.ParameterOnLine())<=PCONFUSION) {
|
||||
#if DEBUG
|
||||
cout<<" Rejet IntPatch_ALine::AddVertex (0) "<<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i=1; i<=n ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXj.IsOnDomS1()==Standard_True) && (VTXj.IsOnDomS2()==Standard_False)) {
|
||||
if((VTXi.IsOnDomS1()==Standard_True) && (VTXi.IsOnDomS2()==Standard_False)) {
|
||||
if(Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1())<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) {
|
||||
#if DEBUG
|
||||
cout<<" Rejet IntPatch_ALine::AddVertex (1) "<<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i=1; i<=n ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_False)) {
|
||||
if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_False)) {
|
||||
if(Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2())<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) {
|
||||
#if DEBUG
|
||||
cout<<" Rejet IntPatch_ALine::AddVertex (2) "<<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i=1; i<=n ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_True)) {
|
||||
if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_True)) {
|
||||
if(Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2())<=PCONFUSION) {
|
||||
if(Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1())<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) {
|
||||
if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) {
|
||||
#if DEBUG
|
||||
cout<<" Rejet IntPatch_ALine::AddVertex (3) "<<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-- Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 1
|
||||
for(i=1; i<=n ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_True)) {
|
||||
if((VTXi.IsOnDomS2()==Standard_False) && (VTXi.IsOnDomS1()==Standard_True)) {
|
||||
Standard_Real p = Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1());
|
||||
#if DEBUG
|
||||
cout<<" Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 1 : "<<p<<endl;
|
||||
#endif
|
||||
if(p<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) {
|
||||
#if DEBUG
|
||||
cout<<" Replace IntPatch_ALine::AddVertex (1) "<<endl;
|
||||
#endif
|
||||
Replace(i,VTXj);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-- Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 2
|
||||
for(i=1; i<=n ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_True)) {
|
||||
if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_False)) {
|
||||
Standard_Real p = Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2());
|
||||
#if DEBUG
|
||||
cout<<" Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 2 : "<<p<<endl;
|
||||
#endif
|
||||
if(p<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) {
|
||||
#if DEBUG
|
||||
cout<<" Replace IntPatch_ALine::AddVertex (2) "<<endl;
|
||||
#endif
|
||||
Replace(i,VTXj);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-- Est ce que VTXi deja present sur 1 et 2 et un point VTXj present sur 1
|
||||
for(i=1; i<=n ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_True)) {
|
||||
if((VTXj.IsOnDomS2()==Standard_False) && (VTXj.IsOnDomS1()==Standard_True)) {
|
||||
Standard_Real p = Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1());
|
||||
if(p<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) {
|
||||
#if DEBUG
|
||||
cout<<" Replace IntPatch_ALine::AddVertex (1) -> RIEN "<<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-- Est ce que VTXj present sur 1 et 2 remplace un point VTXi present sur 2
|
||||
for(i=1; i<=n ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_True)) {
|
||||
if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_False)) {
|
||||
Standard_Real p = Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2());
|
||||
if(p<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
svtx.Append(VTXj);
|
||||
|
||||
}
|
||||
else {
|
||||
svtx.Append(VTXj);
|
||||
}
|
||||
#else
|
||||
svtx.Append(VTXj);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void IntPatch_ALine::ComputeVertexParameters(const Standard_Real Tol) {
|
||||
Standard_Boolean SortIsOK,APointDeleted;
|
||||
Standard_Boolean SortAgain = Standard_True;
|
||||
Standard_Integer nbvtx,i,j;
|
||||
Standard_Real ParamMinOnLine,ParamMaxOnLine;
|
||||
Standard_Boolean OpenFirst,OpenLast;
|
||||
|
||||
ParamMinOnLine = FirstParameter(OpenFirst);
|
||||
ParamMaxOnLine = LastParameter(OpenLast);
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-- F i l t r e s u r r e s t r i c t i o n s --
|
||||
//----------------------------------------------------------
|
||||
//-- deux vertex sur la meme restriction et seulement
|
||||
//-- sur celle ci ne doivent pas avoir le meme parametre
|
||||
//--
|
||||
//--
|
||||
|
||||
//-- Le tri est necessaire si suppression du first ou du last point
|
||||
nbvtx = NbVertex();
|
||||
|
||||
|
||||
//-- On verifie qu un vertex a bien toute ses representations :
|
||||
//-- Cas tres rare : point de tangence sur un debut de ligne
|
||||
//-- et la ligne fait 2 * 2 PI de parametrage.
|
||||
|
||||
for(i=1; i<=nbvtx; i++) {
|
||||
IntPatch_Point& VTX = svtx.ChangeValue(i);
|
||||
Standard_Real p=VTX.ParameterOnLine();
|
||||
Standard_Real pmpimpi=p-PI-PI;
|
||||
if(pmpimpi >= ParamMinOnLine) {
|
||||
gp_Pnt P1 = Value(pmpimpi);
|
||||
Standard_Real d1 = P1.Distance(VTX.Value());
|
||||
if(d1<Tol) {
|
||||
IntPatch_Point OVTX(VTX);
|
||||
OVTX.SetParameter(pmpimpi);
|
||||
svtx.Append(OVTX);
|
||||
}
|
||||
}
|
||||
pmpimpi=p+PI+PI;
|
||||
if(pmpimpi <= ParamMaxOnLine) {
|
||||
gp_Pnt P1 = Value(pmpimpi);
|
||||
Standard_Real d1 = P1.Distance(VTX.Value());
|
||||
if(d1<Tol) {
|
||||
IntPatch_Point OVTX(VTX);
|
||||
OVTX.SetParameter(pmpimpi);
|
||||
svtx.Append(OVTX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nbvtx=NbVertex();
|
||||
|
||||
|
||||
|
||||
if(nbvtx<=0) return;
|
||||
do {
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx; i++) {
|
||||
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine()) {
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Exchange(i-1,i);
|
||||
if(fipt) { if(indf==i) indf=i-1; else if(indf==i-1) indf=i; }
|
||||
if(lapt) { if(indl==i) indl=i-1; else if(indl==i-1) indl=i; }
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
for(i=1; (i<=nbvtx) && (APointDeleted==Standard_False) ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXi.IsOnDomS1()==Standard_True) && (VTXi.IsOnDomS2()==Standard_False)) {
|
||||
for(j=1; (j<=nbvtx) && (APointDeleted==Standard_False) ;j++) {
|
||||
if(i!=j) {
|
||||
const IntPatch_Point& VTXj = svtx.Value(j);
|
||||
if((VTXj.IsOnDomS1()==Standard_True) && (VTXj.IsOnDomS2()==Standard_False)) {
|
||||
if(Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1())<=PCONFUSION) {
|
||||
if(Abs(VTXi.ParameterOnLine()-VTXj.ParameterOnLine())<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) {
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>=j) indl--; }
|
||||
if(fipt) { if(indf>=j) indf--; }
|
||||
APointDeleted = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(APointDeleted == Standard_True);
|
||||
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
for(i=1; (i<=nbvtx) && (APointDeleted==Standard_False) ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_False)) {
|
||||
for(j=1; (j<=nbvtx) && (APointDeleted==Standard_False) ;j++) {
|
||||
if(i!=j) {
|
||||
const IntPatch_Point& VTXj = svtx.Value(j);
|
||||
if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_False)) {
|
||||
if(Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2())<=PCONFUSION) {
|
||||
if(Abs(VTXi.ParameterOnLine()-VTXj.ParameterOnLine())<=PCONFUSION) {
|
||||
if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) {
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>=j) indl--; }
|
||||
if(fipt) { if(indf>=j) indf--; }
|
||||
APointDeleted = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(APointDeleted == Standard_True);
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-- Tri des vertex et suppression des Vtx superflus
|
||||
//--
|
||||
do {
|
||||
nbvtx = NbVertex();
|
||||
if(SortAgain) {
|
||||
do {
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx; i++) {
|
||||
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine()) {
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Exchange(i-1,i);
|
||||
if(fipt) { if(indf==i) indf=i-1; else if(indf==i-1) indf=i; }
|
||||
if(lapt) { if(indl==i) indl=i-1; else if(indl==i-1) indl=i; }
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
}
|
||||
SortAgain = Standard_False;
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx && SortIsOK; i++) {
|
||||
IntPatch_Point& VTX = svtx.ChangeValue(i);
|
||||
for(j=1; j<i && SortIsOK; j++) {
|
||||
IntPatch_Point& VTXM1 = svtx.ChangeValue(j);
|
||||
Standard_Boolean kill = Standard_False;
|
||||
Standard_Boolean killm1 = Standard_False;
|
||||
if(Abs(VTXM1.ParameterOnLine()-VTX.ParameterOnLine())<PCONFUSION) {
|
||||
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()) { //-- OnS1 OnS1
|
||||
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS1 == OnS1
|
||||
if(VTXM1.IsOnDomS2()) { //-- OnS1 == OnS1 OnS2
|
||||
if(VTX.IsOnDomS2()==Standard_False) { //-- OnS1 == OnS1 OnS2 PasOnS2
|
||||
kill=Standard_True;
|
||||
}
|
||||
else {
|
||||
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS1 == OnS1 OnS2 == OnS2
|
||||
kill=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- OnS1 == OnS1 PasOnS2
|
||||
if(VTX.IsOnDomS2()) { //-- OnS1 == OnS1 PasOnS2 OnS2
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- Pas OnS1 et OnS1
|
||||
if(VTXM1.IsOnDomS2()==Standard_False && VTX.IsOnDomS2()==Standard_False) {
|
||||
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()==Standard_False) {
|
||||
kill=Standard_True;
|
||||
}
|
||||
else if(VTX.IsOnDomS1() && VTXM1.IsOnDomS1()==Standard_False) {
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!(kill || killm1)) {
|
||||
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()) { //-- OnS2 OnS2
|
||||
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS2 == OnS2
|
||||
if(VTXM1.IsOnDomS1()) { //-- OnS2 == OnS2 OnS1
|
||||
if(VTX.IsOnDomS1()==Standard_False) { //-- OnS2 == OnS2 OnS1 PasOnS1
|
||||
kill=Standard_True;
|
||||
}
|
||||
else {
|
||||
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS2 == OnS2 OnS1 == OnS1
|
||||
kill=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- OnS2 == OnS2 PasOnS1
|
||||
if(VTX.IsOnDomS1()) { //-- OnS2 == OnS2 PasOnS1 OnS1
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- Pas OnS2 et OnS2
|
||||
if(VTXM1.IsOnDomS1()==Standard_False && VTX.IsOnDomS1()==Standard_False) {
|
||||
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()==Standard_False) {
|
||||
kill=Standard_True;
|
||||
}
|
||||
else if(VTX.IsOnDomS2() && VTXM1.IsOnDomS2()==Standard_False) {
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-- On a j < i
|
||||
if(kill) {
|
||||
SortIsOK = Standard_False;
|
||||
if(lapt) { if(indl>i) indl--; else if(indl==i) indl=j; }
|
||||
if(fipt) { if(indf>i) indf--; else if(indf==i) indf=j; }
|
||||
svtx.Remove(i);
|
||||
nbvtx--;
|
||||
}
|
||||
else if(killm1) {
|
||||
SortIsOK = Standard_False;
|
||||
if(lapt) { if(indl>j) indl--; else if(indl==j) indl=i-1;}
|
||||
if(fipt) { if(indf>j) indf--; else if(indf==j) indf=i-1;}
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-- Traitement des lignes periodiques --
|
||||
//----------------------------------------------------------
|
||||
if(OpenFirst == Standard_False && OpenLast == Standard_False) {
|
||||
nbvtx = NbVertex();
|
||||
|
||||
IntPatch_Point& VTX0 = svtx.ChangeValue(1);
|
||||
IntPatch_Point& VTXN = svtx.ChangeValue(nbvtx);
|
||||
if(VTX0.ParameterOnLine() == ParamMinOnLine) {
|
||||
if(VTXN.ParameterOnLine() !=ParamMaxOnLine) {
|
||||
gp_Pnt PN=Value(ParamMaxOnLine);
|
||||
Standard_Real d = PN.Distance(VTX0.Value());
|
||||
if(d<=Tol) {
|
||||
IntPatch_Point OVTX(VTX0);
|
||||
OVTX.SetParameter(ParamMaxOnLine);
|
||||
svtx.Append(OVTX);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(VTXN.ParameterOnLine() == ParamMaxOnLine) {
|
||||
if(VTX0.ParameterOnLine() !=ParamMinOnLine) {
|
||||
gp_Pnt P0=Value(ParamMinOnLine);
|
||||
Standard_Real d = P0.Distance(VTX0.Value());
|
||||
if(d<=Tol) {
|
||||
IntPatch_Point OVTX(VTXN);
|
||||
OVTX.SetParameter(ParamMinOnLine);
|
||||
svtx.Prepend(OVTX);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
//-- Faut il supprimer le premier et le dernier point
|
||||
//--
|
||||
nbvtx = NbVertex();
|
||||
if(nbvtx>1) {
|
||||
IntPatch_Point& VTX0 = svtx.ChangeValue(1);
|
||||
#ifdef DEB
|
||||
//Standard_Real d;
|
||||
IntPatch_Point& VTX1 =
|
||||
#endif
|
||||
svtx.ChangeValue(2);
|
||||
if( (VTX0.IsOnDomS1() == Standard_False)
|
||||
&& (VTX0.IsOnDomS2() == Standard_False)) {
|
||||
svtx.Remove(1);
|
||||
nbvtx--;
|
||||
if(lapt) {
|
||||
indl--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(nbvtx>1) {
|
||||
IntPatch_Point& VTX0 = svtx.ChangeValue(nbvtx);
|
||||
#ifdef DEB
|
||||
IntPatch_Point& VTX1 =
|
||||
#endif
|
||||
svtx.ChangeValue(nbvtx-1);
|
||||
if( (VTX0.IsOnDomS1() == Standard_False)
|
||||
&& (VTX0.IsOnDomS2() == Standard_False)) {
|
||||
svtx.Remove(nbvtx);
|
||||
#ifndef DEB
|
||||
if((signed)lapt == nbvtx) {
|
||||
#else
|
||||
if(lapt == nbvtx) {
|
||||
#endif
|
||||
indl--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-- Si 2 vertex ont le meme parametre on identifie le p3d
|
||||
nbvtx = NbVertex();
|
||||
do {
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx; i++) {
|
||||
IntPatch_Point& VTX = svtx.ChangeValue(i);
|
||||
IntPatch_Point& VTXm1 = svtx.ChangeValue(i-1);
|
||||
if(Abs(VTX.ParameterOnLine()-VTXm1.ParameterOnLine())<PCONFUSION) {
|
||||
if(VTX.IsOnDomS1() && VTXm1.IsOnDomS1()==Standard_False) {
|
||||
VTXm1.SetArc(Standard_True,
|
||||
VTX.ArcOnS1(),
|
||||
VTX.ParameterOnArc1(),
|
||||
VTX.TransitionLineArc1(),
|
||||
VTX.TransitionOnS1());
|
||||
}
|
||||
else if(VTXm1.IsOnDomS1() && VTX.IsOnDomS1()==Standard_False) {
|
||||
VTX.SetArc(Standard_True,
|
||||
VTXm1.ArcOnS1(),
|
||||
VTXm1.ParameterOnArc1(),
|
||||
VTXm1.TransitionLineArc1(),
|
||||
VTXm1.TransitionOnS1());
|
||||
}
|
||||
if(VTX.IsVertexOnS1() && VTXm1.IsVertexOnS1()==Standard_False) {
|
||||
VTXm1.SetVertex(Standard_True, VTX.VertexOnS1());
|
||||
VTXm1.SetArc(Standard_True,
|
||||
VTX.ArcOnS1(),
|
||||
VTX.ParameterOnArc1(),
|
||||
VTX.TransitionLineArc1(),
|
||||
VTX.TransitionOnS1());
|
||||
}
|
||||
else if(VTXm1.IsVertexOnS1() && VTX.IsVertexOnS1()==Standard_False) {
|
||||
VTX.SetVertex(Standard_True, VTXm1.VertexOnS1());
|
||||
VTX.SetArc(Standard_True,
|
||||
VTXm1.ArcOnS1(),
|
||||
VTXm1.ParameterOnArc1(),
|
||||
VTXm1.TransitionLineArc1(),
|
||||
VTXm1.TransitionOnS1());
|
||||
}
|
||||
|
||||
if(VTX.IsOnDomS2() && VTXm1.IsOnDomS2()==Standard_False) {
|
||||
VTXm1.SetArc(Standard_False,
|
||||
VTX.ArcOnS2(),
|
||||
VTX.ParameterOnArc2(),
|
||||
VTX.TransitionLineArc2(),
|
||||
VTX.TransitionOnS2());
|
||||
}
|
||||
else if(VTXm1.IsOnDomS2() && VTX.IsOnDomS2()==Standard_False) {
|
||||
VTX.SetArc(Standard_False,
|
||||
VTXm1.ArcOnS2(),
|
||||
VTXm1.ParameterOnArc2(),
|
||||
VTXm1.TransitionLineArc2(),
|
||||
VTXm1.TransitionOnS2());
|
||||
}
|
||||
if(VTX.IsVertexOnS2() && VTXm1.IsVertexOnS2()==Standard_False) {
|
||||
VTXm1.SetVertex(Standard_False, VTX.VertexOnS2());
|
||||
VTXm1.SetArc(Standard_False,
|
||||
VTX.ArcOnS2(),
|
||||
VTX.ParameterOnArc2(),
|
||||
VTX.TransitionLineArc2(),
|
||||
VTX.TransitionOnS2());
|
||||
}
|
||||
else if(VTXm1.IsVertexOnS2() && VTX.IsVertexOnS2()==Standard_False) {
|
||||
VTX.SetVertex(Standard_False, VTXm1.VertexOnS2());
|
||||
VTX.SetArc(Standard_False,
|
||||
VTXm1.ArcOnS2(),
|
||||
VTXm1.ParameterOnArc2(),
|
||||
VTXm1.TransitionLineArc2(),
|
||||
VTXm1.TransitionOnS2());
|
||||
}
|
||||
|
||||
if(VTX.Value().SquareDistance(VTXm1.Value()) > 1e-12) {
|
||||
IntPatch_Point CopyVtx = VTXm1;
|
||||
VTXm1.SetParameter(VTX.ParameterOnLine());
|
||||
VTXm1.SetValue(VTX.Value(),VTX.Tolerance(),VTX.IsTangencyPoint());
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
VTX.Parameters(u1,v1,u2,v2);
|
||||
VTXm1.SetParameters(u1,v1,u2,v2);
|
||||
if(CopyVtx.IsOnDomS1()) {
|
||||
VTXm1.SetArc(Standard_True,
|
||||
CopyVtx.ArcOnS1(),
|
||||
CopyVtx.ParameterOnArc1(),
|
||||
CopyVtx.TransitionLineArc1(),
|
||||
CopyVtx.TransitionOnS1());
|
||||
}
|
||||
if(CopyVtx.IsOnDomS2()) {
|
||||
VTXm1.SetArc(Standard_False,
|
||||
CopyVtx.ArcOnS2(),
|
||||
CopyVtx.ParameterOnArc2(),
|
||||
CopyVtx.TransitionLineArc2(),
|
||||
CopyVtx.TransitionOnS2());
|
||||
}
|
||||
if(CopyVtx.IsVertexOnS1()) {
|
||||
VTXm1.SetVertex(Standard_True,CopyVtx.VertexOnS1());
|
||||
VTXm1.SetArc(Standard_True,
|
||||
CopyVtx.ArcOnS1(),
|
||||
CopyVtx.ParameterOnArc1(),
|
||||
CopyVtx.TransitionLineArc1(),
|
||||
CopyVtx.TransitionOnS1());
|
||||
}
|
||||
if(CopyVtx.IsVertexOnS2()) {
|
||||
VTXm1.SetVertex(Standard_False,CopyVtx.VertexOnS2());
|
||||
VTXm1.SetArc(Standard_False,
|
||||
CopyVtx.ArcOnS2(),
|
||||
CopyVtx.ParameterOnArc2(),
|
||||
CopyVtx.TransitionLineArc2(),
|
||||
CopyVtx.TransitionOnS2());
|
||||
}
|
||||
|
||||
|
||||
SortIsOK=Standard_False;
|
||||
//-- cout<<" IntPatch_ALine : ComputeVertexParameters : Ajust "<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
|
||||
/*nbvtx = NbVertex();
|
||||
for(Standard_Integer opopo = 1; opopo<=nbvtx; opopo++) {
|
||||
svtx.Value(opopo).Dump();
|
||||
}*/
|
||||
}
|
89
src/IntPatch/IntPatch_ALine.lxx
Executable file
89
src/IntPatch/IntPatch_ALine.lxx
Executable file
@@ -0,0 +1,89 @@
|
||||
// File: IntPatch_ALine.lxx
|
||||
// Created: Mon Apr 6 11:17:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <IntPatch_Point.hxx>
|
||||
|
||||
|
||||
inline void IntPatch_ALine::Replace (const Standard_Integer Index, const IntPatch_Point& Pnt)
|
||||
{
|
||||
svtx(Index) = Pnt;
|
||||
}
|
||||
|
||||
inline void IntPatch_ALine::SetFirstPoint (const Standard_Integer IndFirst)
|
||||
{
|
||||
fipt = Standard_True;
|
||||
indf = IndFirst;
|
||||
}
|
||||
|
||||
inline void IntPatch_ALine::SetLastPoint (const Standard_Integer IndLast)
|
||||
{
|
||||
lapt = Standard_True;
|
||||
indl = IndLast;
|
||||
}
|
||||
|
||||
inline Standard_Real IntPatch_ALine::FirstParameter (Standard_Boolean& IsIncluded) const
|
||||
{
|
||||
Standard_Real bid,first;
|
||||
curv.Domain(first,bid);
|
||||
IsIncluded = !curv.IsFirstOpen();
|
||||
return first;
|
||||
}
|
||||
|
||||
inline Standard_Real IntPatch_ALine::LastParameter (Standard_Boolean& IsIncluded) const
|
||||
{
|
||||
Standard_Real bid,last;
|
||||
curv.Domain(bid,last);
|
||||
IsIncluded = !curv.IsLastOpen();
|
||||
return last;
|
||||
}
|
||||
|
||||
inline gp_Pnt IntPatch_ALine::Value (const Standard_Real U)
|
||||
{
|
||||
return curv.Value(U);// Value leve l exception DomainError
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_ALine::D1(const Standard_Real U, gp_Pnt& P, gp_Vec& Du)
|
||||
{
|
||||
return curv.D1u(U,P,Du); // D1u leve l exception DomainError
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_ALine::FindParameter(const gp_Pnt& P, Standard_Real& Para) const
|
||||
{
|
||||
return curv.FindParameter(P,Para);
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_ALine::HasFirstPoint () const
|
||||
{
|
||||
return fipt;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_ALine::HasLastPoint () const
|
||||
{
|
||||
return lapt;
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_ALine::FirstPoint () const
|
||||
{
|
||||
if (!fipt) {Standard_DomainError::Raise();}
|
||||
return svtx(indf);
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_ALine::LastPoint () const
|
||||
{
|
||||
if (!lapt) {Standard_DomainError::Raise();}
|
||||
return svtx(indl);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_ALine::NbVertex () const
|
||||
{
|
||||
return svtx.Length();
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_ALine::Vertex (const Standard_Integer Index) const
|
||||
{
|
||||
return svtx(Index);
|
||||
}
|
81
src/IntPatch/IntPatch_ALineToWLine.cdl
Executable file
81
src/IntPatch/IntPatch_ALineToWLine.cdl
Executable file
@@ -0,0 +1,81 @@
|
||||
-- File: IntPatch_ALineToWLine.cdl
|
||||
-- Created: Fri Nov 26 10:26:11 1993
|
||||
-- Author: Modelistation
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class ALineToWLine from IntPatch
|
||||
|
||||
uses
|
||||
WLine from IntPatch,
|
||||
ALine from IntPatch,
|
||||
Quadric from IntSurf
|
||||
|
||||
is
|
||||
|
||||
Create(Quad1 : Quadric from IntSurf;
|
||||
Quad2 : Quadric from IntSurf)
|
||||
|
||||
returns ALineToWLine from IntPatch;
|
||||
|
||||
Create(Quad1 : Quadric from IntSurf;
|
||||
Quad2 : Quadric from IntSurf;
|
||||
Deflection : Real from Standard;
|
||||
PasMaxUV : Real from Standard;
|
||||
NbMaxPoints : Integer from Standard)
|
||||
|
||||
returns ALineToWLine from IntPatch;
|
||||
|
||||
|
||||
SetTolParam(me:out;
|
||||
aT:Real from Standard);
|
||||
|
||||
TolParam(me)
|
||||
returns Real from Standard;
|
||||
|
||||
SetTolOpenDomain(me:out;
|
||||
aT:Real from Standard);
|
||||
|
||||
TolOpenDomain(me)
|
||||
returns Real from Standard;
|
||||
|
||||
SetTolTransition(me:out;
|
||||
aT:Real from Standard);
|
||||
|
||||
TolTransition(me)
|
||||
returns Real from Standard;
|
||||
|
||||
SetTol3D(me:out;
|
||||
aT:Real from Standard);
|
||||
|
||||
Tol3D(me)
|
||||
returns Real from Standard;
|
||||
|
||||
SetConstantParameter(me);
|
||||
|
||||
SetUniformAbscissa(me);
|
||||
|
||||
SetUniformDeflection(me);
|
||||
|
||||
MakeWLine(me; aline: ALine from IntPatch)
|
||||
|
||||
returns WLine from IntPatch;
|
||||
|
||||
MakeWLine(me; aline: ALine from IntPatch; paraminf,paramsup: Real from Standard)
|
||||
returns WLine from IntPatch;
|
||||
|
||||
fields
|
||||
quad1 : Quadric from IntSurf;
|
||||
quad2 : Quadric from IntSurf;
|
||||
deflectionmax : Real from Standard;
|
||||
pasuvmax : Real from Standard;
|
||||
nbpointsmax : Integer from Standard;
|
||||
type : Integer from Standard; -- 0: Constant Parameter
|
||||
-- 1: Uniform Abscissa
|
||||
-- 2: Uniform Deflection
|
||||
myTolParam : Real from Standard;
|
||||
myTolOpenDomain : Real from Standard;
|
||||
myTolTransition : Real from Standard;
|
||||
myTol3D : Real from Standard;
|
||||
|
||||
end;
|
1241
src/IntPatch/IntPatch_ALineToWLine.cxx
Executable file
1241
src/IntPatch/IntPatch_ALineToWLine.cxx
Executable file
File diff suppressed because it is too large
Load Diff
103
src/IntPatch/IntPatch_ArcFunction.cdl
Executable file
103
src/IntPatch/IntPatch_ArcFunction.cdl
Executable file
@@ -0,0 +1,103 @@
|
||||
-- File: IntPatch_ArcFunction.cdl
|
||||
-- Created: Mon Jun 7 17:39:24 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class ArcFunction from IntPatch
|
||||
|
||||
inherits FunctionWithDerivative from math
|
||||
|
||||
uses
|
||||
HCurve2d from Adaptor2d,
|
||||
HSurface from Adaptor3d,
|
||||
Pnt from gp,
|
||||
SequenceOfPnt from TColgp,
|
||||
Quadric from IntSurf
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
returns ArcFunction from IntPatch;
|
||||
|
||||
|
||||
SetQuadric(me: in out; Q: Quadric from IntSurf)
|
||||
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
Set(me: in out; A: HCurve2d from Adaptor2d)
|
||||
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
Set(me: in out; S: HSurface from Adaptor3d)
|
||||
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
Value(me: in out; X: Real from Standard; F: out Real from Standard)
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Derivative(me: in out; X: Real from Standard; D: out Real from Standard)
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Values(me: in out; X: Real from Standard; F,D: out Real from Standard)
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
NbSamples(me)
|
||||
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
|
||||
|
||||
GetStateNumber(me: in out)
|
||||
|
||||
returns Integer from Standard
|
||||
is redefined;
|
||||
|
||||
|
||||
Valpoint(me; Index: Integer from Standard)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Quadric(me)
|
||||
returns Quadric from IntSurf
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Arc(me)
|
||||
returns HCurve2d from Adaptor2d
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Surface(me)
|
||||
returns HSurface from Adaptor3d
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myArc : HCurve2d from Adaptor2d;
|
||||
mySurf : HSurface from Adaptor3d;
|
||||
myQuad : Quadric from IntSurf;
|
||||
ptsol : Pnt from gp;
|
||||
seqpt : SequenceOfPnt from TColgp;
|
||||
|
||||
end ArcFunction;
|
61
src/IntPatch/IntPatch_ArcFunction.cxx
Executable file
61
src/IntPatch/IntPatch_ArcFunction.cxx
Executable file
@@ -0,0 +1,61 @@
|
||||
// File: IntPatch_ArcFunction.cxx
|
||||
// Created: Mon Jun 7 17:39:24 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1993
|
||||
|
||||
#include <IntPatch_ArcFunction.ixx>
|
||||
|
||||
#include <IntPatch_HInterTool.hxx>
|
||||
|
||||
|
||||
IntPatch_ArcFunction::IntPatch_ArcFunction ()
|
||||
{}
|
||||
|
||||
Standard_Boolean IntPatch_ArcFunction::Value(const Standard_Real X, Standard_Real& F)
|
||||
{
|
||||
gp_Pnt2d p2d(myArc->Value(X));
|
||||
mySurf->D0(p2d.X(),p2d.Y(),ptsol);
|
||||
F = myQuad.Distance(ptsol);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntPatch_ArcFunction::Derivative(const Standard_Real X, Standard_Real& D)
|
||||
{
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d d2d;
|
||||
gp_Vec v,d1u,d1v;
|
||||
myArc->D1(X,p2d,d2d);
|
||||
mySurf->D1(p2d.X(),p2d.Y(),ptsol,d1u,d1v);
|
||||
v.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
|
||||
D = v.Dot(myQuad.Gradient(ptsol));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntPatch_ArcFunction::Values(const Standard_Real X, Standard_Real& F, Standard_Real& D)
|
||||
{
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d d2d;
|
||||
gp_Vec d1u,d1v;
|
||||
|
||||
gp_Vec v1,v2;
|
||||
myArc->D1(X,p2d,d2d);
|
||||
mySurf->D1(p2d.X(),p2d.Y(),ptsol,d1u,d1v);
|
||||
v1.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
|
||||
|
||||
myQuad.ValAndGrad(ptsol,F,v2);
|
||||
D = v1.Dot(v2);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Integer IntPatch_ArcFunction::GetStateNumber ()
|
||||
{
|
||||
seqpt.Append(ptsol);
|
||||
return seqpt.Length();
|
||||
}
|
||||
|
||||
Standard_Integer IntPatch_ArcFunction::NbSamples () const
|
||||
{
|
||||
return Max(Max(IntPatch_HInterTool::NbSamplesU(mySurf,0.,0.),
|
||||
IntPatch_HInterTool::NbSamplesV(mySurf,0.,0.)),
|
||||
IntPatch_HInterTool::NbSamplesOnArc(myArc));
|
||||
}
|
43
src/IntPatch/IntPatch_ArcFunction.lxx
Executable file
43
src/IntPatch/IntPatch_ArcFunction.lxx
Executable file
@@ -0,0 +1,43 @@
|
||||
// File: IntPatch_ArcFunction.lxx
|
||||
// Created: Mon Jun 7 17:39:24 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1993
|
||||
|
||||
|
||||
inline const gp_Pnt& IntPatch_ArcFunction::Valpoint (const Standard_Integer Index) const
|
||||
{
|
||||
return seqpt(Index);
|
||||
}
|
||||
|
||||
inline void IntPatch_ArcFunction::Set(const Handle(Adaptor2d_HCurve2d)& A)
|
||||
{
|
||||
myArc = A;
|
||||
seqpt.Clear();
|
||||
}
|
||||
|
||||
inline void IntPatch_ArcFunction::Set(const Handle(Adaptor3d_HSurface)& S)
|
||||
{
|
||||
mySurf = S;
|
||||
seqpt.Clear();
|
||||
}
|
||||
|
||||
inline void IntPatch_ArcFunction::SetQuadric(const IntSurf_Quadric& Q)
|
||||
{
|
||||
myQuad = Q;
|
||||
seqpt.Clear();
|
||||
}
|
||||
|
||||
inline const IntSurf_Quadric& IntPatch_ArcFunction::Quadric() const
|
||||
{
|
||||
return(myQuad);
|
||||
}
|
||||
|
||||
inline const Handle(Adaptor2d_HCurve2d)& IntPatch_ArcFunction::Arc() const
|
||||
{
|
||||
return(myArc);
|
||||
}
|
||||
|
||||
inline const Handle(Adaptor3d_HSurface)& IntPatch_ArcFunction::Surface() const
|
||||
{
|
||||
return(mySurf);
|
||||
}
|
359
src/IntPatch/IntPatch_GLine.cdl
Executable file
359
src/IntPatch/IntPatch_GLine.cdl
Executable file
@@ -0,0 +1,359 @@
|
||||
-- File: IntPatch_GLine.cdl
|
||||
-- Created: Mon Apr 6 11:17:45 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: OPEN CASCADE 1992
|
||||
|
||||
|
||||
class GLine from IntPatch
|
||||
|
||||
|
||||
inherits Line from IntPatch
|
||||
|
||||
---Purpose: Implementation of an intersection line represented
|
||||
-- by a conic.
|
||||
|
||||
uses
|
||||
Point from IntPatch,
|
||||
SequenceOfPoint from IntPatch,
|
||||
Lin from gp,
|
||||
Circ from gp,
|
||||
Elips from gp,
|
||||
Parab from gp,
|
||||
Hypr from gp,
|
||||
Ax2 from gp,
|
||||
TypeTrans from IntSurf,
|
||||
Situation from IntSurf
|
||||
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(L: Lin from gp; Tang: Boolean from Standard;
|
||||
Trans1,Trans2: TypeTrans from IntSurf)
|
||||
|
||||
---Purpose: Creates a Line as intersection line
|
||||
-- when the transitions are In or Out.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(L: Lin from gp; Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf)
|
||||
|
||||
---Purpose: Creates a Line as intersection line
|
||||
-- when the transitions are Touch.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(L: Lin from gp; Tang: Boolean from Standard)
|
||||
|
||||
---Purpose: Creates a Line as intersection line
|
||||
-- when the transitions are Undecided.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(C: Circ from gp; Tang: Boolean from Standard;
|
||||
Trans1,Trans2: TypeTrans from IntSurf)
|
||||
|
||||
---Purpose: Creates a circle as intersection line
|
||||
-- when the transitions are In or Out.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(C: Circ from gp; Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf)
|
||||
|
||||
---Purpose: Creates a circle as intersection line
|
||||
-- when the transitions are Touch.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(C: Circ from gp; Tang: Boolean from Standard)
|
||||
|
||||
---Purpose: Creates a circle as intersection line
|
||||
-- when the transitions are Undecided.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(E: Elips from gp; Tang: Boolean from Standard;
|
||||
Trans1,Trans2: TypeTrans from IntSurf)
|
||||
|
||||
---Purpose: Creates an ellipse as intersection line
|
||||
-- when the transitions are In or Out.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(E: Elips from gp; Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf)
|
||||
|
||||
---Purpose: Creates an ellispe as intersection line
|
||||
-- when the transitions are Touch.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(E: Elips from gp; Tang: Boolean from Standard)
|
||||
|
||||
---Purpose: Creates an ellipse as intersection line
|
||||
-- when the transitions are Undecided.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(P: Parab from gp; Tang: Boolean from Standard;
|
||||
Trans1,Trans2: TypeTrans from IntSurf)
|
||||
|
||||
---Purpose: Creates a parabola as intersection line
|
||||
-- when the transitions are In or Out.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(P: Parab from gp; Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf)
|
||||
|
||||
---Purpose: Creates a parabola as intersection line
|
||||
-- when the transitions are Touch.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(P: Parab from gp; Tang: Boolean from Standard)
|
||||
|
||||
---Purpose: Creates a parabola as intersection line
|
||||
-- when the transitions are Undecided.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(H: Hypr from gp; Tang: Boolean from Standard;
|
||||
Trans1,Trans2: TypeTrans from IntSurf)
|
||||
|
||||
---Purpose: Creates an hyperbola as intersection line
|
||||
-- when the transitions are In or Out.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(H: Hypr from gp; Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf)
|
||||
|
||||
---Purpose: Creates an hyperbola as intersection line
|
||||
-- when the transitions are Touch.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
Create(H: Hypr from gp; Tang: Boolean from Standard)
|
||||
|
||||
---Purpose: Creates an hyperbola as intersection line
|
||||
-- when the transitions are Undecided.
|
||||
|
||||
returns mutable GLine from IntPatch;
|
||||
|
||||
|
||||
AddVertex(me: mutable; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: To add a vertex in the list.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Replace(me: mutable; Index: Integer from Standard; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: To replace the element of range Index in the list
|
||||
-- of points.
|
||||
|
||||
raises OutOfRange from Standard
|
||||
--- The exception OutOfRange is raised when Index <= 0
|
||||
-- or Index > NbVertex.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetFirstPoint(me: mutable; IndFirst: Integer from Standard) is static;
|
||||
|
||||
---C++: inline
|
||||
|
||||
|
||||
SetLastPoint(me: mutable; IndLast: Integer from Standard) is static;
|
||||
|
||||
---C++: inline
|
||||
|
||||
|
||||
Line(me)
|
||||
|
||||
---Purpose: Returns the Lin from gp corresponding to the intersection
|
||||
-- when ArcType returns IntPatch_Line.
|
||||
|
||||
|
||||
returns Lin from gp
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when ArcType does not return
|
||||
-- IntPatch_Line.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Circle(me)
|
||||
|
||||
---Purpose: Returns the Circ from gp corrsponding to the intersection
|
||||
-- when ArcType returns IntPatch_Circle.
|
||||
|
||||
returns Circ from gp
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when ArcType does not return
|
||||
-- IntPatch_Circle.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Ellipse(me)
|
||||
|
||||
---Purpose: Returns the Elips from gp corrsponding to the intersection
|
||||
-- when ArcType returns IntPatch_Ellipse.
|
||||
|
||||
returns Elips from gp
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when ArcType does not return
|
||||
-- IntPatch_Ellipse.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Parabola(me)
|
||||
|
||||
---Purpose: Returns the Parab from gp corrsponding to the intersection
|
||||
-- when ArcType returns IntPatch_Parabola.
|
||||
|
||||
returns Parab from gp
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when ArcType does not return
|
||||
-- IntPatch_Parabola.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Hyperbola(me)
|
||||
|
||||
---Purpose: Returns the Hypr from gp corrsponding to the intersection
|
||||
-- when ArcType returns IntPatch_Hyperbola.
|
||||
|
||||
returns Hypr from gp
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when ArcType does not return
|
||||
-- IntPatch_Hyperbola.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasFirstPoint(me)
|
||||
|
||||
---Purpose: Returns True if the line has a known First point.
|
||||
-- This point is given by the method FirstPoint().
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasLastPoint(me)
|
||||
|
||||
---Purpose: Returns True if the line has a known Last point.
|
||||
-- This point is given by the method LastPoint().
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FirstPoint(me)
|
||||
|
||||
---Purpose: Returns the IntPoint corresponding to the FirstPoint.
|
||||
-- An exception is raised when HasFirstPoint returns False.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
LastPoint(me)
|
||||
|
||||
---Purpose: Returns the IntPoint corresponding to the LastPoint.
|
||||
-- An exception is raised when HasLastPoint returns False.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbVertex(me)
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Vertex(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the vertex of range Index on the line.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises OutOfRange from Standard
|
||||
--- The exception OutOfRange is raised if Index <= 0 or
|
||||
-- Index > NbVertex.
|
||||
|
||||
is static;
|
||||
|
||||
ComputeVertexParameters(me: mutable; Tol: Real from Standard)
|
||||
|
||||
---Purpose: Set the parameters of all the vertex on the line.
|
||||
-- if a vertex is already in the line,
|
||||
-- its parameter is modified
|
||||
-- else a new point in the line is inserted.
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
pos : Ax2 from gp;
|
||||
par1 : Real from Standard;
|
||||
par2 : Real from Standard;
|
||||
fipt : Boolean from Standard;
|
||||
lapt : Boolean from Standard;
|
||||
indf : Integer from Standard;
|
||||
indl : Integer from Standard;
|
||||
svtx : SequenceOfPoint from IntPatch;
|
||||
|
||||
end GLine;
|
799
src/IntPatch/IntPatch_GLine.cxx
Executable file
799
src/IntPatch/IntPatch_GLine.cxx
Executable file
@@ -0,0 +1,799 @@
|
||||
// File: IntPatch_GLine.cxx
|
||||
// Created: Mon Apr 6 11:17:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <IntPatch_GLine.ixx>
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
// modified by Edward AGAPOV (eap) Wed Mar 6 2002 (bug occ212)
|
||||
// -- case: points with equal params == PI/2
|
||||
|
||||
//-- Precision::PConfusion()*1000.0 -> 1e-6
|
||||
//#define PrecisionPConfusion ( Precision::PConfusion()*1000.0 )
|
||||
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a Line as intersection line
|
||||
// when the transitions are In or Out.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Lin& L,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_TypeTrans Trans1,
|
||||
const IntSurf_TypeTrans Trans2) :
|
||||
IntPatch_Line(Tang,Trans1,Trans2),
|
||||
par1(0.0), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Lin;
|
||||
pos = gp_Pln(L.Location(),L.Direction()).Position().Ax2();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a Line as intersection line
|
||||
// when the transitions are Touch.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Lin& L,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_Situation Situ1,
|
||||
const IntSurf_Situation Situ2) :
|
||||
IntPatch_Line(Tang,Situ1,Situ2),
|
||||
par1(0.0), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Lin;
|
||||
pos = gp_Pln(L.Location(),L.Direction()).Position().Ax2();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a Line as intersection line
|
||||
// when the transitions are Undecided.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Lin& L,
|
||||
const Standard_Boolean Tang) :
|
||||
IntPatch_Line(Tang),
|
||||
par1(0.0), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Lin;
|
||||
pos = gp_Pln(L.Location(),L.Direction()).Position().Ax2();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a circle as intersection line
|
||||
// when the transitions are In or Out.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Circ& C,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_TypeTrans Trans1,
|
||||
const IntSurf_TypeTrans Trans2) :
|
||||
IntPatch_Line(Tang,Trans1,Trans2),
|
||||
pos(C.Position()),
|
||||
par1(C.Radius()), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Circle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a circle as intersection line
|
||||
// when the transitions are Touch.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Circ& C,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_Situation Situ1,
|
||||
const IntSurf_Situation Situ2) :
|
||||
IntPatch_Line(Tang,Situ1,Situ2),
|
||||
pos(C.Position()),
|
||||
par1(C.Radius()), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Circle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a circle as intersection line
|
||||
// when the transitions are Undecided.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Circ& C,
|
||||
const Standard_Boolean Tang) :
|
||||
IntPatch_Line(Tang),
|
||||
pos(C.Position()),
|
||||
par1(C.Radius()), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Circle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates an ellipse as intersection line
|
||||
// when the transitions are In or Out.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Elips& E,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_TypeTrans Trans1,
|
||||
const IntSurf_TypeTrans Trans2) :
|
||||
IntPatch_Line(Tang,Trans1,Trans2),
|
||||
pos(E.Position()),
|
||||
par1(E.MajorRadius()),
|
||||
par2(E.MinorRadius()),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Ellipse;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates an ellispe as intersection line
|
||||
// when the transitions are Touch.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Elips& E,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_Situation Situ1,
|
||||
const IntSurf_Situation Situ2) :
|
||||
IntPatch_Line(Tang,Situ1,Situ2),
|
||||
pos(E.Position()),
|
||||
par1(E.MajorRadius()),
|
||||
par2(E.MinorRadius()),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Ellipse;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates an ellipse as intersection line
|
||||
// when the transitions are Undecided.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Elips& E,
|
||||
const Standard_Boolean Tang) :
|
||||
IntPatch_Line(Tang),
|
||||
pos(E.Position()),
|
||||
par1(E.MajorRadius()),
|
||||
par2(E.MinorRadius()),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Ellipse;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a parabola as intersection line
|
||||
// when the transitions are In or Out.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Parab& P,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_TypeTrans Trans1,
|
||||
const IntSurf_TypeTrans Trans2) :
|
||||
IntPatch_Line(Tang,Trans1,Trans2),
|
||||
pos(P.Position()),
|
||||
par1(P.Focal()), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Parabola;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a parabola as intersection line
|
||||
// when the transitions are Touch.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Parab& P,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_Situation Situ1,
|
||||
const IntSurf_Situation Situ2) :
|
||||
IntPatch_Line(Tang,Situ1,Situ2),
|
||||
pos(P.Position()),
|
||||
par1(P.Focal()), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Parabola;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates a parabola as intersection line
|
||||
// when the transitions are Undecided.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Parab& P,
|
||||
const Standard_Boolean Tang) :
|
||||
IntPatch_Line(Tang),
|
||||
pos(P.Position()),
|
||||
par1(P.Focal()), par2(0.0),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Parabola;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates an hyperbola as intersection line
|
||||
// when the transitions are In or Out.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Hypr& H,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_TypeTrans Trans1,
|
||||
const IntSurf_TypeTrans Trans2) :
|
||||
IntPatch_Line(Tang,Trans1,Trans2),
|
||||
pos(H.Position()),
|
||||
par1(H.MajorRadius()),
|
||||
par2(H.MinorRadius()),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Hyperbola;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates an hyperbola as intersection line
|
||||
// when the transitions are Touch.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Hypr& H,
|
||||
const Standard_Boolean Tang,
|
||||
const IntSurf_Situation Situ1,
|
||||
const IntSurf_Situation Situ2) :
|
||||
IntPatch_Line(Tang,Situ1,Situ2),
|
||||
pos(H.Position()),
|
||||
par1(H.MajorRadius()),
|
||||
par2(H.MinorRadius()),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Hyperbola;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_GLine
|
||||
//purpose : Creates an hyperbola as intersection line
|
||||
// when the transitions are Undecided.
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_GLine::IntPatch_GLine (const gp_Hypr& H,
|
||||
const Standard_Boolean Tang) :
|
||||
IntPatch_Line(Tang),
|
||||
pos(H.Position()),
|
||||
par1(H.MajorRadius()),
|
||||
par2(H.MinorRadius()),
|
||||
fipt(Standard_False),lapt(Standard_False),
|
||||
indf(0), indl(0)
|
||||
{
|
||||
typ = IntPatch_Hyperbola;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Replace
|
||||
//purpose : To replace the element of range Index in the list
|
||||
// of points.
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_GLine::Replace (const Standard_Integer /*Index*/,
|
||||
const IntPatch_Point& Pnt)
|
||||
{
|
||||
svtx.Append(Pnt);
|
||||
//-- svtx(Index) = Pnt;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddVertex
|
||||
//purpose : To add a vertex in the list.
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_GLine::AddVertex (const IntPatch_Point& Pnt)
|
||||
{
|
||||
//-- On detecte le cas de 2 points 3d identiques
|
||||
//-- pour les ramener au meme parametre sur la
|
||||
//-- GLine
|
||||
if (NbVertex())
|
||||
{
|
||||
const Standard_Real pf = (fipt? svtx.Value(indf).ParameterOnLine() : 0.0);
|
||||
const Standard_Real pl = (lapt? svtx.Value(indl).ParameterOnLine() : 0.0);
|
||||
Standard_Real par = Pnt.ParameterOnLine();
|
||||
if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse)
|
||||
{
|
||||
if(fipt && lapt) {
|
||||
while(par<pf) par+=PI+PI;
|
||||
while(par>pl) par-=PI+PI;
|
||||
if(par<pf) {
|
||||
const Standard_Real PrecisionPConfusion ( Precision::PConfusion()*1000.0 );
|
||||
if((pf-par)>PrecisionPConfusion) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
IntPatch_Point ParModif = Pnt;
|
||||
ParModif.SetParameter(par);
|
||||
svtx.Append(ParModif);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fipt && lapt) {
|
||||
if(pl<par || par<pf)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
svtx.Append(Pnt);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeVertexParameters
|
||||
//purpose : Set the parameters of all the vertex on the line.
|
||||
// if a vertex is already in the line,
|
||||
// its parameter is modified
|
||||
// else a new point in the line is inserted.
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_GLine::ComputeVertexParameters(const Standard_Real /*Tol*/)
|
||||
{
|
||||
Standard_Boolean SortIsOK,APointDeleted;
|
||||
Standard_Boolean SortAgain = Standard_True;
|
||||
Standard_Integer i,j;
|
||||
const Standard_Real ParamMinOnLine = (fipt? Vertex(indf).ParameterOnLine() : -100000.0);
|
||||
const Standard_Real ParamMaxOnLine = (lapt? Vertex(indl).ParameterOnLine() : 100000.0);
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-- F i l t r e s u r r e s t r i c t i o n s --
|
||||
//----------------------------------------------------------
|
||||
//-- deux vertex sur la meme restriction et seulement
|
||||
//-- sur celle ci ne doivent pas avoir le meme parametre
|
||||
//==========================================================
|
||||
//-- 2 vertices on the same restriction and only
|
||||
//-- on that one must not have the same parametres
|
||||
|
||||
Standard_Integer nbvtx = NbVertex();
|
||||
|
||||
const Standard_Real PrecisionPConfusion ( Precision::PConfusion()*1000.0 );
|
||||
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
for(i=1; (i<=nbvtx) && (!APointDeleted); i++)
|
||||
{
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if(VTXi.IsOnDomS1() || VTXi.IsOnDomS2())
|
||||
{
|
||||
for(j=1; (j<=nbvtx) && (!APointDeleted); j++)
|
||||
{
|
||||
if(i!=j)
|
||||
{
|
||||
const IntPatch_Point& VTXj = svtx.Value(j);
|
||||
if((!VTXj.IsOnDomS1()) && (!VTXj.IsOnDomS2()))
|
||||
{
|
||||
if(Abs(VTXi.ParameterOnLine()-VTXj.ParameterOnLine())<=PrecisionPConfusion)
|
||||
{
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>j) indl--; }
|
||||
if(fipt) { if(indf>j) indf--; }
|
||||
APointDeleted = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(APointDeleted && nbvtx > 2);
|
||||
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
for(i=1; (i<=nbvtx) && (!APointDeleted); i++)
|
||||
{
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if(VTXi.IsOnDomS1() && (!VTXi.IsOnDomS2()))
|
||||
{
|
||||
for(j=1; (j<=nbvtx) && (!APointDeleted); j++)
|
||||
{
|
||||
if(i!=j)
|
||||
{
|
||||
const IntPatch_Point& VTXj = svtx.Value(j);
|
||||
if(VTXj.IsOnDomS1() && (!VTXj.IsOnDomS2()))
|
||||
{
|
||||
if(Abs(VTXi.ParameterOnArc1()-VTXj.ParameterOnArc1())<=PrecisionPConfusion)
|
||||
{
|
||||
if(VTXi.ArcOnS1() == VTXj.ArcOnS1())
|
||||
{
|
||||
if(VTXi.IsVertexOnS1())
|
||||
{
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>j) indl--; }
|
||||
if(fipt) { if(indf>j) indf--; }
|
||||
}
|
||||
else
|
||||
{
|
||||
svtx.Remove(i);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>i) indl--; }
|
||||
if(fipt) { if(indf>i) indf--; }
|
||||
}
|
||||
APointDeleted = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(APointDeleted);
|
||||
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
for(i=1; (i<=nbvtx) && (!APointDeleted); i++)
|
||||
{
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if(VTXi.IsOnDomS2() && (!VTXi.IsOnDomS1()))
|
||||
{
|
||||
for(j=1; (j<=nbvtx) && (!APointDeleted); j++)
|
||||
{
|
||||
if(i!=j)
|
||||
{
|
||||
const IntPatch_Point& VTXj = svtx.Value(j);
|
||||
if(VTXj.IsOnDomS2() && (!VTXj.IsOnDomS1()))
|
||||
{
|
||||
if(Abs(VTXi.ParameterOnArc2()-VTXj.ParameterOnArc2())<=PrecisionPConfusion)
|
||||
{
|
||||
if(VTXi.ArcOnS2() == VTXj.ArcOnS2())
|
||||
{
|
||||
if(VTXi.IsVertexOnS1())
|
||||
{
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>j) indl--; }
|
||||
if(fipt) { if(indf>j) indf--; }
|
||||
}
|
||||
else
|
||||
{
|
||||
svtx.Remove(i);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>i) indl--; }
|
||||
if(fipt) { if(indf>i) indf--; }
|
||||
}
|
||||
APointDeleted = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(APointDeleted);
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//-- Tri des vertex et suppression des Vtx superflus
|
||||
//--
|
||||
//// modified by jgv, 2.11.01 for BUC61033 ////
|
||||
Standard_Real u1min = RealLast(), u1max = RealFirst();
|
||||
Standard_Real u2min = RealLast(), u2max = RealFirst();
|
||||
Standard_Boolean ToBreak = Standard_False;
|
||||
///////////////////////////////////////////////
|
||||
do {
|
||||
nbvtx = NbVertex();
|
||||
if(SortAgain)
|
||||
{
|
||||
do
|
||||
{
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx; i++)
|
||||
{
|
||||
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine())
|
||||
{
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Exchange(i-1,i);
|
||||
if(fipt) { if(indf==i) indf=i-1; else if(indf==i-1) indf=i; }
|
||||
if(lapt) { if(indl==i) indl=i-1; else if(indl==i-1) indl=i; }
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
}
|
||||
|
||||
//// modified by jgv, 2.11.01 for BUC61033 ////
|
||||
if (ToBreak)
|
||||
break;
|
||||
///////////////////////////////////////////////
|
||||
|
||||
SortAgain = Standard_False;
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx && SortIsOK; i++) {
|
||||
IntPatch_Point& VTX = svtx.ChangeValue(i);
|
||||
for(j=1; j<=nbvtx && SortIsOK; j++) {
|
||||
if(i!=j) {
|
||||
IntPatch_Point& VTXM1 = svtx.ChangeValue(j);
|
||||
Standard_Boolean kill = Standard_False;
|
||||
Standard_Boolean killm1 = Standard_False;
|
||||
if(Abs(VTXM1.ParameterOnLine()-VTX.ParameterOnLine())<PrecisionPConfusion) {
|
||||
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()) { //-- OnS1 OnS1
|
||||
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS1 == OnS1
|
||||
if(VTXM1.IsOnDomS2()) { //-- OnS1 == OnS1 OnS2
|
||||
if(VTX.IsOnDomS2()==Standard_False) { //-- OnS1 == OnS1 OnS2 PasOnS2
|
||||
kill=Standard_True;
|
||||
}
|
||||
else {
|
||||
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS1 == OnS1 OnS2 == OnS2
|
||||
if(VTXM1.IsVertexOnS2()) {
|
||||
kill=Standard_True;
|
||||
}
|
||||
else {
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- OnS1 == OnS1 PasOnS2
|
||||
if(VTX.IsOnDomS2()) { //-- OnS1 == OnS1 PasOnS2 OnS2
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- Pas OnS1 et OnS1
|
||||
if(VTXM1.IsOnDomS2()==Standard_False && VTX.IsOnDomS2()==Standard_False) {
|
||||
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()==Standard_False) {
|
||||
kill=Standard_True;
|
||||
}
|
||||
else if(VTX.IsOnDomS1() && VTXM1.IsOnDomS1()==Standard_False) {
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!(kill || killm1)) {
|
||||
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()) { //-- OnS2 OnS2
|
||||
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS2 == OnS2
|
||||
if(VTXM1.IsOnDomS1()) { //-- OnS2 == OnS2 OnS1
|
||||
if(VTX.IsOnDomS1()==Standard_False) { //-- OnS2 == OnS2 OnS1 PasOnS1
|
||||
kill=Standard_True;
|
||||
}
|
||||
else {
|
||||
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS2 == OnS2 OnS1 == OnS1
|
||||
if(VTXM1.IsVertexOnS1()) {
|
||||
kill=Standard_True; //-- OnS2 == OnS2 OnS1 == OnS1 Vtx PasVtx
|
||||
}
|
||||
else {
|
||||
killm1=Standard_True; //-- OnS2 == OnS2 OnS1 == OnS1 PasVtx Vtx
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- OnS2 == OnS2 PasOnS1
|
||||
if(VTX.IsOnDomS1()) { //-- OnS2 == OnS2 PasOnS1 OnS1
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- Pas OnS2 et OnS2
|
||||
if(VTXM1.IsOnDomS1()==Standard_False && VTX.IsOnDomS1()==Standard_False) {
|
||||
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()==Standard_False) {
|
||||
kill=Standard_True;
|
||||
}
|
||||
else if(VTX.IsOnDomS2() && VTXM1.IsOnDomS2()==Standard_False) {
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-- On a j < i
|
||||
if(kill) {
|
||||
SortIsOK = Standard_False;
|
||||
if(lapt) { if(indl>i) indl--; else if(indl==i) indl=j; }
|
||||
if(fipt) { if(indf>i) indf--; else if(indf==i) indf=j; }
|
||||
svtx.Remove(i);
|
||||
nbvtx--;
|
||||
}
|
||||
else if(killm1) {
|
||||
SortIsOK = Standard_False;
|
||||
if(lapt) { if(indl>j) indl--; else if(indl==j) indl=i-1;}
|
||||
if(fipt) { if(indf>j) indf--; else if(indf==j) indf=i-1;}
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
}
|
||||
// else
|
||||
else if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse) { // eap
|
||||
//-- deux points de meme parametre qui ne peuvent etre confondus
|
||||
//-- On change les parametres d un des points si les points UV sont
|
||||
//-- differents. Ceci distingue le cas des aretes de couture.
|
||||
// ==========================================================
|
||||
//-- 2 points with the same parameters
|
||||
//-- Change parametres of one point if points UV are
|
||||
//-- different. This is the case of seam edge
|
||||
Standard_Real ponline = VTX.ParameterOnLine();
|
||||
// eap, =>>
|
||||
Standard_Real newParam = ponline;
|
||||
const Standard_Real PiPi = PI+PI;
|
||||
Standard_Boolean is2PI = ( Abs(ponline-PiPi) <= PrecisionPConfusion );
|
||||
|
||||
if (nbvtx > 2 && // do this check if seam edge only gives vertices
|
||||
!is2PI) // but always change 2PI -> 0
|
||||
continue;
|
||||
|
||||
if (is2PI)
|
||||
newParam = 0;
|
||||
else if (Abs(ponline) <= PrecisionPConfusion)
|
||||
newParam = PiPi;
|
||||
else
|
||||
newParam -= PiPi;
|
||||
// if( (Abs(ponline)<=PrecisionPConfusion)
|
||||
// ||(Abs(ponline-PI-PI) <=PrecisionPConfusion))
|
||||
// eap, <<=
|
||||
Standard_Real u1a,v1a,u2a,v2a,u1b,v1b,u2b,v2b;
|
||||
VTXM1.Parameters(u1a,v1a,u2a,v2a);
|
||||
VTX.Parameters(u1b,v1b,u2b,v2b);
|
||||
Standard_Integer flag = 0;
|
||||
|
||||
if( (Abs(u1a-u1b)<=PrecisionPConfusion) ) flag|=1;
|
||||
if( (Abs(v1a-v1b)<=PrecisionPConfusion) ) flag|=2;
|
||||
if( (Abs(u2a-u2b)<=PrecisionPConfusion) ) flag|=4;
|
||||
if( (Abs(v2a-v2b)<=PrecisionPConfusion) ) flag|=8;
|
||||
Standard_Boolean TestOn1 = Standard_False;
|
||||
Standard_Boolean TestOn2 = Standard_False;
|
||||
switch(flag) {
|
||||
case 3: //-- meme point U1 V1
|
||||
case 7: //-- meme point U1 V1 meme U2
|
||||
case 12: //-- meme U2 V2
|
||||
case 13: //-- meme point U1 meme U2 V2
|
||||
case 10: //-- meme point V1 meme V2 Test si U1a=U1b Mod 2PI et Test si U2a=U2b Mod 2PI
|
||||
break;
|
||||
case 11: //-- meme point U1 V1 meme V2 Test si U2a=U2b Mod 2PI
|
||||
{ TestOn2 = Standard_True; break; }
|
||||
case 14: //-- meme point V1 meme U2 V2 Test si U1a=U1b Mod 2PI
|
||||
{ TestOn1 = Standard_True; break; }
|
||||
default: break;
|
||||
};
|
||||
// eap
|
||||
//if(ArcType()==IntPatch_Circle || ArcType()==IntPatch_Ellipse) {}
|
||||
if(TestOn1) {
|
||||
//// modified by jgv, 2.11.01 for BUC61033 ////
|
||||
Standard_Real U1A = (u1a < u1b)? u1a : u1b;
|
||||
Standard_Real U1B = (u1a < u1b)? u1b : u1a;
|
||||
if (u1min == RealLast())
|
||||
{
|
||||
u1min = U1A;
|
||||
u1max = U1B;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Abs(U1A-u1min) > PrecisionPConfusion)
|
||||
ToBreak = Standard_True;
|
||||
if (Abs(U1B-u1max) > PrecisionPConfusion)
|
||||
ToBreak = Standard_True;
|
||||
}
|
||||
///////////////////////////////////////////////
|
||||
// eap, =>>
|
||||
// if (Abs(ponline) <= PrecisionPConfusion) {
|
||||
// const Standard_Real PiPi = PI+PI;
|
||||
if(newParam >= ParamMinOnLine && newParam <= ParamMaxOnLine
|
||||
/*PiPi >= ParamMinOnLine && PiPi<=ParamMaxOnLine*/) {
|
||||
SortAgain = Standard_True;
|
||||
SortIsOK = Standard_False;
|
||||
if (newParam > ponline)
|
||||
if(u1a < u1b) { VTX.SetParameter(newParam); }
|
||||
else { VTXM1.SetParameter(newParam); }
|
||||
else
|
||||
if(u1a > u1b) { VTX.SetParameter(newParam); }
|
||||
else { VTXM1.SetParameter(newParam); }
|
||||
}
|
||||
// }
|
||||
// else {
|
||||
// if(0.0 >= ParamMinOnLine && 0.0<=ParamMaxOnLine) {
|
||||
// SortAgain = Standard_True;
|
||||
// SortIsOK = Standard_False;
|
||||
// if(u1a > u1b) { VTX.SetParameter(0.0); }
|
||||
// else { VTXM1.SetParameter(0.0); }
|
||||
// }
|
||||
// }
|
||||
// eap, <<=
|
||||
}
|
||||
if(TestOn2) {
|
||||
//// modified by jgv, 2.11.01 for BUC61033 ////
|
||||
Standard_Real U2A = (u2a < u2b)? u2a : u2b;
|
||||
Standard_Real U2B = (u2a < u2b)? u2b : u2a;
|
||||
if (u2min == RealLast())
|
||||
{
|
||||
u2min = U2A;
|
||||
u2max = U2B;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Abs(U2A-u2min) > PrecisionPConfusion)
|
||||
ToBreak = Standard_True;
|
||||
if (Abs(U2B-u2max) > PrecisionPConfusion)
|
||||
ToBreak = Standard_True;
|
||||
}
|
||||
///////////////////////////////////////////////
|
||||
// eap, =>>
|
||||
// if (Abs(ponline) <= PrecisionPConfusion) {
|
||||
// const Standard_Real PiPi = PI+PI;
|
||||
if(newParam >= ParamMinOnLine && newParam <= ParamMaxOnLine
|
||||
/*PiPi >= ParamMinOnLine && PiPi<=ParamMaxOnLine*/) {
|
||||
SortAgain = Standard_True;
|
||||
SortIsOK = Standard_False;
|
||||
if (newParam > ponline)
|
||||
if(u2a < u2b) { VTX.SetParameter(newParam); }
|
||||
else { VTXM1.SetParameter(newParam); }
|
||||
else
|
||||
if(u2a > u2b) { VTX.SetParameter(newParam); }
|
||||
else { VTXM1.SetParameter(newParam); }
|
||||
}
|
||||
// }
|
||||
// else {
|
||||
// if(0.0 >= ParamMinOnLine && 0.0<=ParamMaxOnLine) {
|
||||
// SortAgain = Standard_True;
|
||||
// SortIsOK = Standard_False;
|
||||
// if(u2a > u2b) { VTX.SetParameter(0.0); }
|
||||
// else { VTXM1.SetParameter(0.0); }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// eap, <<=
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} //-- if(i!=j)
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
|
||||
//-- Recalcul de fipt et lapt
|
||||
//--
|
||||
nbvtx=NbVertex();
|
||||
if(nbvtx)
|
||||
{
|
||||
do {
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx; i++)
|
||||
{
|
||||
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine())
|
||||
{
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Exchange(i-1,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
indl=nbvtx;
|
||||
indf=1;
|
||||
}
|
||||
}
|
101
src/IntPatch/IntPatch_GLine.lxx
Executable file
101
src/IntPatch/IntPatch_GLine.lxx
Executable file
@@ -0,0 +1,101 @@
|
||||
// File: IntPatch_GLine.lxx
|
||||
// Created: Mon Apr 6 11:17:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
|
||||
inline void IntPatch_GLine::SetFirstPoint (const Standard_Integer IndFirst)
|
||||
{
|
||||
fipt = Standard_True;
|
||||
indf = IndFirst;
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_GLine::SetLastPoint (const Standard_Integer IndLast)
|
||||
{
|
||||
lapt = Standard_True;
|
||||
indl = IndLast;
|
||||
}
|
||||
|
||||
|
||||
inline gp_Lin IntPatch_GLine::Line () const
|
||||
{
|
||||
if (typ != IntPatch_Lin) {Standard_DomainError::Raise();}
|
||||
return gp_Lin(pos.Axis());
|
||||
}
|
||||
|
||||
|
||||
inline gp_Circ IntPatch_GLine::Circle () const
|
||||
{
|
||||
if (typ != IntPatch_Circle) {Standard_DomainError::Raise();}
|
||||
return gp_Circ(pos,par1);
|
||||
}
|
||||
|
||||
|
||||
inline gp_Elips IntPatch_GLine::Ellipse () const
|
||||
{
|
||||
if (typ != IntPatch_Ellipse) {Standard_DomainError::Raise();}
|
||||
return gp_Elips(pos,par1,par2);
|
||||
}
|
||||
|
||||
|
||||
inline gp_Parab IntPatch_GLine::Parabola () const
|
||||
{
|
||||
if (typ != IntPatch_Parabola) {Standard_DomainError::Raise();}
|
||||
return gp_Parab(pos,par1);
|
||||
}
|
||||
|
||||
|
||||
inline gp_Hypr IntPatch_GLine::Hyperbola () const
|
||||
{
|
||||
if (typ != IntPatch_Hyperbola) {Standard_DomainError::Raise();}
|
||||
return gp_Hypr(pos,par1,par2);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_GLine::HasFirstPoint () const
|
||||
{
|
||||
return fipt;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_GLine::HasLastPoint () const
|
||||
{
|
||||
return lapt;
|
||||
}
|
||||
|
||||
|
||||
inline const IntPatch_Point& IntPatch_GLine::FirstPoint () const
|
||||
{
|
||||
if (!fipt) {Standard_DomainError::Raise();}
|
||||
return svtx(indf);
|
||||
}
|
||||
|
||||
|
||||
inline const IntPatch_Point& IntPatch_GLine::LastPoint () const
|
||||
{
|
||||
if (!lapt) {Standard_DomainError::Raise();}
|
||||
return svtx(indl);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntPatch_GLine::NbVertex () const
|
||||
{
|
||||
return svtx.Length();
|
||||
}
|
||||
|
||||
|
||||
inline const IntPatch_Point& IntPatch_GLine::Vertex (const Standard_Integer Index) const
|
||||
{
|
||||
return svtx(Index);
|
||||
}
|
224
src/IntPatch/IntPatch_HCurve2dTool.cdl
Executable file
224
src/IntPatch/IntPatch_HCurve2dTool.cdl
Executable file
@@ -0,0 +1,224 @@
|
||||
-- File: IntPatch_HCurve2dTool.cdl
|
||||
-- Created: Mon Jul 17 16:25:23 1995
|
||||
-- Author: Laurent BUCHARD
|
||||
---Copyright: OPEN CASCADE 1995
|
||||
|
||||
|
||||
class HCurve2dTool from IntPatch
|
||||
|
||||
uses
|
||||
HCurve2d from Adaptor2d,
|
||||
Array1OfReal from TColStd,
|
||||
Shape from GeomAbs,
|
||||
CurveType from GeomAbs,
|
||||
Vec2d from gp,
|
||||
Pnt2d from gp,
|
||||
Circ2d from gp,
|
||||
Elips2d from gp,
|
||||
Hypr2d from gp,
|
||||
Parab2d from gp,
|
||||
Lin2d from gp,
|
||||
BezierCurve from Geom2d,
|
||||
BSplineCurve from Geom2d
|
||||
|
||||
raises
|
||||
|
||||
OutOfRange from Standard,
|
||||
NoSuchObject from Standard,
|
||||
DomainError from Standard
|
||||
|
||||
is
|
||||
|
||||
--
|
||||
-- Global methods - Apply to the whole curve.
|
||||
--
|
||||
|
||||
FirstParameter(myclass; C: HCurve2d from Adaptor2d) returns Real
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
|
||||
LastParameter(myclass; C: HCurve2d from Adaptor2d) returns Real
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
--
|
||||
-- Services to break the curves to the expected continuity
|
||||
--
|
||||
-- If for example you need the curve to be C2 and the method
|
||||
-- Continuity returns you something lower than C2 (say C1 for
|
||||
-- example).
|
||||
--
|
||||
-- First compute the number of intervals with the requested
|
||||
-- continuity with the method NbIntervals(). Note that if the
|
||||
-- continuity is higher than the one you need NbIntervals will
|
||||
-- return 1.
|
||||
--
|
||||
-- Then you get the parameters bounding the intervals with the
|
||||
-- method Intervals, using an array of length at least
|
||||
-- NbIntervals()+1.
|
||||
--
|
||||
-- If you need to create a curve with a restricted span you can
|
||||
-- use the method Trim().
|
||||
|
||||
|
||||
Continuity(myclass; C: HCurve2d from Adaptor2d) returns Shape from GeomAbs
|
||||
---Purpose:
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
NbIntervals(myclass; C: HCurve2d from Adaptor2d; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: Returns the number of intervals for continuity
|
||||
-- <S>. May be one if Continuity(myclass) >= <S>
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Intervals(myclass; C: HCurve2d from Adaptor2d; T : in out Array1OfReal from TColStd;
|
||||
S : Shape from GeomAbs)
|
||||
---Purpose: Stores in <T> the parameters bounding the intervals
|
||||
-- of continuity <S>.
|
||||
--
|
||||
-- The array must provide enough room to accomodate
|
||||
-- for the parameters. i.e. T.Length() > NbIntervals()
|
||||
raises
|
||||
OutOfRange from Standard
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
IsClosed(myclass; C: HCurve2d from Adaptor2d) returns Boolean
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
IsPeriodic(myclass; C: HCurve2d from Adaptor2d) returns Boolean
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Period(myclass; C: HCurve2d from Adaptor2d) returns Real
|
||||
raises
|
||||
DomainError from Standard -- if the curve is not periodic
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Value(myclass; C: HCurve2d from Adaptor2d; U : Real) returns Pnt2d from gp
|
||||
--- Purpose : Computes the point of parameter U on the curve.
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
D0 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp)
|
||||
--- Purpose : Computes the point of parameter U on the curve.
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
D1 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp ; V : out Vec2d from gp)
|
||||
--- Purpose : Computes the point of parameter U on the curve with its
|
||||
-- first derivative.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C1.
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
D2 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp; V1, V2 : out Vec2d from gp)
|
||||
--- Purpose :
|
||||
-- Returns the point P of parameter U, the first and second
|
||||
-- derivatives V1 and V2.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C2.
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
D3 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp; V1, V2, V3 : out Vec2d from gp)
|
||||
--- Purpose :
|
||||
-- Returns the point P of parameter U, the first, the second
|
||||
-- and the third derivative.
|
||||
raises
|
||||
DomainError from Standard
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not C3.
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
DN (myclass; C: HCurve2d from Adaptor2d; U : Real; N : Integer) returns Vec2d from gp
|
||||
--- Purpose :
|
||||
-- The returned vector gives the value of the derivative for the
|
||||
-- order of derivation N.
|
||||
raises
|
||||
DomainError from Standard,
|
||||
--- Purpose : Raised if the continuity of the current interval
|
||||
-- is not CN.
|
||||
OutOfRange from Standard
|
||||
--- Purpose : Raised if N < 1.
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Resolution(myclass; C: HCurve2d from Adaptor2d; R3d : Real) returns Real
|
||||
---Purpose : Returns the parametric resolution corresponding
|
||||
-- to the real space resolution <R3d>.
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
GetType(myclass; C: HCurve2d from Adaptor2d) returns CurveType from GeomAbs
|
||||
---Purpose: Returns the type of the curve in the current
|
||||
-- interval : Line, Circle, Ellipse, Hyperbola,
|
||||
-- Parabola, BezierCurve, BSplineCurve, OtherCurve.
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
--
|
||||
-- The following methods must be called when GetType returned
|
||||
-- the corresponding type.
|
||||
--
|
||||
|
||||
Line(myclass; C: HCurve2d from Adaptor2d) returns Lin2d from gp
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Circle(myclass; C: HCurve2d from Adaptor2d) returns Circ2d from gp
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Ellipse(myclass; C: HCurve2d from Adaptor2d) returns Elips2d from gp
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Hyperbola(myclass; C: HCurve2d from Adaptor2d) returns Hypr2d from gp
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Parabola(myclass; C: HCurve2d from Adaptor2d) returns Parab2d from gp
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
Bezier(myclass; C: HCurve2d from Adaptor2d) returns BezierCurve from Geom2d
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
BSpline(myclass; C: HCurve2d from Adaptor2d) returns BSplineCurve from Geom2d
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
---C++: inline
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NbSamples(myclass; C: HCurve2d from Adaptor2d; U0,U1: Real from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
end HCurve2dTool;
|
46
src/IntPatch/IntPatch_HCurve2dTool.cxx
Executable file
46
src/IntPatch/IntPatch_HCurve2dTool.cxx
Executable file
@@ -0,0 +1,46 @@
|
||||
// File : IntPatch_HCurve2dTool.cxx
|
||||
// Created : Mon Jul 17 17:39:39 1995
|
||||
// Author : Modelistation
|
||||
// Copyright : OPEN CASCADE 1995
|
||||
|
||||
#include <IntPatch_HCurve2dTool.ixx>
|
||||
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Handle_Geom2d_BezierCurve.hxx>
|
||||
#include <Handle_Geom2d_BSplineCurve.hxx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
|
||||
//============================================================
|
||||
Standard_Integer IntPatch_HCurve2dTool::NbSamples (const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1)
|
||||
{
|
||||
Standard_Real nbs;
|
||||
switch (C->GetType())
|
||||
{
|
||||
case GeomAbs_Line: return 2;
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
nbs = (3 + C->NbPoles());
|
||||
}
|
||||
break;
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
nbs = C->NbKnots();
|
||||
nbs *= C->Degree();
|
||||
//szv:nbs *= C->LastParameter() - C->FirstParameter();
|
||||
//szv:nbs /= U1-U0;
|
||||
nbs *= U1-U0;
|
||||
nbs /= C->LastParameter() - C->FirstParameter();
|
||||
if (nbs < 2.0) nbs = 2.0;
|
||||
}
|
||||
break;
|
||||
default: return 25;
|
||||
}
|
||||
if (nbs>50.0)
|
||||
return 50;
|
||||
return((Standard_Integer)nbs);
|
||||
}
|
136
src/IntPatch/IntPatch_HCurve2dTool.lxx
Executable file
136
src/IntPatch/IntPatch_HCurve2dTool.lxx
Executable file
@@ -0,0 +1,136 @@
|
||||
// File: IntPatch_HCurve2dTool.lxx
|
||||
// Created: Thu Oct 22 12:14:59 1992
|
||||
// Author: Laurent BUCHARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Hypr2d.hxx>
|
||||
|
||||
#include <Handle_Geom2d_BezierCurve.hxx>
|
||||
#include <Handle_Geom2d_BSplineCurve.hxx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
#include <Adaptor2d_HCurve2d.hxx>
|
||||
|
||||
|
||||
//============================================================
|
||||
inline Standard_Real IntPatch_HCurve2dTool::FirstParameter (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->FirstParameter());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Real IntPatch_HCurve2dTool::LastParameter (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->LastParameter());
|
||||
}
|
||||
//============================================================
|
||||
inline GeomAbs_Shape IntPatch_HCurve2dTool::Continuity (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Continuity());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Integer IntPatch_HCurve2dTool::NbIntervals(const Handle(Adaptor2d_HCurve2d)& C,const GeomAbs_Shape Sh) {
|
||||
return(C->NbIntervals(Sh));
|
||||
}
|
||||
//============================================================
|
||||
inline void IntPatch_HCurve2dTool::Intervals(const Handle(Adaptor2d_HCurve2d)& C,
|
||||
TColStd_Array1OfReal& Tab,
|
||||
const GeomAbs_Shape Sh) {
|
||||
C->Intervals(Tab,Sh);
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Boolean IntPatch_HCurve2dTool::IsClosed(const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->IsClosed());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Boolean IntPatch_HCurve2dTool::IsPeriodic(const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->IsPeriodic());
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Real IntPatch_HCurve2dTool::Period(const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Period());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Pnt2d IntPatch_HCurve2dTool::Value (const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const Standard_Real U) {
|
||||
return(C->Value(U));
|
||||
}
|
||||
//============================================================
|
||||
inline void IntPatch_HCurve2dTool::D0(const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt2d& P) {
|
||||
C->D0(U,P);
|
||||
}
|
||||
//============================================================
|
||||
inline void IntPatch_HCurve2dTool::D1 (const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& T) {
|
||||
C->D1(U,P,T);
|
||||
}
|
||||
//============================================================
|
||||
inline void IntPatch_HCurve2dTool::D2 (const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& T,
|
||||
gp_Vec2d& N) {
|
||||
C->D2(U,P,T,N);
|
||||
}
|
||||
//============================================================
|
||||
inline void IntPatch_HCurve2dTool::D3 (const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& V1,
|
||||
gp_Vec2d& V2,
|
||||
gp_Vec2d& V3) {
|
||||
C->D3(U,P,V1,V2,V3);
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Vec2d IntPatch_HCurve2dTool::DN (const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const Standard_Real U,
|
||||
const Standard_Integer N) {
|
||||
return(C->DN(U,N));
|
||||
}
|
||||
//============================================================
|
||||
inline Standard_Real IntPatch_HCurve2dTool::Resolution(const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const Standard_Real R3d) {
|
||||
return(C->Resolution(R3d));
|
||||
}
|
||||
//============================================================
|
||||
inline GeomAbs_CurveType IntPatch_HCurve2dTool::GetType(const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->GetType());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Lin2d IntPatch_HCurve2dTool::Line (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Line());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Circ2d IntPatch_HCurve2dTool::Circle (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Circle());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Elips2d IntPatch_HCurve2dTool::Ellipse (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Ellipse());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Parab2d IntPatch_HCurve2dTool::Parabola (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Parabola());
|
||||
}
|
||||
//============================================================
|
||||
inline gp_Hypr2d IntPatch_HCurve2dTool::Hyperbola (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Hyperbola());
|
||||
}
|
||||
//============================================================
|
||||
inline Handle(Geom2d_BezierCurve) IntPatch_HCurve2dTool::Bezier (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->Bezier());
|
||||
}
|
||||
//============================================================
|
||||
inline Handle(Geom2d_BSplineCurve) IntPatch_HCurve2dTool::BSpline (const Handle(Adaptor2d_HCurve2d)& C) {
|
||||
return(C->BSpline());
|
||||
}
|
||||
//============================================================
|
208
src/IntPatch/IntPatch_HInterTool.cdl
Executable file
208
src/IntPatch/IntPatch_HInterTool.cdl
Executable file
@@ -0,0 +1,208 @@
|
||||
-- File: IntPatch_HInterTool.cdl
|
||||
-- Created: Fri Jul 2 13:19:22 1995
|
||||
-- Author: Laurent BUCHARD
|
||||
---Copyright: OPEN CASCADE 1995
|
||||
|
||||
|
||||
class HInterTool from IntPatch
|
||||
|
||||
---Purpose: Tool for the intersection between 2 surfaces.
|
||||
-- Regroupe pour l instant les methodes hors Adaptor3d...
|
||||
|
||||
uses
|
||||
HVertex from Adaptor3d,
|
||||
HCurve2d from Adaptor2d,
|
||||
HSurface from Adaptor3d,
|
||||
Pnt2d from gp,
|
||||
Pnt from gp
|
||||
|
||||
is
|
||||
|
||||
|
||||
-- Pour polyedres
|
||||
|
||||
SingularOnUMin(myclass; S:HSurface from Adaptor3d)
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
SingularOnUMax(myclass; S:HSurface from Adaptor3d)
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
SingularOnVMin(myclass; S:HSurface from Adaptor3d)
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
SingularOnVMax(myclass; S:HSurface from Adaptor3d)
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
NbSamplesU(myclass; S: HSurface from Adaptor3d; u1,u2: Real from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
NbSamplesV(myclass; S: HSurface from Adaptor3d; v1,v2: Real from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
-- Methodes pour recherche des points interieurs
|
||||
|
||||
NbSamplePoints(myclass; S: HSurface from Adaptor3d)
|
||||
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
SamplePoint(myclass; S : HSurface from Adaptor3d;
|
||||
Index: Integer from Standard;
|
||||
U,V: out Real from Standard);
|
||||
|
||||
|
||||
-- Classify(myclass; S: HSurface from Adaptor3d;
|
||||
-- U,V: Real from Standard)
|
||||
--
|
||||
-- returns State from TopAbs;
|
||||
|
||||
|
||||
-- Methodes sur un arc de restriction
|
||||
|
||||
HasBeenSeen(myclass; C: HCurve2d from Adaptor2d)
|
||||
|
||||
---Purpose: Returns True if all the intersection point and edges
|
||||
-- are known on the Arc.
|
||||
-- The intersection point are given as vertices.
|
||||
-- The intersection edges are given as intervals between
|
||||
-- two vertices.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
NbSamplesOnArc(myclass; A: HCurve2d from Adaptor2d)
|
||||
|
||||
---Purpose: returns the number of points which is used to make
|
||||
-- a sample on the arc. this number is a function of
|
||||
-- the Surface and the CurveOnSurface complexity.
|
||||
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
Bounds(myclass; C: HCurve2d from Adaptor2d;
|
||||
Ufirst,Ulast: out Real from Standard);
|
||||
|
||||
---Purpose: Returns the parametric limits on the arc C.
|
||||
-- These limits must be finite : they are either
|
||||
-- the real limits of the arc, for a finite arc,
|
||||
-- or a bounding box for an infinite arc.
|
||||
|
||||
|
||||
Project(myclass; C: HCurve2d from Adaptor2d;
|
||||
P: Pnt2d from gp;
|
||||
Paramproj: out Real from Standard;
|
||||
Ptproj : out Pnt2d from gp)
|
||||
|
||||
---Purpose: Projects the point P on the arc C.
|
||||
-- If the methods returns Standard_True, the projection is
|
||||
-- successful, and Paramproj is the parameter on the arc
|
||||
-- of the projected point, Ptproj is the projected Point.
|
||||
-- If the method returns Standard_False, Param proj and Ptproj
|
||||
-- are not significant.
|
||||
--
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
-- Methods on a vertex
|
||||
|
||||
|
||||
Tolerance(myclass; V: HVertex from Adaptor3d; C: HCurve2d from Adaptor2d)
|
||||
|
||||
---Purpose: Returns the parametric tolerance used to consider
|
||||
-- that the vertex and another point meet, i-e
|
||||
-- if Abs(parameter(Vertex) - parameter(OtherPnt))<=
|
||||
-- Tolerance, the points are "merged".
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
Parameter(myclass; V: HVertex from Adaptor3d; C: HCurve2d from Adaptor2d)
|
||||
|
||||
---Purpose: Returns the parameter of the vertex V on the arc A.
|
||||
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
-- The following methods are used when HasBeenSeen returns Standard_True
|
||||
|
||||
NbPoints(myclass; C: HCurve2d from Adaptor2d)
|
||||
|
||||
---Purpose: Returns the number of intersection points on the arc A.
|
||||
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
Value(myclass; C: HCurve2d from Adaptor2d; Index: Integer from Standard;
|
||||
Pt: out Pnt from gp; Tol: out Real from Standard;
|
||||
U: out Real from Standard);
|
||||
|
||||
---Purpose: Returns the value (Pt), the tolerance (Tol), and
|
||||
-- the parameter (U) on the arc A , of the intersection
|
||||
-- point of range Index.
|
||||
|
||||
|
||||
IsVertex(myclass; C: HCurve2d from Adaptor2d;
|
||||
Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns True if the intersection point of range Index
|
||||
-- corresponds with a vertex on the arc A.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Vertex(myclass; C: HCurve2d from Adaptor2d; Index: Integer from Standard;
|
||||
V: out HVertex from Adaptor3d);
|
||||
|
||||
---Purpose: When IsVertex returns True, this method returns the
|
||||
-- vertex on the arc A.
|
||||
|
||||
|
||||
NbSegments(myclass; C: HCurve2d from Adaptor2d)
|
||||
|
||||
---Purpose: returns the number of part of A solution of the
|
||||
-- of intersection problem.
|
||||
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
HasFirstPoint(myclass; C: HCurve2d from Adaptor2d;
|
||||
Index: Integer from Standard;
|
||||
IndFirst: out Integer from Standard)
|
||||
|
||||
---Purpose: Returns True when the segment of range Index is not
|
||||
-- open at the left side. In that case, IndFirst is the
|
||||
-- range in the list intersection points (see NbPoints)
|
||||
-- of the one which defines the left bound of the segment.
|
||||
-- Otherwise, the method has to return False, and IndFirst
|
||||
-- has no meaning.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
HasLastPoint(myclass; C: HCurve2d from Adaptor2d;
|
||||
Index: Integer from Standard;
|
||||
IndLast: out Integer from Standard)
|
||||
|
||||
---Purpose: Returns True when the segment of range Index is not
|
||||
-- open at the right side. In that case, IndLast is the
|
||||
-- range in the list intersection points (see NbPoints)
|
||||
-- of the one which defines the right bound of the segment.
|
||||
-- Otherwise, the method has to return False, and IndLast
|
||||
-- has no meaning.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
IsAllSolution(myclass; C: HCurve2d from Adaptor2d)
|
||||
|
||||
---Purpose: Returns True when the whole restriction is solution
|
||||
-- of the intersection problem.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
end HInterTool;
|
315
src/IntPatch/IntPatch_HInterTool.cxx
Executable file
315
src/IntPatch/IntPatch_HInterTool.cxx
Executable file
@@ -0,0 +1,315 @@
|
||||
// File : IntPatch_HInterTool.cxx
|
||||
// Created : Fri Jul 2 13:19:22 1995
|
||||
// Author : Laurent BUCHARD
|
||||
// Copyright : OPEN CASCADE 1995
|
||||
|
||||
#include <IntPatch_HInterTool.ixx>
|
||||
|
||||
#include <Extrema_EPCOfExtPC2d.hxx>
|
||||
#include <Extrema_POnCurv2d.hxx>
|
||||
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
#include <Handle_Geom_BezierSurface.hxx>
|
||||
#include <Handle_Geom_BSplineSurface.hxx>
|
||||
#include <Handle_Geom2d_BezierCurve.hxx>
|
||||
#include <Handle_Geom2d_BSplineCurve.hxx>
|
||||
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
|
||||
static Standard_Real uinf,vinf,usup,vsup;
|
||||
|
||||
|
||||
Standard_Integer IntPatch_HInterTool::NbSamplesV (const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real, const Standard_Real)
|
||||
{
|
||||
switch (S->GetType())
|
||||
{
|
||||
case GeomAbs_Plane: return 2;
|
||||
case GeomAbs_BezierSurface: return (3 + S->NbVPoles());
|
||||
case GeomAbs_BSplineSurface:
|
||||
{
|
||||
Standard_Integer nbs = S->NbVKnots();
|
||||
nbs *= S->VDegree();
|
||||
if (!S->IsVRational()) nbs *= 2;
|
||||
if (nbs < 4) nbs = 4;
|
||||
return nbs;
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
case GeomAbs_Torus:
|
||||
case GeomAbs_SurfaceOfRevolution:
|
||||
case GeomAbs_SurfaceOfExtrusion: return 15;
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
|
||||
Standard_Integer IntPatch_HInterTool::NbSamplesU (const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real, const Standard_Real)
|
||||
{
|
||||
switch (S->GetType())
|
||||
{
|
||||
case GeomAbs_Plane: return 2;
|
||||
case GeomAbs_BezierSurface: return (3 + S->NbUPoles());
|
||||
case GeomAbs_BSplineSurface:
|
||||
{
|
||||
Standard_Integer nbs = S->NbUKnots();
|
||||
nbs *= S->UDegree();
|
||||
if (!S->IsURational()) nbs *= 2;
|
||||
if (nbs < 4) nbs = 4;
|
||||
return nbs;
|
||||
}
|
||||
case GeomAbs_Torus: return 20;
|
||||
//case GeomAbs_Cylinder:
|
||||
//case GeomAbs_Cone:
|
||||
//case GeomAbs_Sphere:
|
||||
//case GeomAbs_SurfaceOfRevolution:
|
||||
//case GeomAbs_SurfaceOfExtrusion: return 10;
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
|
||||
Standard_Integer IntPatch_HInterTool::NbSamplePoints (const Handle(Adaptor3d_HSurface)& S)
|
||||
{
|
||||
uinf = S->FirstUParameter();
|
||||
usup = S->LastUParameter();
|
||||
vinf = S->FirstVParameter();
|
||||
vsup = S->LastVParameter();
|
||||
|
||||
if (usup < uinf) {
|
||||
Standard_Real temp = uinf;
|
||||
uinf = usup;
|
||||
usup = temp;
|
||||
}
|
||||
if (vsup < vinf) {
|
||||
Standard_Real temp = vinf;
|
||||
vinf = vsup;
|
||||
vsup = temp;
|
||||
}
|
||||
if (uinf == RealFirst() && usup == RealLast()) {
|
||||
uinf = -1.e5;
|
||||
usup = 1.e5;
|
||||
}
|
||||
else if (uinf == RealFirst()) {
|
||||
uinf = usup - 2.e5;
|
||||
}
|
||||
else if (usup == RealLast()) {
|
||||
usup = uinf + 2.e5;
|
||||
}
|
||||
|
||||
if (vinf == RealFirst() && vsup == RealLast()) {
|
||||
vinf = -1.e5;
|
||||
vsup = 1.e5;
|
||||
}
|
||||
else if (vinf == RealFirst()) {
|
||||
vinf = vsup - 2.e5;
|
||||
}
|
||||
else if (vsup == RealLast()) {
|
||||
vsup = vinf + 2.e5;
|
||||
}
|
||||
const Standard_Integer m = (1+NbSamplesU(S,uinf,usup)/2) * (1+NbSamplesV(S,vinf,vsup)/2);
|
||||
return(m);
|
||||
}
|
||||
|
||||
void IntPatch_HInterTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Integer Index,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V )
|
||||
{
|
||||
Standard_Integer nbIntU = 1+NbSamplesU(S,uinf,usup);
|
||||
nbIntU>>=1;
|
||||
Standard_Integer nbIntV = 1+NbSamplesV(S,vinf,vsup);
|
||||
nbIntV>>=1;
|
||||
|
||||
if(nbIntU * nbIntV >5) {
|
||||
|
||||
Standard_Integer NV = (Index-1) / nbIntU;
|
||||
Standard_Integer NU = (Index-1) - NV * nbIntU;
|
||||
Standard_Real du = ((usup-uinf)/((Standard_Real)(nbIntU+1)));
|
||||
Standard_Real dv = ((vsup-vinf)/((Standard_Real)(nbIntV+1)));
|
||||
|
||||
Standard_Integer perturb=(NU+NV) & 3;
|
||||
|
||||
//-- petite perturbation pou eviter les pbs de symetrie avec Les recherches de points int.
|
||||
|
||||
switch(perturb) {
|
||||
case 1: dv*=1.001; dv*=0.999; break;
|
||||
case 2: du*=1.001; dv*=1.001; break;
|
||||
case 3: du*=0.999; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
U = uinf + du*(Standard_Real)(NU+1);
|
||||
V = vinf + dv*(Standard_Real)(NV+1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (Index) {
|
||||
case 1:
|
||||
U = 0.76*uinf + 0.24*usup;
|
||||
V = 0.74*vinf + 0.26*vsup;
|
||||
break;
|
||||
case 2:
|
||||
U = 0.73*uinf + 0.27*usup;
|
||||
V = 0.24*vinf + 0.76*vsup;
|
||||
break;
|
||||
case 3:
|
||||
U = 0.25*uinf + 0.75*usup;
|
||||
V = 0.76*vinf + 0.24*vsup;
|
||||
break;
|
||||
case 4:
|
||||
U = 0.26*uinf + 0.74*usup;
|
||||
V = 0.25*vinf + 0.75*vsup;
|
||||
break;
|
||||
default:
|
||||
U = 0.51*uinf+0.49*usup;
|
||||
V = 0.49*vinf+0.51*vsup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IntPatch_HInterTool::NbSamplesOnArc (const Handle(Adaptor2d_HCurve2d)& A)
|
||||
{
|
||||
GeomAbs_CurveType CurveType = A->GetType();
|
||||
|
||||
// Standard_Real nbsOnC = 5;
|
||||
Standard_Integer nbsOnC = 5;
|
||||
switch(CurveType) {
|
||||
case GeomAbs_Line:
|
||||
nbsOnC = 2;
|
||||
break;
|
||||
case GeomAbs_Circle:
|
||||
case GeomAbs_Ellipse:
|
||||
case GeomAbs_Hyperbola:
|
||||
case GeomAbs_Parabola:
|
||||
nbsOnC = 10;
|
||||
break;
|
||||
case GeomAbs_BezierCurve:
|
||||
nbsOnC = A->NbPoles();
|
||||
break;
|
||||
case GeomAbs_BSplineCurve: {
|
||||
//-- Handle_Geom2d_BSplineCurve& BSC=A->BSpline();
|
||||
nbsOnC = 2 + A->NbKnots() * A->Degree();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
nbsOnC = 10;
|
||||
}
|
||||
return(nbsOnC);
|
||||
}
|
||||
|
||||
void IntPatch_HInterTool::Bounds(const Handle(Adaptor2d_HCurve2d)& A,
|
||||
Standard_Real& Ufirst,
|
||||
Standard_Real& Ulast)
|
||||
{
|
||||
Ufirst = A->FirstParameter();
|
||||
Ulast = A->LastParameter();
|
||||
}
|
||||
|
||||
Standard_Boolean IntPatch_HInterTool::Project (const Handle(Adaptor2d_HCurve2d)& C,
|
||||
const gp_Pnt2d& P,
|
||||
Standard_Real& Paramproj,
|
||||
gp_Pnt2d& Ptproj)
|
||||
{
|
||||
Standard_Real epsX = 1.e-8;
|
||||
Standard_Integer Nbu = 20;
|
||||
Standard_Real Tol = 1.e-5;
|
||||
Standard_Real Dist2;
|
||||
|
||||
Extrema_EPCOfExtPC2d extrema(P,C->Curve2d(),Nbu,epsX,Tol);
|
||||
if (!extrema.IsDone()) {
|
||||
return Standard_False;
|
||||
}
|
||||
Standard_Integer Nbext = extrema.NbExt();
|
||||
if (Nbext == 0) {
|
||||
return Standard_False;
|
||||
}
|
||||
Standard_Integer indexmin = 1;
|
||||
Dist2 = extrema.SquareDistance(1);
|
||||
for (Standard_Integer i=2; i<=Nbext; i++) {
|
||||
if (extrema.SquareDistance(i) < Dist2) {
|
||||
indexmin = i;
|
||||
Dist2 = extrema.SquareDistance(i);
|
||||
}
|
||||
}
|
||||
Paramproj = extrema.Point(indexmin).Parameter();
|
||||
Ptproj = extrema.Point(indexmin).Value();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Real IntPatch_HInterTool::Tolerance (const Handle(Adaptor3d_HVertex)& V,
|
||||
const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
return V->Resolution(C);
|
||||
}
|
||||
|
||||
Standard_Real IntPatch_HInterTool::Parameter (const Handle(Adaptor3d_HVertex)& V,
|
||||
const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
return V->Parameter(C);
|
||||
}
|
||||
|
||||
Standard_Boolean IntPatch_HInterTool::HasBeenSeen(const Handle(Adaptor2d_HCurve2d)&)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Integer IntPatch_HInterTool::NbPoints(const Handle(Adaptor2d_HCurve2d)&)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IntPatch_HInterTool::Value(const Handle(Adaptor2d_HCurve2d)&,
|
||||
const Standard_Integer,
|
||||
gp_Pnt&,
|
||||
Standard_Real&,
|
||||
Standard_Real&)
|
||||
{
|
||||
Standard_OutOfRange::Raise();
|
||||
}
|
||||
|
||||
Standard_Boolean IntPatch_HInterTool::IsVertex(const Handle(Adaptor2d_HCurve2d)&,
|
||||
const Standard_Integer)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
void IntPatch_HInterTool::Vertex(const Handle(Adaptor2d_HCurve2d)&,
|
||||
const Standard_Integer,
|
||||
Handle(Adaptor3d_HVertex)&)
|
||||
{
|
||||
Standard_OutOfRange::Raise();
|
||||
}
|
||||
|
||||
Standard_Integer IntPatch_HInterTool::NbSegments(const Handle(Adaptor2d_HCurve2d)&)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Boolean IntPatch_HInterTool::HasFirstPoint (const Handle(Adaptor2d_HCurve2d)&,
|
||||
const Standard_Integer,
|
||||
Standard_Integer&)
|
||||
{
|
||||
Standard_OutOfRange::Raise();
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean IntPatch_HInterTool::HasLastPoint (const Handle(Adaptor2d_HCurve2d)&,
|
||||
const Standard_Integer,
|
||||
Standard_Integer&)
|
||||
{
|
||||
Standard_OutOfRange::Raise();
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean IntPatch_HInterTool::IsAllSolution (const Handle(Adaptor2d_HCurve2d)&)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
25
src/IntPatch/IntPatch_HInterTool.lxx
Executable file
25
src/IntPatch/IntPatch_HInterTool.lxx
Executable file
@@ -0,0 +1,25 @@
|
||||
//-- File: IntPatch_HInterTool.lxx
|
||||
//-- Created: Fri Jul 2 13:19:22 1995
|
||||
//-- Author: Laurent BUCHARD
|
||||
//---Copyright: OPEN CASCADE 1995
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_HInterTool::SingularOnUMin (const Handle(Adaptor3d_HSurface)& )
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_HInterTool::SingularOnUMax (const Handle(Adaptor3d_HSurface)& )
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_HInterTool::SingularOnVMin (const Handle(Adaptor3d_HSurface)& )
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_HInterTool::SingularOnVMax (const Handle(Adaptor3d_HSurface)& )
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
172
src/IntPatch/IntPatch_ImpImpIntersection.cdl
Executable file
172
src/IntPatch/IntPatch_ImpImpIntersection.cdl
Executable file
@@ -0,0 +1,172 @@
|
||||
-- File: IntPatch_ImpImpIntersection.cdl
|
||||
-- Created: Thu May 7 08:47:45 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class ImpImpIntersection from IntPatch
|
||||
|
||||
---Purpose: Implementation of the intersection between two
|
||||
-- quadric patches : Plane, Cone, Cylinder or Sphere.
|
||||
|
||||
|
||||
uses HSurface from Adaptor3d,
|
||||
TopolTool from Adaptor3d,
|
||||
Point from IntPatch,
|
||||
SequenceOfPoint from IntPatch,
|
||||
TheSOnBounds from IntPatch,
|
||||
SequenceOfLine from IntPatch,
|
||||
Line from IntPatch
|
||||
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard,
|
||||
DomainError from Standard,
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create
|
||||
|
||||
returns ImpImpIntersection from IntPatch;
|
||||
|
||||
|
||||
Create (S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang: Real from Standard)
|
||||
|
||||
returns ImpImpIntersection from IntPatch
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
|
||||
|
||||
Perform (me: in out;
|
||||
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang: Real from Standard)
|
||||
|
||||
raises ConstructionError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns True if the calculus was succesfull.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsEmpty(me)
|
||||
|
||||
---Purpose: Returns true if the is no intersection.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TangentFaces(me)
|
||||
|
||||
---Purpose: Returns True if the two patches are considered as
|
||||
-- entierly tangent, i-e every restriction arc of one
|
||||
-- patch is inside the geometric base of the otehr patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
OppositeFaces(me)
|
||||
|
||||
---Purpose: Returns True when the TangentFaces returns True and the
|
||||
-- normal vectors evaluated at a point on the first and the
|
||||
-- second surface are opposite.
|
||||
-- The exception DomainError is raised if TangentFaces
|
||||
-- returns False.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbPnts(me)
|
||||
|
||||
---Purpose: Returns the number of "single" points.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point of range Index.
|
||||
-- An exception is raised if Index<=0 or Index>NbPnt.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbLines(me)
|
||||
|
||||
---Purpose: Returns the number of intersection lines.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Line(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the line of range Index.
|
||||
-- An exception is raised if Index<=0 or Index>NbLine.
|
||||
|
||||
returns Line from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
empt : Boolean from Standard;
|
||||
tgte : Boolean from Standard;
|
||||
oppo : Boolean from Standard;
|
||||
reverse: Boolean from Standard;
|
||||
spnt : SequenceOfPoint from IntPatch;
|
||||
slin : SequenceOfLine from IntPatch;
|
||||
solrst : TheSOnBounds from IntPatch;
|
||||
|
||||
end ImpImpIntersection;
|
43
src/IntPatch/IntPatch_ImpImpIntersection.cxx
Executable file
43
src/IntPatch/IntPatch_ImpImpIntersection.cxx
Executable file
@@ -0,0 +1,43 @@
|
||||
// File: IntPatch_ImpImpIntersection.cxx
|
||||
// Created: Thu May 7 08:47:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <IntPatch_ImpImpIntersection.ixx>
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <IntPatch_SequenceOfLine.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
|
||||
#include <IntSurf_Quadric.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <IntAna_Quadric.hxx>
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
#include <IntAna_IntQuadQuad.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
#include <IntSurf.hxx>
|
||||
|
||||
#include <Adaptor3d_HVertex.hxx>
|
||||
#include <Adaptor2d_HCurve2d.hxx>
|
||||
#include <IntPatch_HInterTool.hxx>
|
||||
#include <IntPatch_ArcFunction.hxx>
|
||||
#include <IntPatch_GLine.hxx>
|
||||
#include <IntPatch_ALine.hxx>
|
||||
#include <IntPatch_RLine.hxx>
|
||||
#include <IntPatch_ThePathPointOfTheSOnBounds.hxx>
|
||||
#include <IntPatch_TheSegmentOfTheSOnBounds.hxx>
|
||||
|
||||
#include <IntPatch_ImpImpIntersection_0.gxx>
|
||||
#include <IntPatch_ImpImpIntersection_1.gxx>
|
||||
#include <IntPatch_ImpImpIntersection_2.gxx>
|
||||
#include <IntPatch_ImpImpIntersection_3.gxx>
|
||||
#include <IntPatch_ImpImpIntersection_4.gxx>
|
||||
#include <IntPatch_ImpImpIntersection_5.gxx>
|
56
src/IntPatch/IntPatch_ImpImpIntersection.lxx
Executable file
56
src/IntPatch/IntPatch_ImpImpIntersection.lxx
Executable file
@@ -0,0 +1,56 @@
|
||||
// File: IntPatch_ImpImpIntersection.lxx
|
||||
// Created: Thu May 7 08:47:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <IntPatch_Line.hxx>
|
||||
|
||||
inline Standard_Boolean IntPatch_ImpImpIntersection::IsDone () const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_ImpImpIntersection::IsEmpty () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return empt;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_ImpImpIntersection::TangentFaces () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return tgte;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_ImpImpIntersection::OppositeFaces () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
if (!tgte) {Standard_DomainError::Raise();}
|
||||
return oppo;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_ImpImpIntersection::NbPnts () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return spnt.Length();
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_ImpImpIntersection::Point (const Standard_Integer Index) const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return spnt(Index);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_ImpImpIntersection::NbLines () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return slin.Length();
|
||||
}
|
||||
|
||||
inline const Handle(IntPatch_Line)& IntPatch_ImpImpIntersection::Line (const Standard_Integer Index) const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return slin(Index);
|
||||
}
|
1901
src/IntPatch/IntPatch_ImpImpIntersection_0.gxx
Executable file
1901
src/IntPatch/IntPatch_ImpImpIntersection_0.gxx
Executable file
File diff suppressed because it is too large
Load Diff
107
src/IntPatch/IntPatch_ImpImpIntersection_1.gxx
Executable file
107
src/IntPatch/IntPatch_ImpImpIntersection_1.gxx
Executable file
@@ -0,0 +1,107 @@
|
||||
// File: IntPatch_ImpImpIntersection_1.gxx
|
||||
// Created: Thu May 7 08:47:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
static Standard_Boolean IntPP (const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&);
|
||||
|
||||
static Standard_Boolean IntPCy (const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
const Standard_Boolean,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&);
|
||||
|
||||
|
||||
static Standard_Boolean IntPSp (const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
const Standard_Boolean,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
||||
|
||||
|
||||
static Standard_Boolean IntPCo (const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
const Standard_Boolean,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
||||
|
||||
|
||||
static void ProcessBounds(const Handle(IntPatch_ALine)&,
|
||||
const IntPatch_SequenceOfLine&,
|
||||
const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
Standard_Boolean&,
|
||||
const gp_Pnt&,
|
||||
const Standard_Real,
|
||||
Standard_Boolean&,
|
||||
const gp_Pnt&,
|
||||
const Standard_Real,
|
||||
Standard_Boolean&,
|
||||
const Standard_Real);
|
||||
|
||||
|
||||
static Standard_Boolean IntCyCy(const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
||||
|
||||
static Standard_Boolean IntCySp(const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
const Standard_Boolean,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
||||
|
||||
static Standard_Boolean IntCyCo(const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
const Standard_Boolean,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
||||
|
||||
static Standard_Boolean IntSpSp(const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
||||
|
||||
static Standard_Boolean IntCoSp(const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
const Standard_Boolean,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
||||
|
||||
static Standard_Boolean IntCoCo(const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
748
src/IntPatch/IntPatch_ImpImpIntersection_2.gxx
Executable file
748
src/IntPatch/IntPatch_ImpImpIntersection_2.gxx
Executable file
@@ -0,0 +1,748 @@
|
||||
// File: IntPatch_ImpImpIntersection_2.gxx
|
||||
// Created: Thu May 7 08:47:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection ():
|
||||
done(Standard_False)
|
||||
{
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection
|
||||
(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_TopolTool)& D1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_TopolTool)& D2,
|
||||
const Standard_Real TolArc,
|
||||
const Standard_Real TolTang)
|
||||
{
|
||||
Perform(S1,D1,S2,D2,TolArc,TolTang);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_TopolTool)& D1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_TopolTool)& D2,
|
||||
const Standard_Real TolArc,
|
||||
const Standard_Real TolTang) {
|
||||
done = Standard_False;
|
||||
spnt.Clear();
|
||||
slin.Clear();
|
||||
|
||||
empt = Standard_True;
|
||||
tgte = Standard_False;
|
||||
oppo = Standard_False;
|
||||
|
||||
Standard_Boolean all1 = Standard_False;
|
||||
Standard_Boolean all2 = Standard_False;
|
||||
Standard_Boolean SameSurf = Standard_False;
|
||||
Standard_Boolean multpoint = Standard_False;
|
||||
|
||||
Standard_Boolean nosolonS1 = Standard_False;
|
||||
// indique s il y a des points sur restriction du carreau 1
|
||||
Standard_Boolean nosolonS2 = Standard_False;
|
||||
// indique s il y a des points sur restriction du carreau 2
|
||||
|
||||
Standard_Integer i, nbpt, nbseg;
|
||||
|
||||
IntPatch_SequenceOfSegmentOfTheSOnBounds edg1,edg2;
|
||||
IntPatch_SequenceOfPathPointOfTheSOnBounds pnt1,pnt2;
|
||||
|
||||
// On commence par intersecter les supports des surfaces
|
||||
|
||||
IntSurf_Quadric quad1;
|
||||
IntSurf_Quadric quad2;
|
||||
IntPatch_ArcFunction AFunc;
|
||||
Standard_Real Tolang = 1.e-8;
|
||||
GeomAbs_SurfaceType typs1 = S1->GetType();
|
||||
GeomAbs_SurfaceType typs2 = S2->GetType();
|
||||
|
||||
|
||||
switch (typs1) {
|
||||
|
||||
case GeomAbs_Plane :
|
||||
{
|
||||
quad1.SetValue(S1->Plane());
|
||||
|
||||
switch (typs2) {
|
||||
|
||||
case GeomAbs_Plane:
|
||||
{
|
||||
quad2.SetValue(S2->Plane());
|
||||
if (!IntPP(quad1,quad2,Tolang,TolTang,SameSurf,slin)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
quad2.SetValue(S2->Cylinder());
|
||||
if (!IntPCy(quad1,quad2,Tolang,TolTang,Standard_False,empt,slin)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
quad2.SetValue(S2->Sphere());
|
||||
if (!IntPSp(quad1,quad2,TolTang,Standard_False,empt,slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
quad2.SetValue(S2->Cone());
|
||||
if (!IntPCo(quad1,quad2,Tolang,TolTang,Standard_False,
|
||||
empt,multpoint,slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
Standard_ConstructionError::Raise();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
quad1.SetValue(S1->Cylinder());
|
||||
switch (typs2){
|
||||
|
||||
case GeomAbs_Plane:
|
||||
{
|
||||
quad2.SetValue(S2->Plane());
|
||||
if (!IntPCy(quad1,quad2,Tolang,TolTang,Standard_True,empt,slin)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
quad2.SetValue(S2->Cylinder());
|
||||
if (!IntCyCy(quad1,quad2,TolTang,empt,SameSurf,multpoint,slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
quad2.SetValue(S2->Sphere());
|
||||
if (!IntCySp(quad1,quad2,TolTang,Standard_False,empt,multpoint,
|
||||
slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
quad2.SetValue(S2->Cone());
|
||||
if (!IntCyCo(quad1,quad2,TolTang,Standard_False,empt,multpoint,
|
||||
slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
Standard_ConstructionError::Raise();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
quad1.SetValue(S1->Sphere());
|
||||
|
||||
switch (typs2){
|
||||
|
||||
case GeomAbs_Plane:
|
||||
{
|
||||
quad2.SetValue(S2->Plane());
|
||||
if (!IntPSp(quad1,quad2,TolTang,Standard_True,empt,slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
quad2.SetValue(S2->Cylinder());
|
||||
if (!IntCySp(quad1,quad2,TolTang,Standard_True,empt,multpoint,
|
||||
slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
quad2.SetValue(S2->Sphere());
|
||||
if (!IntSpSp(quad1,quad2,TolTang,empt,SameSurf,slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
quad2.SetValue(S2->Cone());
|
||||
if (!IntCoSp(quad1,quad2,TolTang,Standard_True,empt,multpoint,
|
||||
slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
Standard_ConstructionError::Raise();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
quad1.SetValue(S1->Cone());
|
||||
|
||||
switch (typs2){
|
||||
|
||||
case GeomAbs_Plane:
|
||||
{
|
||||
quad2.SetValue(S2->Plane());
|
||||
if (!IntPCo(quad1,quad2,Tolang,TolTang,Standard_True,
|
||||
empt,multpoint,slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
quad2.SetValue(S2->Cylinder());
|
||||
if (!IntCyCo(quad1,quad2,TolTang,Standard_True,empt,multpoint,
|
||||
slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
quad2.SetValue(S2->Sphere());
|
||||
if (!IntCoSp(quad1,quad2,TolTang,Standard_False,empt,multpoint,
|
||||
slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
quad2.SetValue(S2->Cone());
|
||||
if (!IntCoCo(quad1,quad2,TolTang,empt,SameSurf,multpoint,
|
||||
slin,spnt)) {
|
||||
return;
|
||||
}
|
||||
if (empt) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
Standard_ConstructionError::Raise();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
Standard_ConstructionError::Raise();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!SameSurf) {
|
||||
|
||||
AFunc.SetQuadric(quad2);
|
||||
AFunc.Set(S1);
|
||||
|
||||
solrst.Perform(AFunc, D1, TolArc, TolTang);
|
||||
|
||||
|
||||
if (!solrst.IsDone()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (solrst.AllArcSolution() && typs1 == typs2) {
|
||||
all1 = Standard_True;
|
||||
}
|
||||
nbpt = solrst.NbPoints();
|
||||
nbseg= solrst.NbSegments();
|
||||
for (i=1; i<= nbpt; i++) {
|
||||
pnt1.Append(solrst.Point(i));
|
||||
}
|
||||
for (i=1; i<= nbseg; i++) {
|
||||
edg1.Append(solrst.Segment(i));
|
||||
}
|
||||
nosolonS1 = (nbpt == 0) && (nbseg == 0);
|
||||
|
||||
if (nosolonS1 && all1) { // cas de face sans restrictions
|
||||
all1 = Standard_False;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
nosolonS1 = Standard_True;
|
||||
}
|
||||
|
||||
if (!SameSurf) {
|
||||
|
||||
AFunc.SetQuadric(quad1);
|
||||
AFunc.Set(S2);
|
||||
|
||||
solrst.Perform(AFunc, D2, TolArc, TolTang);
|
||||
|
||||
if (!solrst.IsDone()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (solrst.AllArcSolution() && typs1 == typs2) {
|
||||
all2 = Standard_True;
|
||||
}
|
||||
nbpt = solrst.NbPoints();
|
||||
nbseg= solrst.NbSegments();
|
||||
for (i=1; i<= nbpt; i++) {
|
||||
pnt2.Append(solrst.Point(i));
|
||||
}
|
||||
|
||||
for (i=1; i<= nbseg; i++) {
|
||||
edg2.Append(solrst.Segment(i));
|
||||
}
|
||||
nosolonS2 = (nbpt == 0) && (nbseg == 0);
|
||||
|
||||
if (nosolonS2 && all2) { // cas de face sans restrictions
|
||||
all2 = Standard_False;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
nosolonS2 = Standard_True;
|
||||
}
|
||||
|
||||
if (SameSurf || (all1 && all2)) {
|
||||
|
||||
// faces "paralleles" parfaites
|
||||
|
||||
empt = Standard_False;
|
||||
tgte = Standard_True;
|
||||
slin.Clear();
|
||||
spnt.Clear();
|
||||
|
||||
gp_Pnt Ptreference;
|
||||
|
||||
switch (typs1) {
|
||||
case GeomAbs_Plane:
|
||||
{
|
||||
Ptreference = (S1->Plane()).Location();
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
Ptreference = ElSLib::Value(0.,0.,S1->Cylinder());
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
Ptreference = ElSLib::Value(PI/4.,PI/4.,S1->Sphere());
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
Ptreference = ElSLib::Value(0.,10.,S1->Cone());
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef DEB
|
||||
default:
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
oppo = quad1.Normale(Ptreference).Dot(quad2.Normale(Ptreference)) < 0.0;
|
||||
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nosolonS1 || !nosolonS2) {
|
||||
|
||||
|
||||
empt = Standard_False;
|
||||
|
||||
// C est la qu il faut commencer a bosser...
|
||||
|
||||
|
||||
PutPointsOnLine(S1,S2,pnt1, slin, Standard_True, D1, quad1,quad2,
|
||||
multpoint,TolArc);
|
||||
|
||||
PutPointsOnLine(S1,S2,pnt2, slin, Standard_False,D2, quad2,quad1,
|
||||
multpoint,TolArc);
|
||||
|
||||
if (edg1.Length() != 0) {
|
||||
ProcessSegments(edg1,slin,quad1,quad2,Standard_True,TolArc);
|
||||
}
|
||||
|
||||
if (edg2.Length() != 0) {
|
||||
ProcessSegments(edg2,slin,quad1,quad2,Standard_False,TolArc);
|
||||
}
|
||||
|
||||
if (edg1.Length() !=0 || edg2.Length() !=0) {
|
||||
// ProcessRLine(slin,S1,S2,TolArc);
|
||||
ProcessRLine(slin,quad1,quad2,TolArc);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
empt = ((slin.Length()==0) && (spnt.Length()==0));
|
||||
}
|
||||
|
||||
Standard_Integer nblin = slin.Length();
|
||||
|
||||
|
||||
|
||||
for(i=1; i<=nblin; i++) {
|
||||
IntPatch_IType thetype = slin.Value(i)->ArcType();
|
||||
if( (thetype == IntPatch_Ellipse)
|
||||
||(thetype == IntPatch_Circle)
|
||||
||(thetype == IntPatch_Lin)
|
||||
||(thetype == IntPatch_Parabola)
|
||||
||(thetype == IntPatch_Hyperbola)) {
|
||||
Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
||||
|
||||
/* if(thetype == IntPatch_Circle) {
|
||||
gp_Pnt P;
|
||||
IntPatch_Point point;
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Standard_Boolean Addf = Standard_False;
|
||||
Standard_Boolean Addl = Standard_False;
|
||||
Standard_Integer v=0;
|
||||
Standard_Integer nbv;
|
||||
gp_Circ Circ = glin->Circle();
|
||||
nbv = glin->NbVertex();
|
||||
if(glin->HasFirstPoint() == Standard_False) {
|
||||
P=ElCLib::Value(0.0,Circ);
|
||||
quad1.Parameters(P,u1,v1); quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(0.0);
|
||||
glin->AddVertex(point);
|
||||
nbv++;
|
||||
glin->SetFirstPoint(nbv);
|
||||
}
|
||||
if(glin->HasLastPoint() == Standard_False) {
|
||||
P=ElCLib::Value(0.0,Circ);
|
||||
quad1.Parameters(P,u1,v1); quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(PI+PI);
|
||||
glin->AddVertex(point);
|
||||
nbv++;
|
||||
glin->SetLastPoint(nbv);
|
||||
}
|
||||
}
|
||||
else if(thetype == IntPatch_Ellipse) {
|
||||
gp_Pnt P;
|
||||
IntPatch_Point point;
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Standard_Boolean Addf = Standard_False;
|
||||
Standard_Boolean Addl = Standard_False;
|
||||
Standard_Integer v=0;
|
||||
Standard_Integer nbv;
|
||||
gp_Elips Elips = glin->Ellipse();
|
||||
nbv = glin->NbVertex();
|
||||
if(glin->HasFirstPoint() == Standard_False) {
|
||||
P=ElCLib::Value(0.0,Elips);
|
||||
quad1.Parameters(P,u1,v1); quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(0.0);
|
||||
glin->AddVertex(point);
|
||||
nbv++;
|
||||
glin->SetFirstPoint(nbv);
|
||||
}
|
||||
if(glin->HasLastPoint() == Standard_False) {
|
||||
P=ElCLib::Value(0.0,Elips);
|
||||
quad1.Parameters(P,u1,v1); quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(PI+PI);
|
||||
glin->AddVertex(point);
|
||||
nbv++;
|
||||
glin->SetLastPoint(nbv);
|
||||
}
|
||||
}
|
||||
*/
|
||||
glin->ComputeVertexParameters(TolArc);
|
||||
}
|
||||
else if(thetype == IntPatch_Analytic) {
|
||||
Handle(IntPatch_ALine)& aligold = *((Handle(IntPatch_ALine)*)&slin.Value(i));
|
||||
aligold->ComputeVertexParameters(TolArc);
|
||||
}
|
||||
else if(thetype == IntPatch_Restriction) {
|
||||
Handle(IntPatch_RLine)& rlig = *((Handle(IntPatch_RLine)*)&slin.Value(i));
|
||||
rlig->ComputeVertexParameters(TolArc);
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
//----------------------------------------------------------------
|
||||
//-- On place 2 vertex sur les courbes de GLine qui n en
|
||||
//-- contiennent pas.
|
||||
|
||||
for(i=1; i<=nblin; i++) {
|
||||
gp_Pnt P;
|
||||
IntPatch_Point point;
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
#ifdef DEB
|
||||
Standard_Boolean Addf = Standard_False;
|
||||
Standard_Boolean Addl = Standard_False;
|
||||
Standard_Integer v=0;
|
||||
#endif
|
||||
Standard_Integer nbv;
|
||||
if(slin.Value(i)->ArcType() == IntPatch_Circle) {
|
||||
const Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
||||
nbv = glin->NbVertex();
|
||||
if(glin->NbVertex() == 0) {
|
||||
gp_Circ Circ = glin->Circle();
|
||||
P=ElCLib::Value(0.0,Circ);
|
||||
quad1.Parameters(P,u1,v1);
|
||||
quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(0.0);
|
||||
glin->AddVertex(point);
|
||||
|
||||
P=ElCLib::Value(0.0,Circ);
|
||||
quad1.Parameters(P,u1,v1);
|
||||
quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(PI+PI);
|
||||
glin->AddVertex(point);
|
||||
}
|
||||
}
|
||||
|
||||
else if(slin.Value(i)->ArcType() == IntPatch_Ellipse) {
|
||||
const Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
||||
nbv = glin->NbVertex();
|
||||
if(glin->NbVertex() == 0) {
|
||||
gp_Elips Elips = glin->Ellipse();
|
||||
P=ElCLib::Value(0.0,Elips);
|
||||
quad1.Parameters(P,u1,v1);
|
||||
quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(0.0);
|
||||
glin->AddVertex(point);
|
||||
|
||||
P=ElCLib::Value(0.0,Elips);
|
||||
quad1.Parameters(P,u1,v1);
|
||||
quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(PI+PI);
|
||||
glin->AddVertex(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
done = Standard_True;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
|
||||
|
||||
#if 0
|
||||
//-- Ancien bout de code
|
||||
//----------------------------------------------------------------
|
||||
//-- On place 2 vertex sur les courbes de GLine qui n en
|
||||
//-- contiennent pas.
|
||||
|
||||
for(i=1; i<=nblin; i++) {
|
||||
gp_Pnt P;
|
||||
IntPatch_Point point;
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Standard_Boolean Addf = Standard_False;
|
||||
Standard_Boolean Addl = Standard_False;
|
||||
Standard_Integer v=0;
|
||||
Standard_Integer nbv;
|
||||
if(slin.Value(i)->ArcType() == IntPatch_Circle) {
|
||||
const Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
||||
nbv = glin->NbVertex();
|
||||
if(glin->NbVertex() == 0) { Addf=Addl=Standard_True; }
|
||||
else {
|
||||
if(glin->HasFirstPoint() == Standard_False) {
|
||||
Addf = Standard_True;
|
||||
for(v=1;v<=nbv;v++) {
|
||||
Standard_Real gv = glin->Vertex(v).ParameterOnLine();
|
||||
if(gv<Precision::PConfusion())
|
||||
Addf = Standard_False;
|
||||
}
|
||||
}
|
||||
if(glin->HasLastPoint() == Standard_False) {
|
||||
Addl = Standard_True;
|
||||
for(v=1;v<=nbv;v++) {
|
||||
Standard_Real gv = glin->Vertex(v).ParameterOnLine();
|
||||
if((PI+PI-gv)<Precision::PConfusion())
|
||||
Addl = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Addl || Addf) {
|
||||
gp_Circ Circ = glin->Circle();
|
||||
if(Addf) {
|
||||
P=ElCLib::Value(0.0,Circ);
|
||||
quad1.Parameters(P,u1,v1);
|
||||
quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(0.0);
|
||||
glin->AddVertex(point);
|
||||
}
|
||||
if(Addl) {
|
||||
P=ElCLib::Value(0.0,Circ);
|
||||
quad1.Parameters(P,u1,v1);
|
||||
quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(PI+PI);
|
||||
glin->AddVertex(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if(slin.Value(i)->ArcType() == IntPatch_Ellipse) {
|
||||
const Handle(IntPatch_GLine)& glin = *((Handle(IntPatch_GLine)*)&slin.Value(i));
|
||||
nbv = glin->NbVertex();
|
||||
if(glin->NbVertex() == 0) { Addf=Addl=Standard_True; }
|
||||
else {
|
||||
if(glin->HasFirstPoint() == Standard_False) {
|
||||
Addf = Standard_True;
|
||||
for(v=1;v<=nbv;v++) {
|
||||
Standard_Real gv = glin->Vertex(v).ParameterOnLine();
|
||||
if(gv<Precision::PConfusion())
|
||||
Addf = Standard_False;
|
||||
}
|
||||
}
|
||||
if(glin->HasLastPoint() == Standard_False) {
|
||||
Addl = Standard_True;
|
||||
for(v=1;v<=nbv;v++) {
|
||||
Standard_Real gv = glin->Vertex(v).ParameterOnLine();
|
||||
if((PI+PI-gv)<Precision::PConfusion())
|
||||
Addl = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Addl || Addf) {
|
||||
gp_Elips Elips = glin->Ellipse();
|
||||
if(Addf) {
|
||||
P=ElCLib::Value(0.0,Elips);
|
||||
quad1.Parameters(P,u1,v1);
|
||||
quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(0.0);
|
||||
glin->AddVertex(point);
|
||||
}
|
||||
if(Addl) {
|
||||
P=ElCLib::Value(0.0,Elips);
|
||||
quad1.Parameters(P,u1,v1);
|
||||
quad2.Parameters(P,u2,v2);
|
||||
point.SetValue(P,TolArc,Standard_False);
|
||||
point.SetParameters(u1,v1,u2,v2);
|
||||
point.SetParameter(PI+PI);
|
||||
glin->AddVertex(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
636
src/IntPatch/IntPatch_ImpImpIntersection_3.gxx
Executable file
636
src/IntPatch/IntPatch_ImpImpIntersection_3.gxx
Executable file
@@ -0,0 +1,636 @@
|
||||
// File: IntPatch_ImpImpIntersection_3.gxx
|
||||
// Created: Thu May 7 08:47:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
Standard_Boolean IntPP (const IntSurf_Quadric& Quad1,
|
||||
const IntSurf_Quadric& Quad2,
|
||||
const Standard_Real Tolang,
|
||||
const Standard_Real TolTang,
|
||||
Standard_Boolean& Same,
|
||||
IntPatch_SequenceOfLine& slin)
|
||||
// Traitement du cas Plan/Plan
|
||||
{
|
||||
IntSurf_TypeTrans trans1,trans2;
|
||||
IntAna_ResultType typint;
|
||||
gp_Pln pl1(Quad1.Plane());
|
||||
gp_Pln pl2(Quad2.Plane());
|
||||
|
||||
IntAna_QuadQuadGeo inter(pl1,pl2,Tolang,TolTang);
|
||||
if (!inter.IsDone()) {return Standard_False;}
|
||||
Same = Standard_False;
|
||||
typint = inter.TypeInter();
|
||||
if (typint == IntAna_Same) { // cas faces confondues
|
||||
Same = Standard_True;
|
||||
}
|
||||
else if (typint != IntAna_Empty) { // on a une ligne
|
||||
gp_Lin linsol = inter.Line(1);
|
||||
Standard_Real discri = linsol.Direction().DotCross
|
||||
(Quad2.Normale(linsol.Location()),
|
||||
Quad1.Normale(linsol.Location()));
|
||||
|
||||
if (discri>0.0) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine (linsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//====================================================================================
|
||||
Standard_Boolean IntPCy (const IntSurf_Quadric& Quad1,
|
||||
const IntSurf_Quadric& Quad2,
|
||||
const Standard_Real Tolang,
|
||||
const Standard_Real TolTang,
|
||||
const Standard_Boolean Reversed,
|
||||
Standard_Boolean& Empty,
|
||||
IntPatch_SequenceOfLine& slin)
|
||||
|
||||
// Traitement du cas Plan/Cylindre et reciproquement
|
||||
{
|
||||
gp_Pln Pl;
|
||||
gp_Cylinder Cy;
|
||||
|
||||
IntSurf_TypeTrans trans1,trans2;
|
||||
IntAna_ResultType typint;
|
||||
|
||||
IntAna_QuadQuadGeo inter;
|
||||
if (!Reversed) {
|
||||
Pl = Quad1.Plane();
|
||||
Cy = Quad2.Cylinder();
|
||||
}
|
||||
else {
|
||||
Pl = Quad2.Plane();
|
||||
Cy = Quad1.Cylinder();
|
||||
}
|
||||
inter.Perform(Pl,Cy,Tolang,TolTang);
|
||||
if (!inter.IsDone()) {return Standard_False;}
|
||||
typint = inter.TypeInter();
|
||||
Standard_Integer NbSol = inter.NbSolutions();
|
||||
Empty = Standard_False;
|
||||
|
||||
switch (typint) {
|
||||
|
||||
case IntAna_Empty :
|
||||
{
|
||||
Empty = Standard_True;
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Line:
|
||||
{
|
||||
gp_Lin linsol = inter.Line(1);
|
||||
gp_Pnt orig(linsol.Location());
|
||||
if (NbSol == 1) { // ligne de tangence
|
||||
gp_Vec TestCurvature(orig,Cy.Location());
|
||||
gp_Vec Normp,Normcyl;
|
||||
if (!Reversed) {
|
||||
Normp = Quad1.Normale(orig);
|
||||
Normcyl = Quad2.Normale(orig);
|
||||
}
|
||||
else {
|
||||
Normp = Quad2.Normale(orig);
|
||||
Normcyl = Quad1.Normale(orig);
|
||||
}
|
||||
|
||||
IntSurf_Situation situcyl;
|
||||
IntSurf_Situation situp;
|
||||
|
||||
if (Normp.Dot(TestCurvature) > 0.) {
|
||||
situcyl = IntSurf_Outside;
|
||||
if (Normp.Dot(Normcyl) > 0.) {
|
||||
situp = IntSurf_Inside;
|
||||
}
|
||||
else {
|
||||
situp = IntSurf_Outside;
|
||||
}
|
||||
}
|
||||
else {
|
||||
situcyl = IntSurf_Inside;
|
||||
if (Normp.Dot(Normcyl) > 0.) {
|
||||
situp = IntSurf_Outside;
|
||||
}
|
||||
else {
|
||||
situp = IntSurf_Inside;
|
||||
}
|
||||
}
|
||||
Handle(IntPatch_GLine) glig;
|
||||
if (!Reversed) {
|
||||
glig = new IntPatch_GLine(linsol, Standard_True, situp, situcyl);
|
||||
}
|
||||
else {
|
||||
glig = new IntPatch_GLine(linsol, Standard_True, situcyl, situp);
|
||||
}
|
||||
slin.Append(glig);
|
||||
}
|
||||
else { // on a 2 droites. Il faut determiner les transitions
|
||||
// de chacune.
|
||||
|
||||
if (linsol.Direction().DotCross(Quad2.Normale(orig),
|
||||
Quad1.Normale(orig)) >0.) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
|
||||
linsol = inter.Line(2);
|
||||
orig = linsol.Location();
|
||||
|
||||
if (linsol.Direction().DotCross(Quad2.Normale(orig),
|
||||
Quad1.Normale(orig)) >0.) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
glig = new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Circle:
|
||||
{
|
||||
gp_Circ cirsol = inter.Circle(1);
|
||||
gp_Pnt ptref;
|
||||
gp_Vec Tgt;
|
||||
ElCLib::D1(0.,cirsol,ptref,Tgt);
|
||||
|
||||
if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) > 0.0) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Ellipse:
|
||||
{
|
||||
gp_Elips elipsol = inter.Ellipse(1);
|
||||
gp_Pnt ptref;
|
||||
gp_Vec Tgt;
|
||||
ElCLib::D1(0.,elipsol,ptref,Tgt);
|
||||
|
||||
if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) > 0.0) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
return Standard_False; // on ne doit pas passer ici
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//====================================================================================
|
||||
Standard_Boolean IntPSp (const IntSurf_Quadric& Quad1,
|
||||
const IntSurf_Quadric& Quad2,
|
||||
const Standard_Real TolTang,
|
||||
const Standard_Boolean Reversed,
|
||||
Standard_Boolean& Empty,
|
||||
IntPatch_SequenceOfLine& slin,
|
||||
IntPatch_SequenceOfPoint& spnt)
|
||||
|
||||
// Traitement du cas Plan/Sphere et reciproquement
|
||||
{
|
||||
gp_Circ cirsol;
|
||||
gp_Pln Pl;
|
||||
gp_Sphere Sp;
|
||||
IntSurf_TypeTrans trans1,trans2;
|
||||
IntAna_ResultType typint;
|
||||
|
||||
IntAna_QuadQuadGeo inter;
|
||||
if (!Reversed) {
|
||||
Pl = Quad1.Plane();
|
||||
Sp = Quad2.Sphere();
|
||||
}
|
||||
else {
|
||||
Pl = Quad2.Plane();
|
||||
Sp = Quad1.Sphere();
|
||||
}
|
||||
inter.Perform(Pl,Sp);
|
||||
|
||||
if (!inter.IsDone()) {return Standard_False;}
|
||||
|
||||
typint = inter.TypeInter();
|
||||
Empty = Standard_False;
|
||||
|
||||
switch (typint) {
|
||||
|
||||
case IntAna_Empty :
|
||||
{
|
||||
Empty = Standard_True;
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Point:
|
||||
{
|
||||
gp_Pnt psol = inter.Point(1);
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
Quad1.Parameters(psol,U1,V1);
|
||||
Quad2.Parameters(psol,U2,V2);
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(psol,TolTang,Standard_True);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Circle:
|
||||
{
|
||||
cirsol = inter.Circle(1);
|
||||
gp_Pnt ptref;
|
||||
gp_Vec Tgt;
|
||||
ElCLib::D1(0.,cirsol,ptref,Tgt);
|
||||
|
||||
if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) >0.) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
return Standard_False; // on ne doit pas passer ici
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//====================================================================================
|
||||
Standard_Boolean IntPCo (const IntSurf_Quadric& Quad1,
|
||||
const IntSurf_Quadric& Quad2,
|
||||
const Standard_Real Tolang,
|
||||
const Standard_Real TolTang,
|
||||
const Standard_Boolean Reversed,
|
||||
Standard_Boolean& Empty,
|
||||
Standard_Boolean& Multpoint,
|
||||
IntPatch_SequenceOfLine& slin,
|
||||
IntPatch_SequenceOfPoint& spnt)
|
||||
|
||||
// Traitement du cas Plan/Cone et reciproquement
|
||||
{
|
||||
gp_Pnt apex;
|
||||
|
||||
gp_Pln Pl;
|
||||
gp_Cone Co;
|
||||
|
||||
IntSurf_TypeTrans trans1,trans2;
|
||||
IntAna_ResultType typint;
|
||||
|
||||
IntAna_QuadQuadGeo inter;
|
||||
if (!Reversed) {
|
||||
Pl = Quad1.Plane();
|
||||
Co = Quad2.Cone();
|
||||
apex = Co.Apex();
|
||||
}
|
||||
else {
|
||||
Pl = Quad2.Plane();
|
||||
Co = Quad1.Cone();
|
||||
apex = Co.Apex();
|
||||
}
|
||||
|
||||
inter.Perform(Pl,Co,Tolang,TolTang);
|
||||
if (!inter.IsDone()) {return Standard_False;}
|
||||
|
||||
typint = inter.TypeInter();
|
||||
Standard_Integer NbSol = inter.NbSolutions();
|
||||
Empty = Standard_False;
|
||||
|
||||
switch (typint) {
|
||||
|
||||
case IntAna_Point:
|
||||
{
|
||||
gp_Pnt psol = inter.Point(1);
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
Quad1.Parameters(psol,U1,V1);
|
||||
Quad2.Parameters(psol,U2,V2);
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(psol,TolTang,Standard_False);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Line:
|
||||
{
|
||||
gp_Lin linsol = inter.Line(1);
|
||||
if (linsol.Direction().Dot(Co.Axis().Direction()) <0.) {
|
||||
linsol.SetDirection(linsol.Direction().Reversed());
|
||||
}
|
||||
Standard_Real para = ElCLib::Parameter(linsol, apex);
|
||||
gp_Pnt ptbid (ElCLib::Value(para+5.,linsol));
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
Quad1.Parameters(apex,U1,V1);
|
||||
Quad2.Parameters(apex,U2,V2);
|
||||
|
||||
if (NbSol == 1) { // ligne de tangence
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(apex,TolTang,Standard_False);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
ptsol.SetParameter(para);
|
||||
gp_Pnt ptbid2(apex.XYZ() + 5.*Co.Axis().Direction().XYZ());
|
||||
gp_Vec TestCurvature(ptbid,ptbid2);
|
||||
gp_Vec Normp,Normco;
|
||||
if (!Reversed) {
|
||||
Normp = Quad1.Normale(ptbid);
|
||||
Normco = Quad2.Normale(ptbid);
|
||||
}
|
||||
else {
|
||||
Normp = Quad2.Normale(ptbid);
|
||||
Normco = Quad1.Normale(ptbid);
|
||||
}
|
||||
|
||||
IntSurf_Situation situco,situco_otherside;
|
||||
IntSurf_Situation situp,situp_otherside;
|
||||
|
||||
if (Normp.Dot(TestCurvature) > 0.) {
|
||||
situco = IntSurf_Outside;
|
||||
situco_otherside = IntSurf_Inside;
|
||||
if (Normp.Dot(Normco) > 0.) {
|
||||
situp = IntSurf_Inside;
|
||||
situp_otherside = IntSurf_Outside;
|
||||
}
|
||||
else {
|
||||
situp = IntSurf_Outside;
|
||||
situp_otherside = IntSurf_Inside;
|
||||
}
|
||||
}
|
||||
else {
|
||||
situco = IntSurf_Inside;
|
||||
situco_otherside = IntSurf_Outside;
|
||||
if (Normp.Dot(Normco) > 0.) {
|
||||
situp = IntSurf_Outside;
|
||||
situp_otherside = IntSurf_Inside;
|
||||
}
|
||||
else {
|
||||
situp = IntSurf_Inside;
|
||||
situp_otherside = IntSurf_Outside;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
//-- Apex ---> Cone.Direction
|
||||
//--
|
||||
Handle(IntPatch_GLine) glig;
|
||||
if (!Reversed) {
|
||||
glig = new IntPatch_GLine(linsol, Standard_True, situp, situco);
|
||||
}
|
||||
else {
|
||||
glig = new IntPatch_GLine(linsol, Standard_True, situco, situp);
|
||||
}
|
||||
glig->AddVertex(ptsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
//----------------------------------------------------------
|
||||
//-- -Cone.Direction <------- Apex
|
||||
//--
|
||||
linsol.SetDirection(linsol.Direction().Reversed());
|
||||
if (!Reversed) {
|
||||
glig = new IntPatch_GLine(linsol, Standard_True, situp_otherside, situco_otherside);
|
||||
}
|
||||
else {
|
||||
glig = new IntPatch_GLine(linsol, Standard_True, situco_otherside, situp_otherside);
|
||||
}
|
||||
glig->AddVertex(ptsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
}
|
||||
else {
|
||||
// on a 2 droites. Il faut determiner les transitions
|
||||
// de chacune. On oriente chaque ligne dans le sens
|
||||
// de l axe du cone. Les transitions de chaque ligne seront
|
||||
// inverses l une de l autre => on ne fait le calcul que sur
|
||||
// la premiere.
|
||||
if (linsol.Direction().DotCross
|
||||
(Quad2.Normale(ptbid),Quad1.Normale(ptbid)) >0.) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
|
||||
Multpoint = Standard_True;
|
||||
//------------------------------------------- Ligne 1 -------
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(apex,TolTang,Standard_False);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
ptsol.SetParameter(para);
|
||||
ptsol.SetMultiple(Standard_True);
|
||||
Handle(IntPatch_GLine) glig;
|
||||
glig = new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
|
||||
glig->AddVertex(ptsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
//-----------------------------------------------------------
|
||||
//-- Other Side : Les transitions restent les memes
|
||||
//-- linsol -> -linsol et Quad1(2).N -> -Quad1(2).N
|
||||
//--
|
||||
linsol.SetDirection(linsol.Direction().Reversed());
|
||||
glig = new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
|
||||
para = ElCLib::Parameter(linsol, apex);
|
||||
ptsol.SetParameter(para);
|
||||
glig->AddVertex(ptsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
|
||||
//------------------------------------------- Ligne 2 -------
|
||||
linsol = inter.Line(2);
|
||||
if (linsol.Direction().Dot(Co.Axis().Direction()) <0.) {
|
||||
linsol.SetDirection(linsol.Direction().Reversed());
|
||||
}
|
||||
para = ElCLib::Parameter(linsol, apex);
|
||||
ptbid = ElCLib::Value(para+5.,linsol);
|
||||
if (linsol.Direction().DotCross
|
||||
(Quad2.Normale(ptbid),Quad1.Normale(ptbid)) >0.) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
ptsol.SetParameter(para);
|
||||
glig = new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
|
||||
para = ElCLib::Parameter(linsol, apex);
|
||||
ptsol.SetParameter(para);
|
||||
glig->AddVertex(ptsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
//-----------------------------------------------------------
|
||||
//-- Other Side : Les transitions restent les memes
|
||||
//-- linsol -> -linsol et Quad1(2).N -> -Quad1(2).N
|
||||
//--
|
||||
linsol.SetDirection(linsol.Direction().Reversed());
|
||||
glig = new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
|
||||
para = ElCLib::Parameter(linsol, apex);
|
||||
ptsol.SetParameter(para);
|
||||
glig->AddVertex(ptsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Circle:
|
||||
{
|
||||
gp_Circ cirsol = inter.Circle(1);
|
||||
#if 0
|
||||
if (ElCLib::LineParameter(Co.Axis(),cirsol.Location()) <
|
||||
ElCLib::LineParameter(Co.Axis(),apex) ) {
|
||||
Empty = Standard_True;
|
||||
}
|
||||
#endif
|
||||
if(0) { }
|
||||
else {
|
||||
|
||||
gp_Pnt ptref;
|
||||
gp_Vec Tgt;
|
||||
ElCLib::D1(0.,cirsol,ptref,Tgt);
|
||||
|
||||
if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) >0.) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Ellipse:
|
||||
{
|
||||
gp_Elips elipsol = inter.Ellipse(1);
|
||||
#if 0
|
||||
if (ElCLib::LineParameter(Co.Axis(),elipsol.Location()) <
|
||||
ElCLib::LineParameter(Co.Axis(),apex) ) {
|
||||
Empty = Standard_True;
|
||||
}
|
||||
#endif
|
||||
if(0) { }
|
||||
else {
|
||||
gp_Pnt ptref;
|
||||
gp_Vec Tgt;
|
||||
ElCLib::D1(0.,elipsol,ptref,Tgt);
|
||||
|
||||
if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) >0.) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Parabola:
|
||||
{
|
||||
gp_Parab parabsol = inter.Parabola(1);
|
||||
#if 0
|
||||
if (ElCLib::LineParameter(Co.Axis(),parabsol.Focus()) <
|
||||
ElCLib::LineParameter(Co.Axis(),apex) ) {
|
||||
Empty = Standard_True;
|
||||
}
|
||||
#endif
|
||||
if(0) { }
|
||||
else {
|
||||
|
||||
gp_Vec Tgtorig(parabsol.YAxis().Direction());
|
||||
Standard_Real ptran = Tgtorig.DotCross(Quad2.Normale(parabsol.Location()),
|
||||
Quad1.Normale(parabsol.Location()));
|
||||
if (ptran >0.00000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if (ptran <-0.00000001) {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(parabsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Hyperbola:
|
||||
{
|
||||
gp_Pnt tophypr;
|
||||
gp_Vec Tgttop;
|
||||
|
||||
for(Standard_Integer i=1; i<=2; i++) {
|
||||
gp_Hypr hyprsol = inter.Hyperbola(i);
|
||||
tophypr = ElCLib::Value(hyprsol.MajorRadius(),
|
||||
hyprsol.XAxis());
|
||||
Tgttop = hyprsol.YAxis().Direction();
|
||||
Standard_Real qwe = Tgttop.DotCross(Quad2.Normale(tophypr),
|
||||
Quad1.Normale(tophypr));
|
||||
|
||||
if (qwe>0.00000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if (qwe<-0.00000001){
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(hyprsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
//====================================================================================
|
1060
src/IntPatch/IntPatch_ImpImpIntersection_4.gxx
Executable file
1060
src/IntPatch/IntPatch_ImpImpIntersection_4.gxx
Executable file
File diff suppressed because it is too large
Load Diff
819
src/IntPatch/IntPatch_ImpImpIntersection_5.gxx
Executable file
819
src/IntPatch/IntPatch_ImpImpIntersection_5.gxx
Executable file
@@ -0,0 +1,819 @@
|
||||
// File: IntPatch_ImpImpIntersection_5.gxx
|
||||
// Created: Thu May 7 08:47:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <gce_MakeLin.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntCoCo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntCoCo(const IntSurf_Quadric& Quad1,
|
||||
const IntSurf_Quadric& Quad2,
|
||||
const Standard_Real Tol,
|
||||
Standard_Boolean& Empty,
|
||||
Standard_Boolean& Same,
|
||||
Standard_Boolean& Multpoint,
|
||||
IntPatch_SequenceOfLine& slin,
|
||||
IntPatch_SequenceOfPoint& spnt)
|
||||
|
||||
{
|
||||
Standard_Integer i, NbSol;
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
IntSurf_TypeTrans trans1,trans2;
|
||||
IntAna_ResultType typint;
|
||||
//
|
||||
gp_Cone Co1(Quad1.Cone());
|
||||
gp_Cone Co2(Quad2.Cone());
|
||||
//
|
||||
IntAna_QuadQuadGeo inter(Co1,Co2,Tol);
|
||||
if (!inter.IsDone()) {
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
typint = inter.TypeInter();
|
||||
NbSol = inter.NbSolutions();
|
||||
Empty = Standard_False;
|
||||
Same = Standard_False;
|
||||
|
||||
switch (typint) {
|
||||
|
||||
case IntAna_Empty :
|
||||
{
|
||||
Empty = Standard_True;
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Same:
|
||||
{
|
||||
Same = Standard_True;
|
||||
}
|
||||
break;
|
||||
|
||||
//modified by NIZNHY-PKV Wed Nov 30 12:56:06 2005f
|
||||
case IntAna_Line :{
|
||||
Standard_Real para, aDot;
|
||||
gp_Pnt aPApex1, aPApex2, ptbid;
|
||||
gp_Lin linsol;
|
||||
gp_Vec NormC1,NormC2;
|
||||
IntPatch_Point aPtsol;
|
||||
Handle(IntPatch_GLine) glig;
|
||||
//
|
||||
aPApex1=Co1.Apex();
|
||||
aPApex2=Co2.Apex();
|
||||
//
|
||||
if (NbSol==1) {
|
||||
IntSurf_Situation situC1, situC2;
|
||||
//
|
||||
linsol = inter.Line(1);
|
||||
para =ElCLib::Parameter(linsol, aPApex1);
|
||||
ptbid=ElCLib::Value(para+5., linsol);
|
||||
Quad1.Parameters(aPApex1, U1, V1);
|
||||
Quad2.Parameters(aPApex1, U2, V2);
|
||||
//
|
||||
aPtsol.SetValue(aPApex1, Tol, Standard_False);
|
||||
aPtsol.SetParameters(U1, V1, U2, V2);
|
||||
aPtsol.SetParameter(para);
|
||||
//
|
||||
NormC1=Quad1.Normale(ptbid);
|
||||
NormC2=Quad2.Normale(ptbid);
|
||||
aDot=NormC1.Dot(NormC2);
|
||||
if (aDot<0.) {
|
||||
situC1=IntSurf_Outside;
|
||||
situC2=IntSurf_Outside;
|
||||
}
|
||||
else {
|
||||
Standard_Real aR1, aR2;
|
||||
gp_Lin aLAx1(aPApex1, Co1.Axis().Direction());
|
||||
gp_Lin aLAx2(aPApex2, Co2.Axis().Direction());
|
||||
//
|
||||
aR1=aLAx1.Distance(ptbid);
|
||||
aR2=aLAx2.Distance(ptbid);
|
||||
//
|
||||
situC1=IntSurf_Inside;
|
||||
situC2=IntSurf_Outside;
|
||||
if (aR1>aR1) {
|
||||
situC1=IntSurf_Outside;
|
||||
situC2=IntSurf_Inside;
|
||||
}
|
||||
}
|
||||
// 1
|
||||
glig=new IntPatch_GLine(linsol, Standard_True, situC1, situC2);
|
||||
glig->AddVertex(aPtsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
// 2
|
||||
linsol.SetDirection(linsol.Direction().Reversed());
|
||||
para =ElCLib::Parameter(linsol, aPApex1);
|
||||
aPtsol.SetParameter(para);
|
||||
|
||||
glig = new IntPatch_GLine(linsol, Standard_True, situC2, situC1);
|
||||
glig->AddVertex(aPtsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
} // if (NbSol==1) {
|
||||
//////////////////////
|
||||
else if (NbSol==2) {
|
||||
//
|
||||
for (i=1; i<=2; ++i) {
|
||||
linsol = inter.Line(i);
|
||||
para =ElCLib::Parameter(linsol, aPApex1);
|
||||
ptbid=ElCLib::Value(para+5., linsol);
|
||||
Quad1.Parameters(aPApex1, U1, V1);
|
||||
Quad2.Parameters(aPApex1, U2, V2);
|
||||
//
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
if (linsol.Direction().
|
||||
DotCross(Quad2.Normale(ptbid),Quad1.Normale(ptbid)) >0.) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
//
|
||||
Multpoint = Standard_True;
|
||||
// 1,3
|
||||
aPtsol.SetValue(aPApex1, Tol, Standard_False);
|
||||
aPtsol.SetParameters(U1,V1,U2,V2);
|
||||
aPtsol.SetParameter(para);
|
||||
aPtsol.SetMultiple(Standard_True);
|
||||
|
||||
glig = new IntPatch_GLine(linsol, Standard_False, trans1, trans2);
|
||||
glig->AddVertex(aPtsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
// 2,4
|
||||
linsol.SetDirection(linsol.Direction().Reversed());
|
||||
para = ElCLib::Parameter(linsol, aPApex1);
|
||||
aPtsol.SetParameter(para);
|
||||
glig = new IntPatch_GLine(linsol, Standard_False, trans1, trans2);
|
||||
glig->AddVertex(aPtsol);
|
||||
glig->SetFirstPoint(1);
|
||||
slin.Append(glig);
|
||||
//
|
||||
} //for (i=1; i<=2; ++i)
|
||||
} //else if (NbSol==2)
|
||||
}
|
||||
break;
|
||||
//modified by NIZNHY-PKV Wed Nov 30 12:56:10 2005t
|
||||
|
||||
case IntAna_Point : {
|
||||
gp_Pnt ptcontact;
|
||||
gp_Pnt apex1(Co1.Apex());
|
||||
gp_Pnt apex2(Co2.Apex());
|
||||
Standard_Real param1,param2;
|
||||
Standard_Real paramapex1 = ElCLib::LineParameter(Co1.Axis(),apex1);
|
||||
Standard_Real paramapex2 = ElCLib::LineParameter(Co2.Axis(),apex2);
|
||||
for (i=1; i <= NbSol; i++) {
|
||||
ptcontact = inter.Point(i);
|
||||
param1 = ElCLib::LineParameter(Co1.Axis(),ptcontact);
|
||||
param2 = ElCLib::LineParameter(Co2.Axis(),ptcontact);
|
||||
|
||||
Quad1.Parameters(ptcontact,U1,V1);
|
||||
Quad2.Parameters(ptcontact,U2,V2);
|
||||
|
||||
if (apex1.Distance(ptcontact) <= Tol &&
|
||||
apex2.Distance(ptcontact) <= Tol) {
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(ptcontact,Tol,Standard_False);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
else if (param1 >= paramapex1 && param2 >= paramapex2) {
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(ptcontact,Tol,Standard_True);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Circle:
|
||||
{
|
||||
Standard_Real para;
|
||||
IntPatch_Point aPtsol;
|
||||
gp_Vec Tgt;
|
||||
gp_Pnt ptref;
|
||||
for (i = 1; i <= NbSol; i++) {
|
||||
gp_Circ cirsol = inter.Circle(i);
|
||||
ElCLib::D1(0.,cirsol,ptref,Tgt);
|
||||
Standard_Real qwe=Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
|
||||
if(qwe> 0.00000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe<-0.00000001){
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
|
||||
if(inter.HasCommonGen()) {
|
||||
const gp_Pnt& aPChar = inter.PChar();
|
||||
Quad1.Parameters(aPChar, U1, V1);
|
||||
Quad2.Parameters(aPChar, U2, V2);
|
||||
aPtsol.SetValue(aPChar, Tol, Standard_False);
|
||||
aPtsol.SetParameters(U1, V1, U2, V2);
|
||||
para = ElCLib::Parameter(cirsol, aPChar);
|
||||
aPtsol.SetParameter(0.);
|
||||
glig->AddVertex(aPtsol);
|
||||
}
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IntAna_Ellipse:
|
||||
{
|
||||
Standard_Real para;
|
||||
IntPatch_Point aPtsol;
|
||||
gp_Elips elipsol = inter.Ellipse(1);
|
||||
|
||||
gp_Vec Tgt;
|
||||
gp_Pnt ptref;
|
||||
ElCLib::D1(0.,elipsol,ptref,Tgt);
|
||||
|
||||
Standard_Real qwe=Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
|
||||
if(qwe> 0.00000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe<-0.00000001) {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
|
||||
if(inter.HasCommonGen()) {
|
||||
const gp_Pnt& aPChar = inter.PChar();
|
||||
Quad1.Parameters(aPChar, U1, V1);
|
||||
Quad2.Parameters(aPChar, U2, V2);
|
||||
aPtsol.SetValue(aPChar, Tol, Standard_False);
|
||||
aPtsol.SetParameters(U1, V1, U2, V2);
|
||||
para = ElCLib::Parameter(elipsol, aPChar);
|
||||
aPtsol.SetParameter(0.);
|
||||
glig->AddVertex(aPtsol);
|
||||
}
|
||||
slin.Append(glig);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IntAna_Hyperbola:
|
||||
{
|
||||
Standard_Real para;
|
||||
IntPatch_Point aPtsol;
|
||||
gp_Vec Tgt;
|
||||
gp_Pnt ptref;
|
||||
for(i=1; i<=2; i++) {
|
||||
gp_Hypr hyprsol = inter.Hyperbola(i);
|
||||
ElCLib::D1(0.,hyprsol,ptref,Tgt);
|
||||
Standard_Real qwe=Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
|
||||
if(qwe> 0.00000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe<-0.00000001){
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(hyprsol,Standard_False,trans1,trans2);
|
||||
if(inter.HasCommonGen()) {
|
||||
const gp_Pnt& aPChar = inter.PChar();
|
||||
Quad1.Parameters(aPChar, U1, V1);
|
||||
Quad2.Parameters(aPChar, U2, V2);
|
||||
aPtsol.SetValue(aPChar, Tol, Standard_False);
|
||||
aPtsol.SetParameters(U1, V1, U2, V2);
|
||||
para = ElCLib::Parameter(hyprsol, aPChar);
|
||||
aPtsol.SetParameter(0.);
|
||||
glig->AddVertex(aPtsol);
|
||||
}
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Parabola:
|
||||
{
|
||||
Standard_Real para;
|
||||
IntPatch_Point aPtsol;
|
||||
gp_Parab parabsol = inter.Parabola(1);
|
||||
|
||||
gp_Vec Tgtorig(parabsol.YAxis().Direction());
|
||||
Standard_Real ptran = Tgtorig.DotCross(Quad2.Normale(parabsol.Location()),
|
||||
Quad1.Normale(parabsol.Location()));
|
||||
if (ptran >0.00000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if (ptran <-0.00000001) {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(parabsol,Standard_False,trans1,trans2);
|
||||
if(inter.HasCommonGen()) {
|
||||
const gp_Pnt& aPChar = inter.PChar();
|
||||
Quad1.Parameters(aPChar, U1, V1);
|
||||
Quad2.Parameters(aPChar, U2, V2);
|
||||
aPtsol.SetValue(aPChar, Tol, Standard_False);
|
||||
aPtsol.SetParameters(U1, V1, U2, V2);
|
||||
para = ElCLib::Parameter(parabsol, aPChar);
|
||||
aPtsol.SetParameter(0.);
|
||||
glig->AddVertex(aPtsol);
|
||||
}
|
||||
slin.Append(glig);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IntAna_NoGeometricSolution:
|
||||
{
|
||||
gp_Pnt psol;
|
||||
IntAna_IntQuadQuad anaint(Co1,Co2,Tol);
|
||||
if (!anaint.IsDone()) {
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (anaint.NbPnt() == 0 && anaint.NbCurve() == 0) {
|
||||
Empty = Standard_True;
|
||||
}
|
||||
else {
|
||||
NbSol = anaint.NbPnt();
|
||||
for (i = 1; i <= NbSol; i++) {
|
||||
psol = anaint.Point(i);
|
||||
Quad1.Parameters(psol,U1,V1);
|
||||
Quad2.Parameters(psol,U2,V2);
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(psol,Tol,Standard_True);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
|
||||
gp_Pnt ptvalid, ptf, ptl;
|
||||
gp_Vec tgvalid;
|
||||
|
||||
Standard_Real first,last,para;
|
||||
Standard_Boolean tgfound,firstp,lastp,kept;
|
||||
Standard_Integer kount;
|
||||
|
||||
NbSol = anaint.NbCurve();
|
||||
for (i = 1; i <= NbSol; i++) {
|
||||
Handle(IntPatch_ALine) alig;
|
||||
kept = Standard_False;
|
||||
IntAna_Curve curvsol = anaint.Curve(i);
|
||||
curvsol.Domain(first,last);
|
||||
firstp = !curvsol.IsFirstOpen();
|
||||
lastp = !curvsol.IsLastOpen();
|
||||
if (firstp) {
|
||||
ptf = curvsol.Value(first);
|
||||
}
|
||||
if (lastp) {
|
||||
ptl = curvsol.Value(last);
|
||||
}
|
||||
para = last;
|
||||
kount = 1;
|
||||
tgfound = Standard_False;
|
||||
|
||||
while (!tgfound) {
|
||||
para = (1.123*first + para)/2.123;
|
||||
tgfound = curvsol.D1u(para,ptvalid,tgvalid);
|
||||
if(tgvalid.SquareMagnitude() < 1e-14) {
|
||||
//-- on se trouve ds un cas ou les normales n'auront pas de sens
|
||||
tgfound = Standard_False;
|
||||
}
|
||||
|
||||
if (!tgfound) {
|
||||
kount ++;
|
||||
tgfound = kount > 5;
|
||||
}
|
||||
}
|
||||
if (kount <= 5) {
|
||||
Standard_Real qwe= tgvalid.DotCross(Quad2.Normale(ptvalid),
|
||||
Quad1.Normale(ptvalid));
|
||||
if(qwe > 0.000000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe < -0.000000001) {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
alig = new IntPatch_ALine(curvsol,Standard_False,trans1,trans2);
|
||||
kept = Standard_True;
|
||||
}
|
||||
else {
|
||||
ptvalid = curvsol.Value(para);
|
||||
alig = new IntPatch_ALine(curvsol,Standard_False);
|
||||
kept = Standard_True;
|
||||
//-- cout << "Transition indeterminee" << endl;
|
||||
}
|
||||
if (kept) {
|
||||
Standard_Boolean Nfirstp = !firstp;
|
||||
Standard_Boolean Nlastp = !lastp;
|
||||
ProcessBounds(alig,slin,Quad1,Quad2,Nfirstp,ptf,first,
|
||||
Nlastp,ptl,last,Multpoint,Tol);
|
||||
slin.Append(alig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
//When two cones have common generatrix passing trough apexes
|
||||
//it is necessary to add it is solution
|
||||
if(inter.HasCommonGen()) {
|
||||
Standard_Real para;
|
||||
IntPatch_Point aPtsol;
|
||||
gp_Pnt aPApex1, aPApex2;
|
||||
aPApex1=Co1.Apex();
|
||||
aPApex2=Co2.Apex();
|
||||
//common generatrix of cones
|
||||
gce_MakeLin aMkLin(aPApex1, aPApex2);
|
||||
const gp_Lin& linsol = aMkLin.Value();
|
||||
Handle(IntPatch_GLine) glig =
|
||||
new IntPatch_GLine(linsol,Standard_True,IntSurf_Undecided,IntSurf_Undecided);
|
||||
|
||||
const gp_Pnt& aPChar = inter.PChar();
|
||||
Quad1.Parameters(aPChar, U1, V1);
|
||||
Quad2.Parameters(aPChar, U2, V2);
|
||||
aPtsol.SetValue(aPChar, Tol, Standard_False);
|
||||
aPtsol.SetParameters(U1, V1, U2, V2);
|
||||
para = ElCLib::Parameter(linsol, aPChar);
|
||||
aPtsol.SetParameter(para);
|
||||
glig->AddVertex(aPtsol);
|
||||
|
||||
slin.Append(glig);
|
||||
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IntCoSp
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntCoSp(const IntSurf_Quadric& Quad1,
|
||||
const IntSurf_Quadric& Quad2,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean Reversed,
|
||||
Standard_Boolean& Empty,
|
||||
Standard_Boolean& Multpoint,
|
||||
IntPatch_SequenceOfLine& slin,
|
||||
IntPatch_SequenceOfPoint& spnt)
|
||||
|
||||
{
|
||||
|
||||
Standard_Integer i;
|
||||
|
||||
IntSurf_TypeTrans trans1,trans2;
|
||||
IntAna_ResultType typint;
|
||||
|
||||
gp_Sphere Sp;
|
||||
gp_Cone Co;
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
|
||||
if (!Reversed) {
|
||||
Co = Quad1.Cone();
|
||||
Sp = Quad2.Sphere();
|
||||
}
|
||||
else {
|
||||
Co = Quad2.Cone();
|
||||
Sp = Quad1.Sphere();
|
||||
}
|
||||
IntAna_QuadQuadGeo inter(Sp,Co,Tol);
|
||||
|
||||
if (!inter.IsDone()) {return Standard_False;}
|
||||
|
||||
typint = inter.TypeInter();
|
||||
Standard_Integer NbSol = inter.NbSolutions();
|
||||
Empty = Standard_False;
|
||||
|
||||
switch (typint) {
|
||||
|
||||
case IntAna_Empty :
|
||||
{
|
||||
Empty = Standard_True;
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Point :
|
||||
{
|
||||
gp_Pnt ptcontact;
|
||||
gp_Pnt apex(Co.Apex());
|
||||
Standard_Real param;
|
||||
Standard_Real paramapex = ElCLib::LineParameter(Co.Axis(),apex);
|
||||
for (i=1; i <= NbSol; i++) {
|
||||
ptcontact = inter.Point(i);
|
||||
param = ElCLib::LineParameter(Co.Axis(),ptcontact);
|
||||
Quad1.Parameters(ptcontact,U1,V1);
|
||||
Quad2.Parameters(ptcontact,U2,V2);
|
||||
|
||||
if (apex.Distance(ptcontact) <= Tol) {
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(ptcontact,Tol,Standard_False);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
else if (param >= paramapex) {
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(ptcontact,Tol,Standard_True);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Circle:
|
||||
{
|
||||
gp_Vec Tgt;
|
||||
gp_Pnt ptref;
|
||||
#ifndef DEB
|
||||
Co.Apex();
|
||||
#else
|
||||
gp_Pnt apex(Co.Apex());
|
||||
//Standard_Real param;
|
||||
Standard_Real paramapex = ElCLib::LineParameter(Co.Axis(),apex);
|
||||
#endif
|
||||
|
||||
for (i=1; i<=NbSol; i++) {
|
||||
gp_Circ cirsol = inter.Circle(i);
|
||||
//-- param = ElCLib::LineParameter(Co.Axis(),
|
||||
//-- cirsol.Location());
|
||||
//-- if (param >= paramapex) {
|
||||
|
||||
ElCLib::D1(0.,cirsol,ptref,Tgt);
|
||||
Standard_Real qwe = Tgt.DotCross(Quad2.Normale(ptref),
|
||||
Quad1.Normale(ptref));
|
||||
if(qwe> 0.00000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe< -0.00000001) {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
//-- }
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_PointAndCircle:
|
||||
{
|
||||
gp_Vec Tgt;
|
||||
gp_Pnt ptref;
|
||||
gp_Pnt apex(Co.Apex());
|
||||
Standard_Real param;
|
||||
Standard_Real paramapex = ElCLib::LineParameter(Co.Axis(),apex);
|
||||
|
||||
// le point est necessairement l apex
|
||||
Quad1.Parameters(apex,U1,V1);
|
||||
Quad2.Parameters(apex,U2,V2);
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(apex,Tol,Standard_False);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
|
||||
gp_Circ cirsol = inter.Circle(1);
|
||||
param = ElCLib::LineParameter(Co.Axis(),
|
||||
cirsol.Location());
|
||||
if (param >= paramapex) {
|
||||
|
||||
ElCLib::D1(0.,cirsol,ptref,Tgt);
|
||||
Standard_Real qwe = Tgt.DotCross(Quad2.Normale(ptref),
|
||||
Quad1.Normale(ptref));
|
||||
if(qwe> 0.000000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe< -0.000000001){
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_NoGeometricSolution:
|
||||
{
|
||||
gp_Pnt psol;
|
||||
IntAna_IntQuadQuad anaint(Co,Sp,Tol);
|
||||
if (!anaint.IsDone()) {
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (anaint.NbPnt()==0 && anaint.NbCurve()==0) {
|
||||
Empty = Standard_True;
|
||||
}
|
||||
else {
|
||||
NbSol = anaint.NbPnt();
|
||||
for (i = 1; i <= NbSol; i++) {
|
||||
psol = anaint.Point(i);
|
||||
Quad1.Parameters(psol,U1,V1);
|
||||
Quad2.Parameters(psol,U2,V2);
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(psol,Tol,Standard_True);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
|
||||
gp_Pnt ptvalid, ptf, ptl;
|
||||
gp_Vec tgvalid;
|
||||
#ifdef DEB
|
||||
Standard_Real paramapex =
|
||||
#endif
|
||||
ElCLib::LineParameter(Co.Axis(),
|
||||
Co.Apex());
|
||||
Standard_Real first,last,para;
|
||||
Standard_Boolean tgfound,firstp,lastp,kept;
|
||||
Standard_Integer kount;
|
||||
|
||||
NbSol = anaint.NbCurve();
|
||||
for (i = 1; i <= NbSol; i++) {
|
||||
Handle(IntPatch_ALine) alig;
|
||||
kept = Standard_False;
|
||||
IntAna_Curve curvsol = anaint.Curve(i);
|
||||
curvsol.Domain(first,last);
|
||||
firstp = !curvsol.IsFirstOpen();
|
||||
lastp = !curvsol.IsLastOpen();
|
||||
if (firstp) {
|
||||
ptf = curvsol.Value(first);
|
||||
}
|
||||
if (lastp) {
|
||||
ptl = curvsol.Value(last);
|
||||
}
|
||||
para = last;
|
||||
kount = 1;
|
||||
tgfound = Standard_False;
|
||||
|
||||
while (!tgfound) {
|
||||
para = (1.123*first + para)/2.123;
|
||||
tgfound = curvsol.D1u(para,ptvalid,tgvalid);
|
||||
if (!tgfound) {
|
||||
kount ++;
|
||||
tgfound = kount > 5;
|
||||
}
|
||||
}
|
||||
if (kount <= 5) {
|
||||
para = ElCLib::LineParameter(Co.Axis(),ptvalid);
|
||||
Standard_Real qwe = tgvalid.DotCross(Quad2.Normale(ptvalid),
|
||||
Quad1.Normale(ptvalid));
|
||||
if(qwe> 0.000000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe<-0.000000001) {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
alig = new IntPatch_ALine(curvsol,Standard_False,trans1,trans2);
|
||||
kept = Standard_True;
|
||||
}
|
||||
else {
|
||||
ptvalid = curvsol.Value(para);
|
||||
para = ElCLib::LineParameter(Co.Axis(),ptvalid);
|
||||
alig = new IntPatch_ALine(curvsol,Standard_False);
|
||||
kept = Standard_True;
|
||||
//-- cout << "Transition indeterminee" << endl;
|
||||
}
|
||||
if (kept) {
|
||||
Standard_Boolean Nfirstp = !firstp;
|
||||
Standard_Boolean Nlastp = !lastp;
|
||||
ProcessBounds(alig,slin,Quad1,Quad2,Nfirstp,ptf,first,
|
||||
Nlastp,ptl,last,Multpoint,Tol);
|
||||
slin.Append(alig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IntSpSp
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntSpSp(const IntSurf_Quadric& Quad1,
|
||||
const IntSurf_Quadric& Quad2,
|
||||
const Standard_Real Tol,
|
||||
Standard_Boolean& Empty,
|
||||
Standard_Boolean& Same,
|
||||
IntPatch_SequenceOfLine& slin,
|
||||
IntPatch_SequenceOfPoint& spnt)
|
||||
|
||||
// Traitement du cas Sphere/Sphere
|
||||
|
||||
{
|
||||
IntSurf_TypeTrans trans1,trans2;
|
||||
IntAna_ResultType typint;
|
||||
gp_Sphere sph1(Quad1.Sphere());
|
||||
gp_Sphere sph2(Quad2.Sphere());
|
||||
|
||||
IntAna_QuadQuadGeo inter(sph1,sph2,Tol);
|
||||
if (!inter.IsDone()) {return Standard_False;}
|
||||
|
||||
typint = inter.TypeInter();
|
||||
Empty = Standard_False;
|
||||
Same = Standard_False;
|
||||
|
||||
switch (typint) {
|
||||
|
||||
case IntAna_Empty :
|
||||
{
|
||||
Empty = Standard_True;
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Same:
|
||||
{
|
||||
Same = Standard_True;
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Point:
|
||||
{
|
||||
gp_Pnt psol(inter.Point(1));
|
||||
Standard_Real U1,V1,U2,V2;
|
||||
Quad1.Parameters(psol,U1,V1);
|
||||
Quad2.Parameters(psol,U2,V2);
|
||||
IntPatch_Point ptsol;
|
||||
ptsol.SetValue(psol,Tol,Standard_True);
|
||||
ptsol.SetParameters(U1,V1,U2,V2);
|
||||
spnt.Append(ptsol);
|
||||
}
|
||||
break;
|
||||
|
||||
case IntAna_Circle:
|
||||
{
|
||||
gp_Circ cirsol = inter.Circle(1);
|
||||
gp_Pnt ptref;
|
||||
gp_Vec Tgt;
|
||||
ElCLib::D1(0.,cirsol,ptref,Tgt);
|
||||
|
||||
Standard_Real qwe=Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
|
||||
if(qwe>0.00000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe<-0.00000001) {
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
return Standard_False; // on ne doit pas passer ici
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
155
src/IntPatch/IntPatch_ImpPrmIntersection.cdl
Executable file
155
src/IntPatch/IntPatch_ImpPrmIntersection.cdl
Executable file
@@ -0,0 +1,155 @@
|
||||
-- File: IntPatch_ImpPrmIntersection.cdl
|
||||
-- Created: Thu May 7 08:47:45 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class ImpPrmIntersection from IntPatch
|
||||
|
||||
---Purpose: Implementation of the intersection between a natural
|
||||
-- quadric patch : Plane, Cone, Cylinder or Sphere and
|
||||
-- a bi-parametrised surface.
|
||||
|
||||
uses
|
||||
TheSearchInside from IntPatch,
|
||||
HSurface from Adaptor3d,
|
||||
TopolTool from Adaptor3d,
|
||||
Point from IntPatch,
|
||||
SequenceOfPoint from IntPatch,
|
||||
TheSOnBounds from IntPatch,
|
||||
SequenceOfLine from IntPatch,
|
||||
Line from IntPatch,
|
||||
PathPointTool from IntSurf,
|
||||
SequenceOfPathPoint from IntSurf,
|
||||
Quadric from IntSurf,
|
||||
QuadricTool from IntSurf,
|
||||
InteriorPoint from IntSurf,
|
||||
InteriorPointTool from IntSurf
|
||||
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard,
|
||||
DomainError from Standard,
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create
|
||||
|
||||
returns ImpPrmIntersection from IntPatch;
|
||||
|
||||
|
||||
Create(Surf1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
Surf2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang,Fleche,Pas: Real from Standard)
|
||||
|
||||
returns ImpPrmIntersection from IntPatch
|
||||
raises ConstructionError from Standard;
|
||||
|
||||
|
||||
SetStartPoint(me: in out; U,V: Real from Standard)
|
||||
---Purpose: to search for solution from the given point
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
Surf1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
Surf2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang,Fleche,Pas: Real from Standard)
|
||||
|
||||
raises ConstructionError from Standard
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns true if the calculus was succesfull.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsEmpty(me)
|
||||
|
||||
---Purpose: Returns true if the is no intersection.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbPnts(me)
|
||||
|
||||
---Purpose: Returns the number of "single" points.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point of range Index.
|
||||
-- An exception is raised if Index<=0 or Index>NbPnt.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbLines(me)
|
||||
|
||||
---Purpose: Returns the number of intersection lines.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Line(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the line of range Index.
|
||||
-- An exception is raised if Index<=0 or Index>NbLine.
|
||||
|
||||
returns Line from IntPatch
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
empt : Boolean from Standard;
|
||||
spnt : SequenceOfPoint from IntPatch;
|
||||
slin : SequenceOfLine from IntPatch;
|
||||
solrst : TheSOnBounds from IntPatch;
|
||||
solins : TheSearchInside from IntPatch;
|
||||
-- iwalk : TheIWalking from IntPatch;
|
||||
myIsStartPnt: Boolean from Standard;
|
||||
myUStart : Real from Standard;
|
||||
myVStart : Real from Standard;
|
||||
|
||||
end ImpPrmIntersection;
|
2493
src/IntPatch/IntPatch_ImpPrmIntersection.cxx
Executable file
2493
src/IntPatch/IntPatch_ImpPrmIntersection.cxx
Executable file
File diff suppressed because it is too large
Load Diff
42
src/IntPatch/IntPatch_ImpPrmIntersection.lxx
Executable file
42
src/IntPatch/IntPatch_ImpPrmIntersection.lxx
Executable file
@@ -0,0 +1,42 @@
|
||||
// File: IntPatch_ImpPrmIntersection.lxx
|
||||
// Created: Thu May 7 08:47:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: Matra Datavision 1992
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <IntPatch_Line.hxx>
|
||||
|
||||
inline Standard_Boolean IntPatch_ImpPrmIntersection::IsDone () const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_ImpPrmIntersection::IsEmpty () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return empt;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_ImpPrmIntersection::NbPnts () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return spnt.Length();
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_ImpPrmIntersection::Point (const Standard_Integer Index) const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return spnt(Index);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_ImpPrmIntersection::NbLines () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return slin.Length();
|
||||
}
|
||||
|
||||
inline const Handle(IntPatch_Line)& IntPatch_ImpPrmIntersection::Line (const Standard_Integer Index) const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return slin(Index);
|
||||
}
|
256
src/IntPatch/IntPatch_Intersection.cdl
Executable file
256
src/IntPatch/IntPatch_Intersection.cdl
Executable file
@@ -0,0 +1,256 @@
|
||||
-- File: IntPatch_Intersection.cdl
|
||||
-- Created: Thu Jan 21 16:40:38 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: OPEN CASCADE 1993
|
||||
|
||||
|
||||
class Intersection from IntPatch
|
||||
|
||||
---Purpose: This class provides a generic algorithm to intersect
|
||||
-- 2 surfaces.
|
||||
|
||||
uses
|
||||
HVertex from Adaptor3d,
|
||||
HCurve2d from Adaptor2d,
|
||||
HSurface from Adaptor3d,
|
||||
Point from IntPatch,
|
||||
SequenceOfPoint from IntPatch,
|
||||
TopolTool from Adaptor3d,
|
||||
SequenceOfLine from IntPatch,
|
||||
Line from IntPatch,
|
||||
--amv
|
||||
ListOfPntOn2S from IntSurf
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard,
|
||||
DomainError from Standard,
|
||||
ConstructionError from Standard
|
||||
|
||||
is
|
||||
Create
|
||||
|
||||
returns Intersection from IntPatch;
|
||||
|
||||
|
||||
Create (S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang: Real from Standard)
|
||||
|
||||
returns Intersection from IntPatch
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
|
||||
Create (S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang: Real from Standard)
|
||||
|
||||
returns Intersection from IntPatch
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
|
||||
|
||||
SetTolerances(me : in out;
|
||||
TolArc : Real from Standard;
|
||||
TolTang : Real from Standard;
|
||||
UVMaxStep: Real from Standard;
|
||||
Fleche : Real from Standard)
|
||||
|
||||
---Purpose: Set the tolerances used by the algorithms:
|
||||
-- --- Implicit - Parametric
|
||||
-- --- Parametric - Parametric
|
||||
-- --- Implicit - Implicit
|
||||
--
|
||||
-- TolArc is used to compute the intersections
|
||||
-- between the restrictions of a surface and a
|
||||
-- walking line.
|
||||
--
|
||||
-- TolTang is used to compute the points on a walking
|
||||
-- line, and in geometric algorithms.
|
||||
--
|
||||
-- Fleche is a parameter used in the walking
|
||||
-- algorithms to provide small curvatures on a line.
|
||||
--
|
||||
-- UVMaxStep is a parameter used in the walking
|
||||
-- algorithms to compute the distance between to
|
||||
-- points in their respective parametrtic spaces.
|
||||
--
|
||||
is static;
|
||||
|
||||
Perform (me: in out;
|
||||
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang: Real from Standard)
|
||||
|
||||
raises ConstructionError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
--amv
|
||||
Perform (me: in out;
|
||||
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang: Real from Standard;
|
||||
LOfPnts: in out ListOfPntOn2S from IntSurf;
|
||||
RestrictLine: Boolean from Standard = Standard_True)
|
||||
|
||||
raises ConstructionError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
Perform (me: in out;
|
||||
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d;
|
||||
U1,V1,U2,V2 : Real from Standard;
|
||||
TolArc,TolTang: Real from Standard)
|
||||
|
||||
raises ConstructionError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
Perform (me: in out;
|
||||
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
TolArc,TolTang: Real from Standard)
|
||||
|
||||
raises ConstructionError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns True if the calculus was succesfull.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsEmpty(me)
|
||||
|
||||
---Purpose: Returns true if the is no intersection.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TangentFaces(me)
|
||||
|
||||
---Purpose: Returns True if the two patches are considered as
|
||||
-- entierly tangent, i-e every restriction arc of one
|
||||
-- patch is inside the geometric base of the other patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
OppositeFaces(me)
|
||||
|
||||
---Purpose: Returns True when the TangentFaces returns True and the
|
||||
-- normal vectors evaluated at a point on the first and the
|
||||
-- second surface are opposite.
|
||||
-- The exception DomainError is raised if TangentFaces
|
||||
-- returns False.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbPnts(me)
|
||||
|
||||
---Purpose: Returns the number of "single" points.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point of range Index.
|
||||
-- An exception is raised if Index<=0 or Index>NbPnt.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbLines(me)
|
||||
|
||||
---Purpose: Returns the number of intersection lines.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Line(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the line of range Index.
|
||||
-- An exception is raised if Index<=0 or Index>NbLine.
|
||||
|
||||
returns Line from IntPatch
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
SequenceOfLine(me)
|
||||
returns SequenceOfLine from IntPatch
|
||||
---C++: return const&
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
Dump(me; Mode: Integer from Standard;
|
||||
S1: HSurface from Adaptor3d; D1: TopolTool from Adaptor3d;
|
||||
S2: HSurface from Adaptor3d; D2: TopolTool from Adaptor3d)
|
||||
---Purpose: Dump of each result line.
|
||||
--- Mode for more accurate dumps.
|
||||
--
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
empt : Boolean from Standard;
|
||||
tgte : Boolean from Standard;
|
||||
oppo : Boolean from Standard;
|
||||
spnt : SequenceOfPoint from IntPatch;
|
||||
slin : SequenceOfLine from IntPatch;
|
||||
myTolArc : Real from Standard;
|
||||
myTolTang : Real from Standard;
|
||||
myUVMaxStep: Real from Standard;
|
||||
myFleche : Real from Standard;
|
||||
myIsStartPnt: Boolean from Standard;
|
||||
myU1Start : Real from Standard;
|
||||
myV1Start : Real from Standard;
|
||||
myU2Start : Real from Standard;
|
||||
myV2Start : Real from Standard;
|
||||
|
||||
end Intersection;
|
1586
src/IntPatch/IntPatch_Intersection.cxx
Executable file
1586
src/IntPatch/IntPatch_Intersection.cxx
Executable file
File diff suppressed because it is too large
Load Diff
56
src/IntPatch/IntPatch_Intersection.lxx
Executable file
56
src/IntPatch/IntPatch_Intersection.lxx
Executable file
@@ -0,0 +1,56 @@
|
||||
// File : IntPatch_Intersection.lxx
|
||||
// Created : Wed Jui 7 18:00:00 1993
|
||||
// Author : Modelization
|
||||
// Copyright : OPEN CASCADE 1993
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <IntPatch_Line.hxx>
|
||||
|
||||
inline Standard_Boolean IntPatch_Intersection::IsDone () const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_Intersection::IsEmpty () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return empt;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_Intersection::TangentFaces () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return tgte;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_Intersection::OppositeFaces () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
if (!tgte) {Standard_DomainError::Raise();}
|
||||
return oppo;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_Intersection::NbPnts () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return spnt.Length();
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_Intersection::Point (const Standard_Integer Index) const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return spnt(Index);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_Intersection::NbLines () const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return slin.Length();
|
||||
}
|
||||
|
||||
inline const Handle(IntPatch_Line)& IntPatch_Intersection::Line (const Standard_Integer Index) const
|
||||
{
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return slin(Index);
|
||||
}
|
217
src/IntPatch/IntPatch_Line.cdl
Executable file
217
src/IntPatch/IntPatch_Line.cdl
Executable file
@@ -0,0 +1,217 @@
|
||||
-- File: Line.cdl
|
||||
-- Created: Wed May 6 15:54:48 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
|
||||
deferred class Line from IntPatch
|
||||
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose: Definition of an intersection line between two
|
||||
-- surfaces.
|
||||
-- A line may be either geometric : line, circle, ellipse,
|
||||
-- parabola, hyperbola, as defined in the class GLine,
|
||||
-- or analytic, as defined in the class ALine, or defined
|
||||
-- by a set of points (coming from a walking algorithm) as
|
||||
-- defined in the class WLine.
|
||||
|
||||
|
||||
uses TypeTrans from IntSurf,
|
||||
Situation from IntSurf,
|
||||
IType from IntPatch,
|
||||
Lin from gp,
|
||||
Circ from gp,
|
||||
Parab from gp,
|
||||
Elips from gp,
|
||||
Hypr from gp,
|
||||
Pnt from gp,
|
||||
Vec from gp
|
||||
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
|
||||
is
|
||||
|
||||
Initialize(Tang: Boolean from Standard;
|
||||
Trans1,Trans2: TypeTrans from IntSurf);
|
||||
|
||||
---Purpose: To initialize the fields, when the transitions
|
||||
-- are In or Out.
|
||||
|
||||
|
||||
Initialize(Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf);
|
||||
|
||||
---Purpose: To initialize the fields, when the transitions
|
||||
-- are Touch.
|
||||
|
||||
|
||||
Initialize(Tang: Boolean from Standard);
|
||||
|
||||
---Purpose: To initialize the fields, when the transitions
|
||||
-- are Undecided.
|
||||
|
||||
|
||||
SetValue(me: mutable; Uiso1,Viso1,Uiso2,Viso2: Boolean from Standard)
|
||||
|
||||
---Purpose: To set the values returned by IsUIsoS1,....
|
||||
-- The default values are False.
|
||||
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ArcType (me)
|
||||
|
||||
---Purpose: Returns the type of geometry 3d (Line, Circle, Parabola,
|
||||
-- Hyperbola, Ellipse, Analytic, Walking, Restriction)
|
||||
|
||||
returns IType from IntPatch
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsTangent(me)
|
||||
|
||||
---Purpose: Returns TRUE if the intersection is a line of tangency
|
||||
-- between the 2 patches.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TransitionOnS1(me)
|
||||
|
||||
---Purpose: Returns the type of the transition of the line
|
||||
-- for the first surface. The transition is "constant"
|
||||
-- along the line.
|
||||
-- The transition is IN if the line is oriented in such
|
||||
-- a way that the system of vector (N1,N2,T) is right-handed,
|
||||
-- where N1 is the normal to the first surface at a point P,
|
||||
-- N2 is the normal to the second surface at a point P,
|
||||
-- T is the tangent to the intersection line at P.
|
||||
-- If the system of vector is left-handed, the transition
|
||||
-- is OUT.
|
||||
-- When N1 and N2 are colinear all along the intersection
|
||||
-- line, the transition will be
|
||||
-- - TOUCH, if it is possible to use the 2nd derivatives
|
||||
-- to determine the position of one surafce compared
|
||||
-- to the other (see Situation)
|
||||
-- - UNDECIDED otherwise.
|
||||
--
|
||||
-- If one of the transition is TOUCH or UNDECIDED, the other
|
||||
-- one has got the same value.
|
||||
|
||||
returns TypeTrans from IntSurf
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TransitionOnS2(me)
|
||||
|
||||
---Purpose: Returns the type of the transition of the line
|
||||
-- for the second surface. The transition is "constant"
|
||||
-- along the line.
|
||||
|
||||
returns TypeTrans from IntSurf
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SituationS1(me)
|
||||
|
||||
---Purpose: Returns the situation (INSIDE/OUTSIDE/UNKNOWN) of
|
||||
-- the first patch compared to the second one, when
|
||||
-- TransitionOnS1 or TransitionOnS2 returns TOUCH.
|
||||
-- Otherwise, an exception is raised.
|
||||
|
||||
returns Situation from IntSurf
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SituationS2(me)
|
||||
|
||||
---Purpose: Returns the situation (INSIDE/OUTSIDE/UNKNOWN) of
|
||||
-- the second patch compared to the first one, when
|
||||
-- TransitionOnS1 or TransitionOnS2 returns TOUCH.
|
||||
-- Otherwise, an exception is raised.
|
||||
|
||||
returns Situation from IntSurf
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsUIsoOnS1(me)
|
||||
|
||||
---Purpose: Returns TRUE if the intersection is a U isoparametric curve
|
||||
-- on the first patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsVIsoOnS1(me)
|
||||
|
||||
---Purpose: Returns TRUE if the intersection is a V isoparametric curve
|
||||
-- on the first patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsUIsoOnS2(me)
|
||||
|
||||
---Purpose: Returns TRUE if the intersection is a U isoparametric curve
|
||||
-- on the second patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsVIsoOnS2(me)
|
||||
|
||||
---Purpose: Returns TRUE if the intersection is a V isoparametric curve
|
||||
-- on the second patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
typ : IType from IntPatch is protected;
|
||||
tg : Boolean from Standard;
|
||||
tS1 : TypeTrans from IntSurf;
|
||||
tS2 : TypeTrans from IntSurf;
|
||||
sit1 : Situation from IntSurf;
|
||||
sit2 : Situation from IntSurf;
|
||||
uS1 : Boolean from Standard;
|
||||
vS1 : Boolean from Standard;
|
||||
uS2 : Boolean from Standard;
|
||||
vS2 : Boolean from Standard;
|
||||
|
||||
end Line;
|
32
src/IntPatch/IntPatch_Line.cxx
Executable file
32
src/IntPatch/IntPatch_Line.cxx
Executable file
@@ -0,0 +1,32 @@
|
||||
#include <IntPatch_Line.ixx>
|
||||
|
||||
|
||||
IntPatch_Line::IntPatch_Line (const Standard_Boolean Tang,
|
||||
const IntSurf_TypeTrans Trans1,
|
||||
const IntSurf_TypeTrans Trans2):
|
||||
tg(Tang),
|
||||
tS1(Trans1),tS2(Trans2),
|
||||
sit1(IntSurf_Unknown),sit2(IntSurf_Unknown),
|
||||
uS1(Standard_False),vS1(Standard_False),
|
||||
uS2(Standard_False),vS2(Standard_False)
|
||||
{}
|
||||
|
||||
IntPatch_Line::IntPatch_Line (const Standard_Boolean Tang,
|
||||
const IntSurf_Situation Situ1,
|
||||
const IntSurf_Situation Situ2):
|
||||
tg(Tang),
|
||||
tS1(IntSurf_Touch),tS2(IntSurf_Touch),
|
||||
sit1(Situ1),sit2(Situ2),
|
||||
uS1(Standard_False),vS1(Standard_False),
|
||||
uS2(Standard_False),vS2(Standard_False)
|
||||
{}
|
||||
|
||||
IntPatch_Line::IntPatch_Line (const Standard_Boolean Tang):
|
||||
tg(Tang),
|
||||
tS1(IntSurf_Undecided),tS2(IntSurf_Undecided),
|
||||
sit1(IntSurf_Unknown),sit2(IntSurf_Unknown),
|
||||
uS1(Standard_False),vS1(Standard_False),
|
||||
uS2(Standard_False),vS2(Standard_False)
|
||||
{}
|
||||
|
||||
|
73
src/IntPatch/IntPatch_Line.lxx
Executable file
73
src/IntPatch/IntPatch_Line.lxx
Executable file
@@ -0,0 +1,73 @@
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
|
||||
inline void IntPatch_Line::SetValue (const Standard_Boolean Uiso1,
|
||||
const Standard_Boolean Viso1,
|
||||
const Standard_Boolean Uiso2,
|
||||
const Standard_Boolean Viso2) {
|
||||
uS1 = Uiso1;
|
||||
vS1 = Viso1;
|
||||
uS2 = Uiso2;
|
||||
vS2 = Viso2;
|
||||
}
|
||||
|
||||
|
||||
inline IntPatch_IType IntPatch_Line::ArcType () const {
|
||||
return typ;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_Line::IsTangent () const {
|
||||
|
||||
return tg;
|
||||
}
|
||||
|
||||
|
||||
inline IntSurf_TypeTrans IntPatch_Line::TransitionOnS1 () const {
|
||||
|
||||
return tS1;
|
||||
}
|
||||
|
||||
|
||||
inline IntSurf_TypeTrans IntPatch_Line::TransitionOnS2 () const {
|
||||
|
||||
return tS2;
|
||||
}
|
||||
|
||||
|
||||
inline IntSurf_Situation IntPatch_Line::SituationS1 () const {
|
||||
|
||||
if (tS1 != IntSurf_Touch) {Standard_DomainError::Raise();}
|
||||
return sit1;
|
||||
}
|
||||
|
||||
|
||||
inline IntSurf_Situation IntPatch_Line::SituationS2 () const {
|
||||
|
||||
if (tS2 != IntSurf_Touch) {Standard_DomainError::Raise();}
|
||||
return sit2;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Line::IsUIsoOnS1 () const {
|
||||
|
||||
return uS1;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Line::IsVIsoOnS1 () const {
|
||||
|
||||
return vS1;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Line::IsUIsoOnS2 () const {
|
||||
|
||||
return uS2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Line::IsVIsoOnS2 () const {
|
||||
|
||||
return vS2;
|
||||
}
|
69
src/IntPatch/IntPatch_LineConstructor.cdl
Executable file
69
src/IntPatch/IntPatch_LineConstructor.cdl
Executable file
@@ -0,0 +1,69 @@
|
||||
-- File: IntPatch_LineConstructor.cdl
|
||||
-- Created: Thu Nov 7 10:32:26 1996
|
||||
-- Author: Laurent BUCHARD
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class LineConstructor from IntPatch
|
||||
|
||||
---Purpose: The intersections algorithms compute the intersection
|
||||
-- on two surfaces and return the intersections lines as
|
||||
-- IntPatch_Line.
|
||||
|
||||
-- a IntPatch Line contains a geometrical part and
|
||||
-- several topological informations (the intersections
|
||||
-- between the intersection curve and the restrictions of
|
||||
-- the faces.)
|
||||
--
|
||||
-- The LineConstructor algorithm takes an IntPatch_Line
|
||||
-- and compute on this object the sections which belong
|
||||
-- to the two faces (which are inside the restrictions
|
||||
-- of the faces)
|
||||
--
|
||||
|
||||
uses
|
||||
HSurface from Adaptor3d,
|
||||
TopolTool from Adaptor3d,
|
||||
SequenceOfLine from IntPatch,
|
||||
Line from IntPatch,
|
||||
SurfaceType from GeomAbs
|
||||
|
||||
is
|
||||
|
||||
Create(mode : Integer from Standard)
|
||||
|
||||
|
||||
--Purpose: ***** THE ONLY MODE SUPPORTED IS MODE=2 *****
|
||||
--Purpose: mode = 0 .... Nothing is done
|
||||
--
|
||||
-- mode = 1 .... Only cuts the line.
|
||||
--
|
||||
-- mode = 2 .... Cuts the line and keep the valid lines
|
||||
--
|
||||
returns LineConstructor from IntPatch;
|
||||
|
||||
Perform(me: in out;
|
||||
SL : SequenceOfLine from IntPatch;
|
||||
L : Line from IntPatch;
|
||||
S1 : HSurface from Adaptor3d;
|
||||
D1 : TopolTool from Adaptor3d;
|
||||
S2 : HSurface from Adaptor3d;
|
||||
D2 : TopolTool from Adaptor3d;
|
||||
Tol: Real from Standard)
|
||||
is static;
|
||||
|
||||
NbLines(me)
|
||||
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
|
||||
Line(me; index: Integer from Standard)
|
||||
|
||||
returns Line from IntPatch
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
slin : SequenceOfLine from IntPatch;
|
||||
|
||||
end LineConstructor;
|
1719
src/IntPatch/IntPatch_LineConstructor.cxx
Executable file
1719
src/IntPatch/IntPatch_LineConstructor.cxx
Executable file
File diff suppressed because it is too large
Load Diff
437
src/IntPatch/IntPatch_Point.cdl
Executable file
437
src/IntPatch/IntPatch_Point.cdl
Executable file
@@ -0,0 +1,437 @@
|
||||
-- File: IntPatch_Point.cdl
|
||||
-- Created: Wed May 6 14:01:12 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: OPEN CASCADE 1992
|
||||
|
||||
|
||||
class Point from IntPatch
|
||||
|
||||
---Purpose: Definition of an intersection point between two surfaces.
|
||||
-- Such a point is contains geometrical informations (see
|
||||
-- the Value method) and logical informations.
|
||||
|
||||
uses
|
||||
HVertex from Adaptor3d,
|
||||
HCurve2d from Adaptor2d,
|
||||
PntOn2S from IntSurf,
|
||||
Line from IntPatch,
|
||||
Transition from IntSurf,
|
||||
Pnt from gp
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create
|
||||
|
||||
---Purpose: Empty constructor.
|
||||
---C++: inline
|
||||
returns Point from IntPatch;
|
||||
|
||||
|
||||
SetValue(me: in out; Pt: Pnt from gp; Tol: Real from Standard;
|
||||
Tangent: Boolean from Standard)
|
||||
|
||||
---Purpose: Sets the values of a point which is on no domain,
|
||||
-- when both surfaces are implicit ones.
|
||||
-- If Tangent is True, the point is a point of tangency
|
||||
-- between the surfaces.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetValue(me: in out; Pt: Pnt from gp)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
SetTolerance(me: in out; Tol: Real from Standard)
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
SetParameters(me: in out; U1,V1,U2,V2: Real from Standard)
|
||||
|
||||
---Purpose: Sets the values of the parameters of the point
|
||||
-- on each surface.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
SetParameter(me: in out; Para: Real from Standard)
|
||||
|
||||
---Purpose: Set the value of the parameter on the intersection line.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
SetVertex(me: in out; OnFirst: Boolean from Standard; V: HVertex from Adaptor3d)
|
||||
|
||||
---Purpose: Sets the values of a point which is a vertex on
|
||||
-- the initial facet of restriction of one
|
||||
-- of the surface.
|
||||
-- If OnFirst is True, the point is on the domain of the
|
||||
-- first patch, otherwise the point is on the domain of the
|
||||
-- second surface.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetArc(me: in out; OnFirst: Boolean from Standard;
|
||||
A: HCurve2d from Adaptor2d; Param: Real from Standard;
|
||||
TLine, TArc: Transition from IntSurf)
|
||||
|
||||
---Purpose: Sets the values of a point which is on one of the domain,
|
||||
-- when both surfaces are implicit ones.
|
||||
-- If OnFirst is True, the point is on the domain of the
|
||||
-- first patch, otherwise the point is on the domain of the
|
||||
-- second surface.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetMultiple(me: in out; IsMult: Boolean from Standard)
|
||||
|
||||
---Purpose: Sets (or unsets) the point as a point on several
|
||||
-- intersection line.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
Value(me)
|
||||
|
||||
---Purpose: Returns the intersection point (geometric information).
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ParameterOnLine(me)
|
||||
|
||||
---Purpose: This method returns the parameter of the point
|
||||
-- on the intersection line.
|
||||
-- If the points does not belong to an intersection line,
|
||||
-- the value returned does not have any sens.
|
||||
|
||||
returns Real from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Tolerance(me)
|
||||
|
||||
---Purpose: This method returns the fuzziness on the point.
|
||||
|
||||
returns Real from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsTangencyPoint(me)
|
||||
|
||||
---Purpose: Returns True if the Point is a tangency point between
|
||||
-- the surfaces.
|
||||
-- If the Point is on one of the domain (IsOnDomS1 returns
|
||||
-- True or IsOnDomS2 returns True), an exception is raised.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ParametersOnS1(me; U1,V1: out Real from Standard)
|
||||
|
||||
---Purpose: Returns the parameters on the first surface of the point.
|
||||
|
||||
raises DomainError from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ParametersOnS2(me; U2,V2: out Real from Standard)
|
||||
|
||||
---Purpose: Returns the parameters on the second surface of the point.
|
||||
|
||||
raises DomainError from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsMultiple(me)
|
||||
|
||||
---Purpose: Returns True if the point belongs to several intersection
|
||||
-- lines.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsOnDomS1(me)
|
||||
|
||||
---Purpose: Returns TRUE if the point is on a boundary of the domain
|
||||
-- of the first patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsVertexOnS1(me)
|
||||
|
||||
---Purpose: Returns TRUE if the point is a vertex on the initial
|
||||
-- restriction facet of the first surface.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
VertexOnS1(me)
|
||||
|
||||
---Purpose: Returns the information about the point when it is
|
||||
-- on the domain of the first patch, i-e when the function
|
||||
-- IsVertexOnS1 returns True.
|
||||
-- Otherwise, an exception is raised.
|
||||
|
||||
returns HVertex from Adaptor3d
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ArcOnS1(me)
|
||||
|
||||
---Purpose: Returns the arc of restriction containing the
|
||||
-- vertex.
|
||||
-- The exception DomainError is raised if
|
||||
-- IsOnDomS1 returns False.
|
||||
|
||||
returns HCurve2d from Adaptor2d
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TransitionLineArc1(me)
|
||||
|
||||
---Purpose: Returns the transition of the point on the
|
||||
-- intersection line with the arc on S1.
|
||||
-- The exception DomainError is raised if IsOnDomS1
|
||||
-- returns False.
|
||||
|
||||
returns Transition from IntSurf
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TransitionOnS1(me)
|
||||
|
||||
---Purpose: Returns the transition between the intersection line
|
||||
-- returned by the method Line and the arc on S1 returned
|
||||
-- by ArcOnS1().
|
||||
-- The exception DomainError is raised if
|
||||
-- IsOnDomS1 returns False.
|
||||
|
||||
returns Transition from IntSurf
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ParameterOnArc1(me)
|
||||
|
||||
---Purpose: Returns the parameter of the point on the
|
||||
-- arc returned by the method ArcOnS2.
|
||||
-- The exception DomainError is raised if
|
||||
-- IsOnDomS1 returns False.
|
||||
|
||||
returns Real from Standard
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsOnDomS2(me)
|
||||
|
||||
---Purpose: Returns TRUE if the point is on a boundary of the domain
|
||||
-- of the second patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsVertexOnS2(me)
|
||||
|
||||
---Purpose: Returns TRUE if the point is a vertex on the initial
|
||||
-- restriction facet of the first surface.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
VertexOnS2(me)
|
||||
|
||||
---Purpose: Returns the information about the point when it is
|
||||
-- on the domain of the second patch, i-e when the function
|
||||
-- IsVertexOnS2 returns True.
|
||||
-- Otherwise, an exception is raised.
|
||||
|
||||
returns HVertex from Adaptor3d
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ArcOnS2(me)
|
||||
|
||||
---Purpose: Returns the arc of restriction containing the
|
||||
-- vertex.
|
||||
-- The exception DomainError is raised if
|
||||
-- IsOnDomS2 returns False.
|
||||
|
||||
returns HCurve2d from Adaptor2d
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TransitionLineArc2(me)
|
||||
|
||||
---Purpose: Returns the transition of the point on the
|
||||
-- intersection line with the arc on S2.
|
||||
-- The exception DomainError is raised if IsOnDomS2
|
||||
-- returns False.
|
||||
|
||||
returns Transition from IntSurf
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
TransitionOnS2(me)
|
||||
|
||||
---Purpose: Returns the transition between the intersection line
|
||||
-- returned by the method Line and the arc on S2 returned
|
||||
-- by ArcOnS2.
|
||||
-- The exception DomainError is raised if
|
||||
-- IsOnDomS2 returns False.
|
||||
|
||||
returns Transition from IntSurf
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ParameterOnArc2(me)
|
||||
|
||||
---Purpose: Returns the parameter of the point on the
|
||||
-- arc returned by the method ArcOnS2.
|
||||
-- The exception DomainError is raised if
|
||||
-- IsOnDomS2 returns False.
|
||||
|
||||
returns Real from Standard
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
PntOn2S(me)
|
||||
|
||||
---Purpose: Returns the PntOn2S
|
||||
-- (geometric Point and the parameters)
|
||||
--
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
|
||||
returns PntOn2S from IntSurf
|
||||
is static;
|
||||
|
||||
Parameters(me; U1,V1,U2,V2: out Real from Standard)
|
||||
---Purpose: Returns the parameters on the first and on the
|
||||
-- second surface of the point.
|
||||
raises DomainError from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ReverseTransition(me: in out)
|
||||
is static;
|
||||
|
||||
Dump(me)
|
||||
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
pt : PntOn2S from IntSurf;
|
||||
para : Real from Standard;
|
||||
tol : Real from Standard;
|
||||
tgt : Boolean from Standard;
|
||||
mult : Boolean from Standard;
|
||||
|
||||
onS1 : Boolean from Standard;
|
||||
vtxonS1 : Boolean from Standard;
|
||||
vS1 : HVertex from Adaptor3d;
|
||||
arcS1 : HCurve2d from Adaptor2d;
|
||||
traline1 : Transition from IntSurf;
|
||||
tra1 : Transition from IntSurf;
|
||||
prm1 : Real from Standard;
|
||||
|
||||
onS2 : Boolean from Standard;
|
||||
vtxonS2 : Boolean from Standard;
|
||||
vS2 : HVertex from Adaptor3d;
|
||||
arcS2 : HCurve2d from Adaptor2d;
|
||||
traline2 : Transition from IntSurf;
|
||||
tra2 : Transition from IntSurf;
|
||||
prm2 : Real from Standard;
|
||||
|
||||
end Point;
|
199
src/IntPatch/IntPatch_Point.cxx
Executable file
199
src/IntPatch/IntPatch_Point.cxx
Executable file
@@ -0,0 +1,199 @@
|
||||
// File: IntPatch_Point.cxx
|
||||
// Created: Wed May 6 14:01:12 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <IntPatch_Point.ixx>
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
void IntPatch_Point::SetValue (const gp_Pnt& Pt,
|
||||
const Standard_Real Tol,
|
||||
const Standard_Boolean Tangent)
|
||||
{
|
||||
onS1 = Standard_False;
|
||||
onS2 = Standard_False;
|
||||
vtxonS1 = Standard_False;
|
||||
vtxonS2 = Standard_False;
|
||||
mult = Standard_False;
|
||||
tgt = Tangent;
|
||||
pt.SetValue(Pt);
|
||||
tol = Tol;
|
||||
}
|
||||
|
||||
void IntPatch_Point::SetVertex(const Standard_Boolean OnFirst, const Handle(Adaptor3d_HVertex)& V)
|
||||
{
|
||||
if (OnFirst) {
|
||||
onS1 = Standard_True;
|
||||
vtxonS1 = Standard_True;
|
||||
vS1 = V;
|
||||
}
|
||||
else {
|
||||
onS2 = Standard_True;
|
||||
vtxonS2 = Standard_True;
|
||||
vS2 = V;
|
||||
}
|
||||
}
|
||||
|
||||
void IntPatch_Point::SetArc (const Standard_Boolean OnFirst,
|
||||
const Handle(Adaptor2d_HCurve2d)& A,
|
||||
const Standard_Real Param,
|
||||
const IntSurf_Transition& TLine,
|
||||
const IntSurf_Transition& TArc)
|
||||
{
|
||||
if (OnFirst) {
|
||||
onS1 = Standard_True;
|
||||
arcS1 = A;
|
||||
traline1 = TLine;
|
||||
tra1 = TArc;
|
||||
prm1 = Param;
|
||||
}
|
||||
else {
|
||||
onS2 = Standard_True;
|
||||
arcS2 = A;
|
||||
traline2 = TLine;
|
||||
tra2 = TArc;
|
||||
prm2 = Param;
|
||||
}
|
||||
}
|
||||
|
||||
void IntPatch_Point::ReverseTransition()
|
||||
{
|
||||
if(onS1)
|
||||
{
|
||||
IntSurf_Transition TLine;
|
||||
switch (traline1.TransitionType())
|
||||
{
|
||||
case IntSurf_In: TLine.SetValue(Standard_False,IntSurf_Out); break;
|
||||
case IntSurf_Out: TLine.SetValue(Standard_False,IntSurf_In); break;
|
||||
}
|
||||
traline1=TLine;
|
||||
IntSurf_Transition TArc;
|
||||
switch (tra1.TransitionType())
|
||||
{
|
||||
case IntSurf_In: TArc.SetValue(Standard_False,IntSurf_Out); break;
|
||||
case IntSurf_Out: TArc.SetValue(Standard_False,IntSurf_In); break;
|
||||
}
|
||||
tra1=TArc;
|
||||
}
|
||||
if(onS2)
|
||||
{
|
||||
IntSurf_Transition TLine;
|
||||
switch (traline2.TransitionType())
|
||||
{
|
||||
case IntSurf_In: TLine.SetValue(Standard_False,IntSurf_Out); break;
|
||||
case IntSurf_Out: TLine.SetValue(Standard_False,IntSurf_In); break;
|
||||
}
|
||||
traline2=TLine;
|
||||
IntSurf_Transition TArc;
|
||||
switch (tra2.TransitionType())
|
||||
{
|
||||
case IntSurf_In: TArc.SetValue(Standard_False,IntSurf_Out); break;
|
||||
case IntSurf_Out: TArc.SetValue(Standard_False,IntSurf_In); break;
|
||||
}
|
||||
tra2=TArc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include <IntSurf_Situation.hxx>
|
||||
#include <IntSurf_Transition.hxx>
|
||||
#include <IntSurf_TypeTrans.hxx>
|
||||
|
||||
static void DumpTransition(const IntSurf_Transition& T)
|
||||
{
|
||||
IntSurf_TypeTrans typetrans = T.TransitionType();
|
||||
if(typetrans == IntSurf_In) cout<<" In ";
|
||||
else if(typetrans == IntSurf_Out) cout<<" Out ";
|
||||
else if(typetrans == IntSurf_Undecided) cout<<" Und.";
|
||||
else if(typetrans == IntSurf_Touch) {
|
||||
cout<<" Touch ";
|
||||
if(T.Situation() == IntSurf_Inside) cout<<" Inside ";
|
||||
else if(T.Situation() == IntSurf_Outside) cout<<" Outside";
|
||||
else cout<<" Unknown";
|
||||
if(T.IsOpposite()) cout<<" Opposite ";
|
||||
else cout<<" Non_Opposite ";
|
||||
}
|
||||
|
||||
if(typetrans != IntSurf_Undecided) {
|
||||
if(T.IsTangent()) cout<<" Tangent ";
|
||||
else cout<<" Non_Tangent";
|
||||
}
|
||||
}
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
void IntPatch_Point::Dump() const {
|
||||
cout<<"----------- IntPatch_Point : "<<endl;
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
pt.Parameters(u1,v1,u2,v2);
|
||||
#if 0
|
||||
cout<<"IntSurf_PntOn2S : Pnt ("<<pt.Value().X()
|
||||
<<","<<pt.Value().Y()<<","<<pt.Value().Z()<<")"<<endl;
|
||||
cout<<" u1:"<<u1; cout<<" u2:"<<u2;
|
||||
cout<<" v1:"<<v1;
|
||||
cout<<" v2:"<<v2<<endl;
|
||||
cout<<" para("<<para<<")";
|
||||
cout<<" mult("<<mult<<")";
|
||||
cout<<" OnS1("<<onS1<<")";
|
||||
cout<<" VtxOnS1("<<vtxonS1<<")"<<endl;
|
||||
cout<<" OnS2("<<onS2<<")";
|
||||
cout<<" VtxOnS2("<<vtxonS2<<")";
|
||||
cout<<" prm1("<<prm1<<")";
|
||||
cout<<" prm2("<<prm2<<")";
|
||||
#else
|
||||
|
||||
#ifndef DEB // for porting on linux
|
||||
printf("P(%15.10f,%15.10f,%15.10f) UV1(%15.10f,%15.10f) UV2(%15.10f,%15.10f) (Para:%15.10f)\n",
|
||||
(double)(pt.Value().X()),
|
||||
(double)(pt.Value().Y()),
|
||||
(double)(pt.Value().Z()),
|
||||
(double)u1,(double)v1,(double)u2,(double)v2,(double)para);
|
||||
if(onS1) { printf("*OnS1* par=%15.10f arc1=%10lu",(double)prm1,
|
||||
*((long unsigned *)(((Handle_Standard_Transient *)(&arcS1))))
|
||||
); }
|
||||
if(vtxonS1) { printf(" *Vtx1* vtx1=%10lu",
|
||||
*((long unsigned *)(((Handle_Standard_Transient *)(&vS1))))); }
|
||||
if(onS1 || vtxonS1) printf("\n");
|
||||
if(onS2) { printf("*OnS2* par=%15.10f arc2=%10lu",(double)prm2,
|
||||
*((long unsigned *)(((Handle_Standard_Transient *)(&arcS2))))); }
|
||||
if(vtxonS2) { printf(" *Vtx2* vtx2=%10lu",
|
||||
*((long unsigned *)(((Handle_Standard_Transient *)(&vS2))))); }
|
||||
|
||||
#else // debug mode
|
||||
printf("P(%15.10lf,%15.10lf,%15.10lf) UV1(%15.10lf,%15.10lf) UV2(%15.10lf,%15.10lf) (Para:%15.10lf)\n",
|
||||
(double)(pt.Value().X()),
|
||||
(double)(pt.Value().Y()),
|
||||
(double)(pt.Value().Z()),
|
||||
(double)u1,(double)v1,(double)u2,(double)v2,(double)para);
|
||||
if(onS1) { printf("*OnS1* par=%15.10lf arc1=%10lu",(double)prm1,
|
||||
*((long unsigned *)(((Handle_Standard_Transient *)(&arcS1))))
|
||||
); }
|
||||
if(vtxonS1) { printf(" *Vtx1* vtx1=%10lu",
|
||||
*((long unsigned *)(((Handle_Standard_Transient *)(&vS1))))); }
|
||||
if(onS1 || vtxonS1) printf("\n");
|
||||
if(onS2) { printf("*OnS2* par=%15.10lf arc2=%10lu",(double)prm2,
|
||||
*((long unsigned *)(((Handle_Standard_Transient *)(&arcS2))))); }
|
||||
if(vtxonS2) { printf(" *Vtx2* vtx2=%10lu",
|
||||
*((long unsigned *)(((Handle_Standard_Transient *)(&vS2))))); }
|
||||
|
||||
#endif
|
||||
if(onS2 || vtxonS2) printf("\n");
|
||||
fflush(stdout);
|
||||
|
||||
#endif
|
||||
if(onS1 || onS2) {
|
||||
cout<<" tgt:"<<((tgt)? 1 : 0) <<" mult:"<<((mult)? 1 :0);
|
||||
if(onS1) {
|
||||
cout<<"\n-traline1 : "; DumpTransition(traline1);
|
||||
cout<<" -tra1 : "; DumpTransition(tra1);
|
||||
}
|
||||
if(onS2) {
|
||||
cout<<"\n-traline2 : "; DumpTransition(traline2);
|
||||
cout<<" -tra2 : "; DumpTransition(tra2);
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
196
src/IntPatch/IntPatch_Point.lxx
Executable file
196
src/IntPatch/IntPatch_Point.lxx
Executable file
@@ -0,0 +1,196 @@
|
||||
// File: IntPatch_Point.lxx
|
||||
// Created: Wed May 6 14:01:12 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
|
||||
inline IntPatch_Point::IntPatch_Point ()
|
||||
: para(0.0), tol(0.0), tgt(Standard_False), mult(Standard_False),
|
||||
onS1(Standard_False), vtxonS1(Standard_False), prm1(0.0),
|
||||
onS2(Standard_False), vtxonS2(Standard_False), prm2(0.0),
|
||||
vS1(NULL), vS2(NULL),
|
||||
arcS1(NULL), arcS2(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_Point::SetValue (const gp_Pnt& Pt)
|
||||
{
|
||||
pt.SetValue(Pt);
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_Point::SetTolerance (const Standard_Real Tol)
|
||||
{
|
||||
tol = Tol;
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_Point::SetParameters (const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2)
|
||||
{
|
||||
pt.SetValue(U1,V1,U2,V2);
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_Point::SetParameter (const Standard_Real Para)
|
||||
{
|
||||
para = Para;
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_Point::SetMultiple (const Standard_Boolean IsMult)
|
||||
{
|
||||
mult = IsMult;
|
||||
}
|
||||
|
||||
|
||||
inline const gp_Pnt& IntPatch_Point::Value () const
|
||||
{
|
||||
return pt.Value();
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntPatch_Point::Tolerance () const
|
||||
{
|
||||
return tol;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntPatch_Point::ParameterOnLine () const
|
||||
{
|
||||
return para;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Point::IsTangencyPoint () const
|
||||
{
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_Point::ParametersOnS1 (Standard_Real& U1, Standard_Real& V1) const
|
||||
{
|
||||
pt.ParametersOnS1(U1,V1);
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_Point::ParametersOnS2 (Standard_Real& U2, Standard_Real& V2) const
|
||||
{
|
||||
pt.ParametersOnS2(U2,V2);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Point::IsMultiple () const
|
||||
{
|
||||
return mult;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Point::IsOnDomS1 () const
|
||||
{
|
||||
return onS1;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Point::IsVertexOnS1 () const
|
||||
{
|
||||
return vtxonS1;
|
||||
}
|
||||
|
||||
|
||||
inline const Handle(Adaptor3d_HVertex)& IntPatch_Point::VertexOnS1 () const
|
||||
{
|
||||
if (!vtxonS1) {Standard_DomainError::Raise();}
|
||||
return vS1;
|
||||
}
|
||||
|
||||
|
||||
inline const Handle(Adaptor2d_HCurve2d)& IntPatch_Point::ArcOnS1 () const
|
||||
{
|
||||
if (!onS1) {Standard_DomainError::Raise();}
|
||||
return arcS1;
|
||||
}
|
||||
|
||||
|
||||
inline const IntSurf_Transition& IntPatch_Point::TransitionLineArc1 () const
|
||||
{
|
||||
if (!onS1) {Standard_DomainError::Raise();}
|
||||
return traline1;
|
||||
}
|
||||
|
||||
|
||||
inline const IntSurf_Transition& IntPatch_Point::TransitionOnS1 () const
|
||||
{
|
||||
if (!onS1) {Standard_DomainError::Raise();}
|
||||
return tra1;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntPatch_Point::ParameterOnArc1 () const
|
||||
{
|
||||
if (!onS1) {Standard_DomainError::Raise();}
|
||||
return prm1;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Point::IsOnDomS2 () const
|
||||
{
|
||||
return onS2;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntPatch_Point::IsVertexOnS2 () const
|
||||
{
|
||||
return vtxonS2;
|
||||
}
|
||||
|
||||
|
||||
inline const Handle(Adaptor3d_HVertex)& IntPatch_Point::VertexOnS2 () const
|
||||
{
|
||||
if (!vtxonS2) {Standard_DomainError::Raise();}
|
||||
return vS2;
|
||||
}
|
||||
|
||||
|
||||
inline const Handle(Adaptor2d_HCurve2d)& IntPatch_Point::ArcOnS2 () const
|
||||
{
|
||||
if (!onS2) {Standard_DomainError::Raise();}
|
||||
return arcS2;
|
||||
}
|
||||
|
||||
|
||||
inline const IntSurf_Transition& IntPatch_Point::TransitionLineArc2 () const
|
||||
{
|
||||
if (!onS2) {Standard_DomainError::Raise();}
|
||||
return traline2;
|
||||
}
|
||||
|
||||
|
||||
inline const IntSurf_Transition& IntPatch_Point::TransitionOnS2 () const
|
||||
{
|
||||
if (!onS2) {Standard_DomainError::Raise();}
|
||||
return tra2;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntPatch_Point::ParameterOnArc2 () const
|
||||
{
|
||||
if (!onS2) {Standard_DomainError::Raise();}
|
||||
return prm2;
|
||||
}
|
||||
|
||||
|
||||
inline const IntSurf_PntOn2S& IntPatch_Point::PntOn2S() const
|
||||
{
|
||||
return pt;
|
||||
}
|
||||
|
||||
|
||||
inline void IntPatch_Point::Parameters(Standard_Real& U1, Standard_Real& V1,
|
||||
Standard_Real& U2, Standard_Real& V2) const
|
||||
{
|
||||
pt.Parameters(U1,V1,U2,V2);
|
||||
}
|
62
src/IntPatch/IntPatch_PolyArc.cdl
Executable file
62
src/IntPatch/IntPatch_PolyArc.cdl
Executable file
@@ -0,0 +1,62 @@
|
||||
-- File: IntPatch_PolyArc.cdl
|
||||
-- Created: Wed Jan 27 09:44:03 1993
|
||||
-- Author: Isabelle GRIGNON
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class PolyArc from IntPatch
|
||||
|
||||
inherits Polygo from IntPatch
|
||||
|
||||
uses Box2d from Bnd,
|
||||
Pnt2d from gp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
HCurve2d from Adaptor2d
|
||||
|
||||
raises ConstructionError from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(A: HCurve2d from Adaptor2d; NbSample: Integer from Standard;
|
||||
Pfirst,Plast : Real from Standard;
|
||||
BoxOtherPolygon: Box2d from Bnd)
|
||||
|
||||
---Purpose: Creates the polygon of the arc A on the surface S.
|
||||
-- The arc is limited by the parameters Pfirst and Plast.
|
||||
-- None of these parameters can be infinite.
|
||||
|
||||
returns PolyArc from IntPatch
|
||||
|
||||
raises ConstructionError from Standard;
|
||||
--- This exception is raised if Pfirst=RealFirst or Plast=RealLast or
|
||||
-- NbSample<=1.
|
||||
|
||||
|
||||
Bounding(me)
|
||||
---C++: return const&
|
||||
returns Box2d from Bnd;
|
||||
|
||||
Error(me) returns Real from Standard;
|
||||
|
||||
Closed(me) returns Boolean from Standard;
|
||||
|
||||
NbPoints(me) returns Integer;
|
||||
|
||||
Point(me; Index : Integer) returns Pnt2d from gp;
|
||||
|
||||
Parameter(me ; Index : Integer) returns Real from Standard;
|
||||
|
||||
SetOffset(me:in out; OffsetX,OffsetY: Real from Standard);
|
||||
|
||||
|
||||
fields
|
||||
|
||||
brise : Array1OfPnt2d from TColgp;
|
||||
param : Array1OfReal from TColStd;
|
||||
boite : Box2d from Bnd;
|
||||
fleche : Real from Standard;
|
||||
offsetx: Real from Standard;
|
||||
offsety: Real from Standard;
|
||||
ferme : Boolean from Standard;
|
||||
|
||||
end PolyArc;
|
198
src/IntPatch/IntPatch_PolyArc.cxx
Executable file
198
src/IntPatch/IntPatch_PolyArc.cxx
Executable file
@@ -0,0 +1,198 @@
|
||||
// File: IntPatch_PolyArc.cxx
|
||||
// Created: Wed Jan 27 09:44:03 1993
|
||||
// Author: Isabelle GRIGNON
|
||||
// Copyright: Matra Datavision 1993
|
||||
|
||||
#include <IntPatch_PolyArc.ixx>
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
inline void MinMax (const Standard_Real a1, const Standard_Real a2,
|
||||
Standard_Real& amin, Standard_Real& amax)
|
||||
{
|
||||
if (a1 < a2) {
|
||||
amin = a1; amax = a2;
|
||||
}
|
||||
else {
|
||||
amin = a2; amax = a1;
|
||||
}
|
||||
}
|
||||
|
||||
IntPatch_PolyArc::IntPatch_PolyArc(const Handle(Adaptor2d_HCurve2d)& Line ,
|
||||
const Standard_Integer NbSample,
|
||||
const Standard_Real aPdeb,
|
||||
const Standard_Real aPfin,
|
||||
const Bnd_Box2d& BoxOtherPolygon):
|
||||
brise(1,Max(1,NbSample)),
|
||||
param(1,Max(1,NbSample)),
|
||||
offsetx(0.0),
|
||||
offsety(0.0)
|
||||
{
|
||||
Standard_Real Pdeb = aPdeb;
|
||||
Standard_Real Pfin = aPfin;
|
||||
gp_Pnt2d p2d;
|
||||
|
||||
if (Pdeb == RealFirst() || Pfin == RealLast() || NbSample <= 1) {
|
||||
Standard_ConstructionError::Raise();
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//-- On veut eviter les cas ou le present polygone est beaucoup plus
|
||||
//-- grand que l objet en second.
|
||||
//--
|
||||
//-- Par exemple lorsque l objet en second est une ligne de cheminement
|
||||
//-- qui contient de nombreux segments (>>100), une fleche nulle
|
||||
//-- et ce polygone quelques segments et une fleche qui contient
|
||||
//-- toute la ligne de cheminement.
|
||||
//--
|
||||
//-- Dans ce cas (tout un polygone compris dans la zone d influence)
|
||||
//-- les calculs deviennent tres longs (N2)
|
||||
//----------------------------------------------------------------------
|
||||
Standard_Integer IndexInf = NbSample+1;
|
||||
Standard_Integer IndexSup = 0;
|
||||
|
||||
Standard_Real bx0,by0,bxmin,bxmax,bymin,bymax,r,r2;
|
||||
|
||||
BoxOtherPolygon.Get(bxmin,bymin,bxmax,bymax);
|
||||
r=(bxmax-bxmin)+(bymax-bymin);
|
||||
bx0=(bxmax+bxmin)*0.5;
|
||||
by0=(bymax+bymin)*0.5;
|
||||
|
||||
Standard_Real Pas;
|
||||
Standard_Real X,Y,Xs,Ys,Xm,Ym,XXs,YYs;
|
||||
|
||||
r*=0.8;
|
||||
r2 = r*r*49.;
|
||||
Standard_Integer nbloop=0;
|
||||
|
||||
do {
|
||||
nbloop++;
|
||||
Pas = (Pfin-Pdeb)/(NbSample-1);
|
||||
param(1) = Pdeb;
|
||||
Line->D0(Pdeb,p2d);
|
||||
Xs = p2d.X(); Ys = p2d.Y();
|
||||
brise(1).SetCoord(Xs,Ys);
|
||||
|
||||
boite.SetVoid();
|
||||
|
||||
boite.Add(brise(1));
|
||||
fleche =0.;
|
||||
|
||||
for (Standard_Integer i =2; i<=NbSample;i++) {
|
||||
param(i) = Pdeb + (i-1)*Pas;
|
||||
Line->D0(param(i),p2d);
|
||||
X = p2d.X(); Y = p2d.Y();
|
||||
brise(i).SetCoord(X,Y);
|
||||
XXs = 0.5*(Xs+X);
|
||||
YYs = 0.5*(Ys+Y);
|
||||
//------------------------------------------------------------
|
||||
//-- On recherche le debut et la fin de la zone significative
|
||||
//------------------------------------------------------------
|
||||
// MSV: (see cda 002 H2) if segment is too large (>>r) we have
|
||||
// a risk to jump through BoxOtherPolygon, therefore we should
|
||||
// check this condition if the first one is failure.
|
||||
Standard_Boolean isMidPtInBox = (Abs(bx0-XXs) + Abs(by0-YYs)) < r;
|
||||
Standard_Boolean isSegOut = Standard_True;
|
||||
if(!isMidPtInBox) {
|
||||
Standard_Real d = (X-Xs)*(X-Xs)+(Y-Ys)*(Y-Ys);
|
||||
if (d > r2) {
|
||||
Standard_Real xmin,xmax,ymin,ymax;
|
||||
MinMax (Xs,X, xmin,xmax);
|
||||
MinMax (Ys,Y, ymin,ymax);
|
||||
isSegOut = (xmax < bxmin || xmin > bxmax ||
|
||||
ymax < bymin || ymin > bymax);
|
||||
}
|
||||
}
|
||||
if(isMidPtInBox || !isSegOut) {
|
||||
// MSV: take the previous and the next segments too, because of
|
||||
// we check only the middle point (see BUC60946)
|
||||
//if(IndexInf>i) IndexInf=i-1;
|
||||
//if(IndexSup<i) IndexSup=i;
|
||||
if(IndexInf>i) IndexInf=Max(i-2,1);
|
||||
if(IndexSup<i) IndexSup=Min(i+1,NbSample);
|
||||
}
|
||||
|
||||
boite.Add(brise(i));
|
||||
Line->D0(param(i)-Pas*0.5,p2d);
|
||||
Xm = p2d.X() - XXs;
|
||||
Ym = p2d.Y() - YYs;
|
||||
Xm = Sqrt(Xm*Xm+Ym*Ym);
|
||||
fleche =Max (fleche , Xm);
|
||||
Xs = X;
|
||||
Ys = Y;
|
||||
}
|
||||
if(IndexInf > IndexSup) {
|
||||
r+=r;
|
||||
r2 = r*r*49.;
|
||||
//-- cout<<" Le rayon : "<<r<<" est insuffisant "<<endl;
|
||||
}
|
||||
else {
|
||||
//----------------------------------------------
|
||||
//-- Si le nombre de points significatifs est
|
||||
//-- insuffisant, on reechantillonne une fois
|
||||
//-- encore
|
||||
//----------------------------------------------
|
||||
if((IndexSup-IndexInf)<(NbSample/2)) {
|
||||
//-- cout<<" --- On remet ca entre les index "<<IndexInf<<" et "<<IndexSup<<endl;
|
||||
nbloop = 10;
|
||||
//if(IndexInf>1) IndexInf--;
|
||||
//if(IndexSup<NbSample) IndexSup++;
|
||||
Pdeb = param(IndexInf);
|
||||
Pfin = param(IndexSup);
|
||||
//IndexInf = IndexSup+1;
|
||||
IndexInf = NbSample+1;
|
||||
IndexSup = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
while((IndexInf > IndexSup) && nbloop<=10);
|
||||
fleche*=1.2;
|
||||
if(fleche<0.00000001)
|
||||
fleche = 0.00000001;
|
||||
boite.Enlarge(fleche);
|
||||
|
||||
if(Line->Value(aPdeb).Distance(Line->Value(aPfin))<=1e-7) {
|
||||
ferme=Standard_True;
|
||||
}
|
||||
else {
|
||||
ferme=Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
const Bnd_Box2d& IntPatch_PolyArc::Bounding() const {
|
||||
return(boite);
|
||||
}
|
||||
|
||||
Standard_Real IntPatch_PolyArc::Error() const {return fleche;}
|
||||
|
||||
Standard_Boolean IntPatch_PolyArc::Closed() const { return ferme;}
|
||||
|
||||
Standard_Integer IntPatch_PolyArc::NbPoints() const {return brise.Length();}
|
||||
|
||||
gp_Pnt2d IntPatch_PolyArc::Point(const Standard_Integer Index ) const
|
||||
{
|
||||
if(offsetx == 0.0 && offsety==0.0)
|
||||
return(brise(Index));
|
||||
|
||||
const gp_Pnt2d& P = brise(Index);
|
||||
return (gp_Pnt2d(P.X()+offsetx,P.Y()+offsety));
|
||||
}
|
||||
|
||||
Standard_Real IntPatch_PolyArc::Parameter(const Standard_Integer Index ) const
|
||||
{ return param(Index);}
|
||||
|
||||
|
||||
void IntPatch_PolyArc::SetOffset(const Standard_Real ox,const Standard_Real oy) {
|
||||
Standard_Real xmin,ymin,xmax,ymax,g;
|
||||
boite.Get(xmin,ymin,xmax,ymax);
|
||||
g = boite.GetGap();
|
||||
|
||||
boite.SetVoid();
|
||||
|
||||
boite.Update(xmin-offsetx,ymin-offsety,
|
||||
xmax-offsetx,ymax-offsety);
|
||||
offsetx = ox;
|
||||
offsety = oy;
|
||||
boite.Update(xmin+offsetx,ymin+offsety,
|
||||
xmax+offsetx,ymax+offsety);
|
||||
boite.SetGap(g);
|
||||
}
|
59
src/IntPatch/IntPatch_PolyLine.cdl
Executable file
59
src/IntPatch/IntPatch_PolyLine.cdl
Executable file
@@ -0,0 +1,59 @@
|
||||
-- File: IntPatch_PolyLine.cdl
|
||||
-- Created: Fri Jan 29 17:14:59 1993
|
||||
-- Author: Isabelle GRIGNON
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class PolyLine from IntPatch
|
||||
|
||||
inherits Polygo from IntPatch
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Box2d from Bnd,
|
||||
IType from IntPatch,
|
||||
WLine from IntPatch,
|
||||
RLine from IntPatch
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns PolyLine from IntPatch;
|
||||
|
||||
Create (InitDefle: Real from Standard)
|
||||
returns PolyLine from IntPatch;
|
||||
|
||||
SetWLine(me: in out; OnFirst: Boolean from Standard; Line: WLine from IntPatch)
|
||||
is static;
|
||||
|
||||
SetRLine(me: in out; OnFirst: Boolean from Standard; Line: RLine from IntPatch)
|
||||
is static;
|
||||
|
||||
Prepare(me: in out)
|
||||
is static private;
|
||||
|
||||
ResetError(me: in out);
|
||||
|
||||
Bounding (me)
|
||||
---C++: return const &
|
||||
returns Box2d from Bnd;
|
||||
|
||||
Error(me) returns Real from Standard;
|
||||
|
||||
Closed(me) returns Boolean from Standard;
|
||||
|
||||
NbPoints(me) returns Integer;
|
||||
|
||||
Point(me; Index : Integer)
|
||||
returns Pnt2d from gp;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
box : Box2d from Bnd;
|
||||
pnt : Pnt2d from gp;
|
||||
typ : IType from IntPatch;
|
||||
onfirst : Boolean from Standard;
|
||||
wpoly : WLine from IntPatch;
|
||||
rpoly : RLine from IntPatch;
|
||||
defle : Real from Standard;
|
||||
|
||||
end PolyLine;
|
229
src/IntPatch/IntPatch_PolyLine.cxx
Executable file
229
src/IntPatch/IntPatch_PolyLine.cxx
Executable file
@@ -0,0 +1,229 @@
|
||||
// File: IntPatch_PolyLine.cxx
|
||||
// Created: Fri Jan 29 17:14:59 1993
|
||||
// Author: Isabelle GRIGNON
|
||||
// Copyright: Matra Datavision 1993
|
||||
|
||||
//-- lbr le 12 juin : Ajout des fleches sur les Lines
|
||||
//-- msv 13.03.2002 : compute deflection for WLine; Error() returns deflection
|
||||
|
||||
#include <IntPatch_PolyLine.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#define INITDEFLE Precision::PConfusion()*100.
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_PolyLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_PolyLine::IntPatch_PolyLine ()
|
||||
: defle(INITDEFLE)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_PolyLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IntPatch_PolyLine::IntPatch_PolyLine (const Standard_Real InitDefle)
|
||||
: defle(InitDefle)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetWLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_PolyLine::SetWLine(const Standard_Boolean OnFirst, const Handle(IntPatch_WLine)& Line)
|
||||
{
|
||||
typ = IntPatch_Walking;
|
||||
wpoly = Line;
|
||||
onfirst = OnFirst;
|
||||
Prepare();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_PolyLine::SetRLine(const Standard_Boolean OnFirst, const Handle(IntPatch_RLine)& Line)
|
||||
{
|
||||
typ = IntPatch_Restriction;
|
||||
rpoly = Line;
|
||||
onfirst = OnFirst;
|
||||
Prepare();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepare
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_PolyLine::Prepare()
|
||||
{
|
||||
Standard_Integer i;
|
||||
box.SetVoid();
|
||||
Standard_Integer n=NbPoints();
|
||||
Standard_Real eps = defle;
|
||||
|
||||
gp_Pnt2d P1, P2;
|
||||
if (n >= 3) {
|
||||
P1 = Point(1); P2 = Point(2);
|
||||
}
|
||||
for (i=1; i<=n ;i++) {
|
||||
const gp_Pnt2d& P3 = Point(i);
|
||||
if (i >= 3) {
|
||||
gp_XY V13 = P3.XY() - P1.XY();
|
||||
gp_XY V12 = P2.XY() - P1.XY();
|
||||
Standard_Real d13 = V13.Modulus(), d;
|
||||
if (d13 > eps)
|
||||
d = V13.CrossMagnitude(V12) / d13;
|
||||
else
|
||||
d = eps;
|
||||
if (d > defle) {
|
||||
// try to compute deflection more precisely using parabola interpolation
|
||||
gp_XY V23 = P3.XY() - P2.XY();
|
||||
Standard_Real d12 = V12.Modulus(), d23 = V23.Modulus();
|
||||
// compute parameter of P2 (assume parameters of P1,P3 are 0,1)
|
||||
Standard_Real tm = d12 / (d12+d23);
|
||||
if (tm > 0.1 && tm < 0.9) {
|
||||
tm -= (tm-0.5) * 0.6;
|
||||
Standard_Real tm1mtm = tm*(1-tm);
|
||||
// coefficients of parabola
|
||||
Standard_Real Ax = (tm*V13.X() - V12.X()) / tm1mtm;
|
||||
Standard_Real Bx = (V12.X() - tm*tm*V13.X()) / tm1mtm;
|
||||
Standard_Real Cx = P1.X();
|
||||
Standard_Real Ay = (tm*V13.Y() - V12.Y()) / tm1mtm;
|
||||
Standard_Real By = (V12.Y() - tm*tm*V13.Y()) / tm1mtm;
|
||||
Standard_Real Cy = P1.Y();
|
||||
// equations of lines P1-P2 and P2-P3
|
||||
Standard_Real A1 = V12.Y() / d12;
|
||||
Standard_Real B1 = -V12.X() / d12;
|
||||
Standard_Real C1 = (P2.X()*P1.Y() - P1.X()*P2.Y()) / d12;
|
||||
Standard_Real A2 = V23.Y() / d23;
|
||||
Standard_Real B2 = -V23.X() / d23;
|
||||
Standard_Real C2 = (P3.X()*P2.Y() - P2.X()*P3.Y()) / d23;
|
||||
// points on parabola with max deflection
|
||||
Standard_Real t1 = -0.5 * (A1*Bx + B1*By) / (A1*Ax + B1*Ay);
|
||||
Standard_Real t2 = -0.5 * (A2*Bx + B2*By) / (A2*Ax + B2*Ay);
|
||||
Standard_Real xt1 = Ax*t1*t1 + Bx*t1 + Cx;
|
||||
Standard_Real yt1 = Ay*t1*t1 + By*t1 + Cy;
|
||||
Standard_Real xt2 = Ax*t2*t2 + Bx*t2 + Cx;
|
||||
Standard_Real yt2 = Ay*t2*t2 + By*t2 + Cy;
|
||||
// max deflection on segments P1-P2 and P2-P3
|
||||
Standard_Real d1 = Abs (A1*xt1 + B1*yt1 + C1);
|
||||
Standard_Real d2 = Abs (A2*xt2 + B2*yt2 + C2);
|
||||
if (d2 > d1) d1 = d2;
|
||||
// select min deflection from linear and parabolic ones
|
||||
if (d1 < d) d = d1;
|
||||
}
|
||||
if (d > defle) defle=d;
|
||||
}
|
||||
P1 = P2; P2 = P3;
|
||||
}
|
||||
box.Add(P3);
|
||||
}
|
||||
box.Enlarge(defle);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ResetError
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_PolyLine::ResetError()
|
||||
{
|
||||
defle = INITDEFLE;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Bounding
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Bnd_Box2d& IntPatch_PolyLine::Bounding() const
|
||||
{
|
||||
return box;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Error
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IntPatch_PolyLine::Error() const
|
||||
{
|
||||
// return 0.0000001;
|
||||
return defle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Closed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IntPatch_PolyLine::Closed() const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbPoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IntPatch_PolyLine::NbPoints() const
|
||||
{
|
||||
return (typ == IntPatch_Walking ? wpoly->NbPnts() : rpoly->NbPnts());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Pnt2d IntPatch_PolyLine::Point(const Standard_Integer Index ) const
|
||||
{
|
||||
Standard_Real X,Y,X1,Y1,DX,DY;
|
||||
DX=DY=0;
|
||||
if (onfirst) {
|
||||
if (typ == IntPatch_Walking) {
|
||||
wpoly->Point(Index).ParametersOnS1(X,Y);
|
||||
if(Index==1) {
|
||||
wpoly->Point(2).ParametersOnS1(X1,Y1);
|
||||
DX=0.0000001*(X-X1);
|
||||
DY=0.0000001*(Y-Y1);
|
||||
}
|
||||
else if(Index==wpoly->NbPnts()) {
|
||||
wpoly->Point(Index-1).ParametersOnS1(X1,Y1);
|
||||
DX=0.0000001*(X-X1);
|
||||
DY=0.0000001*(Y-Y1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rpoly->Point(Index).ParametersOnS1(X,Y);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (typ == IntPatch_Walking) {
|
||||
wpoly->Point(Index).ParametersOnS2(X,Y);
|
||||
if(Index==1) {
|
||||
wpoly->Point(2).ParametersOnS2(X1,Y1);
|
||||
DX=0.0000001*(X-X1);
|
||||
DY=0.0000001*(Y-Y1);
|
||||
}
|
||||
else if(Index==wpoly->NbPnts()) {
|
||||
wpoly->Point(Index-1).ParametersOnS2(X1,Y1);
|
||||
DX=0.0000001*(X-X1);
|
||||
DY=0.0000001*(Y-Y1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rpoly->Point(Index).ParametersOnS2(X,Y);
|
||||
}
|
||||
}
|
||||
|
||||
return(gp_Pnt2d(X+DX,Y+DY));
|
||||
}
|
38
src/IntPatch/IntPatch_Polygo.cdl
Executable file
38
src/IntPatch/IntPatch_Polygo.cdl
Executable file
@@ -0,0 +1,38 @@
|
||||
-- File: IntPatch_Polygo.cdl
|
||||
-- Created: Thu May 6 17:49:16 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@form4>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
deferred class Polygo from IntPatch
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Box2d from Bnd
|
||||
|
||||
is
|
||||
|
||||
Delete(me:out) is virtual;
|
||||
---C++: alias "Standard_EXPORT virtual ~IntPatch_Polygo(){Delete() ; }"
|
||||
|
||||
Bounding (me)
|
||||
---C++: return const &
|
||||
returns Box2d from Bnd
|
||||
is deferred;
|
||||
|
||||
Error(me) returns Real from Standard
|
||||
is deferred;
|
||||
|
||||
Closed(me) returns Boolean from Standard
|
||||
is deferred;
|
||||
|
||||
NbPoints(me) returns Integer
|
||||
is deferred;
|
||||
|
||||
Point(me; Index : Integer)
|
||||
returns Pnt2d from gp
|
||||
is deferred;
|
||||
|
||||
end Polygo;
|
4
src/IntPatch/IntPatch_Polygo.cxx
Executable file
4
src/IntPatch/IntPatch_Polygo.cxx
Executable file
@@ -0,0 +1,4 @@
|
||||
#include <IntPatch_Polygo.ixx>
|
||||
|
||||
void IntPatch_Polygo::Delete()
|
||||
{}
|
65
src/IntPatch/IntPatch_PolygoTool.cdl
Executable file
65
src/IntPatch/IntPatch_PolygoTool.cdl
Executable file
@@ -0,0 +1,65 @@
|
||||
-- File: IntPatch_PolygoTool.cdl
|
||||
-- Created: Thu May 6 17:50:02 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@form4>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
class PolygoTool from IntPatch
|
||||
|
||||
---Purpose: Tool an a polygon to instantiates the Interference
|
||||
-- between 2 polygons.
|
||||
|
||||
|
||||
uses Box2d from Bnd,
|
||||
Pnt2d from gp,
|
||||
Polygo from IntPatch
|
||||
|
||||
|
||||
is
|
||||
|
||||
Bounding (myclass; Line : Polygo from IntPatch )
|
||||
|
||||
returns Box2d from Bnd;
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
|
||||
DeflectionOverEstimation(myclass; Line :Polygo from IntPatch)
|
||||
|
||||
returns Real from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
Closed(myclass; Line : Polygo from IntPatch )
|
||||
|
||||
returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbSegments(myclass; Line : Polygo from IntPatch )
|
||||
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
|
||||
BeginOfSeg(myclass; Line : Polygo from IntPatch;
|
||||
Index : Integer from Standard)
|
||||
|
||||
returns Pnt2d from gp;
|
||||
---C++: inline
|
||||
|
||||
|
||||
EndOfSeg(myclass; Line : Polygo from IntPatch ;
|
||||
Index : Integer from Standard)
|
||||
|
||||
returns Pnt2d from gp;
|
||||
---C++: inline
|
||||
|
||||
|
||||
Dump(myclass; Line : Polygo from IntPatch);
|
||||
|
||||
|
||||
end PolygoTool;
|
||||
|
24
src/IntPatch/IntPatch_PolygoTool.cxx
Executable file
24
src/IntPatch/IntPatch_PolygoTool.cxx
Executable file
@@ -0,0 +1,24 @@
|
||||
#include <IntPatch_PolygoTool.ixx>
|
||||
|
||||
|
||||
|
||||
void IntPatch_PolygoTool::Dump(const IntPatch_Polygo& L) {
|
||||
static int num=0;
|
||||
num++;
|
||||
cout<<"\n#------------- D u m p B o x 2 d ("<<num<<")"<<endl;
|
||||
IntPatch_PolygoTool::Bounding(L).Dump();
|
||||
cout<<"\n#-----------------------------------------------"<<endl;
|
||||
|
||||
Standard_Integer nbs = IntPatch_PolygoTool::NbSegments(L);
|
||||
cout<<"\npol2d "<<num<<" "<<nbs<<" ";
|
||||
cout<<IntPatch_PolygoTool::DeflectionOverEstimation(L)<<endl;
|
||||
|
||||
for(Standard_Integer i=1;i<=nbs;i++) {
|
||||
gp_Pnt2d P(IntPatch_PolygoTool::BeginOfSeg(L,i));
|
||||
cout<<"pnt2d "<<num<<" "<< P.X()<<" "<<P.Y()<<endl;
|
||||
}
|
||||
gp_Pnt2d PF(IntPatch_PolygoTool::EndOfSeg(L,nbs));
|
||||
cout<<"pnt2d "<<num<<" "<< PF.X()<<" "<<PF.Y()<<endl;
|
||||
}
|
||||
|
||||
|
34
src/IntPatch/IntPatch_PolygoTool.lxx
Executable file
34
src/IntPatch/IntPatch_PolygoTool.lxx
Executable file
@@ -0,0 +1,34 @@
|
||||
#ifndef IntPatch_Polygo_HeaderFile
|
||||
#include <IntPatch_Polygo.hxx>
|
||||
#endif
|
||||
#ifndef Bnd_Box2d_HeaderFile
|
||||
#include <Bnd_Box2d.hxx>
|
||||
#endif
|
||||
#ifndef gp_Pnt2d_HeaderFile
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#endif
|
||||
|
||||
inline const Bnd_Box2d& IntPatch_PolygoTool::Bounding(const IntPatch_Polygo& Line)
|
||||
{ return Line.Bounding(); }
|
||||
|
||||
|
||||
inline Standard_Real IntPatch_PolygoTool::DeflectionOverEstimation
|
||||
(const IntPatch_Polygo& Line)
|
||||
{ return Line.Error();} // fleche non calculable
|
||||
|
||||
inline Standard_Boolean IntPatch_PolygoTool::Closed(const IntPatch_Polygo& Line)
|
||||
{ return Line.Closed();}
|
||||
|
||||
inline Standard_Integer IntPatch_PolygoTool::NbSegments(const IntPatch_Polygo& Line)
|
||||
{ return Line.NbPoints()-1;}
|
||||
|
||||
inline gp_Pnt2d IntPatch_PolygoTool::BeginOfSeg(const IntPatch_Polygo& Line,
|
||||
const Standard_Integer Index)
|
||||
{ return Line.Point(Index);}
|
||||
|
||||
|
||||
inline gp_Pnt2d IntPatch_PolygoTool::EndOfSeg(const IntPatch_Polygo& Line,
|
||||
const Standard_Integer Index)
|
||||
{ return Line.Point(Index+1);}
|
||||
|
||||
|
243
src/IntPatch/IntPatch_Polyhedron.cdl
Executable file
243
src/IntPatch/IntPatch_Polyhedron.cdl
Executable file
@@ -0,0 +1,243 @@
|
||||
-- File: IntPatch_Polyhedron.cdl
|
||||
-- Created: Wed Feb 3 11:24:14 1993
|
||||
-- Author: Laurent BUCHARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Polyhedron from IntPatch
|
||||
|
||||
---Purpose: This class provides a linear approximation of the PSurface.
|
||||
--- preview a constructor on a zone of a surface
|
||||
|
||||
uses
|
||||
HSurface from Adaptor3d,
|
||||
XYZ from gp,
|
||||
Pnt from gp,
|
||||
Array2OfPnt from TColgp,
|
||||
Array2OfReal from TColStd,
|
||||
Box from Bnd,
|
||||
HArray1OfBox from Bnd
|
||||
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
|
||||
is
|
||||
Create (Surface : HSurface from Adaptor3d;
|
||||
nbdU,nbdV : Integer)
|
||||
|
||||
returns Polyhedron from IntPatch;
|
||||
|
||||
---Purpose: MaTriangle constructor with an double array of pnt for the
|
||||
-- representation of a double array of triangles.
|
||||
|
||||
|
||||
Create (Surface : HSurface from Adaptor3d)
|
||||
returns Polyhedron from IntPatch;
|
||||
|
||||
Destroy(me:in out);
|
||||
---C++: alias ~
|
||||
|
||||
Perform (me:in out; Surface : HSurface from Adaptor3d;
|
||||
nbdU,nbdV: Integer)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
DeflectionOverEstimation
|
||||
(me : in out; flec : Real from Standard)
|
||||
is static;
|
||||
|
||||
DeflectionOnTriangle
|
||||
(me;
|
||||
Surface : HSurface from Adaptor3d;
|
||||
Index : Integer from Standard)
|
||||
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
UMinSingularity
|
||||
(me : in out; Sing : Boolean from Standard)
|
||||
is static;
|
||||
|
||||
UMaxSingularity
|
||||
(me : in out; Sing : Boolean from Standard)
|
||||
is static;
|
||||
|
||||
VMinSingularity
|
||||
(me : in out; Sing : Boolean from Standard)
|
||||
is static;
|
||||
|
||||
VMaxSingularity
|
||||
(me : in out; Sing : Boolean from Standard)
|
||||
is static;
|
||||
|
||||
Size (me;
|
||||
nbdu, nbdv : in out Integer)
|
||||
is static;
|
||||
---Purpose: Get the size of the MaTriangle.
|
||||
|
||||
|
||||
NbTriangles (me)
|
||||
returns Integer
|
||||
is static;
|
||||
---Purpose: Give the number of triangles in this double array of
|
||||
-- triangles (nbdu*nbdv*2).
|
||||
|
||||
|
||||
Triangle (me;
|
||||
Index : in Integer;
|
||||
P1,P2,P3 : out Integer)
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Give the 3 points of the triangle of addresse Index in
|
||||
-- the double array of triangles.
|
||||
|
||||
|
||||
|
||||
TriConnex (me;
|
||||
Triang : in Integer;
|
||||
Pivot,Pedge : in Integer;
|
||||
TriCon : out Integer;
|
||||
OtherP : out Integer)
|
||||
returns Integer from Standard
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Give the addresse Tricon of the triangle connexe to the
|
||||
-- triangle of address Triang by the edge Pivot Pedge and
|
||||
-- the third point of this connexe triangle. When we are
|
||||
-- on a free edge TriCon==0 but the function return the
|
||||
-- value of the triangle in the other side of Pivot on
|
||||
-- the free edge. Used to turn around a vertex.
|
||||
|
||||
|
||||
NbPoints (me)
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
---Purpose: Give the number of point in the double array of
|
||||
-- triangles ((nbdu+1)*(nbdv+1)).
|
||||
|
||||
Point (me : in out ;
|
||||
thePnt : in Pnt from gp;
|
||||
lig, col : in Integer;
|
||||
U,V : in Real from Standard)
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Set the value of a field of the double array of
|
||||
-- points.
|
||||
|
||||
|
||||
Point (me;
|
||||
Index : in Integer;
|
||||
U,V : out Real from Standard)
|
||||
returns Pnt from gp
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Give the point of index i in the MaTriangle.
|
||||
---C++: return const &
|
||||
|
||||
Point (me;
|
||||
Index : in Integer)
|
||||
returns Pnt from gp
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Give the point of index i in the MaTriangle.
|
||||
---C++: return const &
|
||||
|
||||
|
||||
Point (me;
|
||||
Index : in Integer;
|
||||
P : out Pnt from gp)
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Give the point of index i in the MaTriangle.
|
||||
|
||||
|
||||
Bounding (me)
|
||||
returns Box from Bnd
|
||||
is static;
|
||||
---Purpose: Give the bounding box of the MaTriangle.
|
||||
---C++: return const &
|
||||
|
||||
FillBounding (me : in out)
|
||||
is static;
|
||||
---Purpose: Compute the array of boxes. The box <n> corresponding
|
||||
-- to the triangle <n>.
|
||||
|
||||
|
||||
ComponentsBounding
|
||||
(me)
|
||||
returns HArray1OfBox from Bnd
|
||||
is static;
|
||||
---Purpose: Give the array of boxes. The box <n> corresponding
|
||||
-- to the triangle <n>.
|
||||
---C++: return const &
|
||||
|
||||
|
||||
DeflectionOverEstimation
|
||||
(me)
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
HasUMinSingularity
|
||||
(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
HasUMaxSingularity
|
||||
(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
HasVMinSingularity
|
||||
(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
HasVMaxSingularity
|
||||
(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
PlaneEquation (me;
|
||||
Triang : in Integer from Standard;
|
||||
NormalVector : out XYZ from gp;
|
||||
PolarDistance : out Real from Standard)
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Give the plane equation of the triangle of addresse Triang.
|
||||
|
||||
|
||||
Contain (me;
|
||||
Triang : in Integer from Standard;
|
||||
ThePnt : in Pnt from gp)
|
||||
returns Boolean
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Give the plane equation of the triangle of addresse Triang.
|
||||
|
||||
Parameters(me; Index : Integer from Standard;
|
||||
U,V : out Real from Standard)
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
|
||||
-- Test needings :
|
||||
|
||||
Dump (me)
|
||||
is static;
|
||||
|
||||
fields
|
||||
TheBnd : Box from Bnd;
|
||||
TheComponentsBnd: HArray1OfBox from Bnd;
|
||||
TheDeflection : Real from Standard;
|
||||
nbdeltaU : Integer from Standard;
|
||||
nbdeltaV : Integer from Standard;
|
||||
C_MyPnts : Address from Standard;
|
||||
C_MyU : Address from Standard;
|
||||
C_MyV : Address from Standard;
|
||||
UMinSingular : Boolean from Standard;
|
||||
UMaxSingular : Boolean from Standard;
|
||||
VMinSingular : Boolean from Standard;
|
||||
VMaxSingular : Boolean from Standard;
|
||||
|
||||
end Polyhedron;
|
664
src/IntPatch/IntPatch_Polyhedron.cxx
Executable file
664
src/IntPatch/IntPatch_Polyhedron.cxx
Executable file
@@ -0,0 +1,664 @@
|
||||
// File: IntPatch_Polyhedron.cxx
|
||||
// Created: Wed Feb 3 11:33:09 1993
|
||||
// Author: Laurent BUCHARD
|
||||
// Copyright: OPEN CASCADE 1993
|
||||
|
||||
#include <IntPatch_Polyhedron.ixx>
|
||||
|
||||
#include <IntPatch_HInterTool.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <Bnd_Array1OfBox.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MSG_DEBUG 0
|
||||
|
||||
#define LONGUEUR_MINI_EDGE_TRIANGLE 1e-14
|
||||
#define DEFLECTION_COEFF 1.1
|
||||
#define NBMAXUV 30
|
||||
|
||||
//================================================================================
|
||||
static Standard_Integer NbPOnU (const Handle(Adaptor3d_HSurface)& S)
|
||||
{
|
||||
const Standard_Real u0 = S->FirstUParameter();
|
||||
const Standard_Real u1 = S->LastUParameter();
|
||||
const Standard_Integer nbpu = IntPatch_HInterTool::NbSamplesU(S,u0,u1);
|
||||
return (nbpu>NBMAXUV? NBMAXUV : nbpu);
|
||||
}
|
||||
//================================================================================
|
||||
static Standard_Integer NbPOnV (const Handle(Adaptor3d_HSurface)& S)
|
||||
{
|
||||
const Standard_Real v0 = S->FirstVParameter();
|
||||
const Standard_Real v1 = S->LastVParameter();
|
||||
const Standard_Integer nbpv = IntPatch_HInterTool::NbSamplesV(S,v0,v1);
|
||||
return (nbpv>NBMAXUV? NBMAXUV : nbpv);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntPatch_Polyhedron::Destroy()
|
||||
{
|
||||
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts; if(C_MyPnts) delete [] CMyPnts;
|
||||
Standard_Real *CMyU = (Standard_Real *)C_MyU; if(C_MyU) delete [] CMyU;
|
||||
Standard_Real *CMyV = (Standard_Real *)C_MyV; if(C_MyV) delete [] CMyV;
|
||||
C_MyPnts=C_MyU=C_MyV=NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_Polyhedron
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntPatch_Polyhedron::IntPatch_Polyhedron (const Handle(Adaptor3d_HSurface)& Surface)
|
||||
: TheDeflection(Epsilon(100.)),
|
||||
nbdeltaU(NbPOnU(Surface)),
|
||||
nbdeltaV(NbPOnV(Surface)),
|
||||
C_MyPnts(NULL),C_MyU(NULL),C_MyV(NULL),
|
||||
UMinSingular(IntPatch_HInterTool::SingularOnVMin(Surface)),
|
||||
UMaxSingular(IntPatch_HInterTool::SingularOnVMin(Surface)),
|
||||
VMinSingular(IntPatch_HInterTool::SingularOnVMin(Surface)),
|
||||
VMaxSingular(IntPatch_HInterTool::SingularOnVMin(Surface))
|
||||
{
|
||||
const Standard_Integer t = (nbdeltaU+1)*(nbdeltaV+1)+1;
|
||||
gp_Pnt *CMyPnts = new gp_Pnt[t];
|
||||
Standard_Real *CMyU = new Standard_Real[t];
|
||||
Standard_Real *CMyV = new Standard_Real[t];
|
||||
C_MyPnts = CMyPnts;
|
||||
C_MyU = CMyU;
|
||||
C_MyV = CMyV;
|
||||
|
||||
const Standard_Real u0 = Surface->FirstUParameter();
|
||||
const Standard_Real u1 = Surface->LastUParameter();
|
||||
const Standard_Real v0 = Surface->FirstVParameter();
|
||||
const Standard_Real v1 = Surface->LastVParameter();
|
||||
|
||||
const Standard_Real U1mU0sNbdeltaU = (u1-u0)/(Standard_Real)nbdeltaU;
|
||||
const Standard_Real V1mV0sNbdeltaV = (v1-v0)/(Standard_Real)nbdeltaV;
|
||||
|
||||
gp_Pnt TP;
|
||||
Standard_Real U,V;
|
||||
Standard_Integer i1, i2, Index=1;
|
||||
for (i1 = 0, U = u0; i1 <= nbdeltaU; i1++, U+= U1mU0sNbdeltaU) {
|
||||
for (i2 = 0, V = v0; i2 <= nbdeltaV; i2++, V+= V1mV0sNbdeltaV ) {
|
||||
Surface->D0(U,V,TP);
|
||||
CMyPnts[Index] = TP;
|
||||
CMyU[Index] = U;
|
||||
CMyV[Index] = V;
|
||||
TheBnd.Add(TP);
|
||||
Index++;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real tol=0.0;
|
||||
const Standard_Integer nbtriangles = NbTriangles();
|
||||
for (i1=1; i1<=nbtriangles; i1++) {
|
||||
const Standard_Real tol1 = DeflectionOnTriangle(Surface,i1);
|
||||
if(tol1>tol) tol=tol1;
|
||||
}
|
||||
|
||||
tol*=DEFLECTION_COEFF;
|
||||
|
||||
DeflectionOverEstimation(tol);
|
||||
FillBounding();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntPatch_Polyhedron
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntPatch_Polyhedron::IntPatch_Polyhedron (const Handle(Adaptor3d_HSurface)& Surface,
|
||||
const Standard_Integer nbu,
|
||||
const Standard_Integer nbv)
|
||||
: TheDeflection(Epsilon(100.)),
|
||||
nbdeltaU(nbu),
|
||||
nbdeltaV(nbv),
|
||||
C_MyPnts(NULL),C_MyU(NULL),C_MyV(NULL),
|
||||
UMinSingular(IntPatch_HInterTool::SingularOnVMin(Surface)),
|
||||
UMaxSingular(IntPatch_HInterTool::SingularOnVMin(Surface)),
|
||||
VMinSingular(IntPatch_HInterTool::SingularOnVMin(Surface)),
|
||||
VMaxSingular(IntPatch_HInterTool::SingularOnVMin(Surface))
|
||||
{
|
||||
const Standard_Integer t = (nbdeltaU+1)*(nbdeltaV+1)+1;
|
||||
gp_Pnt *CMyPnts = new gp_Pnt[t];
|
||||
Standard_Real *CMyU = new Standard_Real[t];
|
||||
Standard_Real *CMyV = new Standard_Real[t];
|
||||
C_MyPnts = CMyPnts;
|
||||
C_MyU = CMyU;
|
||||
C_MyV = CMyV;
|
||||
|
||||
const Standard_Real u0 = Surface->FirstUParameter();
|
||||
const Standard_Real u1 = Surface->LastUParameter();
|
||||
const Standard_Real v0 = Surface->FirstVParameter();
|
||||
const Standard_Real v1 = Surface->LastVParameter();
|
||||
|
||||
const Standard_Real U1mU0sNbdeltaU = (u1-u0)/(Standard_Real)nbdeltaU;
|
||||
const Standard_Real V1mV0sNbdeltaV = (v1-v0)/(Standard_Real)nbdeltaV;
|
||||
|
||||
gp_Pnt TP;
|
||||
Standard_Real U,V;
|
||||
Standard_Integer i1, i2, Index=1;
|
||||
for (i1 = 0, U = u0; i1 <= nbdeltaU; i1++, U+= U1mU0sNbdeltaU) {
|
||||
for (i2 = 0, V = v0; i2 <= nbdeltaV; i2++, V+= V1mV0sNbdeltaV ) {
|
||||
Surface->D0(U,V,TP);
|
||||
CMyPnts[Index] = TP;
|
||||
CMyU[Index] = U;
|
||||
CMyV[Index] = V;
|
||||
TheBnd.Add(TP);
|
||||
Index++;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real tol=0.0;
|
||||
const Standard_Integer nbtriangles = NbTriangles();
|
||||
for (i1=1; i1<=nbtriangles; i1++) {
|
||||
const Standard_Real tol1 = DeflectionOnTriangle(Surface,i1);
|
||||
if(tol1>tol) tol=tol1;
|
||||
}
|
||||
|
||||
tol*=DEFLECTION_COEFF;
|
||||
|
||||
DeflectionOverEstimation(tol);
|
||||
FillBounding();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DeflectionOnTriangle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real IntPatch_Polyhedron::DeflectionOnTriangle
|
||||
(const Handle(Adaptor3d_HSurface)& Surface,
|
||||
const Standard_Integer Triang) const
|
||||
{
|
||||
Standard_Integer i1,i2,i3;
|
||||
|
||||
Triangle(Triang,i1,i2,i3);
|
||||
//-- Calcul de l eqution du plan
|
||||
Standard_Real u1,v1,u2,v2,u3,v3;
|
||||
gp_Pnt P1,P2,P3;
|
||||
P1 = Point(i1,u1,v1);
|
||||
P2 = Point(i2,u2,v2);
|
||||
P3 = Point(i3,u3,v3);
|
||||
if(P1.SquareDistance(P2)<=LONGUEUR_MINI_EDGE_TRIANGLE) return(0);
|
||||
if(P1.SquareDistance(P3)<=LONGUEUR_MINI_EDGE_TRIANGLE) return(0);
|
||||
if(P2.SquareDistance(P3)<=LONGUEUR_MINI_EDGE_TRIANGLE) return(0);
|
||||
gp_XYZ XYZ1=P2.XYZ()-P1.XYZ();
|
||||
gp_XYZ XYZ2=P3.XYZ()-P2.XYZ();
|
||||
gp_XYZ XYZ3=P1.XYZ()-P3.XYZ();
|
||||
gp_Vec NormalVector((XYZ1^XYZ2)+(XYZ2^XYZ3)+(XYZ3^XYZ1));
|
||||
NormalVector.Normalize();
|
||||
#ifdef DEB
|
||||
Standard_Real PolarDistance = NormalVector * P1.XYZ();
|
||||
#endif
|
||||
//-- Calcul du point u,v au centre du triangle
|
||||
Standard_Real u = (u1+u2+u3)/3.0;
|
||||
Standard_Real v = (v1+v2+v3)/3.0;
|
||||
gp_Vec P1P(P1,Surface->Value(u,v));
|
||||
return(Abs(P1P.Dot(NormalVector)));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntPatch_Polyhedron::Parameters( const Standard_Integer Index
|
||||
,Standard_Real &U
|
||||
,Standard_Real &V) const
|
||||
{
|
||||
U = ((Standard_Real *)C_MyU)[Index];
|
||||
V = ((Standard_Real *)C_MyV)[Index];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DeflectionOverEstimation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntPatch_Polyhedron::DeflectionOverEstimation(const Standard_Real flec)
|
||||
{
|
||||
if(flec<0.0001) {
|
||||
TheDeflection=0.0001;
|
||||
TheBnd.Enlarge(0.0001);
|
||||
}
|
||||
else {
|
||||
TheDeflection=flec;
|
||||
TheBnd.Enlarge(flec);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DeflectionOverEstimation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntPatch_Polyhedron::DeflectionOverEstimation() const
|
||||
{
|
||||
return TheDeflection;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Bounding
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Bnd_Box& IntPatch_Polyhedron::Bounding() const
|
||||
{
|
||||
return TheBnd;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FillBounding
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntPatch_Polyhedron::FillBounding()
|
||||
{
|
||||
TheComponentsBnd=new Bnd_HArray1OfBox(1, NbTriangles());
|
||||
Bnd_Box Boite;
|
||||
Standard_Integer p1, p2, p3;
|
||||
Standard_Integer nbtriangles = NbTriangles();
|
||||
for (Standard_Integer iTri=1; iTri<=nbtriangles; iTri++) {
|
||||
Triangle(iTri, p1, p2, p3);
|
||||
Boite.SetVoid();
|
||||
const gp_Pnt& P1 = Point(p1);
|
||||
const gp_Pnt& P2 = Point(p2);
|
||||
const gp_Pnt& P3 = Point(p3);
|
||||
if(P1.SquareDistance(P2)>LONGUEUR_MINI_EDGE_TRIANGLE) {
|
||||
if(P1.SquareDistance(P3)>LONGUEUR_MINI_EDGE_TRIANGLE) {
|
||||
if(P2.SquareDistance(P3)>LONGUEUR_MINI_EDGE_TRIANGLE) {
|
||||
Boite.Add(P1);
|
||||
Boite.Add(P2);
|
||||
Boite.Add(P3);
|
||||
}
|
||||
}
|
||||
}
|
||||
Boite.Enlarge(TheDeflection);
|
||||
TheComponentsBnd->SetValue(iTri,Boite);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComponentsBounding
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(Bnd_HArray1OfBox)& IntPatch_Polyhedron::ComponentsBounding () const
|
||||
{
|
||||
return TheComponentsBnd;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbTriangles
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntPatch_Polyhedron::NbTriangles () const
|
||||
{
|
||||
return nbdeltaU*nbdeltaV*2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbPoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntPatch_Polyhedron::NbPoints () const
|
||||
{
|
||||
return (nbdeltaU+1)*(nbdeltaV+1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TriConnex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntPatch_Polyhedron::TriConnex (const Standard_Integer Triang,
|
||||
const Standard_Integer Pivot,
|
||||
const Standard_Integer Pedge,
|
||||
Standard_Integer& TriCon,
|
||||
Standard_Integer& OtherP) const {
|
||||
|
||||
#ifdef DEB
|
||||
Standard_Integer nbdeltaUp1 = nbdeltaU + 1;
|
||||
Standard_Integer nbdeltaUm2 = nbdeltaU + nbdeltaU;
|
||||
#endif
|
||||
Standard_Integer Pivotm1 = Pivot-1;
|
||||
Standard_Integer nbdeltaVp1 = nbdeltaV+1;
|
||||
Standard_Integer nbdeltaVm2 = nbdeltaV + nbdeltaV;
|
||||
|
||||
// Pivot position in the MaTriangle :
|
||||
Standard_Integer ligP = Pivotm1/nbdeltaVp1;
|
||||
Standard_Integer colP = Pivotm1 - ligP * nbdeltaVp1;
|
||||
|
||||
// Point sur Edge position in the MaTriangle and edge typ :
|
||||
#ifndef DEB
|
||||
Standard_Integer ligE = 0, colE = 0, typE = 0;
|
||||
#else
|
||||
Standard_Integer ligE, colE, typE;
|
||||
#endif
|
||||
if (Pedge!=0) {
|
||||
ligE= (Pedge-1)/nbdeltaVp1;
|
||||
colE= (Pedge-1) - (ligE * nbdeltaVp1);
|
||||
// Horizontal
|
||||
if (ligP==ligE) typE=1;
|
||||
// Vertical
|
||||
else if (colP==colE) typE=2;
|
||||
// Oblique
|
||||
else typE=3;
|
||||
}
|
||||
else {
|
||||
typE=0;
|
||||
}
|
||||
|
||||
// Triangle position General case :
|
||||
#ifndef DEB
|
||||
Standard_Integer linT = 0, colT = 0;
|
||||
Standard_Integer linO = 0, colO = 0;
|
||||
#else
|
||||
Standard_Integer linT, colT;
|
||||
Standard_Integer linO, colO;
|
||||
#endif
|
||||
Standard_Integer t,tt;
|
||||
if (Triang!=0) {
|
||||
t = (Triang-1)/(nbdeltaVm2);
|
||||
tt= (Triang-1)-t*nbdeltaVm2;
|
||||
linT= 1+t;
|
||||
colT= 1+tt;
|
||||
if (typE==0) {
|
||||
if (ligP==linT) {
|
||||
ligE=ligP-1;
|
||||
colE=colP-1;
|
||||
typE=3;
|
||||
}
|
||||
else {
|
||||
if (colT==ligP+ligP) {
|
||||
ligE=ligP;
|
||||
colE=colP-1;
|
||||
typE=1;
|
||||
}
|
||||
else {
|
||||
ligE=ligP+1;
|
||||
colE=colP+1;
|
||||
typE=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (typE) {
|
||||
case 1: // Horizontal
|
||||
if (linT==ligP) {
|
||||
linT++;
|
||||
linO=ligP+1;
|
||||
colO=(colP>colE)? colP : colE; //--colO=Max(colP, colE);
|
||||
}
|
||||
else {
|
||||
linT--;
|
||||
linO=ligP-1;
|
||||
colO=(colP<colE)? colP : colE; //--colO=Min(colP, colE);
|
||||
}
|
||||
break;
|
||||
case 2: // Vertical
|
||||
if (colT==(colP+colP)) {
|
||||
colT++;
|
||||
linO=(ligP>ligE)? ligP : ligE; //--linO=Max(ligP, ligE);
|
||||
colO=colP+1;;
|
||||
}
|
||||
else {
|
||||
colT--;
|
||||
linO=(ligP<ligE)? ligP : ligE; //--linO=Min(ligP, ligE);
|
||||
colO=colP-1;;
|
||||
}
|
||||
break;
|
||||
case 3: // Oblique
|
||||
if ((colT&1)==0) {
|
||||
colT--;
|
||||
linO=(ligP>ligE)? ligP : ligE; //--linO=Max(ligP, ligE);
|
||||
colO=(colP<colE)? colP : colE; //--colO=Min(colP, colE);
|
||||
}
|
||||
else {
|
||||
colT++;
|
||||
linO=(ligP<ligE)? ligP : ligE; //--linO=Min(ligP, ligE);
|
||||
colO=(colP>colE)? colP : colE; //--colO=Max(colP, colE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Unknown Triangle position :
|
||||
if (Pedge==0) {
|
||||
// Unknown edge :
|
||||
linT=(1>ligP)? 1 : ligP; //--linT=Max(1, ligP);
|
||||
colT=(1>(colP+colP))? 1 : (colP+colP); //--colT=Max(1, colP+colP);
|
||||
if (ligP==0) linO=ligP+1;
|
||||
else linO=ligP-1;
|
||||
colO=colP;
|
||||
}
|
||||
else {
|
||||
// Known edge We take the left or down connectivity :
|
||||
switch (typE) {
|
||||
case 1: // Horizontal
|
||||
linT=ligP+1;
|
||||
colT=(colP>colE)? colP : colE; //--colT=Max(colP,colE);
|
||||
colT+=colT;
|
||||
linO=ligP+1;
|
||||
colO=(colP>colE)? colP : colE; //--colO=Max(colP,colE);
|
||||
break;
|
||||
case 2: // Vertical
|
||||
linT=(ligP>ligE)? ligP : ligE; //--linT=Max(ligP, ligE);
|
||||
colT=colP+colP;
|
||||
linO=(ligP<ligE)? ligP : ligE; //--linO=Min(ligP, ligE);
|
||||
colO=colP-1;
|
||||
break;
|
||||
case 3: // Oblique
|
||||
linT=(ligP>ligE)? ligP : ligE; //--linT=Max(ligP, ligE);
|
||||
colT=colP+colE;
|
||||
linO=(ligP>ligE)? ligP : ligE; //--linO=Max(ligP, ligE);
|
||||
colO=(colP<colE)? colP : colE; //--colO=Min(colP, colE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TriCon=(linT-1)*nbdeltaVm2 + colT;
|
||||
|
||||
if (linT<1) {
|
||||
linO=0;
|
||||
colO=colP+colP-colE;
|
||||
if (colO<0) {colO=0;linO=1;}
|
||||
else if (colO>nbdeltaV) {colO=nbdeltaV;linO=1;}
|
||||
TriCon=0;
|
||||
}
|
||||
else if (linT>nbdeltaU) {
|
||||
linO=nbdeltaU;
|
||||
colO=colP+colP-colE;
|
||||
if (colO<0) {colO=0;linO=nbdeltaU-1;}
|
||||
else if (colO>nbdeltaV) {colO=nbdeltaV;linO=nbdeltaU-1;}
|
||||
TriCon=0;
|
||||
}
|
||||
|
||||
if (colT<1) {
|
||||
colO=0;
|
||||
linO=ligP+ligP-ligE;
|
||||
if (linO<0) {linO=0;colO=1;}
|
||||
else if (linO>nbdeltaU) {linO=nbdeltaU;colO=1;}
|
||||
TriCon=0;
|
||||
}
|
||||
else if (colT>nbdeltaV) {
|
||||
colO=nbdeltaV;
|
||||
linO=ligP+ligP-ligE;
|
||||
if (linO<0) {linO=0;colO=nbdeltaV-1;}
|
||||
else if (linO>nbdeltaU) {linO=nbdeltaU;colO=nbdeltaV-1;}
|
||||
TriCon=0;
|
||||
}
|
||||
|
||||
OtherP=linO*nbdeltaVp1 + colO+1;
|
||||
|
||||
|
||||
//----------------------------------------------------
|
||||
//-- Detection des cas ou le triangle retourne est
|
||||
//-- invalide. Dans ce cas, on retourne le triangle
|
||||
//-- suivant par un nouvel appel a TriConnex.
|
||||
//--
|
||||
//-- Si En entree : Point(Pivot)==Point(Pedge)
|
||||
//-- Alors on retourne OtherP a 0
|
||||
//-- et Tricon = Triangle
|
||||
//--
|
||||
if(Point(Pivot).SquareDistance(Point(Pedge))<=LONGUEUR_MINI_EDGE_TRIANGLE) {
|
||||
OtherP=0;
|
||||
TriCon=Triang;
|
||||
#if MSG_DEBUG
|
||||
cout<<" Probleme ds IntCurveSurface_Polyhedron : Pivot et PEdge Confondus "<<endl;
|
||||
#endif
|
||||
return(TriCon);
|
||||
}
|
||||
if(Point(OtherP).SquareDistance(Point(Pedge))<=LONGUEUR_MINI_EDGE_TRIANGLE) {
|
||||
#if MSG_DEBUG
|
||||
cout<<" Probleme ds IntCurveSurface_Polyhedron : OtherP et PEdge Confondus "<<endl;
|
||||
#endif
|
||||
Standard_Integer TempTri,TempOtherP;
|
||||
TempTri = TriCon;
|
||||
TempOtherP = OtherP;
|
||||
|
||||
return(0); //-- BUG NON CORRIGE ( a revoir le role de nbdeltaU et nbdeltaV)
|
||||
|
||||
return(TriConnex(TempTri,Pivot,TempOtherP,TriCon,OtherP));
|
||||
}
|
||||
return TriCon;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PlaneEquation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_Polyhedron::PlaneEquation (const Standard_Integer Triang,
|
||||
gp_XYZ& NormalVector,
|
||||
Standard_Real& PolarDistance) const
|
||||
{
|
||||
Standard_Integer i1,i2,i3;
|
||||
Triangle(Triang,i1,i2,i3);
|
||||
|
||||
gp_XYZ Pointi1(Point(i1).XYZ());
|
||||
gp_XYZ Pointi2(Point(i2).XYZ());
|
||||
gp_XYZ Pointi3(Point(i3).XYZ());
|
||||
|
||||
|
||||
gp_XYZ v1= Pointi2 - Pointi1;
|
||||
gp_XYZ v2= Pointi3 - Pointi2;
|
||||
gp_XYZ v3= Pointi1 - Pointi3;
|
||||
|
||||
if(v1.SquareModulus()<=LONGUEUR_MINI_EDGE_TRIANGLE) { NormalVector.SetCoord(1.0,0.0,0.0); return; }
|
||||
if(v2.SquareModulus()<=LONGUEUR_MINI_EDGE_TRIANGLE) { NormalVector.SetCoord(1.0,0.0,0.0); return; }
|
||||
if(v3.SquareModulus()<=LONGUEUR_MINI_EDGE_TRIANGLE) { NormalVector.SetCoord(1.0,0.0,0.0); return; }
|
||||
|
||||
NormalVector= (v1^v2)+(v2^v3)+(v3^v1);
|
||||
NormalVector.Normalize();
|
||||
PolarDistance = NormalVector * Point(i1).XYZ();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Contain
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntPatch_Polyhedron::Contain (const Standard_Integer Triang,
|
||||
const gp_Pnt& ThePnt) const
|
||||
{
|
||||
Standard_Integer i1,i2,i3;
|
||||
Triangle(Triang,i1,i2,i3);
|
||||
gp_XYZ Pointi1(Point(i1).XYZ());
|
||||
gp_XYZ Pointi2(Point(i2).XYZ());
|
||||
gp_XYZ Pointi3(Point(i3).XYZ());
|
||||
|
||||
gp_XYZ v1=(Pointi2-Pointi1)^(ThePnt.XYZ()-Pointi1);
|
||||
gp_XYZ v2=(Pointi3-Pointi2)^(ThePnt.XYZ()-Pointi2);
|
||||
gp_XYZ v3=(Pointi1-Pointi3)^(ThePnt.XYZ()-Pointi3);
|
||||
if (v1*v2 >= 0. && v2*v3 >= 0. && v3*v1>=0.)
|
||||
return Standard_True;
|
||||
else
|
||||
return Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IntPatch_Polyhedron::Dump()const
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Size
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntPatch_Polyhedron::Size(Standard_Integer& nbdu,
|
||||
Standard_Integer& nbdv) const
|
||||
{
|
||||
nbdu=nbdeltaU;
|
||||
nbdv=nbdeltaV;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Triangle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntPatch_Polyhedron::Triangle (const Standard_Integer Index,
|
||||
Standard_Integer& P1,
|
||||
Standard_Integer& P2,
|
||||
Standard_Integer& P3) const
|
||||
{
|
||||
Standard_Integer line=1+((Index-1)/(nbdeltaV*2));
|
||||
Standard_Integer colon=1+((Index-1)%(nbdeltaV*2));
|
||||
Standard_Integer colpnt=(colon+1)/2;
|
||||
|
||||
// General formula = (line-1)*(nbdeltaV+1)+colpnt
|
||||
|
||||
// Position of P1 = MesXYZ(line,colpnt);
|
||||
P1= (line-1)*(nbdeltaV+1) + colpnt;
|
||||
|
||||
// Position of P2= MesXYZ(line+1,colpnt+((colon-1)%2));
|
||||
P2= line*(nbdeltaV+1) + colpnt+((colon-1)%2);
|
||||
|
||||
// Position of P3= MesXYZ(line+(colon%2),colpnt+1);
|
||||
P3= (line-1+(colon%2))*(nbdeltaV+1) + colpnt + 1;
|
||||
//-- printf("\nTriangle %4d P1:%4d P2:%4d P3:%4d",Index,P1,P2,P3);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
//=======================================================================
|
||||
const gp_Pnt& IntPatch_Polyhedron::Point( const Standard_Integer Index
|
||||
,Standard_Real& U
|
||||
,Standard_Real& V) const
|
||||
{
|
||||
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts;
|
||||
Standard_Real *CMyU = (Standard_Real *)C_MyU;
|
||||
Standard_Real *CMyV = (Standard_Real *)C_MyV;
|
||||
U=CMyU[Index];
|
||||
V=CMyV[Index];
|
||||
return CMyPnts[Index];
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
//=======================================================================
|
||||
const gp_Pnt& IntPatch_Polyhedron::Point(const Standard_Integer Index) const {
|
||||
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts;
|
||||
return CMyPnts[Index];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
//=======================================================================
|
||||
void IntPatch_Polyhedron::Point (const gp_Pnt& /*p*/,
|
||||
const Standard_Integer /*lig*/,
|
||||
const Standard_Integer /*col*/,
|
||||
const Standard_Real /*u*/,
|
||||
const Standard_Real /*v*/)
|
||||
{
|
||||
//printf("\n IntPatch_Polyhedron::Point : Ne dois pas etre appelle\n");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
//=======================================================================
|
||||
void IntPatch_Polyhedron::Point (const Standard_Integer Index, gp_Pnt& P) const
|
||||
{
|
||||
gp_Pnt *CMyPnts = (gp_Pnt *)C_MyPnts;
|
||||
P = CMyPnts[Index];
|
||||
}
|
||||
//=======================================================================
|
87
src/IntPatch/IntPatch_PolyhedronTool.cdl
Executable file
87
src/IntPatch/IntPatch_PolyhedronTool.cdl
Executable file
@@ -0,0 +1,87 @@
|
||||
-- File: IntPatch_PolyhedronTool.cdl
|
||||
-- Created: Thu May 6 17:35:54 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class PolyhedronTool from IntPatch
|
||||
|
||||
---Purpose: Describe the signature of a polyedral surface with
|
||||
-- only triangular facets and the necessary informations
|
||||
-- to compute the interferences.
|
||||
|
||||
uses
|
||||
Polyhedron from IntPatch,
|
||||
XYZ from gp,
|
||||
Pnt from gp,
|
||||
Box from Bnd,
|
||||
HArray1OfBox from Bnd
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
is Bounding (myclass; thePolyh : Polyhedron from IntPatch)
|
||||
returns Box from Bnd;
|
||||
---Purpose: Give the bounding box of the Polyhedron.
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
ComponentsBounding
|
||||
(myclass; thePolyh : Polyhedron from IntPatch)
|
||||
returns HArray1OfBox from Bnd;
|
||||
---Purpose: Give the array of boxes. The box <n> corresponding
|
||||
-- to the triangle <n>.
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
|
||||
|
||||
DeflectionOverEstimation
|
||||
(myclass; thePolyh : Polyhedron from IntPatch)
|
||||
returns Real from Standard;
|
||||
---Purpose: Give the tolerance of the polygon.
|
||||
---C++: inline
|
||||
|
||||
|
||||
|
||||
-- Structure needings :
|
||||
|
||||
NbTriangles (myclass; thePolyh : Polyhedron from IntPatch)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Give the number of triangles in this polyedral surface.
|
||||
---C++: inline
|
||||
|
||||
|
||||
Triangle (myclass; thePolyh : Polyhedron from IntPatch;
|
||||
Index : in Integer from Standard;
|
||||
P1,P2,P3 : out Integer from Standard)
|
||||
raises OutOfRange from Standard;
|
||||
---Purpose: Give the indices of the 3 points of the triangle of
|
||||
-- address Index in the Polyhedron.
|
||||
---C++: inline
|
||||
|
||||
|
||||
Point (myclass; thePolyh : Polyhedron from IntPatch;
|
||||
Index : in Integer)
|
||||
returns Pnt from gp
|
||||
raises OutOfRange from Standard;
|
||||
---Purpose: Give the point of index i in the polyedral surface.
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
|
||||
|
||||
TriConnex (myclass; thePolyh : Polyhedron from IntPatch;
|
||||
Triang : in Integer;
|
||||
Pivot,Pedge : in Integer;
|
||||
TriCon : out Integer;
|
||||
OtherP : out Integer)
|
||||
returns Integer
|
||||
raises OutOfRange from Standard;
|
||||
---Purpose: Gives the addresse Tricon of the triangle connexe to
|
||||
-- the triangle of address Triang by the edge Pivot Pedge
|
||||
-- and the third point of this connexe triangle. When we
|
||||
-- are on a free edge TriCon==0 but the function return
|
||||
-- the value of the triangle in the other side of Pivot
|
||||
-- on the free edge. Used to turn around a vertex.
|
||||
---C++: inline
|
||||
|
||||
|
||||
end PolyhedronTool;
|
6
src/IntPatch/IntPatch_PolyhedronTool.cxx
Executable file
6
src/IntPatch/IntPatch_PolyhedronTool.cxx
Executable file
@@ -0,0 +1,6 @@
|
||||
// File: IntPatch_PolyhedronTool.cxx
|
||||
// Created: Thu May 6 17:35:54 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: Matra Datavision 1993
|
||||
|
||||
#include <IntPatch_PolyhedronTool.ixx>
|
50
src/IntPatch/IntPatch_PolyhedronTool.lxx
Executable file
50
src/IntPatch/IntPatch_PolyhedronTool.lxx
Executable file
@@ -0,0 +1,50 @@
|
||||
// File: IntPatch_PolyhedronTool.lxx
|
||||
// Created: Thu May 6 17:35:54 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: Matra Datavision 1993
|
||||
|
||||
inline const Bnd_Box& IntPatch_PolyhedronTool::Bounding (const IntPatch_Polyhedron& thePolyh)
|
||||
{
|
||||
return thePolyh.Bounding();
|
||||
}
|
||||
|
||||
inline const Handle(Bnd_HArray1OfBox)& IntPatch_PolyhedronTool::ComponentsBounding (const IntPatch_Polyhedron& thePolyh)
|
||||
{
|
||||
return thePolyh.ComponentsBounding();
|
||||
}
|
||||
|
||||
inline Standard_Real IntPatch_PolyhedronTool::DeflectionOverEstimation (const IntPatch_Polyhedron& thePolyh)
|
||||
{
|
||||
return thePolyh.DeflectionOverEstimation();
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_PolyhedronTool::NbTriangles (const IntPatch_Polyhedron& thePolyh)
|
||||
{
|
||||
return thePolyh.NbTriangles();
|
||||
}
|
||||
|
||||
inline void IntPatch_PolyhedronTool::Triangle (const IntPatch_Polyhedron& thePolyh,
|
||||
const Standard_Integer Index,
|
||||
Standard_Integer& P1,
|
||||
Standard_Integer& P2,
|
||||
Standard_Integer& P3)
|
||||
{
|
||||
thePolyh.Triangle(Index, P1,P2,P3);
|
||||
}
|
||||
|
||||
inline const gp_Pnt& IntPatch_PolyhedronTool::Point (const IntPatch_Polyhedron& thePolyh,
|
||||
const Standard_Integer Index)
|
||||
{
|
||||
return thePolyh.Point(Index);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_PolyhedronTool::TriConnex
|
||||
(const IntPatch_Polyhedron& thePolyh,
|
||||
const Standard_Integer Triang,
|
||||
const Standard_Integer Pivot,
|
||||
const Standard_Integer Pedge,
|
||||
Standard_Integer& TriCon,
|
||||
Standard_Integer& OtherP)
|
||||
{
|
||||
return thePolyh.TriConnex(Triang, Pivot, Pedge, TriCon, OtherP);
|
||||
}
|
352
src/IntPatch/IntPatch_PrmPrmIntersection.cdl
Executable file
352
src/IntPatch/IntPatch_PrmPrmIntersection.cdl
Executable file
@@ -0,0 +1,352 @@
|
||||
-- File: IntPatch_PrmPrmIntersection.cdl
|
||||
-- Created: Thu Jan 28 14:46:57 1993
|
||||
-- Author: Laurent BUCHARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class PrmPrmIntersection from IntPatch
|
||||
|
||||
---Purpose: Implementation of the Intersection between two
|
||||
-- bi-parametrised surfaces.
|
||||
--
|
||||
-- To avoid multiple constructions of the approximated
|
||||
-- polyhedron of the surfaces, the algorithm can be
|
||||
-- called whith the two surfaces and their associated
|
||||
-- polyhedron.
|
||||
--
|
||||
|
||||
|
||||
uses
|
||||
Polyhedron from IntPatch,
|
||||
HSurface from Adaptor3d,
|
||||
TopolTool from Adaptor3d,
|
||||
Line from IntPatch,
|
||||
SequenceOfLine from IntPatch,
|
||||
PrmPrmIntersection_T3Bits from IntPatch,
|
||||
LineOn2S from IntSurf,
|
||||
--amv
|
||||
ListOfPntOn2S from IntSurf
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
---Purpose : Empty Constructor
|
||||
|
||||
returns PrmPrmIntersection from IntPatch;
|
||||
|
||||
Perform(me:in out;
|
||||
Caro1 : HSurface from Adaptor3d;
|
||||
Polyhedron1 : Polyhedron from IntPatch;
|
||||
Domain1 : TopolTool from Adaptor3d;
|
||||
Caro2 : HSurface from Adaptor3d;
|
||||
Polyhedron2 : Polyhedron from IntPatch;
|
||||
Domain2 : TopolTool from Adaptor3d;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard)
|
||||
|
||||
---Purpose: Performs the intersection between <Caro1> and
|
||||
-- <Caro2>. Associated Polyhedrons <Polyhedron1>
|
||||
-- and <Polyhedron2> are given.
|
||||
|
||||
is static;
|
||||
Perform(me:in out;
|
||||
Caro1 : HSurface from Adaptor3d;
|
||||
Polyhedron1 : Polyhedron from IntPatch;
|
||||
Domain1 : TopolTool from Adaptor3d;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard)
|
||||
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me :in out;
|
||||
Caro1 : HSurface from Adaptor3d;
|
||||
Domain1 : TopolTool from Adaptor3d;
|
||||
Caro2 : HSurface from Adaptor3d;
|
||||
Domain2 : TopolTool from Adaptor3d;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard;
|
||||
--amv
|
||||
ClearFlag : Boolean from Standard = Standard_True)
|
||||
|
||||
---Purpose: Performs the intersection between <Caro1> and
|
||||
-- <Caro2>. The method computes the polyhedron on
|
||||
-- each surface.
|
||||
|
||||
is static;
|
||||
|
||||
--amv
|
||||
Perform(me :in out;
|
||||
Caro1 : HSurface from Adaptor3d;
|
||||
Domain1 : TopolTool from Adaptor3d;
|
||||
Caro2 : HSurface from Adaptor3d;
|
||||
Domain2 : TopolTool from Adaptor3d;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard;
|
||||
ListOfPnts: in out ListOfPntOn2S from IntSurf;
|
||||
RestrictLine: Boolean from Standard)
|
||||
|
||||
---Purpose: Performs the intersection between <Caro1> and
|
||||
-- <Caro2>. The method computes the polyhedron on
|
||||
-- each surface.
|
||||
|
||||
is static;
|
||||
|
||||
Perform(me :in out;
|
||||
Caro1 : HSurface from Adaptor3d;
|
||||
Domain1 : TopolTool from Adaptor3d;
|
||||
Caro2 : HSurface from Adaptor3d;
|
||||
Domain2 : TopolTool from Adaptor3d;
|
||||
U1,V1,U2,V2 : Real from Standard;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard)
|
||||
|
||||
---Purpose: Performs the intersection between <Caro1> and
|
||||
-- <Caro2>. The method computes the polyhedron on
|
||||
-- each surface.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me :in out;
|
||||
Caro1 : HSurface from Adaptor3d;
|
||||
Domain1 : TopolTool from Adaptor3d;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard)
|
||||
|
||||
---Purpose: Performs the intersection between <Caro1> and
|
||||
-- <Caro2>. The method computes the polyhedron on
|
||||
-- each surface.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
|
||||
Perform(me:in out;
|
||||
Caro1 : HSurface from Adaptor3d;
|
||||
Domain1 : TopolTool from Adaptor3d;
|
||||
Caro2 : HSurface from Adaptor3d;
|
||||
Polyhedron2 : Polyhedron from IntPatch;
|
||||
Domain2 : TopolTool from Adaptor3d;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard)
|
||||
|
||||
---Purpose: Performs the intersection between <Caro1> and
|
||||
-- <Caro2>.
|
||||
--
|
||||
-- The polyhedron which approximates <Caro2>,
|
||||
-- <Polyhedron2> is given. The other one is
|
||||
-- computed.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me:in out;
|
||||
Caro1 : HSurface from Adaptor3d;
|
||||
Polyhedron1 : Polyhedron from IntPatch;
|
||||
Domain1 : TopolTool from Adaptor3d;
|
||||
Caro2 : HSurface from Adaptor3d;
|
||||
Domain2 : TopolTool from Adaptor3d;
|
||||
TolTangency,
|
||||
Epsilon,
|
||||
Deflection,
|
||||
Increment : Real from Standard)
|
||||
|
||||
---Purpose: Performs the intersection between <Caro1> and
|
||||
-- <Caro2>.
|
||||
--
|
||||
-- The polyhedron which approximates <Caro1>,
|
||||
-- <Polyhedron1> is given. The other one is
|
||||
-- computed.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns true if the calculus was succesfull.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsEmpty(me)
|
||||
|
||||
---Purpose: Returns true if the is no intersection.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
NbLines(me)
|
||||
|
||||
---Purpose: Returns the number of intersection lines.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
is static;
|
||||
|
||||
|
||||
Line(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the line of range Index.
|
||||
-- An exception is raised if Index<=0 or Index>NbLine.
|
||||
|
||||
returns Line from IntPatch
|
||||
---C++: return const&
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
is static;
|
||||
|
||||
NewLine(me; Caro1 : HSurface from Adaptor3d;
|
||||
Caro2 : HSurface from Adaptor3d;
|
||||
IndexLine,
|
||||
LowPoint,
|
||||
HighPoint,
|
||||
NbPoints: Integer from Standard)
|
||||
|
||||
---Purpose: Computes about <NbPoints> Intersection Points on
|
||||
-- the Line <IndexLine> between the Points of Index
|
||||
-- <LowPoint> and <HighPoint>.
|
||||
--
|
||||
-- All the points of the line of index <IndexLine>
|
||||
-- with an index between <LowPoint> and <HighPoint>
|
||||
-- are in the returned line. New Points are inserted
|
||||
-- between existing points if those points are not
|
||||
-- too closed.
|
||||
--
|
||||
-- An exception is raised if Index<=0 or Index>NbLine.
|
||||
-- or if IsDone returns False
|
||||
|
||||
returns Line from IntPatch
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
GrilleInteger ( me ;
|
||||
ix : Integer from Standard ;
|
||||
iy : Integer from Standard ;
|
||||
iz : Integer from Standard )
|
||||
returns Integer from Standard
|
||||
is static ;
|
||||
---C++: inline
|
||||
|
||||
IntegerGrille ( me ;
|
||||
t : Integer from Standard ;
|
||||
ix : in out Integer from Standard ;
|
||||
iy : in out Integer from Standard ;
|
||||
iz : in out Integer from Standard )
|
||||
is static ;
|
||||
---C++: inline
|
||||
|
||||
DansGrille ( me ;
|
||||
t : Integer from Standard )
|
||||
returns Integer from Standard
|
||||
is static ;
|
||||
---C++: inline
|
||||
|
||||
|
||||
|
||||
NbPointsGrille ( me )
|
||||
returns Integer from Standard
|
||||
is static ;
|
||||
---C++: inline
|
||||
|
||||
|
||||
RemplitLin ( me ;
|
||||
x1 : Integer from Standard ;
|
||||
y1 : Integer from Standard ;
|
||||
z1 : Integer from Standard ;
|
||||
x2 : Integer from Standard ;
|
||||
y2 : Integer from Standard ;
|
||||
z2 : Integer from Standard ;
|
||||
Map : in out PrmPrmIntersection_T3Bits from IntPatch )
|
||||
is static ;
|
||||
|
||||
RemplitTri ( me ;
|
||||
x1 : Integer from Standard ;
|
||||
y1 : Integer from Standard ;
|
||||
z1 : Integer from Standard ;
|
||||
x2 : Integer from Standard ;
|
||||
y2 : Integer from Standard ;
|
||||
z2 : Integer from Standard ;
|
||||
x3 : Integer from Standard ;
|
||||
y3 : Integer from Standard ;
|
||||
z3 : Integer from Standard ;
|
||||
Map : in out PrmPrmIntersection_T3Bits from IntPatch )
|
||||
is static ;
|
||||
|
||||
|
||||
Remplit ( me ;
|
||||
a : Integer from Standard ;
|
||||
b : Integer from Standard ;
|
||||
c : Integer from Standard ;
|
||||
Map : in out PrmPrmIntersection_T3Bits from IntPatch )
|
||||
is static ;
|
||||
|
||||
CodeReject ( me ;
|
||||
x1 : Real from Standard ;
|
||||
y1 : Real from Standard ;
|
||||
z1 : Real from Standard ;
|
||||
x2 : Real from Standard ;
|
||||
y2 : Real from Standard ;
|
||||
z2 : Real from Standard ;
|
||||
x3 : Real from Standard ;
|
||||
y3 : Real from Standard ;
|
||||
z3 : Real from Standard )
|
||||
returns Integer from Standard
|
||||
is static ;
|
||||
|
||||
PointDepart ( me ;
|
||||
LineOn2S : in out LineOn2S from IntSurf ;
|
||||
S1 : HSurface from Adaptor3d ;
|
||||
SU1 : Integer from Standard ;
|
||||
SV1 : Integer from Standard ;
|
||||
S2 : HSurface from Adaptor3d ;
|
||||
SU2 : Integer from Standard ;
|
||||
SV2 : Integer from Standard )
|
||||
is static ;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
empt : Boolean from Standard;
|
||||
Preci : Real from Standard;
|
||||
Fleche : Real from Standard;
|
||||
Pas : Real from Standard;
|
||||
SLin : SequenceOfLine from IntPatch;
|
||||
|
||||
end PrmPrmIntersection;
|
3290
src/IntPatch/IntPatch_PrmPrmIntersection.cxx
Executable file
3290
src/IntPatch/IntPatch_PrmPrmIntersection.cxx
Executable file
File diff suppressed because it is too large
Load Diff
96
src/IntPatch/IntPatch_PrmPrmIntersection.lxx
Executable file
96
src/IntPatch/IntPatch_PrmPrmIntersection.lxx
Executable file
@@ -0,0 +1,96 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <IntPatch_Line.hxx>
|
||||
|
||||
|
||||
|
||||
#define _DECAL 7
|
||||
#define _DECAL2 14
|
||||
#define _BASE 128
|
||||
#define _BASEM1 127
|
||||
|
||||
|
||||
//======================================================================
|
||||
inline Standard_Integer IntPatch_PrmPrmIntersection::NbLines() const {
|
||||
if(!done)
|
||||
StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection ");
|
||||
return(SLin.Length());
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
inline const Handle(IntPatch_Line)& IntPatch_PrmPrmIntersection::Line
|
||||
(const Standard_Integer n) const {
|
||||
if(!done)
|
||||
StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection ");
|
||||
return(SLin.Value(n));
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
inline Standard_Boolean IntPatch_PrmPrmIntersection::IsEmpty() const {
|
||||
if(!done)
|
||||
StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection ");
|
||||
return(empt);
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
inline Standard_Boolean IntPatch_PrmPrmIntersection::IsDone() const {
|
||||
return(done);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_PrmPrmIntersection::GrilleInteger(const Standard_Integer ix,
|
||||
const Standard_Integer iy,
|
||||
const Standard_Integer iz) const
|
||||
{
|
||||
Standard_Integer tz = iz<<_DECAL2;
|
||||
Standard_Integer ty = iy<<_DECAL;
|
||||
Standard_Integer t = ix;
|
||||
t|=ty;
|
||||
t|=tz;
|
||||
return(t);
|
||||
}
|
||||
|
||||
inline void IntPatch_PrmPrmIntersection::IntegerGrille(const Standard_Integer tt,
|
||||
Standard_Integer &ix,
|
||||
Standard_Integer &iy,
|
||||
Standard_Integer &iz) const
|
||||
{
|
||||
Standard_Integer t = tt;
|
||||
ix = t & _BASEM1;
|
||||
t>>=_DECAL;
|
||||
iy = t & _BASEM1;
|
||||
t>>=_DECAL;
|
||||
iz = t;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_PrmPrmIntersection::DansGrille(const Standard_Integer t) const
|
||||
{
|
||||
if(t>=0) {
|
||||
if(t<_BASE){
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_PrmPrmIntersection::NbPointsGrille() const
|
||||
{ return(_BASE); }
|
||||
|
||||
|
||||
inline Standard_Integer IntPatch_PrmPrmIntersection::CodeReject(const Standard_Real x0,
|
||||
const Standard_Real y0,
|
||||
const Standard_Real z0,
|
||||
const Standard_Real x1,
|
||||
const Standard_Real y1,
|
||||
const Standard_Real z1,
|
||||
const Standard_Real x,
|
||||
const Standard_Real y,
|
||||
const Standard_Real z) const
|
||||
{
|
||||
int code = 0;
|
||||
if(x<x0) code =1;
|
||||
if(y<y0) code|=2;
|
||||
if(z<z0) code|=4;
|
||||
if(x>x1) code|=8;
|
||||
if(y>y1) code|=16;
|
||||
if(z>z1) code|=32;
|
||||
return(code);
|
||||
}
|
38
src/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.cdl
Executable file
38
src/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.cdl
Executable file
@@ -0,0 +1,38 @@
|
||||
-- File: IntPatch_PrmPrmIntersection_T3Bits.cdl
|
||||
-- Created: Thu Jan 28 14:46:57 1993
|
||||
-- Author: Laurent BUCHARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class PrmPrmIntersection_T3Bits from IntPatch
|
||||
|
||||
uses Integer from Standard
|
||||
|
||||
is
|
||||
|
||||
Create (size : Integer from Standard);
|
||||
|
||||
Destroy(me : in out);
|
||||
---C++: alias ~
|
||||
|
||||
Add (me : in out; t : Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
Val (me ; t : Integer from Standard) returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
Raz (me : in out; t : Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
ResetAnd (me : in out);
|
||||
|
||||
And (me : in out;
|
||||
Oth : in out PrmPrmIntersection_T3Bits from IntPatch;
|
||||
indiceprecedent : in out Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
fields
|
||||
-- ind : Integer from Standard;
|
||||
p : Address from Standard;
|
||||
Isize : Integer from Standard;
|
||||
|
||||
end PrmPrmIntersection_T3Bits;
|
56
src/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.cxx
Executable file
56
src/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.cxx
Executable file
@@ -0,0 +1,56 @@
|
||||
// File: IntPatch_PrmPrmIntersection_T3Bits.cxx
|
||||
// Created: Thu Dec 16 16:34:03 1999
|
||||
// Author: Atelier CAS2000
|
||||
// Copyright: OPEN CASCADE 1999
|
||||
|
||||
#include <IntPatch_PrmPrmIntersection_T3Bits.ixx>
|
||||
|
||||
IntPatch_PrmPrmIntersection_T3Bits::IntPatch_PrmPrmIntersection_T3Bits(const Standard_Integer size)
|
||||
{
|
||||
//-- ex: size=4 -> 4**3 = 64 bits -> 2 mots 32bits
|
||||
Standard_Integer nb = (size*size*size)>>5;
|
||||
Isize = nb;
|
||||
p = new Standard_Integer [nb];
|
||||
do { ((Standard_Integer *) p)[--nb]=0; } while(nb);
|
||||
}
|
||||
|
||||
void IntPatch_PrmPrmIntersection_T3Bits::Destroy()
|
||||
{
|
||||
if(p) { delete[] ((Standard_Integer*)p); p=NULL; }
|
||||
}
|
||||
|
||||
void IntPatch_PrmPrmIntersection_T3Bits::ResetAnd()
|
||||
{
|
||||
//ind = 0;
|
||||
}
|
||||
|
||||
Standard_Integer IntPatch_PrmPrmIntersection_T3Bits::And(IntPatch_PrmPrmIntersection_T3Bits& Oth,
|
||||
Standard_Integer& indice)
|
||||
{
|
||||
int k=indice>>5;
|
||||
Standard_Integer r=0;
|
||||
while(k<Isize)
|
||||
{
|
||||
Standard_Integer r=((Standard_Integer *) p)[k] & ((Standard_Integer *) Oth.p)[k];
|
||||
if(r)
|
||||
{
|
||||
unsigned long int c=0;
|
||||
do
|
||||
{
|
||||
if(r&1)
|
||||
{
|
||||
const Standard_Integer op = (k<<5)|(c);
|
||||
Raz(op);
|
||||
Oth.Raz(op);
|
||||
indice = op;
|
||||
return(1);
|
||||
}
|
||||
c++;
|
||||
r>>=1;
|
||||
}
|
||||
while(c<32);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
return(0);
|
||||
}
|
19
src/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.lxx
Executable file
19
src/IntPatch/IntPatch_PrmPrmIntersection_T3Bits.lxx
Executable file
@@ -0,0 +1,19 @@
|
||||
// File: IntPatch_PrmPrmIntersection_T3Bits.lxx
|
||||
// Created: Thu Dec 16 16:34:03 1999
|
||||
// Author: Atelier CAS2000
|
||||
// Copyright: OPEN CASCADE 1999
|
||||
|
||||
inline void IntPatch_PrmPrmIntersection_T3Bits::Add(const Standard_Integer t)
|
||||
{
|
||||
((Standard_Integer *) p)[t>>5] |= (1<<(((unsigned int)t)&31));
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_PrmPrmIntersection_T3Bits::Val(const Standard_Integer t) const
|
||||
{
|
||||
return (((Standard_Integer *) p)[t>>5] & (1<<(((unsigned int)t)&31)));
|
||||
}
|
||||
|
||||
inline void IntPatch_PrmPrmIntersection_T3Bits::Raz(const Standard_Integer t)
|
||||
{
|
||||
((Standard_Integer *) p)[t>>5] &= ~(1<<(((unsigned int)t)&31));
|
||||
}
|
316
src/IntPatch/IntPatch_RLine.cdl
Executable file
316
src/IntPatch/IntPatch_RLine.cdl
Executable file
@@ -0,0 +1,316 @@
|
||||
-- File: IntPatch_RLine.cdl
|
||||
-- Created: Mon Apr 6 11:17:45 1992
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class RLine from IntPatch
|
||||
|
||||
|
||||
inherits Line from IntPatch
|
||||
|
||||
---Purpose: Implementation of an intersection line described by a
|
||||
-- restriction line on one of the surfaces.
|
||||
|
||||
|
||||
uses
|
||||
HCurve2d from Adaptor2d,
|
||||
Point from IntPatch,
|
||||
SequenceOfPoint from IntPatch,
|
||||
TypeTrans from IntSurf,
|
||||
Situation from IntSurf,
|
||||
PntOn2S from IntSurf,
|
||||
LineOn2S from IntSurf
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
is
|
||||
|
||||
|
||||
Create(Tang: Boolean from Standard;
|
||||
Trans1,Trans2: TypeTrans from IntSurf)
|
||||
|
||||
---Purpose: Creates a restriction as an intersection line
|
||||
-- when the transitions are In or Out.
|
||||
|
||||
returns mutable RLine from IntPatch;
|
||||
|
||||
|
||||
Create(Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf)
|
||||
|
||||
---Purpose: Creates a restriction as an intersection line
|
||||
-- when the transitions are Touch.
|
||||
|
||||
returns mutable RLine from IntPatch;
|
||||
|
||||
|
||||
Create(Tang: Boolean from Standard)
|
||||
|
||||
---Purpose: Creates a restriction as an intersection line
|
||||
-- when the transitions are Undecided.
|
||||
|
||||
returns mutable RLine from IntPatch;
|
||||
|
||||
|
||||
AddVertex(me: mutable; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: To add a vertex in the list.
|
||||
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Replace(me: mutable; Index: Integer from Standard; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: Replaces the element of range Index in the list
|
||||
-- of points.
|
||||
|
||||
---C++: inline
|
||||
|
||||
raises OutOfRange from Standard
|
||||
--- The exception OutOfRange is raised when Index <= 0
|
||||
-- or Index > NbVertex.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetFirstPoint(me: mutable; IndFirst: Integer from Standard) is static;
|
||||
|
||||
---C++: inline
|
||||
|
||||
|
||||
SetLastPoint(me: mutable; IndLast: Integer from Standard) is static;
|
||||
|
||||
---C++: inline
|
||||
|
||||
|
||||
Add(me: mutable; L: LineOn2S from IntSurf)
|
||||
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsArcOnS1(me)
|
||||
|
||||
---Purpose: Returns True if the intersection is on the domain of the
|
||||
-- first patch.
|
||||
-- Returns False if the intersection is on the domain of
|
||||
-- the second patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
IsArcOnS2(me)
|
||||
|
||||
---Purpose: Returns True if the intersection is on the domain of the
|
||||
-- first patch.
|
||||
-- Returns False if the intersection is on the domain of
|
||||
-- the second patch.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
SetArcOnS1(me: mutable; A: HCurve2d from Adaptor2d)
|
||||
|
||||
is static;
|
||||
|
||||
SetArcOnS2(me: mutable; A: HCurve2d from Adaptor2d)
|
||||
|
||||
is static;
|
||||
|
||||
SetParamOnS1(me: mutable; p1,p2: Real from Standard)
|
||||
--- first and last parameters on the restriction of the first
|
||||
-- patch
|
||||
is static;
|
||||
|
||||
SetParamOnS2(me: mutable; p1,p2: out Real from Standard)
|
||||
--- first and last parameters on the restriction of the first
|
||||
-- patch
|
||||
is static;
|
||||
|
||||
ArcOnS1(me)
|
||||
|
||||
---Purpose: Returns the concerned arc.
|
||||
|
||||
returns HCurve2d from Adaptor2d
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
ArcOnS2(me)
|
||||
|
||||
---Purpose: Returns the concerned arc.
|
||||
|
||||
returns HCurve2d from Adaptor2d
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
ParamOnS1(me; p1,p2: out Real from Standard)
|
||||
--- first and last parameters on the restriction of the first
|
||||
-- patch
|
||||
is static;
|
||||
|
||||
ParamOnS2(me; p1,p2: out Real from Standard)
|
||||
--- first and last parameters on the restriction of the first
|
||||
-- patch
|
||||
is static;
|
||||
|
||||
HasFirstPoint(me)
|
||||
|
||||
---Purpose: Returns True if the line has a known First point.
|
||||
-- This point is given by the method FirstPoint().
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasLastPoint(me)
|
||||
|
||||
---Purpose: Returns True if the line has a known Last point.
|
||||
-- This point is given by the method LastPoint().
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FirstPoint(me)
|
||||
|
||||
---Purpose: Returns the IntPoint corresponding to the FirstPoint.
|
||||
-- An exception is raised when HasFirstPoint returns False.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
LastPoint(me)
|
||||
|
||||
---Purpose: Returns the IntPoint corresponding to the LastPoint.
|
||||
-- An exception is raised when HasLastPoint returns False.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbVertex(me)
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Vertex(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the vertex of range Index on the line.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises OutOfRange from Standard
|
||||
--- The exception OutOfRange is raised if Index <= 0 or
|
||||
-- Index > NbVertex.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasPolygon(me)
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbPnts(me)
|
||||
|
||||
---Purpose: Returns the number of intersection points.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised if HasPolygon returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the intersection point of range Index.
|
||||
|
||||
returns PntOn2S from IntSurf
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
DomainError from Standard
|
||||
--- The exception DomainError is raised if HasPolygon returns False.
|
||||
--- The exception OutOfRange is raised if Index <= 0 or Index > NbPnts.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetPoint(me:mutable; Index: Integer from Standard; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: Set the Point of index <Index> in the LineOn2S
|
||||
|
||||
is static;
|
||||
|
||||
ComputeVertexParameters(me: mutable; Tol:Real from Standard)
|
||||
|
||||
---Purpose: Set the parameters of all the vertex on the line.
|
||||
-- if a vertex is already in the line,
|
||||
-- its parameter is modified
|
||||
-- else a new point in the line is inserted.
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
theArcOnS1 : HCurve2d from Adaptor2d;
|
||||
theArcOnS2 : HCurve2d from Adaptor2d;
|
||||
onS1 : Boolean from Standard;
|
||||
onS2 : Boolean from Standard;
|
||||
|
||||
ParamInf1 : Real from Standard;
|
||||
ParamSup1 : Real from Standard;
|
||||
ParamInf2 : Real from Standard;
|
||||
ParamSup2 : Real from Standard;
|
||||
|
||||
curv : LineOn2S from IntSurf;
|
||||
fipt : Boolean from Standard;
|
||||
lapt : Boolean from Standard;
|
||||
indf : Integer from Standard;
|
||||
indl : Integer from Standard;
|
||||
svtx : SequenceOfPoint from IntPatch;
|
||||
|
||||
end RLine;
|
337
src/IntPatch/IntPatch_RLine.cxx
Executable file
337
src/IntPatch/IntPatch_RLine.cxx
Executable file
@@ -0,0 +1,337 @@
|
||||
// File: IntPatch_RLine.cxx
|
||||
// Created: Mon Apr 6 11:17:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1992
|
||||
|
||||
#include <IntPatch_RLine.ixx>
|
||||
|
||||
#include <IntSurf_PntOn2S.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
IntPatch_RLine::IntPatch_RLine (const Standard_Boolean Tang,
|
||||
const IntSurf_TypeTrans Trans1,
|
||||
const IntSurf_TypeTrans Trans2) :
|
||||
IntPatch_Line(Tang,Trans1,Trans2),
|
||||
fipt(Standard_False),lapt(Standard_False)
|
||||
|
||||
{
|
||||
typ = IntPatch_Restriction;
|
||||
onS2=Standard_False;
|
||||
onS1=Standard_False;
|
||||
}
|
||||
|
||||
|
||||
IntPatch_RLine::IntPatch_RLine (const Standard_Boolean Tang,
|
||||
const IntSurf_Situation Situ1,
|
||||
const IntSurf_Situation Situ2) :
|
||||
IntPatch_Line(Tang,Situ1,Situ2),
|
||||
fipt(Standard_False),lapt(Standard_False)
|
||||
{
|
||||
typ = IntPatch_Restriction;
|
||||
onS2=Standard_False;
|
||||
onS1=Standard_False;
|
||||
}
|
||||
|
||||
|
||||
IntPatch_RLine::IntPatch_RLine (const Standard_Boolean Tang) :
|
||||
IntPatch_Line(Tang),
|
||||
fipt(Standard_False),lapt(Standard_False)
|
||||
|
||||
{
|
||||
typ = IntPatch_Restriction;
|
||||
onS2=Standard_False;
|
||||
onS1=Standard_False;
|
||||
}
|
||||
|
||||
void IntPatch_RLine::ParamOnS1(Standard_Real& a,Standard_Real& b) const {
|
||||
if(onS1) {
|
||||
a=RealLast(); b=-a;
|
||||
for(Standard_Integer i=svtx.Length();i>=1;i--) {
|
||||
Standard_Real p=svtx(i).ParameterOnLine();
|
||||
if(p<a) a=p;
|
||||
if(p>b) b=p;
|
||||
}
|
||||
}
|
||||
else {
|
||||
a=b=0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void IntPatch_RLine::ParamOnS2(Standard_Real& a,Standard_Real& b) const {
|
||||
if(onS2) {
|
||||
a=RealLast(); b=-a;
|
||||
for(Standard_Integer i=svtx.Length();i>=1;i--) {
|
||||
Standard_Real p=svtx(i).ParameterOnLine();
|
||||
if(p<a) a=p;
|
||||
if(p>b) b=p;
|
||||
}
|
||||
}
|
||||
else {
|
||||
a=b=0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IntPatch_RLine::SetArcOnS1(const Handle(Adaptor2d_HCurve2d)& A) {
|
||||
theArcOnS1 = A;
|
||||
onS1=Standard_True;
|
||||
}
|
||||
|
||||
void IntPatch_RLine::SetArcOnS2(const Handle(Adaptor2d_HCurve2d)& A) {
|
||||
theArcOnS2 = A;
|
||||
onS2=Standard_True;
|
||||
}
|
||||
|
||||
|
||||
void IntPatch_RLine::SetPoint(const Standard_Integer Index,
|
||||
const IntPatch_Point& thepoint) {
|
||||
curv->Value(Index,thepoint.PntOn2S());
|
||||
}
|
||||
|
||||
//void IntPatch_RLine::ComputeVertexParameters(const Standard_Real Tol)
|
||||
void IntPatch_RLine::ComputeVertexParameters(const Standard_Real )
|
||||
{
|
||||
Standard_Integer i,j,nbvtx;//k;
|
||||
|
||||
Standard_Real ParamMinOnLine,ParamMaxOnLine;
|
||||
if(fipt) { ParamMinOnLine = Vertex(indf).ParameterOnLine(); } else { ParamMinOnLine = -100000.0; }
|
||||
if(lapt) { ParamMaxOnLine = Vertex(indl).ParameterOnLine(); } else { ParamMaxOnLine = 100000.0; }
|
||||
Standard_Boolean APointDeleted = Standard_False;
|
||||
//----------------------------------------------------------
|
||||
//-- F i l t r e s u r r e s t r i c t i o n s --
|
||||
//----------------------------------------------------------
|
||||
//-- deux vertex sur la meme restriction et seulement
|
||||
//-- sur celle ci ne doivent pas avoir le meme parametre
|
||||
//--
|
||||
nbvtx = NbVertex();
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
for(i=1; (i<=nbvtx) && (APointDeleted==Standard_False) ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXi.IsOnDomS1()==Standard_True) && (VTXi.IsOnDomS2()==Standard_False)) {
|
||||
for(j=1; (j<=nbvtx) && (APointDeleted==Standard_False) ;j++) {
|
||||
if(i!=j) {
|
||||
const IntPatch_Point& VTXj = svtx.Value(j);
|
||||
if((VTXj.IsOnDomS1()==Standard_True) && (VTXj.IsOnDomS2()==Standard_False)) {
|
||||
if(VTXi.ParameterOnLine() == VTXj.ParameterOnLine()) {
|
||||
if(VTXi.ArcOnS1() == VTXj.ArcOnS1()) {
|
||||
if(VTXi.ParameterOnArc1() == VTXj.ParameterOnArc1()) {
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>=j) indl--; }
|
||||
if(fipt) { if(indf>=j) indf--; }
|
||||
APointDeleted = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(APointDeleted == Standard_True);
|
||||
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
for(i=1; (i<=nbvtx) && (APointDeleted==Standard_False) ;i++) {
|
||||
const IntPatch_Point& VTXi = svtx.Value(i);
|
||||
if((VTXi.IsOnDomS2()==Standard_True) && (VTXi.IsOnDomS1()==Standard_False)) {
|
||||
for(j=1; (j<=nbvtx) && (APointDeleted==Standard_False) ;j++) {
|
||||
if(i!=j) {
|
||||
const IntPatch_Point& VTXj = svtx.Value(j);
|
||||
if((VTXj.IsOnDomS2()==Standard_True) && (VTXj.IsOnDomS1()==Standard_False)) {
|
||||
if(VTXi.ParameterOnLine() == VTXj.ParameterOnLine()) {
|
||||
if(VTXi.ArcOnS2() == VTXj.ArcOnS2()) {
|
||||
if(VTXi.ParameterOnArc2() == VTXj.ParameterOnArc2()) {
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
if(lapt) { if(indl>=j) indl--; }
|
||||
if(fipt) { if(indf>=j) indf--; }
|
||||
APointDeleted = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(APointDeleted == Standard_True);
|
||||
|
||||
nbvtx = NbVertex();
|
||||
|
||||
//----------------------------------------------------
|
||||
//-- On trie les Vertex
|
||||
Standard_Boolean SortIsOK;
|
||||
do {
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx; i++) {
|
||||
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine()) {
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Exchange(i-1,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
|
||||
do {
|
||||
APointDeleted = Standard_False;
|
||||
Standard_Boolean restrdiff;
|
||||
for(i=1; i<=nbvtx && (APointDeleted == Standard_False); i++) {
|
||||
const IntPatch_Point& VTX = svtx.Value(i);
|
||||
for(j=1; j<=nbvtx && (APointDeleted == Standard_False) ; j++) {
|
||||
if(i!=j) {
|
||||
const IntPatch_Point& VTXM1 = svtx.Value(j);
|
||||
|
||||
Standard_Boolean kill = Standard_False;
|
||||
Standard_Boolean killm1 = Standard_False;
|
||||
|
||||
if(VTXM1.ParameterOnLine() == VTX.ParameterOnLine()) {
|
||||
restrdiff=Standard_False;
|
||||
if(VTXM1.IsOnDomS1() && VTX.IsOnDomS1()) { //-- OnS1 OnS1
|
||||
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS1 == OnS1
|
||||
if(VTX.ParameterOnArc1() == VTXM1.ParameterOnArc1()) {
|
||||
if(VTXM1.IsOnDomS2()) { //-- OnS1 == OnS1 OnS2
|
||||
if(VTX.IsOnDomS2()==Standard_False) { //-- OnS1 == OnS1 OnS2 PasOnS2
|
||||
kill=Standard_True;
|
||||
}
|
||||
else {
|
||||
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS1 == OnS1 OnS2 == OnS2
|
||||
if(VTX.ParameterOnArc2() == VTXM1.ParameterOnArc2()) {
|
||||
kill=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- OnS1 == OnS1 PasOnS2
|
||||
if(VTX.IsOnDomS2()) { //-- OnS1 == OnS1 PasOnS2 OnS2
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
restrdiff=Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if((restrdiff==Standard_False) && (!(kill || killm1))) {
|
||||
if(VTXM1.IsOnDomS2() && VTX.IsOnDomS2()) { //-- OnS2 OnS2
|
||||
if(VTXM1.ArcOnS2() == VTX.ArcOnS2()) { //-- OnS2 == OnS2
|
||||
if(VTX.ParameterOnArc2() == VTXM1.ParameterOnArc2()) {
|
||||
if(VTXM1.IsOnDomS1()) { //-- OnS2 == OnS2 OnS1
|
||||
if(VTX.IsOnDomS1()==Standard_False) { //-- OnS2 == OnS2 OnS1 PasOnS1
|
||||
kill=Standard_True;
|
||||
}
|
||||
else {
|
||||
if(VTXM1.ArcOnS1() == VTX.ArcOnS1()) { //-- OnS2 == OnS2 OnS1 == OnS1
|
||||
if(VTX.ParameterOnArc1() == VTXM1.ParameterOnArc1()) {
|
||||
kill=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //-- OnS2 == OnS2 PasOnS1
|
||||
if(VTX.IsOnDomS1()) { //-- OnS2 == OnS2 PasOnS1 OnS1
|
||||
killm1=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
restrdiff=Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(restrdiff==Standard_False) {
|
||||
if(kill) {
|
||||
APointDeleted = Standard_True;
|
||||
svtx.Remove(i);
|
||||
nbvtx--;
|
||||
}
|
||||
else if(killm1) {
|
||||
APointDeleted = Standard_True;
|
||||
svtx.Remove(j);
|
||||
nbvtx--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(APointDeleted == Standard_True);
|
||||
|
||||
do {
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx && SortIsOK; i++) {
|
||||
const IntPatch_Point& Pim1=svtx.Value(i-1);
|
||||
const IntPatch_Point& Pii =svtx.Value(i);
|
||||
if(Pim1.ParameterOnLine()==Pii.ParameterOnLine()) {
|
||||
if( (Pii.IsOnDomS1() == Standard_False)
|
||||
&& (Pii.IsOnDomS2() == Standard_False)) {
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Remove(i);
|
||||
nbvtx--;
|
||||
}
|
||||
else {
|
||||
if( (Pim1.IsOnDomS1() == Standard_False)
|
||||
&& (Pim1.IsOnDomS2() == Standard_False)) {
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Remove(i-1);
|
||||
nbvtx--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
|
||||
//----------------------------------------------------
|
||||
//-- On trie les Vertex ( Cas Bizarre )
|
||||
nbvtx = NbVertex();
|
||||
do {
|
||||
SortIsOK = Standard_True;
|
||||
for(i=2; i<=nbvtx; i++) {
|
||||
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine()) {
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Exchange(i-1,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
|
||||
|
||||
SetFirstPoint(1);
|
||||
SetLastPoint(nbvtx);
|
||||
|
||||
|
||||
#if 0
|
||||
Standard_Boolean SortIsOK;
|
||||
Standard_Integer nbvtx = NbVertex();
|
||||
do {
|
||||
SortIsOK = Standard_True;
|
||||
for(Standard_Integer i=2; i<=nbvtx; i++) {
|
||||
if(svtx.Value(i-1).ParameterOnLine() > svtx.Value(i).ParameterOnLine()) {
|
||||
SortIsOK = Standard_False;
|
||||
svtx.Exchange(i,i-1);
|
||||
if(fipt) {
|
||||
if(indf == i) indf = i-1;
|
||||
else if(indf == (i-1)) indf = i;
|
||||
}
|
||||
if(lapt) {
|
||||
if(indl == i) indl = i-1;
|
||||
else if(indl == (i-1)) indl = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(!SortIsOK);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
109
src/IntPatch/IntPatch_RLine.lxx
Executable file
109
src/IntPatch/IntPatch_RLine.lxx
Executable file
@@ -0,0 +1,109 @@
|
||||
// File: IntPatch_RLine.lxx
|
||||
// Created: Mon Apr 6 11:17:45 1992
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: Matra Datavision 1992
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <IntSurf_LineOn2S.hxx>
|
||||
#include <IntPatch_Point.hxx>
|
||||
|
||||
|
||||
inline const Handle(Adaptor2d_HCurve2d)& IntPatch_RLine::ArcOnS1() const
|
||||
{
|
||||
return theArcOnS1;
|
||||
}
|
||||
|
||||
inline const Handle(Adaptor2d_HCurve2d)& IntPatch_RLine::ArcOnS2() const
|
||||
{
|
||||
return theArcOnS2;
|
||||
}
|
||||
|
||||
//-- Il faut mettre cet include ici , car l include fait un define Handle(Adaptor2d_HCurve2d) ...
|
||||
//-- et en fin de fichier un undef Handle(Adaptor2d_HCurve2d) ...
|
||||
|
||||
inline void IntPatch_RLine::AddVertex (const IntPatch_Point& Pnt)
|
||||
{
|
||||
svtx.Append(Pnt);
|
||||
}
|
||||
|
||||
inline void IntPatch_RLine::Replace (const Standard_Integer Index,
|
||||
const IntPatch_Point& Pnt)
|
||||
{
|
||||
svtx(Index) = Pnt;
|
||||
}
|
||||
|
||||
inline void IntPatch_RLine::SetFirstPoint (const Standard_Integer IndFirst)
|
||||
{
|
||||
fipt = Standard_True;
|
||||
indf = IndFirst;
|
||||
}
|
||||
|
||||
inline void IntPatch_RLine::SetLastPoint (const Standard_Integer IndLast)
|
||||
{
|
||||
lapt = Standard_True;
|
||||
indl = IndLast;
|
||||
}
|
||||
|
||||
inline void IntPatch_RLine::Add(const Handle(IntSurf_LineOn2S)& L)
|
||||
{
|
||||
curv = L;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_RLine::IsArcOnS1() const
|
||||
{
|
||||
return onS1;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_RLine::IsArcOnS2() const
|
||||
{
|
||||
return onS2;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_RLine::HasFirstPoint () const
|
||||
{
|
||||
return fipt;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_RLine::HasLastPoint () const
|
||||
{
|
||||
return lapt;
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_RLine::FirstPoint () const
|
||||
{
|
||||
if (!fipt) {Standard_DomainError::Raise();}
|
||||
return svtx(indf);
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_RLine::LastPoint () const
|
||||
{
|
||||
if (!lapt) {Standard_DomainError::Raise();}
|
||||
return svtx(indl);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_RLine::NbVertex () const
|
||||
{
|
||||
return svtx.Length();
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_RLine::Vertex (const Standard_Integer Index) const
|
||||
{
|
||||
return svtx(Index);
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_RLine::HasPolygon () const
|
||||
{
|
||||
return (!curv.IsNull());
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_RLine::NbPnts () const
|
||||
{
|
||||
if (curv.IsNull()) {Standard_DomainError::Raise();}
|
||||
return curv->NbPoints();
|
||||
}
|
||||
|
||||
inline const IntSurf_PntOn2S& IntPatch_RLine::Point (const Standard_Integer Index) const
|
||||
{
|
||||
if (curv.IsNull()) {Standard_DomainError::Raise();}
|
||||
return curv->Value(Index);
|
||||
}
|
33
src/IntPatch/IntPatch_RstInt.cdl
Executable file
33
src/IntPatch/IntPatch_RstInt.cdl
Executable file
@@ -0,0 +1,33 @@
|
||||
-- File: IntPatch_RstInt.cdl
|
||||
-- Created: Fri May 7 12:45:18 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class RstInt from IntPatch
|
||||
|
||||
---Purpose: trouver les points d intersection entre la ligne de
|
||||
-- cheminement et les arcs de restriction
|
||||
|
||||
uses Polygo from IntPatch,
|
||||
PolygoTool from IntPatch,
|
||||
Line from IntPatch,
|
||||
HSurface from Adaptor3d,
|
||||
TopolTool from Adaptor3d
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is
|
||||
|
||||
PutVertexOnLine(myclass;
|
||||
L : in out Line from IntPatch;
|
||||
Surf : HSurface from Adaptor3d;
|
||||
Domain : TopolTool from Adaptor3d;
|
||||
OtherSurf : HSurface from Adaptor3d;
|
||||
OnFirst : Boolean from Standard ;
|
||||
Tol : Real from Standard)
|
||||
|
||||
raises DomainError from Standard;
|
||||
--- The exception is raised if the Line from is neither
|
||||
-- a WLine nor a RLine.
|
||||
|
||||
end RstInt;
|
1225
src/IntPatch/IntPatch_RstInt.cxx
Executable file
1225
src/IntPatch/IntPatch_RstInt.cxx
Executable file
File diff suppressed because it is too large
Load Diff
328
src/IntPatch/IntPatch_WLine.cdl
Executable file
328
src/IntPatch/IntPatch_WLine.cdl
Executable file
@@ -0,0 +1,328 @@
|
||||
-- File: IntPatch_WLine.cdl
|
||||
-- Created: Mon May 27 13:18:45 1991
|
||||
-- Author: Isabelle GRIGNON
|
||||
---Copyright: Matra Datavision 1991, 1992
|
||||
|
||||
|
||||
class WLine from IntPatch
|
||||
|
||||
inherits Line from IntPatch
|
||||
|
||||
---Purpose: Definition of set of points as a result of the intersection
|
||||
-- between 2 parametrised patches.
|
||||
|
||||
uses
|
||||
HCurve2d from Adaptor2d,
|
||||
Point from IntPatch,
|
||||
SequenceOfPoint from IntPatch,
|
||||
PntOn2S from IntSurf,
|
||||
LineOn2S from IntSurf,
|
||||
TypeTrans from IntSurf,
|
||||
Situation from IntSurf,
|
||||
Box2d from Bnd,
|
||||
Box from Bnd,
|
||||
Pnt2d from gp,
|
||||
Pnt from gp
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
DomainError from Standard
|
||||
is
|
||||
Create(Line: LineOn2S from IntSurf; Tang: Boolean from Standard;
|
||||
Trans1, Trans2: TypeTrans from IntSurf)
|
||||
|
||||
---Purpose: Creates a WLine as an intersection when the
|
||||
-- transitions are In or Out.
|
||||
|
||||
returns mutable WLine from IntPatch;
|
||||
|
||||
|
||||
Create(Line: LineOn2S from IntSurf; Tang: Boolean from Standard;
|
||||
Situ1,Situ2: Situation from IntSurf)
|
||||
|
||||
---Purpose: Creates a WLine as an intersection when the
|
||||
-- transitions are Touch.
|
||||
|
||||
returns mutable WLine from IntPatch;
|
||||
|
||||
|
||||
Create(Line: LineOn2S from IntSurf; Tang: Boolean from Standard)
|
||||
|
||||
---Purpose: Creates a WLine as an intersection when the
|
||||
-- transitions are Undecided.
|
||||
|
||||
returns mutable WLine from IntPatch;
|
||||
|
||||
|
||||
AddVertex(me: mutable; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: Adds a vertex in the list.
|
||||
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetPoint(me:mutable; Index: Integer from Standard; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: Set the Point of index <Index> in the LineOn2S
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Replace(me: mutable; Index: Integer from Standard; Pnt: Point from IntPatch)
|
||||
|
||||
---Purpose: Replaces the element of range Index in the list
|
||||
-- of points.
|
||||
-- The exception OutOfRange is raised when
|
||||
-- Index <= 0 or Index > NbVertex.
|
||||
|
||||
---C++: inline
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
SetFirstPoint(me: mutable; IndFirst: Integer from Standard) is static;
|
||||
|
||||
---C++: inline
|
||||
|
||||
|
||||
SetLastPoint(me: mutable; IndLast: Integer from Standard) is static;
|
||||
|
||||
---C++: inline
|
||||
|
||||
|
||||
NbPnts(me)
|
||||
|
||||
---Purpose: Returns the number of intersection points.
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the intersection point of range Index.
|
||||
|
||||
returns PntOn2S from IntSurf
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises OutOfRange from Standard
|
||||
--- The exception OutOfRange is raised if Index <= 0 or Index > NbPnts.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasFirstPoint(me)
|
||||
|
||||
---Purpose: Returns True if the line has a known First point.
|
||||
-- This point is given by the method FirstPoint().
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasLastPoint(me)
|
||||
|
||||
---Purpose: Returns True if the line has a known Last point.
|
||||
-- This point is given by the method LastPoint().
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FirstPoint(me)
|
||||
|
||||
---Purpose: Returns the Point corresponding to the FirstPoint.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when HasFirstPoint
|
||||
-- returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
LastPoint(me)
|
||||
|
||||
---Purpose: Returns the Point corresponding to the LastPoint.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when HasFirstPoint
|
||||
-- returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FirstPoint(me; Indfirst: out Integer from Standard)
|
||||
|
||||
---Purpose: Returns the Point corresponding to the FirstPoint.
|
||||
-- Indfirst is the index of the first in the list
|
||||
-- of vertices.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when HasFirstPoint
|
||||
-- returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
LastPoint(me; Indlast: out Integer from Standard)
|
||||
|
||||
---Purpose: Returns the Point corresponding to the LastPoint.
|
||||
-- Indlast is the index of the last in the list
|
||||
-- of vertices.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises DomainError from Standard
|
||||
--- The exception DomainError is raised when HasFirstPoint
|
||||
-- returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbVertex(me)
|
||||
|
||||
returns Integer from Standard
|
||||
---C++: inline
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Vertex(me; Index: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the vertex of range Index on the line.
|
||||
|
||||
returns Point from IntPatch
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises OutOfRange from Standard
|
||||
--- The exception OutOfRange is raised if Index <= 0 or
|
||||
-- Index > NbVertex.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ComputeVertexParameters(me: mutable; Tol: Real from Standard)
|
||||
|
||||
---Purpose: Set the parameters of all the vertex on the line.
|
||||
-- if a vertex is already in the line,
|
||||
-- its parameter is modified
|
||||
-- else a new point in the line is inserted.
|
||||
is static;
|
||||
|
||||
Curve(me)
|
||||
|
||||
returns LineOn2S from IntSurf
|
||||
is static;
|
||||
|
||||
|
||||
IsOutSurf1Box(me: mutable; P1: Pnt2d from gp )
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
IsOutSurf2Box(me: mutable; P1: Pnt2d from gp )
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
IsOutBox(me: mutable; P: Pnt from gp)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
|
||||
SetPeriod(me: mutable; pu1,pv1,pu2,pv2: Real from Standard)
|
||||
is static;
|
||||
|
||||
|
||||
U1Period(me)
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
V1Period(me)
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
U2Period(me)
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
V2Period(me)
|
||||
returns Real from Standard
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
SetArcOnS1(me: mutable ; A : HCurve2d from Adaptor2d)
|
||||
is static;
|
||||
|
||||
HasArcOnS1(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
GetArcOnS1(me)
|
||||
---C++: return const&
|
||||
returns HCurve2d from Adaptor2d;
|
||||
|
||||
SetArcOnS2(me: mutable ; A : HCurve2d from Adaptor2d)
|
||||
is static;
|
||||
|
||||
HasArcOnS2(me)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
GetArcOnS2(me)
|
||||
---C++: return const&
|
||||
returns HCurve2d from Adaptor2d;
|
||||
|
||||
Dump(me)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
curv : LineOn2S from IntSurf;
|
||||
fipt : Boolean from Standard;
|
||||
lapt : Boolean from Standard;
|
||||
indf : Integer from Standard;
|
||||
indl : Integer from Standard;
|
||||
svtx : SequenceOfPoint from IntPatch;
|
||||
|
||||
Buv1 : Box2d from Bnd;
|
||||
Buv2 : Box2d from Bnd;
|
||||
Bxyz : Box from Bnd;
|
||||
|
||||
u1period : Real from Standard;
|
||||
v1period : Real from Standard;
|
||||
u2period : Real from Standard;
|
||||
v2period : Real from Standard;
|
||||
|
||||
hasArcOnS1 : Boolean from Standard;
|
||||
theArcOnS1 : HCurve2d from Adaptor2d;
|
||||
hasArcOnS2 : Boolean from Standard;
|
||||
theArcOnS2 : HCurve2d from Adaptor2d;
|
||||
|
||||
end WLine;
|
1041
src/IntPatch/IntPatch_WLine.cxx
Executable file
1041
src/IntPatch/IntPatch_WLine.cxx
Executable file
File diff suppressed because it is too large
Load Diff
88
src/IntPatch/IntPatch_WLine.lxx
Executable file
88
src/IntPatch/IntPatch_WLine.lxx
Executable file
@@ -0,0 +1,88 @@
|
||||
// File: IntPatch_WLine.lxx
|
||||
// Created: Mon May 27 13:18:45 1991
|
||||
// Author: Isabelle GRIGNON
|
||||
// Copyright: OPEN CASCADE 1991, 1992
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <IntSurf_LineOn2S.hxx>
|
||||
#include <IntPatch_Point.hxx>
|
||||
|
||||
|
||||
inline void IntPatch_WLine::AddVertex (const IntPatch_Point& Pnt)
|
||||
{
|
||||
svtx.Append(Pnt);
|
||||
}
|
||||
|
||||
inline void IntPatch_WLine::Replace (const Standard_Integer Index,
|
||||
const IntPatch_Point& Pnt)
|
||||
{
|
||||
svtx(Index) = Pnt;
|
||||
}
|
||||
|
||||
inline void IntPatch_WLine::SetFirstPoint (const Standard_Integer IndFirst)
|
||||
{
|
||||
fipt = Standard_True;
|
||||
indf = IndFirst;
|
||||
}
|
||||
|
||||
inline void IntPatch_WLine::SetLastPoint (const Standard_Integer IndLast)
|
||||
{
|
||||
lapt = Standard_True;
|
||||
indl = IndLast;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_WLine::NbPnts () const
|
||||
{
|
||||
return curv->NbPoints();
|
||||
}
|
||||
|
||||
inline const IntSurf_PntOn2S& IntPatch_WLine::Point (const Standard_Integer Index) const
|
||||
{
|
||||
return curv->Value(Index);
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_WLine::HasFirstPoint () const
|
||||
{
|
||||
return fipt;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntPatch_WLine::HasLastPoint () const
|
||||
{
|
||||
return lapt;
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_WLine::FirstPoint () const
|
||||
{
|
||||
if (!fipt) {Standard_DomainError::Raise();}
|
||||
return svtx(indf);
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_WLine::LastPoint () const
|
||||
{
|
||||
if (!lapt) {Standard_DomainError::Raise();}
|
||||
return svtx(indl);
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_WLine::FirstPoint (Standard_Integer& Indfirst) const
|
||||
{
|
||||
if (!fipt) {Standard_DomainError::Raise();}
|
||||
Indfirst = indf;
|
||||
return svtx(indf);
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_WLine::LastPoint (Standard_Integer& Indlast) const
|
||||
{
|
||||
if (!lapt) {Standard_DomainError::Raise();}
|
||||
Indlast = indl;
|
||||
return svtx(indl);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntPatch_WLine::NbVertex () const
|
||||
{
|
||||
return svtx.Length();
|
||||
}
|
||||
|
||||
inline const IntPatch_Point& IntPatch_WLine::Vertex (const Standard_Integer Index) const
|
||||
{
|
||||
return svtx(Index);
|
||||
}
|
Reference in New Issue
Block a user