mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0024708: Convertation of the generic classes to the non-generic. Part 2
Generic classes from "AppParCurves" package: "AppDef_SmoothCriterion", "AppDef_LinearCriteria" and "AppDef_Variational" moved to the corresponding non-generic classes "AppDef_SmoothCriterion", "AppDef_LinearCriteria" and "AppDef_Variational" to "AppDef" package. Also several "*.cxx" files of "AppDef_Variational" class merged to one ".cxx". Generic class from "IntImp" package: "IntImp_ZerCOnSSParFunc" moved to the corresponding non-generic class "IntPatch_CSFunction" to "IntPatch" package. Next unused generic classes were removed: - IntCurveSurface_SurfaceTool - Intf_InterferencePolygon3d And some other minor changes.
This commit is contained in:
@@ -92,10 +92,6 @@ is
|
||||
---Purpose: Computes the interference between two polygons in 2d.
|
||||
-- Result : points of intersections and zones of tangence.
|
||||
|
||||
generic class InterferencePolygon3d;
|
||||
---Purpose: Computes the interference between two polygon in 3d.
|
||||
-- Section points, common perpendicular and projections.
|
||||
|
||||
generic class InterferencePolygonPolyhedron;
|
||||
---Purpose: Computes the interference between a polygon or a straight
|
||||
-- line and a polyhedron. Points of intersection and zones
|
||||
|
@@ -1,148 +0,0 @@
|
||||
-- Created on: 1992-09-29
|
||||
-- Created by: Didier PIFFAULT
|
||||
-- Copyright (c) 1992-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
generic class InterferencePolygon3d from Intf
|
||||
(Polygon3d1 as any;
|
||||
ToolPolygon3d1 as any; -- as ToolPolygon(Pnt,Polygon3d1,Box)
|
||||
Polygon3d2 as any;
|
||||
ToolPolygon3d2 as any) -- as ToolPolygon(Pnt,Polygon3d2,Box)
|
||||
inherits Interference from Intf
|
||||
|
||||
---Purpose: Computes the interference between two polygons or the
|
||||
-- self interference of a polygon in 3 dimensions . In 3
|
||||
-- dimensions the result can be a common perpendicular ,
|
||||
-- an orthogonal projection or a real intersections.
|
||||
-- There are two different instantiation arguments to
|
||||
-- authorize an interference between two polygons from
|
||||
-- differents origin. Ex : to intersect a curve polygon
|
||||
-- with an algorithmic curve from numerical walking
|
||||
-- between two surfaces.
|
||||
|
||||
uses Pnt from gp,
|
||||
SectionPoint from Intf,
|
||||
SeqOfSectionPoint from Intf,
|
||||
SectionLine from Intf,
|
||||
SeqOfSectionLine from Intf
|
||||
|
||||
raises OutOfRange from Standard
|
||||
|
||||
|
||||
is
|
||||
-- Interface :
|
||||
|
||||
Create returns InterferencePolygon3d from Intf;
|
||||
---Purpose: Constructs an empty interference of 3d Polygon.
|
||||
|
||||
|
||||
Create (Obje1 : in Polygon3d1 ;Obje2 : in Polygon3d2)
|
||||
returns InterferencePolygon3d from Intf;
|
||||
---Purpose: Constructs and computes an interference between two Polygons.
|
||||
|
||||
|
||||
Create (Obje : in Polygon3d1)
|
||||
returns InterferencePolygon3d from Intf;
|
||||
---Purpose: Constructs and computes the self interference of a Polygon.
|
||||
|
||||
|
||||
Perform (me : in out;
|
||||
Obje1 : in Polygon3d1 ;Obje2 : in Polygon3d2);
|
||||
---Purpose: Computes an interference between two Polygons.
|
||||
|
||||
|
||||
Perform (me : in out;
|
||||
Obje : in Polygon3d1);
|
||||
---Purpose: Computes the auto interference of a Polygon.
|
||||
|
||||
|
||||
NbResults (me)
|
||||
returns Integer is static;
|
||||
---Purpose: Gives the number of common Perpendiculars or orthogonal
|
||||
-- projections between the two polygons.
|
||||
|
||||
ResultLine (me;
|
||||
Index : in Integer)
|
||||
returns SectionLine from Intf
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Gives the segment of address <Index> in the interference
|
||||
-- representing the perpendicular or the orthogonal
|
||||
-- projection .
|
||||
--
|
||||
---C++: return const &
|
||||
|
||||
|
||||
ResultValue (me;
|
||||
Index : in Integer)
|
||||
returns Real from Standard
|
||||
raises OutOfRange from Standard
|
||||
is static;
|
||||
---Purpose: Gives the distance between the two polygons
|
||||
|
||||
|
||||
MinimalDistance(me)
|
||||
returns Real from Standard
|
||||
is static;
|
||||
---Purpose: Gives the distance between the two polygon3d at the
|
||||
-- perpendicular or projection of minimal length.
|
||||
|
||||
|
||||
MinimalResult (me)
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
---Purpose: Give the perpendicular or projection of minimal length.
|
||||
-- WARNING : if there are points of intersection the minimal
|
||||
-- result is one of them and this function is unusuable.
|
||||
|
||||
|
||||
-- Implementation :
|
||||
|
||||
Interference (me : in out;
|
||||
Obje1 : in Polygon3d1;
|
||||
Obje2 : in Polygon3d2)
|
||||
is private;
|
||||
|
||||
Interference (me : in out;
|
||||
Obje : in Polygon3d1)
|
||||
is private;
|
||||
|
||||
CommonPerpen (me : in out;
|
||||
BegO : in Pnt from gp;
|
||||
EndO : in Pnt from gp;
|
||||
BegT : in Pnt from gp;
|
||||
EndT : in Pnt from gp)
|
||||
is private;
|
||||
---Purpose: Computes the common perpendicular between the two
|
||||
-- segments <BegO><EndO> and <BegT><EndT>.
|
||||
|
||||
Projections (me : in out;
|
||||
BegO : in Pnt from gp;
|
||||
EndO : in Pnt from gp;
|
||||
BegT : in Pnt from gp;
|
||||
EndT : in Pnt from gp)
|
||||
is private;
|
||||
---Purpose: Computes the different orthogonal projections between
|
||||
-- segment <BegO><EndO> and points <BegT>,<EndT> and segment
|
||||
-- <BegT><EndT> and points <BegO>,<EndO>.
|
||||
|
||||
|
||||
fields IndexMin : Integer from Standard;
|
||||
MinimalDist : Real from Standard;
|
||||
iObje1, iObje2 : Integer from Standard;
|
||||
beginOfNotClosedFirst: Boolean from Standard;
|
||||
beginOfNotClosedSecon: Boolean from Standard;
|
||||
|
||||
|
||||
end InterferencePolygon3d;
|
@@ -1,320 +0,0 @@
|
||||
// Created on: 1992-10-09
|
||||
// Created by: Didier PIFFAULT
|
||||
// Copyright (c) 1992-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Intf_SectionPoint.hxx>
|
||||
#include <Intf_SeqOfSectionPoint.hxx>
|
||||
#include <Intf_SectionLine.hxx>
|
||||
#include <Intf_SeqOfSectionLine.hxx>
|
||||
#include <Intf_SeqOfTangentZone.hxx>
|
||||
#include <Intf_TangentZone.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Intf_InterferencePolygon3d
|
||||
//purpose : Empty constructor.
|
||||
//=======================================================================
|
||||
|
||||
Intf_InterferencePolygon3d::Intf_InterferencePolygon3d()
|
||||
: Intf_Interference (Standard_False),
|
||||
IndexMin (0),
|
||||
iObje1 (0),
|
||||
iObje2 (0),
|
||||
beginOfNotClosedFirst (Standard_True),
|
||||
beginOfNotClosedSecon (Standard_True)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intf_InterferencePolygon3d
|
||||
//purpose : Constructor of the interference beetween two Polygon.
|
||||
//=======================================================================
|
||||
|
||||
Intf_InterferencePolygon3d::Intf_InterferencePolygon3d
|
||||
(const Polygon3d1& Obje1, const Polygon3d2& Obje2)
|
||||
: Intf_Interference (Standard_False),
|
||||
IndexMin (0),
|
||||
iObje1 (0),
|
||||
iObje2 (0),
|
||||
beginOfNotClosedFirst (Standard_True),
|
||||
beginOfNotClosedSecon (Standard_True)
|
||||
{
|
||||
Tolerance=ToolPolygon3d1::DeflectionOverEstimation(Obje1)+
|
||||
ToolPolygon3d2::DeflectionOverEstimation(Obje2);
|
||||
if (Tolerance<=0.) Tolerance=Epsilon(1000.);
|
||||
Interference(Obje1, Obje2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Intf_InterferencePolygon3d
|
||||
//purpose : Constructor of the auto interference of a Polygon.
|
||||
//=======================================================================
|
||||
|
||||
Intf_InterferencePolygon3d::Intf_InterferencePolygon3d
|
||||
(const Polygon3d1& Obje)
|
||||
: Intf_Interference (Standard_True),
|
||||
IndexMin(0),
|
||||
iObje1 (0),
|
||||
iObje2 (0),
|
||||
beginOfNotClosedFirst (Standard_True),
|
||||
beginOfNotClosedSecon (Standard_True)
|
||||
{
|
||||
Tolerance=ToolPolygon3d1::DeflectionOverEstimation(Obje)*2;
|
||||
Interference(Obje);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intf_InterferencePolygon3d::Perform
|
||||
(const Polygon3d1& Obje1, const Polygon3d2& Obje2)
|
||||
{
|
||||
SelfInterference(Standard_False);
|
||||
IndexMin=0;
|
||||
Tolerance=ToolPolygon3d1::DeflectionOverEstimation(Obje1)+
|
||||
ToolPolygon3d2::DeflectionOverEstimation(Obje2);
|
||||
if (Tolerance<=0.) Tolerance=Epsilon(1000.);
|
||||
Interference(Obje1, Obje2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intf_InterferencePolygon3d::Perform
|
||||
(const Polygon3d1& Obje)
|
||||
{
|
||||
SelfInterference(Standard_True);
|
||||
IndexMin=0;
|
||||
Tolerance=ToolPolygon3d1::DeflectionOverEstimation(Obje)*2;
|
||||
Interference(Obje);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
// Return the number of singularity in the interference.
|
||||
//--------------------------------------------------------
|
||||
Standard_Integer Intf_InterferencePolygon3d::NbResults () const
|
||||
{
|
||||
return mySLines.Length();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Give the result of range Index in the interference.
|
||||
//----------------------------------------------------------
|
||||
const Intf_SectionLine& Intf_InterferencePolygon3d::ResultLine
|
||||
(const Standard_Integer Index) const
|
||||
{
|
||||
return mySLines(Index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ResultValue
|
||||
//purpose : give the distance beetween the two polygons for this result.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Intf_InterferencePolygon3d::ResultValue
|
||||
(const Standard_Integer Index) const
|
||||
{
|
||||
return mySLines(Index).GetPoint(1).Pnt().Distance
|
||||
(mySLines(Index).GetPoint(2).Pnt());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MinimalDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Intf_InterferencePolygon3d::MinimalDistance () const
|
||||
{
|
||||
return MinimalDist;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MinimalResult
|
||||
//purpose : give the result of minimal distance.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Intf_InterferencePolygon3d::MinimalResult () const
|
||||
{
|
||||
return IndexMin;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Interference
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intf_InterferencePolygon3d::Interference
|
||||
(const Polygon3d1& Obje1,
|
||||
const Polygon3d2& Obje2)
|
||||
{
|
||||
beginOfNotClosedFirst=!ToolPolygon3d1::Closed(Obje1);
|
||||
for (iObje1=1; iObje1<=ToolPolygon3d1::NbSegments(Obje1); iObje1++) {
|
||||
beginOfNotClosedSecon=!ToolPolygon3d2::Closed(Obje2);
|
||||
for (iObje2=1; iObje2<=ToolPolygon3d2::NbSegments(Obje2); iObje2++) {
|
||||
|
||||
CommonPerpen(ToolPolygon3d1::BeginOfSeg(Obje1, iObje1),
|
||||
ToolPolygon3d1::EndOfSeg(Obje1, iObje1),
|
||||
ToolPolygon3d2::BeginOfSeg(Obje2, iObje2),
|
||||
ToolPolygon3d2::EndOfSeg(Obje2, iObje2));
|
||||
|
||||
Projections(ToolPolygon3d1::BeginOfSeg(Obje1, iObje1),
|
||||
ToolPolygon3d1::EndOfSeg(Obje1, iObje1),
|
||||
ToolPolygon3d2::BeginOfSeg(Obje2, iObje2),
|
||||
ToolPolygon3d2::EndOfSeg(Obje2, iObje2));
|
||||
|
||||
beginOfNotClosedSecon=Standard_False;
|
||||
}
|
||||
beginOfNotClosedFirst=Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Interference
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intf_InterferencePolygon3d::Interference
|
||||
(const Polygon3d1& Obje)
|
||||
{
|
||||
beginOfNotClosedFirst=!ToolPolygon3d1::Closed(Obje);
|
||||
beginOfNotClosedSecon=Standard_False;
|
||||
for (iObje1=1; iObje1<=ToolPolygon3d1::NbSegments(Obje); iObje1++) {
|
||||
for (iObje2=iObje1+1; iObje2<=ToolPolygon3d1::NbSegments(Obje); iObje2++) {
|
||||
|
||||
CommonPerpen(ToolPolygon3d1::BeginOfSeg(Obje, iObje1),
|
||||
ToolPolygon3d1::EndOfSeg(Obje, iObje1),
|
||||
ToolPolygon3d1::BeginOfSeg(Obje, iObje2),
|
||||
ToolPolygon3d1::EndOfSeg(Obje, iObje2));
|
||||
|
||||
Projections(ToolPolygon3d1::BeginOfSeg(Obje, iObje1),
|
||||
ToolPolygon3d1::EndOfSeg(Obje, iObje1),
|
||||
ToolPolygon3d1::BeginOfSeg(Obje, iObje2),
|
||||
ToolPolygon3d1::EndOfSeg(Obje, iObje2));
|
||||
|
||||
}
|
||||
beginOfNotClosedFirst=Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CommonPerpen
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intf_InterferencePolygon3d::CommonPerpen
|
||||
(const gp_Pnt& BegO, const gp_Pnt& EndO,
|
||||
const gp_Pnt& BegT, const gp_Pnt& EndT)
|
||||
{
|
||||
gp_XYZ segT=EndT.XYZ()-BegT.XYZ();
|
||||
gp_XYZ segO=EndO.XYZ()-BegO.XYZ();
|
||||
gp_XYZ refPlane=segT^segO;
|
||||
Standard_Real lgsO=Sqrt(segT*segT);
|
||||
Standard_Real lgsT=Sqrt(segO*segO);
|
||||
|
||||
if (lgsO<=Tolerance || lgsT<=Tolerance) {
|
||||
// Un des segments n a pas une longueur significative
|
||||
}
|
||||
else if (refPlane.Modulus()<Tolerance) {
|
||||
// Les deux segments sont paralleles
|
||||
}
|
||||
else {
|
||||
// Les deux segments ne sont pas parralleles
|
||||
Standard_Real distOP=(BegT.XYZ()*refPlane)/refPlane.Modulus();
|
||||
Standard_Real distTP=(BegO.XYZ()*refPlane)/refPlane.Modulus();
|
||||
Standard_Real lgPC=distOP-distTP;
|
||||
|
||||
if (Abs(lgPC)< Tolerance) {
|
||||
// Les deux segments sont dans le meme plan
|
||||
}
|
||||
else {
|
||||
// Les deux segments ne sont pas dans le meme plan
|
||||
|
||||
gp_XYZ pO=refPlane^segO; // Plan contenant segO normal a refPlane
|
||||
pO.Normalize();
|
||||
Standard_Real dpO=pO*BegO.XYZ();
|
||||
|
||||
Standard_Real distBegTpO=(pO*BegT.XYZ())-dpO;
|
||||
Standard_Real distEndTpO=(pO*EndT.XYZ())-dpO;
|
||||
Standard_Real parT=-1.;
|
||||
|
||||
if (distBegTpO*distEndTpO<0.)
|
||||
parT=distBegTpO/(distBegTpO-distEndTpO);
|
||||
else if (Abs(distBegTpO)<=Tolerance)
|
||||
parT=0.;
|
||||
else if (Abs(distEndTpO)<=Tolerance)
|
||||
parT=1.;
|
||||
|
||||
if (parT>=0.) {
|
||||
gp_XYZ pT=refPlane^segT; // Plan contenant segT normal a refPlane
|
||||
pT.Normalize();
|
||||
Standard_Real dpT=pT*BegT.XYZ();
|
||||
|
||||
Standard_Real distBegOpT=(pT*BegO.XYZ())-dpT;
|
||||
Standard_Real distEndOpT=(pT*EndO.XYZ())-dpT;
|
||||
Standard_Real parO=-1.;
|
||||
|
||||
if (distBegOpT*distEndOpT<0.)
|
||||
parO=distBegOpT/(distBegOpT-distEndOpT);
|
||||
else if (Abs(distBegOpT)<=Tolerance)
|
||||
parO=0.;
|
||||
else if (Abs(distEndOpT)<=Tolerance)
|
||||
parO=1.;
|
||||
|
||||
if (parO>=0.) {
|
||||
// Il y a une perpendiculaire commune interessante
|
||||
Intf_SectionLine PC;
|
||||
PC.Append(Intf_SectionPoint
|
||||
(BegO.Translated(gp_Vec(segO*parO)),
|
||||
Intf_EDGE, iObje1, 0, parO,
|
||||
Intf_EXTERNAL, 0, 0, 0., 0));
|
||||
PC.Append(Intf_SectionPoint
|
||||
(BegT.Translated(gp_Vec(segT*parT)),
|
||||
Intf_EXTERNAL, 0, 0, 0.,
|
||||
Intf_EDGE, iObje2, 0, parT, 0.));
|
||||
mySLines.Append(PC);
|
||||
Standard_Real dist=PC.GetPoint(1).Pnt().Distance
|
||||
(PC.GetPoint(2).Pnt());
|
||||
if (dist< MinimalDist) {
|
||||
MinimalDist=dist;
|
||||
IndexMin=mySLines.Length();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Projections
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Intf_InterferencePolygon3d::Projections
|
||||
(const gp_Pnt& BegO, const gp_Pnt& EndO,
|
||||
const gp_Pnt& BegT, const gp_Pnt& EndT)
|
||||
{
|
||||
}
|
||||
|
||||
// EOF File: Intf_InterferencePolygon3d.gxx
|
Reference in New Issue
Block a user