1
0
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:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

103
src/AppDef/AppDef.cdl Executable file
View File

@@ -0,0 +1,103 @@
--
-- -- File: AppDef.cdl
-- Created: Mon Dec 2 13:36:09 1991
-- Author: Laurent PAINNOT
-- <lpa@topsn3>
---Copyright: Matra Datavision 1991, 1992
-- 06/06/96 : JPI : ajout Variational
--
--
package AppDef
---Purpose: This package describes all the classes needed to approximate
-- points in Bezier curves. It is used in the package
-- AppParCurves.
-- The points of the same range for the approximation are
-- organised in MultiPointConstraints. These MultiPointConstraints
--
-- are organized in a MultiLine.
-- The corresponding result of a MultiLine approximation is
-- a MultiCurve (set of Bezier curves) which has the same
-- structure as a MultiLine: The MultiCurve is a set of
-- MultiPoint.
-- A point of a MultiLine can have many significations: the approximation curve
-- can go through this point or not, can have a given tangency, or can
-- have a given curvature.
-- Note: a CurvaturePoint is also a PassPoint and a TangencyPoint.
-- A TangencyPoint is also a PassPoint.
uses AppParCurves, Approx, gp, TColgp, TCollection, Standard, MMgt
is
class MultiPointConstraint;
---Purpose: a MultiPointConstraint is a set of points which have the same range
-- in the MultiLine and the same constraints.
class MultiLine;
---Purpose: this is the organized set of points.
class MyLineTool;
---Purpose: example of MultiLine tool corresponding to the tools of the packages
-- AppParCurves and Approx. For Approx, the tool will not addd points
-- if the algorithms want some.
--- Classes instanciees:
class TheLeastSquares instantiates LeastSquare from AppParCurves
(MultiLine from AppDef,
MyLineTool from AppDef);
class TheVariational instantiates Variational from AppParCurves
(MultiLine from AppDef,
MyLineTool from AppDef);
class TheResol instantiates ResolConstraint from AppParCurves
(MultiLine from AppDef,
MyLineTool from AppDef);
class TheFunction instantiates Function from AppParCurves
(MultiLine from AppDef,
MyLineTool from AppDef,
TheLeastSquares from AppDef,
TheResol from AppDef);
class TheGradient instantiates Gradient from AppParCurves
(MultiLine from AppDef,
MyLineTool from AppDef);
class Compute instantiates ComputeLine from Approx
(MultiLine from AppDef,
MyLineTool from AppDef);
class BSplineCompute instantiates BSplComputeLine from Approx
(MultiLine from AppDef,
MyLineTool from AppDef);
class Array1OfMultiPointConstraint instantiates Array1 from TCollection
(MultiPointConstraint);
class HArray1OfMultiPointConstraint instantiates
HArray1 from TCollection(
MultiPointConstraint,Array1OfMultiPointConstraint);
end AppDef;

155
src/AppDef/AppDef_MultiLine.cdl Executable file
View File

@@ -0,0 +1,155 @@
-- File: MultiLine.cdl
-- Created: Mon Dec 2 08:24:32 1991
-- Author: Laurent PAINNOT
-- <lpa@topsn3>
---Copyright: Matra Datavision 1991, 1992
class MultiLine from AppDef
---Purpose: This class describes the organized set of points used in the
-- approximations. A MultiLine is composed of n
-- MultiPointConstraints.
-- The approximation of the MultiLine will be done in the order
-- of the given n MultiPointConstraints.
--
--
-- Example of a MultiLine composed of MultiPointConstraints:
--
-- P1______P2_____P3______P4________........_____PNbMult
--
-- Q1______Q2_____Q3______Q4________........_____QNbMult
-- . .
-- . .
-- . .
-- R1______R2_____R3______R4________........_____RNbMult
--
--
-- Pi, Qi, ..., Ri are points of dimension 2 or 3.
--
-- (P1, Q1, ...R1), ...(Pn, Qn, ...Rn) n= 1,...NbMult are
-- MultiPointConstraints.
-- There are NbPoints points in each MultiPointConstraint.
uses MultiPointConstraint from AppDef,
HArray1OfMultiPointConstraint from AppDef,
Array1OfMultiPointConstraint from AppDef,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
OStream from Standard
raises ConstructionError from Standard,
DimensionError from Standard,
OutOfRange from Standard
is
Create
---Purpose: creates an undefined MultiLine.
returns MultiLine from AppDef;
Create(NbMult: Integer)
---Purpose: given the number NbMult of MultiPointConstraints of this
-- MultiLine , it initializes all the fields.SetValue must be
-- called in order for the values of the multipoint
-- constraint to be taken into account.
-- An exception is raised if NbMult < 0.
returns MultiLine from AppDef
raises ConstructionError from Standard;
Create(tabMultiP: Array1OfMultiPointConstraint)
---Purpose: Constructs a MultiLine with an array of MultiPointConstraints.
returns MultiLine from AppDef
raises ConstructionError from Standard;
Create(tabP3d: Array1OfPnt)
---Purpose: The MultiLine constructed will have one line of
-- 3d points without their tangencies.
returns MultiLine from AppDef
raises ConstructionError from Standard;
Create(tabP2d: Array1OfPnt2d)
---Purpose: The MultiLine constructed will have one line of
-- 2d points without their tangencies.
returns MultiLine from AppDef
raises ConstructionError from Standard;
NbMultiPoints(me)
---Purpose: returns the number of MultiPointConstraints of the
-- MultiLine.
returns Integer
is static;
NbPoints(me)
---Purpose: returns the number of Points from MultiPoints composing
-- the MultiLine.
returns Integer
is static;
SetParameter(me: in out; Index: Integer; U: Real)
---Purpose: Sets the value of the parameter for the
-- MultiPointConstraint at position Index.
-- Exceptions
-- - Standard_OutOfRange if Index is less
-- than 0 or Index is greater than the number
-- of Multipoint constraints in the MultiLine.
raises OutOfRange from Standard
is static;
SetValue(me: in out; Index: Integer; MPoint: MultiPointConstraint)
---Purpose: It sets the MultiPointConstraint of range Index to the
-- value MPoint.
-- An exception is raised if Index < 0 or Index> MPoint.
-- An exception is raised if the dimensions of the
-- MultiPoints are different.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
Value(me; Index: Integer)
---Purpose: returns the MultiPointConstraint of range Index
-- An exception is raised if Index<0 or Index>MPoint.
returns MultiPointConstraint from AppDef
raises OutOfRange from Standard
is static;
Dump(me; o: in out OStream)
---Purpose: Prints on the stream o information on the current
-- state of the object.
-- Is used to redefine the operator <<.
is static;
fields
tabMult: HArray1OfMultiPointConstraint from AppDef is protected;
end MultiLine from AppDef;

90
src/AppDef/AppDef_MultiLine.cxx Executable file
View File

@@ -0,0 +1,90 @@
// File AppDef_MultiLine.cxx
// Lpa, le 3/12/91
#include <AppDef_MultiLine.ixx>
#include <Standard_OutOfRange.hxx>
#include <AppDef_Array1OfMultiPointConstraint.hxx>
#include <Standard_ConstructionError.hxx>
AppDef_MultiLine::AppDef_MultiLine(){}
AppDef_MultiLine::AppDef_MultiLine (const Standard_Integer NbMult)
{
if (NbMult < 0 ) Standard_ConstructionError::Raise();
tabMult = new AppDef_HArray1OfMultiPointConstraint (1, NbMult);
}
AppDef_MultiLine::AppDef_MultiLine (const AppDef_Array1OfMultiPointConstraint& tabMultiP)
{
tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabMultiP.Length());
Standard_Integer i, Lower = tabMultiP.Lower();
for (i = 1; i <= tabMultiP.Length(); i++) {
tabMult->SetValue(i, tabMultiP.Value(Lower+i-1));
}
}
AppDef_MultiLine::AppDef_MultiLine (const TColgp_Array1OfPnt& tabP3d)
{
tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabP3d.Length());
Standard_Integer i, Lower = tabP3d.Lower();
for (i = 1; i <= tabP3d.Length(); i++) {
AppDef_MultiPointConstraint MP(1, 0);
MP.SetPoint(1, tabP3d(Lower+i-1));
tabMult->SetValue(i, MP);
}
}
AppDef_MultiLine::AppDef_MultiLine (const TColgp_Array1OfPnt2d& tabP2d)
{
tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabP2d.Length());
Standard_Integer i, Lower = tabP2d.Lower();
for (i = 1; i <= tabP2d.Length(); i++) {
AppDef_MultiPointConstraint MP(0, 1);
MP.SetPoint2d(1, tabP2d(Lower+i-1));
tabMult->SetValue(i, MP);
}
}
Standard_Integer AppDef_MultiLine::NbMultiPoints () const {
return tabMult->Length();
}
Standard_Integer AppDef_MultiLine::NbPoints() const {
return tabMult->Value(1).NbPoints() + tabMult->Value(1).NbPoints2d();
}
void AppDef_MultiLine::SetValue (const Standard_Integer Index,
const AppDef_MultiPointConstraint& MPoint) {
if ((Index <= 0) || (Index > tabMult->Length())) {
Standard_OutOfRange::Raise();
}
tabMult->SetValue(Index, MPoint);
}
AppDef_MultiPointConstraint AppDef_MultiLine::Value (const Standard_Integer Index) const
{
if ((Index <= 0) || (Index > tabMult->Length())) {
Standard_OutOfRange::Raise();
}
return tabMult->Value(Index);
}
void AppDef_MultiLine::Dump(Standard_OStream& o) const
{
o << "AppDef_MultiLine dump:" << endl;
// AppDef_MultiPointConstraint MP = tabMult->Value(1);
o << "It contains " << tabMult->Length() << " MultiPointConstraint"<< endl;
// o << MP->NbPoints() << " 3d and " << MP->NbPoints2d() << endl;
}

View File

@@ -0,0 +1,286 @@
-- File: MultiPointConstraint.cdl
-- Created: Mon Dec 2 09:03:29 1991
-- Author: Laurent PAINNOT
-- <lpa@topsn3>
---Copyright: Matra Datavision 1991, 1992
class MultiPointConstraint from AppDef
inherits MultiPoint from AppParCurves
---Purpose: Describes a MultiPointConstraint used in a
-- Multiline. MultiPointConstraints are composed
-- of several two or three-dimensional points.
-- The purpose is to define the corresponding
-- points that share a common constraint in order
-- to compute the approximation of several lines in parallel.
-- Notes:
-- - The order of points of a MultiPointConstraints is very important.
-- Users must give 3D points first, and then 2D points.
-- - The constraints for the points included in a
-- MultiPointConstraint are always identical for
-- all points, including the parameter.
-- - If a MultiPointConstraint is a "tangency"
-- point, the point is also a "passing" point.
uses Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec from TColgp,
Array1OfVec2d from TColgp,
Constraint from AppParCurves,
OStream from Standard,
TShared from MMgt
raises OutOfRange from Standard,
ConstructionError from Standard,
DimensionError from Standard
is
Create
---Purpose: creates an undefined MultiPointConstraint.
returns MultiPointConstraint from AppDef;
Create(NbPoints, NbPoints2d: Integer)
---Purpose: constructs a set of Points used to approximate a Multiline.
-- These Points can be of 2 or 3 dimensions.
-- Points will be initialized with SetPoint and SetPoint2d.
returns MultiPointConstraint from AppDef;
Create(tabP: Array1OfPnt)
---Purpose: creates a MultiPoint only composed of 3D points.
returns MultiPointConstraint from AppDef;
Create(tabP: Array1OfPnt2d)
---Purpose: creates a MultiPoint only composed of 2D points.
returns MultiPointConstraint from AppDef;
Create(tabP: Array1OfPnt; tabP2d: Array1OfPnt2d)
---Purpose: constructs a set of Points used to approximate a Multiline.
-- These Points can be of 2 or 3 dimensions.
-- Points will be initialized with SetPoint and SetPoint2d.
returns MultiPointConstraint from AppDef;
Create(tabP: Array1OfPnt; tabP2d: Array1OfPnt2d;
tabVec: Array1OfVec; tabVec2d: Array1OfVec2d;
tabCur: Array1OfVec; tabCur2d: Array1OfVec2d)
---Purpose: creates a MultiPointConstraint with a constraint of
-- Curvature.
-- An exception is raised if
-- (length of <tabP> + length of <tabP2d> ) is different
-- from (length of <tabVec> + length of <tabVec2d> ) or
-- from (length of <tabCur> + length of <tabCur2d> )
returns MultiPointConstraint from AppDef
raises ConstructionError from Standard;
Create(tabP: Array1OfPnt; tabP2d: Array1OfPnt2d;
tabVec: Array1OfVec; tabVec2d: Array1OfVec2d)
---Purpose: creates a MultiPointConstraint with a constraint of
-- Tangency.
-- An exception is raised if
-- (length of <tabP> + length of <tabP2d> ) is different
-- from (length of <tabVec> + length of <tabVec2d> )
returns MultiPointConstraint from AppDef
raises ConstructionError from Standard;
Create(tabP: Array1OfPnt; tabVec: Array1OfVec; tabCur: Array1OfVec)
---Purpose: creates a MultiPointConstraint only composed of 3d points
-- with constraints of curvature.
-- An exception is raised if the length of tabP is different
-- from the length of tabVec or from tabCur.
returns MultiPointConstraint from AppDef
raises ConstructionError;
Create(tabP: Array1OfPnt; tabVec: Array1OfVec)
---Purpose: creates a MultiPointConstraint only composed of 3d points
-- with constraints of tangency.
-- An exception is raised if the length of tabP is different
-- from the length of tabVec.
returns MultiPointConstraint
raises ConstructionError;
Create(tabP2d: Array1OfPnt2d; tabVec2d: Array1OfVec2d)
---Purpose: creates a MultiPointConstraint only composed of 2d points
-- with constraints of tangency.
-- An exception is raised if the length of tabP is different
-- from the length of tabVec2d.
returns MultiPointConstraint from AppDef
raises ConstructionError from Standard;
Create(tabP2d: Array1OfPnt2d;
tabVec2d: Array1OfVec2d;
tabCur2d: Array1OfVec2d)
---Purpose: creates a MultiPointConstraint only composed of 2d points
-- with constraints of curvature.
-- An exception is raised if the length of tabP is different
-- from the length of tabVec2d or from tabCur2d.
returns MultiPointConstraint from AppDef
raises ConstructionError from Standard;
SetTang(me: in out; Index: Integer; Tang: Vec)
---Purpose: sets the value of the tangency of the point of range
-- Index.
-- An exception is raised if Index <0 or if Index > number
-- of 3d points.
-- An exception is raised if Tang has an incorrect number of
-- dimensions.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
Tang(me; Index: Integer)
---Purpose: returns the tangency value of the point of range Index.
-- An exception is raised if Index < 0 or if Index > number
-- of 3d points.
returns Vec from gp
raises OutOfRange from Standard
is static;
SetTang2d(me: in out; Index: Integer; Tang2d: Vec2d)
---Purpose: sets the value of the tangency of the point of range
-- Index.
-- An exception is raised if Index <number of 3d points or if
-- Index > total number of Points
-- An exception is raised if Tang has an incorrect number of
-- dimensions.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
Tang2d(me; Index: Integer)
---Purpose: returns the tangency value of the point of range Index.
-- An exception is raised if Index < number of 3d points or
-- if Index > total number of points.
returns Vec2d from gp
raises OutOfRange from Standard
is static;
SetCurv(me: in out; Index: Integer; Curv: Vec)
---Purpose: Vec sets the value of the normal vector at the
-- point of index Index. The norm of the normal
-- vector at the point of position Index is set to the normal curvature.
-- An exception is raised if Index <0 or if Index > number
-- of 3d points.
-- An exception is raised if Curv has an incorrect number of
-- dimensions.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
Curv(me; Index: Integer)
---Purpose: returns the normal vector at the point of range Index.
-- An exception is raised if Index < 0 or if Index > number
-- of 3d points.
returns Vec from gp
raises OutOfRange from Standard
is static;
SetCurv2d(me: in out; Index: Integer; Curv2d: Vec2d)
---Purpose: Vec sets the value of the normal vector at the
-- point of index Index. The norm of the normal
-- vector at the point of position Index is set to the normal curvature.
-- An exception is raised if Index <0 or if Index > number
-- of 3d points.
-- An exception is raised if Curv has an incorrect number of
-- dimensions.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
Curv2d(me; Index: Integer)
---Purpose: returns the normal vector at the point of range Index.
-- An exception is raised if Index < 0 or if Index > number
-- of 3d points.
returns Vec2d from gp
is static;
IsTangencyPoint(me)
---Purpose: returns True if the MultiPoint has a tangency value.
returns Boolean
raises OutOfRange from Standard
is static;
IsCurvaturePoint(me)
---Purpose: returns True if the MultiPoint has a curvature value.
returns Boolean
raises OutOfRange from Standard
is static;
Dump(me; o: in out OStream)
---Purpose: Prints on the stream o information on the current
-- state of the object.
-- Is used to redefine the operator <<.
is redefined;
fields
ttabTang: TShared from MMgt;
ttabCurv: TShared from MMgt;
ttabTang2d: TShared from MMgt;
ttabCurv2d: TShared from MMgt;
end MultiPointConstraint from AppDef;

View File

@@ -0,0 +1,348 @@
// File: AppDef_MultiPointConstraint.cxx
// Created: 1991
// Author: LPA
// <pmn@sgi29>
#include <AppDef_MultiPointConstraint.ixx>
#include <Standard_OutOfRange.hxx>
#include <Standard_ConstructionError.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TColgp_HArray1OfPnt2d.hxx>
#include <TColgp_HArray1OfVec.hxx>
#include <TColgp_HArray1OfVec2d.hxx>
#define tabTang (*(Handle_TColgp_HArray1OfVec*)&ttabTang)
#define tabCurv (*(Handle_TColgp_HArray1OfVec*)&ttabCurv)
#define tabTang2d (*(Handle_TColgp_HArray1OfVec2d*)&ttabTang2d)
#define tabCurv2d (*(Handle_TColgp_HArray1OfVec2d*)&ttabCurv2d)
AppDef_MultiPointConstraint::AppDef_MultiPointConstraint() {}
AppDef_MultiPointConstraint::
AppDef_MultiPointConstraint(const Standard_Integer NbPoles,
const Standard_Integer NbPoles2d):
AppParCurves_MultiPoint(NbPoles, NbPoles2d)
{
}
AppDef_MultiPointConstraint::
AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP):
AppParCurves_MultiPoint(tabP)
{
}
AppDef_MultiPointConstraint::
AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP2d):
AppParCurves_MultiPoint(tabP2d)
{
}
AppDef_MultiPointConstraint::
AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP,
const TColgp_Array1OfPnt2d& tabP2d):
AppParCurves_MultiPoint(tabP, tabP2d)
{
}
AppDef_MultiPointConstraint::AppDef_MultiPointConstraint
(const TColgp_Array1OfPnt& tabP,
const TColgp_Array1OfPnt2d& tabP2d,
const TColgp_Array1OfVec& tabVec,
const TColgp_Array1OfVec2d& tabVec2d,
const TColgp_Array1OfVec& tabCur,
const TColgp_Array1OfVec2d& tabCur2d):
AppParCurves_MultiPoint(tabP, tabP2d) {
if ((tabP.Length() != tabVec.Length()) ||
(tabP2d.Length() != tabVec2d.Length()) ||
(tabCur.Length() != tabP.Length()) ||
(tabCur2d.Length() != tabP2d.Length())) {
Standard_ConstructionError::Raise();
}
Handle(TColgp_HArray1OfVec) T3d =
new TColgp_HArray1OfVec(1, tabVec.Length());
ttabTang = T3d;
Handle(TColgp_HArray1OfVec2d) T2d =
new TColgp_HArray1OfVec2d(1, tabVec2d.Length());
ttabTang2d = T2d;
Standard_Integer i, Lower = tabVec.Lower();
for (i = 1; i <= tabVec.Length(); i++) {
tabTang->SetValue(i, tabVec.Value(Lower+i-1));
}
Lower = tabVec2d.Lower();
for (i = 1; i <= tabVec2d.Length(); i++) {
tabTang2d->SetValue(i, tabVec2d.Value(Lower+i-1));
}
Handle(TColgp_HArray1OfVec) C3d =
new TColgp_HArray1OfVec(1, tabCur.Length());
ttabCurv = C3d;
Handle(TColgp_HArray1OfVec2d) C2d =
new TColgp_HArray1OfVec2d(1, tabCur2d.Length());
ttabCurv2d = C2d;
Lower = tabCur.Lower();
for (i = 1; i <= tabVec.Length(); i++) {
tabCurv->SetValue(i, tabCur.Value(Lower+i-1));
}
Lower = tabCur2d.Lower();
for (i = 1; i <= tabCur2d.Length(); i++) {
tabCurv2d->SetValue(i, tabCur2d.Value(Lower+i-1));
}
}
AppDef_MultiPointConstraint::AppDef_MultiPointConstraint
(const TColgp_Array1OfPnt& tabP,
const TColgp_Array1OfPnt2d& tabP2d,
const TColgp_Array1OfVec& tabVec,
const TColgp_Array1OfVec2d& tabVec2d):
AppParCurves_MultiPoint(tabP, tabP2d) {
if ((tabP.Length() != tabVec.Length()) ||
(tabP2d.Length() != tabVec2d.Length())) {
Standard_ConstructionError::Raise();
}
Handle(TColgp_HArray1OfVec) T3d =
new TColgp_HArray1OfVec(1, tabVec.Length());
ttabTang = T3d;
Handle(TColgp_HArray1OfVec2d) T2d =
new TColgp_HArray1OfVec2d(1, tabVec2d.Length());
ttabTang2d = T2d;
Standard_Integer i, Lower = tabVec.Lower();
for (i = 1; i <= tabVec.Length(); i++) {
tabTang->SetValue(i, tabVec.Value(Lower+i-1));
}
Lower = tabVec2d.Lower();
for (i = 1; i <= tabVec2d.Length(); i++) {
tabTang2d->SetValue(i, tabVec2d.Value(Lower+i-1));
}
}
AppDef_MultiPointConstraint::AppDef_MultiPointConstraint (
const TColgp_Array1OfPnt& tabP,
const TColgp_Array1OfVec& tabVec):
AppParCurves_MultiPoint(tabP) {
if (tabP.Length() != tabVec.Length()) {
Standard_ConstructionError::Raise();
}
Handle(TColgp_HArray1OfVec) T3d =
new TColgp_HArray1OfVec(1, tabVec.Length());
ttabTang = T3d;
Standard_Integer i, Lower = tabVec.Lower();
for (i = 1; i <= tabVec.Length(); i++) {
tabTang->SetValue(i, tabVec.Value(Lower+i-1));
}
}
AppDef_MultiPointConstraint::AppDef_MultiPointConstraint
(const TColgp_Array1OfPnt& tabP,
const TColgp_Array1OfVec& tabVec,
const TColgp_Array1OfVec& tabCur):
AppParCurves_MultiPoint(tabP) {
if ((tabP.Length() != tabVec.Length()) ||
(tabP.Length() != tabCur.Length())) {
Standard_ConstructionError::Raise();
}
Handle(TColgp_HArray1OfVec) T3d =
new TColgp_HArray1OfVec(1, tabVec.Length());
ttabTang = T3d;
Standard_Integer i, Lower = tabVec.Lower();
for (i = 1; i <= tabVec.Length(); i++) {
tabTang->SetValue(i, tabVec.Value(Lower+i-1));
}
Handle(TColgp_HArray1OfVec) C3d =
new TColgp_HArray1OfVec(1, tabCur.Length());
ttabCurv = C3d;
Lower = tabCur.Lower();
for (i = 1; i <= tabCur.Length(); i++) {
tabCurv->SetValue(i, tabCur.Value(Lower+i-1));
}
}
AppDef_MultiPointConstraint::AppDef_MultiPointConstraint
(const TColgp_Array1OfPnt2d& tabP2d,
const TColgp_Array1OfVec2d& tabVec2d):
AppParCurves_MultiPoint(tabP2d) {
if (tabP2d.Length() != tabVec2d.Length()) {
Standard_ConstructionError::Raise();
}
Handle(TColgp_HArray1OfVec2d) T2d =
new TColgp_HArray1OfVec2d(1, tabVec2d.Length());
ttabTang2d = T2d;
Standard_Integer i, Lower = tabVec2d.Lower();
for (i = 1; i <= tabVec2d.Length(); i++) {
tabTang2d->SetValue(i, tabVec2d.Value(Lower+i-1));
}
}
AppDef_MultiPointConstraint::AppDef_MultiPointConstraint
(const TColgp_Array1OfPnt2d& tabP2d,
const TColgp_Array1OfVec2d& tabVec2d,
const TColgp_Array1OfVec2d& tabCur2d):
AppParCurves_MultiPoint(tabP2d) {
if ((tabP2d.Length() != tabVec2d.Length()) ||
(tabCur2d.Length() != tabP2d.Length())) {
Standard_ConstructionError::Raise();
}
Handle(TColgp_HArray1OfVec2d) T2d =
new TColgp_HArray1OfVec2d(1, tabVec2d.Length());
ttabTang2d = T2d;
Standard_Integer i, Lower = tabVec2d.Lower();
for (i = 1; i <= tabVec2d.Length(); i++) {
tabTang2d->SetValue(i, tabVec2d.Value(Lower+i-1));
}
Handle(TColgp_HArray1OfVec2d) C2d =
new TColgp_HArray1OfVec2d(1, tabCur2d.Length());
ttabCurv2d = C2d;
Lower = tabCur2d.Lower();
for (i = 1; i <= tabCur2d.Length(); i++) {
tabCurv2d->SetValue(i, tabCur2d.Value(Lower+i-1));
}
}
void AppDef_MultiPointConstraint::SetTang (const Standard_Integer Index,
const gp_Vec& Tang) {
if (tabTang.IsNull())
tabTang = new TColgp_HArray1OfVec (1, nbP);
if ((Index <= 0) || (Index > nbP)) {
Standard_OutOfRange::Raise();
}
tabTang->SetValue(Index, Tang);
}
gp_Vec AppDef_MultiPointConstraint::Tang (const Standard_Integer Index) const {
if ((Index <= 0) || (Index > nbP)) {
Standard_OutOfRange::Raise();
}
return tabTang->Value(Index);
}
void AppDef_MultiPointConstraint::SetTang2d (const Standard_Integer Index,
const gp_Vec2d& Tang2d){
if (tabTang2d.IsNull())
tabTang2d = new TColgp_HArray1OfVec2d (1, nbP2d);
if ((Index <= nbP) ||
(Index > nbP+nbP2d)) {
Standard_OutOfRange::Raise();
}
tabTang2d->SetValue(Index-nbP, Tang2d);
}
gp_Vec2d AppDef_MultiPointConstraint::Tang2d (const Standard_Integer Index) const {
if ((Index <= nbP) ||
(Index > nbP+nbP2d)) {
Standard_OutOfRange::Raise();
}
return tabTang2d->Value(Index-nbP);
}
void AppDef_MultiPointConstraint::SetCurv (const Standard_Integer Index, const gp_Vec& Curv) {
if (tabCurv.IsNull())
tabCurv = new TColgp_HArray1OfVec (1, nbP);
if ((Index <= 0) || (Index > nbP)) {
Standard_OutOfRange::Raise();
}
tabCurv->SetValue(Index, Curv);
}
gp_Vec AppDef_MultiPointConstraint::Curv (const Standard_Integer Index) const {
if ((Index <= 0) || (Index > nbP)) {
Standard_OutOfRange::Raise();
}
return tabCurv->Value(Index);
}
void AppDef_MultiPointConstraint::SetCurv2d (const Standard_Integer Index,
const gp_Vec2d& Curv2d){
if (tabCurv2d.IsNull())
tabCurv2d = new TColgp_HArray1OfVec2d (1, nbP2d);
if ((Index <= nbP) ||
(Index > nbP+nbP2d)) {
Standard_OutOfRange::Raise();
}
tabCurv2d->SetValue(Index- nbP, Curv2d);
}
gp_Vec2d AppDef_MultiPointConstraint::Curv2d (const Standard_Integer Index) const {
if ((Index <= nbP) ||
(Index > nbP+nbP2d)) {
Standard_OutOfRange::Raise();
}
return tabCurv2d->Value(Index - nbP);
}
Standard_Boolean AppDef_MultiPointConstraint::IsTangencyPoint() const
{
return !(tabTang.IsNull() && tabTang2d.IsNull());
}
Standard_Boolean AppDef_MultiPointConstraint::IsCurvaturePoint() const
{
return !(tabCurv.IsNull() && tabCurv2d.IsNull());
}
void AppDef_MultiPointConstraint::Dump(Standard_OStream& o) const
{
o << "AppDef_MultiPointConstraint dump:" << endl;
}

112
src/AppDef/AppDef_MyLineTool.cdl Executable file
View File

@@ -0,0 +1,112 @@
-- File: AppDef_MyLineTool.cdl
-- Created: Wed Jan 20 16:20:46 1993
-- Author: Laurent PAINNOT
-- <lpa@sdsun1>
---Copyright: Matra Datavision 1993
class MyLineTool from AppDef
uses MultiLine from AppDef,
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec from TColgp,
Array1OfVec2d from TColgp,
Status from Approx
is
FirstPoint(myclass; ML: MultiLine) returns Integer;
---Purpose: Returns the first index of multipoints of the MultiLine.
LastPoint(myclass; ML: MultiLine) returns Integer;
---Purpose: Returns the last index of multipoints of the MultiLine.
NbP2d(myclass; ML: MultiLine) returns Integer;
---Purpose: Returns the number of 2d points of a MultiLine.
NbP3d(myclass; ML: MultiLine) returns Integer;
---Purpose: Returns the number of 3d points of a MultiLine.
Value(myclass; ML: MultiLine; MPointIndex: Integer;
tabPt: out Array1OfPnt);
---Purpose: returns the 3d points of the multipoint <MPointIndex>
-- when only 3d points exist.
Value(myclass; ML: MultiLine; MPointIndex: Integer;
tabPt2d: out Array1OfPnt2d);
---Purpose: returns the 2d points of the multipoint <MPointIndex>
-- when only 2d points exist.
Value(myclass; ML: MultiLine; MPointIndex: Integer;
tabPt: out Array1OfPnt; tabPt2d: out Array1OfPnt2d);
---Purpose: returns the 3d and 2d points of the multipoint
-- <MPointIndex>.
Tangency(myclass; ML: MultiLine; MPointIndex: Integer;
tabV: out Array1OfVec) returns Boolean;
---Purpose: returns the 3d points of the multipoint <MPointIndex>
-- when only 3d points exist.
Tangency(myclass; ML: MultiLine; MPointIndex: Integer;
tabV2d: out Array1OfVec2d) returns Boolean;
---Purpose: returns the 2d tangency points of the multipoint
-- <MPointIndex> only when 2d points exist.
Tangency(myclass; ML: MultiLine; MPointIndex: Integer;
tabV: out Array1OfVec; tabV2d: out Array1OfVec2d)
returns Boolean;
---Purpose: returns the 3d and 2d points of the multipoint
-- <MPointIndex>.
Curvature(myclass; ML: MultiLine; MPointIndex: Integer;
tabV: out Array1OfVec) returns Boolean;
---Purpose: returns the 3d curvatures of the multipoint <MPointIndex>
-- when only 3d points exist.
Curvature(myclass; ML: MultiLine; MPointIndex: Integer;
tabV2d: out Array1OfVec2d) returns Boolean;
---Purpose: returns the 2d curvatures of the multipoint
-- <MPointIndex> only when 2d points exist.
Curvature(myclass; ML: MultiLine; MPointIndex: Integer;
tabV: out Array1OfVec; tabV2d: out Array1OfVec2d)
returns Boolean;
---Purpose: returns the 3d and 2d curvatures of the multipoint
-- <MPointIndex>.
WhatStatus(myclass; ML: MultiLine; I1, I2: Integer)
returns Status from Approx;
---Purpose: returns NoPointsAdded
MakeMLBetween(myclass; ML: MultiLine; I1, I2: Integer;
NbPMin: Integer)
returns MultiLine;
---Purpose: Is never called in the algorithms.
-- Nothing is done.
---C++: return &
end MyLineTool;

193
src/AppDef/AppDef_MyLineTool.cxx Executable file
View File

@@ -0,0 +1,193 @@
// AppDef_MyLineTool.cxx
// 24-06-96 : JPI : implementation des methodes AppDef_MyLineTool::Curvature
// pour le lissage variationnel
#include <AppDef_MyLineTool.ixx>
#include <AppDef_MultiPointConstraint.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
Standard_Integer AppDef_MyLineTool::FirstPoint(const AppDef_MultiLine&)
{
return 1;
}
Standard_Integer AppDef_MyLineTool::LastPoint(const AppDef_MultiLine& ML)
{
return ML.NbMultiPoints();
}
Standard_Integer AppDef_MyLineTool::NbP2d(const AppDef_MultiLine& ML)
{
return ML.Value(1).NbPoints2d();
}
Standard_Integer AppDef_MyLineTool::NbP3d(const AppDef_MultiLine& ML)
{
return ML.Value(1).NbPoints();
}
void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfPnt& tabPt)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
Standard_Integer nbp3d = MPC.NbPoints(), low = tabPt.Lower();
for (Standard_Integer i = 1; i <= nbp3d; i++) {
tabPt(i+low-1) = MPC.Point(i);
}
}
void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfPnt2d& tabPt2d)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabPt2d.Lower();
for (Standard_Integer i = 1; i <= nbp2d; i++) {
tabPt2d(i+low-1) = MPC.Point2d(i);
}
}
void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfPnt& tabPt,
TColgp_Array1OfPnt2d& tabPt2d)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
Standard_Integer i, nbp2d = MPC.NbPoints2d(), low2d = tabPt2d.Lower();
Standard_Integer nbp3d = MPC.NbPoints(), low = tabPt.Lower();
for (i = 1; i <= nbp3d; i++) {
tabPt(i+low-1) = MPC.Point(i);
}
for (i = 1; i <= nbp2d; i++) {
tabPt2d(i+low2d-1) = MPC.Point2d(nbp3d+i);
}
}
Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfVec& tabV)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
if (MPC.IsTangencyPoint()) {
Standard_Integer nbp3d = MPC.NbPoints(), low = tabV.Lower();
for (Standard_Integer i = 1; i <= nbp3d; i++) {
tabV(i+low-1) = MPC.Tang(i);
}
return Standard_True;
}
else return Standard_False;
}
Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfVec2d& tabV2d)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
if (MPC.IsTangencyPoint()) {
Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabV2d.Lower();
for (Standard_Integer i = 1; i <= nbp2d; i++) {
tabV2d(i+low-1) = MPC.Tang2d(i);
}
return Standard_True;
}
else return Standard_False;
}
Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfVec& tabV,
TColgp_Array1OfVec2d& tabV2d)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
if (MPC.IsTangencyPoint()) {
Standard_Integer i, nbp3d = MPC.NbPoints(), low = tabV.Lower();
Standard_Integer nbp2d = MPC.NbPoints2d(), low2d = tabV2d.Lower();
for (i = 1; i <= nbp3d; i++) {
tabV(i+low-1) = MPC.Tang(i);
}
for (i = 1; i <= nbp2d; i++) {
tabV2d(i+low2d-1) = MPC.Tang2d(nbp3d+i);
}
return Standard_True;
}
else return Standard_False;
}
AppDef_MultiLine& AppDef_MyLineTool::MakeMLBetween(const AppDef_MultiLine&,
const Standard_Integer ,
const Standard_Integer ,
const Standard_Integer )
{
return *((AppDef_MultiLine*) 0);
}
Approx_Status AppDef_MyLineTool::WhatStatus(const AppDef_MultiLine&,
const Standard_Integer,
const Standard_Integer)
{
return Approx_NoPointsAdded;
}
Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfVec& tabV)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
if (MPC.IsCurvaturePoint()) {
Standard_Integer nbp3d = MPC.NbPoints(), low = tabV.Lower();
for (Standard_Integer i = 1; i <= nbp3d; i++) {
tabV(i+low-1) = MPC.Curv(i);
}
return Standard_True;
}
else return Standard_False;
}
Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfVec2d& tabV2d)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
if (MPC.IsCurvaturePoint()) {
Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabV2d.Lower();
for (Standard_Integer i = 1; i <= nbp2d; i++) {
tabV2d(i+low-1) = MPC.Curv2d(i);
}
return Standard_True;
}
else return Standard_False;
}
Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
const Standard_Integer MPointIndex,
TColgp_Array1OfVec& tabV,
TColgp_Array1OfVec2d& tabV2d)
{
AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
if (MPC.IsCurvaturePoint()) {
Standard_Integer i, nbp3d = MPC.NbPoints(), low = tabV.Lower();
Standard_Integer nbp2d = MPC.NbPoints2d(), low2d = tabV2d.Lower();
for (i = 1; i <= nbp3d; i++) {
tabV(i+low-1) = MPC.Curv(i);
}
for (i = 1; i <= nbp2d; i++) {
tabV2d(i+low2d-1) = MPC.Curv2d(nbp3d+i);
}
return Standard_True;
}
else return Standard_False;
}