mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
42
src/Geom2dLProp/Geom2dLProp.cdl
Executable file
42
src/Geom2dLProp/Geom2dLProp.cdl
Executable file
@@ -0,0 +1,42 @@
|
||||
-- File: Geom2dLProp.cdl
|
||||
-- Created: Thu Mar 26 10:42:56 1992
|
||||
-- Author: Herve LEGRAND
|
||||
-- <hl@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
package Geom2dLProp
|
||||
|
||||
---Purpose: Handles local properties of curves and surfaces from the
|
||||
-- packages Geom and Geom2d.
|
||||
-- SeeAlso: Package LProp.
|
||||
|
||||
|
||||
---Level : Public.
|
||||
-- All methods of all classes will be public.
|
||||
|
||||
uses Standard, gp, Geom2d, LProp
|
||||
|
||||
is
|
||||
|
||||
class Curve2dTool;
|
||||
|
||||
class CLProps2d from Geom2dLProp
|
||||
instantiates CLProps from LProp(Curve from Geom2d,
|
||||
Vec2d from gp,
|
||||
Pnt2d from gp,
|
||||
Dir2d from gp,
|
||||
Curve2dTool from Geom2dLProp);
|
||||
class CurAndInf2d;
|
||||
|
||||
private class NumericCurInf2d instantiates NumericCurInf from LProp(
|
||||
Curve from Geom2d,
|
||||
Vec2d from gp,
|
||||
Pnt2d from gp,
|
||||
Dir2d from gp,
|
||||
Curve2dTool from Geom2dLProp);
|
||||
|
||||
end Geom2dLProp;
|
||||
|
||||
|
||||
|
||||
|
60
src/Geom2dLProp/Geom2dLProp_CurAndInf2d.cdl
Executable file
60
src/Geom2dLProp/Geom2dLProp_CurAndInf2d.cdl
Executable file
@@ -0,0 +1,60 @@
|
||||
-- File: Geom2dLProp_CurAndInf2d.cdl
|
||||
-- Created: Tue Sep 6 14:37:18 1994
|
||||
-- Author: Yves FRICAUD
|
||||
-- <yfr@ecolox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class CurAndInf2d from Geom2dLProp inherits CurAndInf from LProp
|
||||
|
||||
---Purpose: An algorithm for computing local properties of a curve.
|
||||
-- These properties include:
|
||||
-- - the maximum and minimum curvatures
|
||||
-- - the inflection points.
|
||||
-- A CurAndInf2d object provides the framework for:
|
||||
-- - defining the curve to be analyzed
|
||||
-- - implementing the computation algorithms
|
||||
-- - consulting the results.
|
||||
|
||||
uses
|
||||
Curve from Geom2d
|
||||
is
|
||||
Create;
|
||||
|
||||
--- Purpose: Initializes the framework.
|
||||
-- Note: The curve on which the local properties are
|
||||
-- computed is defined using one of the following
|
||||
-- functions: Perform, PerformCurExt or PerformInf.
|
||||
|
||||
Perform (me : in out; C : Curve)
|
||||
---Purpose: For the curve C, Computes both the
|
||||
-- inflection points and the maximum and minimum curvatures.
|
||||
is static;
|
||||
|
||||
PerformCurExt (me : in out; C : Curve)
|
||||
---Purpose: For the curve C, Computes the locals extremas of curvature.
|
||||
is static;
|
||||
|
||||
PerformInf (me : in out; C : Curve)
|
||||
---Purpose: For the curve C, Computes the inflections.
|
||||
-- After computation, the following functions can be used:
|
||||
-- - IsDone to check if the computation was successful
|
||||
-- - NbPoints to obtain the number of computed particular points
|
||||
-- - Parameter to obtain the parameter on the curve for
|
||||
-- each particular point
|
||||
-- - Type to check if the point is an inflection point or an
|
||||
-- extremum of curvature of the curve C.
|
||||
-- Warning
|
||||
-- These functions can be used to analyze a series of
|
||||
-- curves, however it is necessary to clear the table of
|
||||
-- results between each computation.
|
||||
is static;
|
||||
|
||||
IsDone (me) returns Boolean
|
||||
---Purpose: True if the solutions are found.
|
||||
is static;
|
||||
|
||||
fields
|
||||
isDone : Boolean from Standard;
|
||||
|
||||
end CurAndInf2d;
|
159
src/Geom2dLProp/Geom2dLProp_CurAndInf2d.cxx
Executable file
159
src/Geom2dLProp/Geom2dLProp_CurAndInf2d.cxx
Executable file
@@ -0,0 +1,159 @@
|
||||
// File: Geom2dLProp_CurAndInf2d.cxx
|
||||
// Created: Tue Sep 6 15:14:52 1994
|
||||
// Author: Yves FRICAUD
|
||||
// <yfr@ecolox>
|
||||
|
||||
|
||||
#include <Geom2dLProp_CurAndInf2d.ixx>
|
||||
#include <Geom2dLProp_NumericCurInf2d.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <LProp_AnalyticCurInf.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <gp_Hypr2d.hxx>
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Geom2dLProp_CurAndInf2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Geom2dLProp_CurAndInf2d::Geom2dLProp_CurAndInf2d()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2dLProp_CurAndInf2d::Perform(const Handle(Geom2d_Curve)& C)
|
||||
{
|
||||
PerformCurExt(C);
|
||||
PerformInf (C);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCurExt
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2dLProp_CurAndInf2d::PerformCurExt(const Handle(Geom2d_Curve)& C)
|
||||
{
|
||||
isDone = Standard_True;
|
||||
|
||||
Geom2dAdaptor_Curve CC(C);
|
||||
LProp_AnalyticCurInf AC;
|
||||
Geom2dLProp_NumericCurInf2d NC;
|
||||
GeomAbs_CurveType CType = CC.GetType();
|
||||
|
||||
switch (CType) {
|
||||
case GeomAbs_Line:
|
||||
break;
|
||||
case GeomAbs_Circle:
|
||||
break;
|
||||
case GeomAbs_Ellipse:
|
||||
AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
|
||||
break;
|
||||
case GeomAbs_Hyperbola:
|
||||
AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
|
||||
break;
|
||||
case GeomAbs_Parabola:
|
||||
AC.Perform(CType,CC.FirstParameter(),CC.LastParameter(),*this);
|
||||
break;
|
||||
case GeomAbs_BSplineCurve:
|
||||
if (CC.Continuity() >= GeomAbs_C3 ) {
|
||||
NC.PerformCurExt(C,*this);
|
||||
isDone = NC.IsDone();
|
||||
}
|
||||
else {
|
||||
// Decoupage en intervalles C3.
|
||||
isDone = Standard_True;
|
||||
Standard_Integer NbInt = CC.NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal Param(1,NbInt+1);
|
||||
CC.Intervals(Param,GeomAbs_C3);
|
||||
for (Standard_Integer i = 1; i <= NbInt; i++) {
|
||||
NC.PerformCurExt(C,Param(i),Param(i+1),*this);
|
||||
if (!NC.IsDone()) {isDone = Standard_False;}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default : {
|
||||
NC.PerformCurExt(C,*this);
|
||||
isDone = NC.IsDone();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformInf
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2dLProp_CurAndInf2d::PerformInf(const Handle(Geom2d_Curve)& C)
|
||||
{
|
||||
isDone = Standard_True;
|
||||
|
||||
Geom2dAdaptor_Curve CC(C);
|
||||
GeomAbs_CurveType CType = CC.GetType();
|
||||
Geom2dLProp_NumericCurInf2d NC;
|
||||
|
||||
switch (CType) {
|
||||
case GeomAbs_Line:
|
||||
break;
|
||||
case GeomAbs_Circle:
|
||||
break;
|
||||
case GeomAbs_Ellipse:
|
||||
break;
|
||||
case GeomAbs_Hyperbola:
|
||||
break;
|
||||
case GeomAbs_Parabola:
|
||||
break;
|
||||
case GeomAbs_BSplineCurve:
|
||||
if (CC.Continuity() >= GeomAbs_C3 ) {
|
||||
NC.PerformInf(C,*this);
|
||||
isDone = NC.IsDone();
|
||||
}
|
||||
else {
|
||||
// Decoupage en intervalles C3.
|
||||
isDone = Standard_True;
|
||||
Standard_Integer NbInt = CC.NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal Param(1,NbInt+1);
|
||||
CC.Intervals(Param,GeomAbs_C3);
|
||||
|
||||
for (Standard_Integer i = 1; i <= NbInt; i++) {
|
||||
NC.PerformInf(C,Param(i),Param(i+1),*this);
|
||||
if (!NC.IsDone()) {isDone = Standard_False;}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default : {
|
||||
NC.PerformInf(C,*this);
|
||||
isDone = NC.IsDone();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Geom2dLProp_CurAndInf2d::IsDone() const
|
||||
{
|
||||
return isDone;
|
||||
}
|
||||
|
||||
|
53
src/Geom2dLProp/Geom2dLProp_Curve2dTool.cdl
Executable file
53
src/Geom2dLProp/Geom2dLProp_Curve2dTool.cdl
Executable file
@@ -0,0 +1,53 @@
|
||||
-- File: Curve2dTool.cdl
|
||||
-- Created: Thu Mar 26 13:38:57 1992
|
||||
-- Author: Herve LEGRAND
|
||||
-- <hl@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class Curve2dTool from Geom2dLProp
|
||||
|
||||
uses Vec2d from gp,
|
||||
Pnt2d from gp,
|
||||
Dir2d from gp,
|
||||
Curve from Geom2d
|
||||
|
||||
is
|
||||
|
||||
Value(myclass; C : Curve from Geom2d; U : Real;
|
||||
P : out Pnt2d);
|
||||
---Purpose: Computes the point <P> of parameter <U> on the curve <C>.
|
||||
|
||||
D1 (myclass; C : Curve from Geom2d; U : Real;
|
||||
P : out Pnt2d; V1 : out Vec2d);
|
||||
---Purpose: Computes the point <P> and first derivative <V1> of
|
||||
-- parameter <U> on the curve <C>.
|
||||
|
||||
D2 (myclass; C : Curve from Geom2d; U : Real;
|
||||
P : out Pnt2d; V1, V2 : out Vec2d);
|
||||
---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 Geom2d; U : Real;
|
||||
P : out Pnt2d; V1, V2, V3 : out Vec2d);
|
||||
---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 Geom2d) 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 Geom2d) returns Real;
|
||||
---Purpose: returns the first parameter bound of the curve.
|
||||
--
|
||||
|
||||
LastParameter(myclass; C : Curve from Geom2d) returns Real;
|
||||
---Purpose: returns the last parameter bound of the curve.
|
||||
-- FirstParameter must be less than LastParameter.
|
||||
|
||||
end Curve2dTool;
|
||||
|
||||
|
||||
|
68
src/Geom2dLProp/Geom2dLProp_Curve2dTool.cxx
Executable file
68
src/Geom2dLProp/Geom2dLProp_Curve2dTool.cxx
Executable file
@@ -0,0 +1,68 @@
|
||||
// File: Geom2dLProp_Curve2dTool.cxx
|
||||
// Created: Tue Aug 18 15:40:26 1992
|
||||
// Author: Herve LEGRAND
|
||||
// <hl@bravox>
|
||||
|
||||
#include <Geom2dLProp_Curve2dTool.ixx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
void Geom2dLProp_Curve2dTool::Value(const Handle_Geom2d_Curve& C,
|
||||
const Standard_Real U, gp_Pnt2d& P)
|
||||
{
|
||||
P = C->Value(U);
|
||||
}
|
||||
|
||||
void Geom2dLProp_Curve2dTool::D1(const Handle_Geom2d_Curve& C,
|
||||
const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1)
|
||||
{
|
||||
C->D1(U, P, V1);
|
||||
}
|
||||
|
||||
void Geom2dLProp_Curve2dTool::D2(const Handle_Geom2d_Curve& C,
|
||||
const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2)
|
||||
{
|
||||
C->D2(U, P, V1, V2);
|
||||
}
|
||||
|
||||
void Geom2dLProp_Curve2dTool::D3(const Handle_Geom2d_Curve& C,
|
||||
const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3)
|
||||
{
|
||||
C->D3(U, P, V1, V2, V3);
|
||||
}
|
||||
|
||||
Standard_Integer Geom2dLProp_Curve2dTool::Continuity(const Handle_Geom2d_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 Geom2dLProp_Curve2dTool::FirstParameter(const Handle_Geom2d_Curve& C)
|
||||
{
|
||||
return C->FirstParameter();
|
||||
}
|
||||
|
||||
Standard_Real Geom2dLProp_Curve2dTool::LastParameter(const Handle_Geom2d_Curve& C)
|
||||
{
|
||||
return C->LastParameter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user