mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
57
src/GeomLProp/GeomLProp.cdl
Executable file
57
src/GeomLProp/GeomLProp.cdl
Executable file
@@ -0,0 +1,57 @@
|
||||
-- File: GeomLProp.cdl
|
||||
-- Created: Thu Mar 26 10:42:56 1992
|
||||
-- Author: Herve LEGRAND
|
||||
-- <hl@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
package GeomLProp
|
||||
|
||||
---Purpose: These global functions compute the degree of
|
||||
-- continuity of a 3D curve built by concatenation of two
|
||||
-- other curves (or portions of curves) at their junction point.
|
||||
|
||||
uses Standard, gp, Geom, GeomAbs, LProp
|
||||
|
||||
is
|
||||
|
||||
private class CurveTool;
|
||||
private class SurfaceTool;
|
||||
|
||||
class CLProps from GeomLProp
|
||||
instantiates CLProps from LProp(Curve from Geom,
|
||||
Vec from gp,
|
||||
Pnt from gp,
|
||||
Dir from gp,
|
||||
CurveTool from GeomLProp);
|
||||
|
||||
|
||||
class SLProps from GeomLProp
|
||||
instantiates SLProps from LProp(Surface from Geom,
|
||||
SurfaceTool from GeomLProp);
|
||||
|
||||
|
||||
Continuity(C1,C2 : Curve from Geom;
|
||||
u1,u2 : Real from Standard;
|
||||
r1,r2 : Boolean from Standard;
|
||||
tl,ta : Real from Standard)
|
||||
---Purpose: Computes the regularity at the junction between C1 and
|
||||
-- C2. The booleans r1 and r2 are true if the curves must
|
||||
-- be taken reversed. The point u1 on C1 and the point
|
||||
-- u2 on C2 must be confused.
|
||||
-- tl and ta are the linear and angular tolerance used two
|
||||
-- compare the derivative.
|
||||
returns Shape from GeomAbs;
|
||||
|
||||
|
||||
Continuity(C1,C2 : Curve from Geom;
|
||||
u1,u2 : Real from Standard;
|
||||
r1,r2 : Boolean from Standard)
|
||||
---Purpose: The same as preciding but using the standard
|
||||
-- tolerances from package Precision.
|
||||
returns Shape from GeomAbs;
|
||||
|
||||
end GeomLProp;
|
||||
|
||||
|
||||
|
||||
|
176
src/GeomLProp/GeomLProp.cxx
Executable file
176
src/GeomLProp/GeomLProp.cxx
Executable file
@@ -0,0 +1,176 @@
|
||||
// File: GeomLProp.cxx
|
||||
// Created: Wed Feb 23 08:57:59 1994
|
||||
// Author: Laurent BOURESCHE
|
||||
// <lbo@nonox>
|
||||
|
||||
|
||||
#include <GeomLProp.ixx>
|
||||
#include <Precision.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <GeomLProp_CLProps.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
Standard_Integer GeomAbsToInteger(const GeomAbs_Shape gcont)
|
||||
{
|
||||
Standard_Integer cont=0 ;
|
||||
switch (gcont) {
|
||||
case GeomAbs_C0 :
|
||||
cont = 0 ;
|
||||
break ;
|
||||
case GeomAbs_G1 :
|
||||
cont = 1 ;
|
||||
break ;
|
||||
case GeomAbs_C1 :
|
||||
cont = 2 ;
|
||||
break ;
|
||||
case GeomAbs_G2 :
|
||||
cont = 3 ;
|
||||
break ;
|
||||
case GeomAbs_C2 :
|
||||
cont = 4 ;
|
||||
break ;
|
||||
case GeomAbs_C3 :
|
||||
cont = 5 ;
|
||||
break ;
|
||||
case GeomAbs_CN :
|
||||
cont = 6 ;
|
||||
break ;
|
||||
}
|
||||
return cont ;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Continuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_Shape GeomLProp::Continuity(const Handle(Geom_Curve)& C1,
|
||||
const Handle(Geom_Curve)& C2,
|
||||
const Standard_Real u1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Boolean r1,
|
||||
const Standard_Boolean r2,
|
||||
const Standard_Real tl,
|
||||
const Standard_Real ta)
|
||||
{
|
||||
GeomAbs_Shape cont = GeomAbs_C0;
|
||||
Standard_Integer index1,
|
||||
index2 ;
|
||||
Standard_Real tolerance ;
|
||||
Standard_Boolean fini = Standard_False;
|
||||
gp_Vec d1,d2;
|
||||
gp_Dir dir1,dir2;
|
||||
Standard_Integer cont1, cont2 ;
|
||||
GeomAbs_Shape gcont1 = C1->Continuity(), gcont2 = C2->Continuity();
|
||||
cont1 = GeomAbsToInteger(gcont1) ;
|
||||
cont2 = GeomAbsToInteger(gcont2) ;
|
||||
|
||||
Handle(Geom_Curve) aCurve1 = C1 ;
|
||||
Handle(Geom_Curve) aCurve2 = C2 ;
|
||||
if (C1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))){
|
||||
Handle(Geom_TrimmedCurve) aTrimmed =
|
||||
Handle(Geom_TrimmedCurve) ::DownCast(aCurve1) ;
|
||||
aCurve1 = aTrimmed->BasisCurve() ;
|
||||
}
|
||||
if (C2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))){
|
||||
Handle(Geom_TrimmedCurve) aTrimmed =
|
||||
Handle(Geom_TrimmedCurve) ::DownCast(aCurve2) ;
|
||||
aCurve2 = aTrimmed->BasisCurve() ;
|
||||
}
|
||||
if (aCurve1->IsKind(STANDARD_TYPE(Geom_BSplineCurve))){
|
||||
Handle(Geom_BSplineCurve) BSplineCurve =
|
||||
Handle(Geom_BSplineCurve)::DownCast(aCurve1) ;
|
||||
BSplineCurve->Resolution(tl,
|
||||
tolerance) ;
|
||||
BSplineCurve->LocateU(
|
||||
u1,
|
||||
tolerance,
|
||||
index1,
|
||||
index2) ;
|
||||
|
||||
if (index1 > 1 && index2 < BSplineCurve->NbKnots() && index1 == index2) {
|
||||
cont1 = BSplineCurve->Degree() - BSplineCurve->Multiplicity(index1) ;
|
||||
}
|
||||
else {
|
||||
cont1 = 5 ;
|
||||
}
|
||||
}
|
||||
if (aCurve2->IsKind(STANDARD_TYPE(Geom_BSplineCurve))){
|
||||
Handle(Geom_BSplineCurve) BSplineCurve =
|
||||
Handle(Geom_BSplineCurve)::DownCast(aCurve2) ;
|
||||
BSplineCurve->Resolution(tl,
|
||||
tolerance) ;
|
||||
BSplineCurve->LocateU(
|
||||
u2,
|
||||
tolerance,
|
||||
index1,
|
||||
index2) ;
|
||||
|
||||
if (index1 > 1 && index2 < BSplineCurve->NbKnots() && index1 == index2) {
|
||||
cont2 = BSplineCurve->Degree() - BSplineCurve->Multiplicity(index1) ;
|
||||
}
|
||||
else {
|
||||
cont2 = 5 ;
|
||||
}
|
||||
}
|
||||
Standard_Integer n1 = 0, n2 = 0;
|
||||
if (cont1 >= 5) n1 = 3;
|
||||
else if(cont1 == 4) n1 = 2;
|
||||
else if(cont1 == 2) n1 = 1;
|
||||
if (cont2 >= 5) n2 = 3;
|
||||
else if(cont2 == 4) n2 = 2;
|
||||
else if(cont2 == 2) n2 = 1;
|
||||
GeomLProp_CLProps clp1(C1,u1,n1,tl);
|
||||
GeomLProp_CLProps clp2(C2,u2,n2,tl);
|
||||
if(!(clp1.Value().IsEqual(clp2.Value(),tl))) {
|
||||
Standard_Failure::Raise("Courbes non jointives");
|
||||
}
|
||||
Standard_Integer min = Min(n1,n2);
|
||||
if ( min >= 1 ) {
|
||||
d1 = clp1.D1();
|
||||
d2 = clp2.D1();
|
||||
if(r1) d1.Reverse();
|
||||
if(r2) d2.Reverse();
|
||||
if(d1.IsEqual(d2,tl,ta)) {
|
||||
cont = GeomAbs_C1;
|
||||
}
|
||||
else if(clp1.IsTangentDefined() && clp2.IsTangentDefined()){
|
||||
clp1.Tangent(dir1);
|
||||
clp2.Tangent(dir2);
|
||||
if(r1) dir1.Reverse();
|
||||
if(r2) dir2.Reverse();
|
||||
if(dir1.IsEqual(dir2,ta)){
|
||||
cont = GeomAbs_G1;
|
||||
}
|
||||
fini = Standard_True;
|
||||
}
|
||||
else {fini = Standard_True; }
|
||||
}
|
||||
if ( min >= 2 && !fini ) {
|
||||
d1 = clp1.D2();
|
||||
d2 = clp2.D2();
|
||||
if(d1.IsEqual(d2,tl,ta)){
|
||||
cont = GeomAbs_C2;
|
||||
}
|
||||
}
|
||||
return cont;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Continuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_Shape GeomLProp::Continuity(const Handle(Geom_Curve)& C1,
|
||||
const Handle(Geom_Curve)& C2,
|
||||
const Standard_Real u1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Boolean r1,
|
||||
const Standard_Boolean r2)
|
||||
{
|
||||
return Continuity(C1,C2,u1,u2,r1,r2,
|
||||
Precision::Confusion(),Precision::Angular());
|
||||
}
|
48
src/GeomLProp/GeomLProp_CurveTool.cdl
Executable file
48
src/GeomLProp/GeomLProp_CurveTool.cdl
Executable file
@@ -0,0 +1,48 @@
|
||||
-- File: CurveTool.cdl
|
||||
-- Created: Thu Mar 26 13:35:47 1992
|
||||
-- Author: Herve LEGRAND
|
||||
-- <hl@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
private class CurveTool from GeomLProp
|
||||
|
||||
uses Vec from gp,
|
||||
Pnt from gp,
|
||||
Dir from gp,
|
||||
Curve from Geom
|
||||
|
||||
is
|
||||
|
||||
Value(myclass; C : Curve from Geom; U : Real; P : out Pnt);
|
||||
---Purpose: Computes the point <P> of parameter <U> on the curve <C>.
|
||||
|
||||
D1 (myclass; C : Curve from Geom; U : Real; P : out Pnt; V1 : out Vec);
|
||||
---Purpose: Computes the point <P> and first derivative <V1> of
|
||||
-- parameter <U> on the curve <C>.
|
||||
|
||||
D2 (myclass; C : Curve from Geom; U : Real; P : out Pnt; V1, V2 : out Vec);
|
||||
---Purpose: Computes the point <P>, the first derivative <V1> and second
|
||||
-- derivative <V2> of parameter <U> on the curve <C>.
|
||||
|
||||
D3 (myclass; C : Curve from Geom; U : Real;
|
||||
P : out Pnt; V1, V2, V3 : out Vec);
|
||||
---Purpose: Computes the point <P>, the first derivative <V1>, the
|
||||
-- second derivative <V2> and third derivative <V3> of
|
||||
-- parameter <U> on the curve <C>.
|
||||
|
||||
Continuity(myclass; C : Curve from Geom) returns Integer;
|
||||
---Purpose: returns the order of continuity of the curve <C>.
|
||||
-- returns 1 : first derivative only is computable
|
||||
-- returns 2 : first and second derivative only are computable.
|
||||
-- returns 3 : first, second and third are computable.
|
||||
|
||||
FirstParameter(myclass; C : Curve from Geom) returns Real;
|
||||
---Purpose: returns the first parameter bound of the curve.
|
||||
--
|
||||
|
||||
LastParameter(myclass; C : Curve from Geom) returns Real;
|
||||
---Purpose: returns the last parameter bound of the curve.
|
||||
-- FirstParameter must be less than LastParamenter.
|
||||
|
||||
end CurveTool;
|
||||
|
67
src/GeomLProp/GeomLProp_CurveTool.cxx
Executable file
67
src/GeomLProp/GeomLProp_CurveTool.cxx
Executable file
@@ -0,0 +1,67 @@
|
||||
// File: GeomLProp_CurveTool.cxx
|
||||
// Created: Tue Aug 18 15:40:26 1992
|
||||
// Author: Herve LEGRAND
|
||||
// <hl@bravox>
|
||||
|
||||
#include <GeomLProp_CurveTool.ixx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
void GeomLProp_CurveTool::Value(const Handle_Geom_Curve& C,
|
||||
const Standard_Real U, gp_Pnt& P)
|
||||
{
|
||||
P = C->Value(U);
|
||||
}
|
||||
|
||||
void GeomLProp_CurveTool::D1(const Handle_Geom_Curve& C,
|
||||
const Standard_Real U, gp_Pnt& P, gp_Vec& V1)
|
||||
{
|
||||
C->D1(U, P, V1);
|
||||
}
|
||||
|
||||
void GeomLProp_CurveTool::D2(const Handle_Geom_Curve& C,
|
||||
const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2)
|
||||
{
|
||||
C->D2(U, P, V1, V2);
|
||||
}
|
||||
|
||||
void GeomLProp_CurveTool::D3(const Handle_Geom_Curve& C,
|
||||
const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3)
|
||||
{
|
||||
C->D3(U, P, V1, V2, V3);
|
||||
}
|
||||
|
||||
Standard_Integer GeomLProp_CurveTool::Continuity(const Handle_Geom_Curve& C)
|
||||
{
|
||||
GeomAbs_Shape s = C->Continuity();
|
||||
switch (s) {
|
||||
case GeomAbs_C0:
|
||||
return 0;
|
||||
case GeomAbs_C1:
|
||||
return 1;
|
||||
case GeomAbs_C2:
|
||||
return 2;
|
||||
case GeomAbs_C3:
|
||||
return 3;
|
||||
case GeomAbs_G1:
|
||||
return 0;
|
||||
case GeomAbs_G2:
|
||||
return 0;
|
||||
case GeomAbs_CN:
|
||||
return 3;
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Real GeomLProp_CurveTool::FirstParameter(const Handle_Geom_Curve& C)
|
||||
{
|
||||
return C->FirstParameter();
|
||||
}
|
||||
|
||||
Standard_Real GeomLProp_CurveTool::LastParameter(const Handle_Geom_Curve& C)
|
||||
{
|
||||
return C->LastParameter();
|
||||
}
|
||||
|
||||
|
||||
|
39
src/GeomLProp/GeomLProp_SurfaceTool.cdl
Executable file
39
src/GeomLProp/GeomLProp_SurfaceTool.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: SurfaceTool.cdl
|
||||
-- Created: Thu Mar 26 13:40:06 1992
|
||||
-- Author: Herve LEGRAND
|
||||
-- <hl@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
private class SurfaceTool from GeomLProp
|
||||
|
||||
uses Pnt from gp,
|
||||
Vec from gp,
|
||||
Surface from Geom
|
||||
|
||||
is
|
||||
|
||||
Value(myclass; S : Surface; U, V : Real; P : out Pnt);
|
||||
---Purpose: Computes the point <P> of parameter <U> and <V> on the
|
||||
-- Surface <S>.
|
||||
|
||||
D1 (myclass; S : Surface; U, V : Real; P : out Pnt; D1U, D1V : out Vec);
|
||||
---Purpose: Computes the point <P> and first derivative <D1*> of
|
||||
-- parameter <U> and <V> on the Surface <S>.
|
||||
|
||||
D2 (myclass; S : Surface; U, V : Real;
|
||||
P : out Pnt; D1U, D1V, D2U, D2V, DUV : out Vec);
|
||||
---Purpose: Computes the point <P>, the first derivative <D1*> and second
|
||||
-- derivative <D2*> of parameter <U> and <V> on the Surface <S>.
|
||||
|
||||
DN (myclass; S : Surface; U, V : Real; IU, IV : Integer)
|
||||
returns Vec;
|
||||
|
||||
Continuity(myclass; S : Surface) returns Integer;
|
||||
---Purpose: returns the order of continuity of the Surface <S>.
|
||||
-- returns 1 : first derivative only is computable
|
||||
-- returns 2 : first and second derivative only are computable.
|
||||
|
||||
Bounds(myclass; S : Surface; U1, V1, U2, V2 : out Real);
|
||||
---Purpose: returns the bounds of the Surface.
|
||||
|
||||
end SurfaceTool;
|
76
src/GeomLProp/GeomLProp_SurfaceTool.cxx
Executable file
76
src/GeomLProp/GeomLProp_SurfaceTool.cxx
Executable file
@@ -0,0 +1,76 @@
|
||||
// File: GeomLProp_SurfaceTool.cxx
|
||||
// Created: Tue Aug 18 15:16:03 1992
|
||||
// Author: Herve LEGRAND
|
||||
// <hl@bravox>
|
||||
|
||||
#include <GeomLProp_SurfaceTool.ixx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
|
||||
void GeomLProp_SurfaceTool::Value(const Handle_Geom_Surface& S,
|
||||
const Standard_Real U, const Standard_Real V, gp_Pnt& P)
|
||||
{
|
||||
P = S->Value(U, V);
|
||||
}
|
||||
|
||||
void GeomLProp_SurfaceTool::D1(const Handle_Geom_Surface& S,
|
||||
const Standard_Real U, const Standard_Real V,
|
||||
gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V)
|
||||
{
|
||||
S->D1(U, V, P, D1U, D1V);
|
||||
}
|
||||
|
||||
void GeomLProp_SurfaceTool::D2(const Handle_Geom_Surface& S,
|
||||
const Standard_Real U, const Standard_Real V,
|
||||
gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& DUV)
|
||||
{
|
||||
S->D2(U, V, P, D1U, D1V, D2U, D2V, DUV);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DN
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Vec GeomLProp_SurfaceTool::DN(const Handle_Geom_Surface& S,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer IU,
|
||||
const Standard_Integer IV)
|
||||
{
|
||||
return S->DN(U, V, IU, IV);
|
||||
}
|
||||
|
||||
Standard_Integer GeomLProp_SurfaceTool::Continuity(const Handle_Geom_Surface& S)
|
||||
{
|
||||
GeomAbs_Shape s = S->Continuity();
|
||||
switch (s) {
|
||||
case GeomAbs_C0:
|
||||
return 0;
|
||||
case GeomAbs_C1:
|
||||
return 1;
|
||||
case GeomAbs_C2:
|
||||
return 2;
|
||||
case GeomAbs_C3:
|
||||
return 3;
|
||||
case GeomAbs_G1:
|
||||
return 0;
|
||||
case GeomAbs_G2:
|
||||
return 0;
|
||||
case GeomAbs_CN:
|
||||
return 3;
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GeomLProp_SurfaceTool::Bounds(const Handle_Geom_Surface& S,
|
||||
Standard_Real& U1, Standard_Real& V1,
|
||||
Standard_Real& U2, Standard_Real& V2)
|
||||
{
|
||||
S->Bounds(U1, U2, V1, V2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user