1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

0024002: Overall code and build procedure refactoring -- automatic

Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl":
- WOK-generated header files from inc and sources from drv are moved to src
- CDL files removed
- All packages are converted to nocdlpack
This commit is contained in:
abv
2015-07-12 07:42:38 +03:00
parent 543a996496
commit 42cf5bc1ca
15354 changed files with 623957 additions and 509844 deletions

View File

@@ -1,117 +0,0 @@
-- Created on: 1991-04-11
-- Created by: Laurent PAINNOT
-- Copyright (c) 1991-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.
package AppParCurves
---Purpose: Parallel Approximation in n curves.
-- This package gives all the algorithms used to approximate a MultiLine
-- described by the tool MLineTool.
-- The result of the approximation will be a MultiCurve.
uses math, FEmTool, gp, TColgp, StdFail, TColStd, TCollection, Standard, MMgt, GeomAbs, PLib
is
enumeration Constraint is
NoConstraint,
PassPoint,
TangencyPoint,
CurvaturePoint
end Constraint;
---Purpose:
-- - NoConstraint: this point has no constraints.
-- - PassPoint: the approximation curve passes through this point.
-- - TangencyPoint: this point has a tangency constraint.
-- - CurvaturePoint: this point has a curvature constraint.
class MultiPoint;
class MultiCurve;
class MultiBSpCurve;
class ConstraintCouple;
-- Algorithms:
generic class LeastSquare;
generic class ResolConstraint;
generic class Function;
generic class BSpFunction;
generic class Gradient, Gradient_BFGS, ParLeastSquare, ResConstraint, ParFunction;
generic class BSpGradient, BSpGradient_BFGS, BSpParLeastSquare, BSpParFunction;
--- instantiate classes:
--
imported Array1OfConstraintCouple;
imported transient class HArray1OfConstraintCouple;
imported Array1OfMultiPoint;
imported transient class HArray1OfMultiPoint;
imported Array1OfMultiCurve;
imported transient class HArray1OfMultiCurve;
imported SequenceOfMultiCurve;
imported Array1OfMultiBSpCurve;
imported transient class HArray1OfMultiBSpCurve;
imported SequenceOfMultiBSpCurve;
BernsteinMatrix(NbPoles: in Integer from Standard;
U : in Vector from math;
A : in out Matrix from math);
Bernstein(NbPoles: in Integer from Standard;
U : in Vector from math;
A : in out Matrix from math;
DA : in out Matrix from math);
SecondDerivativeBernstein(U: Real; DDA: in out Vector from math);
SplineFunction(NbPoles : in Integer from Standard;
Degree : in Integer from Standard;
Parameters : in Vector from math;
FlatKnots : in Vector from math;
A : in out Matrix from math;
DA : in out Matrix from math;
Index : in out IntegerVector from math);
end AppParCurves;

View File

@@ -15,12 +15,13 @@
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#include <AppParCurves.ixx>
#include <AppParCurves.hxx>
#include <BSplCLib.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
#include <math_Matrix.hxx>
#include <TColStd_Array1OfReal.hxx>
void AppParCurves::BernsteinMatrix(const Standard_Integer NbPoles,
const math_Vector& U,

View File

@@ -0,0 +1,107 @@
// Created on: 1991-04-11
// Created by: Laurent PAINNOT
// Copyright (c) 1991-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.
#ifndef _AppParCurves_HeaderFile
#define _AppParCurves_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <math_Vector.hxx>
#include <Standard_Real.hxx>
#include <math_IntegerVector.hxx>
class math_Matrix;
class AppParCurves_MultiPoint;
class AppParCurves_MultiCurve;
class AppParCurves_MultiBSpCurve;
class AppParCurves_ConstraintCouple;
class AppParCurves_LeastSquare;
class AppParCurves_ResolConstraint;
class AppParCurves_Function;
class AppParCurves_BSpFunction;
class AppParCurves_Gradient;
class AppParCurves_Gradient_BFGS;
class AppParCurves_ParLeastSquare;
class AppParCurves_ResConstraint;
class AppParCurves_ParFunction;
class AppParCurves_BSpGradient;
class AppParCurves_BSpGradient_BFGS;
class AppParCurves_BSpParLeastSquare;
class AppParCurves_BSpParFunction;
//! Parallel Approximation in n curves.
//! This package gives all the algorithms used to approximate a MultiLine
//! described by the tool MLineTool.
//! The result of the approximation will be a MultiCurve.
class AppParCurves
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT static void BernsteinMatrix (const Standard_Integer NbPoles, const math_Vector& U, math_Matrix& A);
Standard_EXPORT static void Bernstein (const Standard_Integer NbPoles, const math_Vector& U, math_Matrix& A, math_Matrix& DA);
Standard_EXPORT static void SecondDerivativeBernstein (const Standard_Real U, math_Vector& DDA);
Standard_EXPORT static void SplineFunction (const Standard_Integer NbPoles, const Standard_Integer Degree, const math_Vector& Parameters, const math_Vector& FlatKnots, math_Matrix& A, math_Matrix& DA, math_IntegerVector& Index);
protected:
private:
friend class AppParCurves_MultiPoint;
friend class AppParCurves_MultiCurve;
friend class AppParCurves_MultiBSpCurve;
friend class AppParCurves_ConstraintCouple;
friend class AppParCurves_LeastSquare;
friend class AppParCurves_ResolConstraint;
friend class AppParCurves_Function;
friend class AppParCurves_BSpFunction;
friend class AppParCurves_Gradient;
friend class AppParCurves_Gradient_BFGS;
friend class AppParCurves_ParLeastSquare;
friend class AppParCurves_ResConstraint;
friend class AppParCurves_ParFunction;
friend class AppParCurves_BSpGradient;
friend class AppParCurves_BSpGradient_BFGS;
friend class AppParCurves_BSpParLeastSquare;
friend class AppParCurves_BSpParFunction;
};
#endif // _AppParCurves_HeaderFile

View File

@@ -1,221 +0,0 @@
-- Created on: 1993-09-21
-- Created by: Modelistation
-- Copyright (c) 1993-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 BSpFunction from AppParCurves (
MultiLine as any;
ToolLine as any; -- as ToolLine(MultiLine)
Squares as any)
inherits MultipleVarFunctionWithGradient from math
---Purpose: This function inherits MultipleVarFunctionWithGradient to be
-- used in the mathematical algorithm BFGS.
-- It computes the value of the function
-- F=sum(||Qui - B*Pi||)2 where Pi are Poles of the BSpline
-- curves approximating the given MultiLine SSP and ui the
-- parameters associated to the points Qi of SSP.
-- It also computes the gradient for values ui of the parameter.
uses MultiBSpCurve from AppParCurves,
HArray1OfConstraintCouple from AppParCurves,
Constraint from AppParCurves,
Vector from math,
IntegerVector from math,
Matrix from math,
HArray1OfInteger from TColStd,
Array1OfReal from TColStd,
Array1OfInteger from TColStd
is
Create(SSP: MultiLine; FirstPoint, LastPoint: Integer;
TheConstraints: HArray1OfConstraintCouple;
Parameters: Vector; Knots: Array1OfReal;
Mults: Array1OfInteger; NbPol: Integer)
---Purpose: initializes the fields of the function. The approximating
-- curve has <NbPol> control points.
returns BSpFunction from AppParCurves;
NbVariables(me)
---Purpose: returns the number of variables of the function. It
-- corresponds to the number of MultiPoints.
returns Integer
is static;
Perform(me: in out; X: Vector)
---Purpose: this method is used each time Value or Gradient is
-- needed.
is static protected;
Value(me: in out; X: Vector; F: out Real)
---Purpose: this method computes the new approximation of the
-- MultiLine
-- SSP and calculates F = sum (||Pui - Bi*Pi||2) for each
-- point of the MultiLine.
returns Boolean
is static;
Gradient(me: in out; X: Vector; G: out Vector)
---Purpose: returns the gradient G of the sum above for the
-- parameters Xi.
returns Boolean
is static;
Values(me: in out; X: Vector; F: out Real; G: out Vector)
---Purpose: returns the value F=sum(||Pui - Bi*Pi||)2.
-- returns the value G = grad(F) for the parameters Xi.
returns Boolean
is static;
NewParameters(me)
---Purpose: returns the new parameters of the MultiLine.
---C++: return const&
returns Vector
is static;
CurveValue(me: in out)
---Purpose: returns the MultiBSpCurve approximating the set after
-- computing the value F or Grad(F).
returns MultiBSpCurve from AppParCurves
is static;
Error(me: in out; IPoint, CurveIndex: Integer)
---Purpose: returns the distance between the MultiPoint of range
-- IPoint and the curve CurveIndex.
returns Real
is static;
MaxError3d(me)
---Purpose: returns the maximum distance between the points
-- and the MultiBSpCurve.
returns Real
is static;
MaxError2d(me)
---Purpose: returns the maximum distance between the points
-- and the MultiBSpCurve.
returns Real
is static;
FunctionMatrix(me)
---Purpose: returns the function matrix used to approximate the
-- multiline.
---C++: return const&
returns Matrix from math
is static;
DerivativeFunctionMatrix(me)
---Purpose: returns the derivative function matrix used to approximate the
-- multiline.
---C++: return const&
returns Matrix from math
is static;
Index(me)
---Purpose: Returns the indexes of the first non null values of
-- A and DA.
-- The values are non null from Index(ieme point) +1
-- to Index(ieme point) + degree +1.
---C++: return const&
returns IntegerVector
is static;
FirstConstraint(me; TheConstraints: HArray1OfConstraintCouple;
FirstPoint: Integer)
---Purpose:
returns Constraint from AppParCurves
is static;
LastConstraint(me; TheConstraints: HArray1OfConstraintCouple;
LastPoint: Integer)
---Purpose:
returns Constraint from AppParCurves
is static;
SetFirstLambda(me: in out; l1: Real)
is static;
SetLastLambda(me: in out; l2: Real)
is static;
fields
Done: Boolean;
MyMultiLine : MultiLine;
MyMultiBSpCurve: MultiBSpCurve from AppParCurves;
nbpoles: Integer;
myParameters: Vector;
FVal: Real;
ValGrad_F: Vector from math;
MyF: Matrix from math;
PTLX : Matrix from math;
PTLY : Matrix from math;
PTLZ : Matrix from math;
A: Matrix from math;
DA: Matrix from math;
MyLeastSquare : Squares;
Contraintes: Boolean;
NbP: Integer;
NbCu: Integer;
Adeb: Integer;
Afin: Integer;
tabdim: HArray1OfInteger from TColStd;
ERR3d: Real;
ERR2d: Real;
FirstP: Integer;
LastP: Integer;
myConstraints: HArray1OfConstraintCouple from AppParCurves;
mylambda1: Real;
mylambda2: Real;
end BSpFunction;

View File

@@ -1,185 +0,0 @@
-- Created on: 1993-09-22
-- Created by: Modelistation
-- Copyright (c) 1993-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 BSpGradient from AppParCurves
(MultiLine as any;
ToolLine as any) -- as ToolLine(MultiLine)
---Purpose: This algorithm uses the algorithms LeastSquare,
-- ResConstraint and a gradient method to approximate a set
-- of points (AppDef_MultiLine) with a minimization of the
-- sum(square(|F(i)-Qi|)) by changing the parameter.
-- The algorithm used is from of the mathematical
-- package: math_BFGS, a gradient method.
-- The Result is a Bspline set.
uses Vector from math,
MultipleVarFunctionWithGradient from math,
MultiBSpCurve from AppParCurves,
HArray1OfConstraintCouple from AppParCurves,
Array1OfReal from TColStd,
Array1OfInteger from TColStd
raises OutOfRange from Standard,
NotDone from StdFail
private class BSpParLeastSquare instantiates LeastSquare from AppParCurves
(MultiLine, ToolLine);
private class BSpParFunction instantiates BSpFunction from AppParCurves
(MultiLine, ToolLine, BSpParLeastSquare);
class BSpGradient_BFGS from AppParCurves
inherits BFGS from math
uses MultipleVarFunctionWithGradient from math,
Vector from math
is
Create ( F : in out MultipleVarFunctionWithGradient from math ;
StartingPoint : Vector from math ;
Tolerance3d : Real from Standard ;
Tolerance2d : Real from Standard ;
Eps : Real from Standard ;
NbIterations : Integer from Standard = 200 );
IsSolutionReached ( me ;
F : in out MultipleVarFunctionWithGradient from math )
returns Boolean from Standard is redefined ;
fields
myTol3d : Real from Standard ;
myTol2d : Real from Standard ;
end BSpGradient_BFGS from AppParCurves ;
is
Create(SSP: MultiLine; FirstPoint, LastPoint: Integer;
TheConstraints: HArray1OfConstraintCouple;
Parameters: in out Vector;
Knots: Array1OfReal; Mults: Array1OfInteger;
Deg: Integer;
Tol3d, Tol2d: Real; NbIterations: Integer = 1)
---Purpose: Tries to minimize the sum (square(||Qui - Bi*Pi||))
-- where Pui describe the approximating BSpline curves'Poles
-- and Qi the MultiLine points with a parameter ui.
-- In this algorithm, the parameters ui are the unknowns.
-- The tolerance required on this sum is given by Tol.
-- The desired degree of the resulting curve is Deg.
returns BSpGradient from AppParCurves;
Create(SSP: MultiLine; FirstPoint, LastPoint: Integer;
TheConstraints: HArray1OfConstraintCouple;
Parameters: in out Vector;
Knots: Array1OfReal; Mults: Array1OfInteger;
Deg: Integer;
Tol3d, Tol2d: Real; NbIterations: Integer;
lambda1, lambda2: Real)
---Purpose: Tries to minimize the sum (square(||Qui - Bi*Pi||))
-- where Pui describe the approximating BSpline curves'Poles
-- and Qi the MultiLine points with a parameter ui.
-- In this algorithm, the parameters ui are the unknowns.
-- The tolerance required on this sum is given by Tol.
-- The desired degree of the resulting curve is Deg.
returns BSpGradient from AppParCurves;
Perform(me: in out; SSP: MultiLine; FirstPoint, LastPoint: Integer;
TheConstraints: HArray1OfConstraintCouple;
Parameters: in out Vector;
Knots: Array1OfReal; Mults: Array1OfInteger;
Deg: Integer;
Tol3d, Tol2d: Real; NbIterations: Integer = 200)
is static protected;
IsDone(me)
---Purpose: returns True if all has been correctly done.
returns Boolean
is static;
Value(me)
---Purpose: returns all the BSpline curves approximating the
-- MultiLine SSP after minimization of the parameter.
returns MultiBSpCurve from AppParCurves
raises NotDone from StdFail
is static;
Error(me; Index: Integer)
---Purpose: returns the difference between the old and the new
-- approximation.
-- An exception is raised if NotDone.
-- An exception is raised if Index<1 or Index>NbParameters.
returns Real
raises NotDone from StdFail,
OutOfRange from Standard
is static;
MaxError3d(me)
---Purpose: returns the maximum difference between the old and the
-- new approximation.
returns Real
raises NotDone from StdFail
is static;
MaxError2d(me)
---Purpose: returns the maximum difference between the old and the
-- new approximation.
returns Real
raises NotDone from StdFail
is static;
AverageError(me)
---Purpose: returns the average error between the old and the
-- new approximation.
returns Real
raises NotDone from StdFail
is static;
fields
SCU: MultiBSpCurve from AppParCurves;
ParError: Vector from math;
AvError: Real;
MError3d: Real;
MError2d: Real;
mylambda1: Real;
mylambda2: Real;
myIsLambdaDefined: Boolean;
Done: Boolean;
end BSpGradient from AppParCurves;

View File

@@ -0,0 +1,33 @@
// Created on: 1991-04-11
// Created by: Laurent PAINNOT
// Copyright (c) 1991-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.
#ifndef _AppParCurves_Constraint_HeaderFile
#define _AppParCurves_Constraint_HeaderFile
//! - NoConstraint: this point has no constraints.
//! - PassPoint: the approximation curve passes through this point.
//! - TangencyPoint: this point has a tangency constraint.
//! - CurvaturePoint: this point has a curvature constraint.
enum AppParCurves_Constraint
{
AppParCurves_NoConstraint,
AppParCurves_PassPoint,
AppParCurves_TangencyPoint,
AppParCurves_CurvaturePoint
};
#endif // _AppParCurves_Constraint_HeaderFile

View File

@@ -1,65 +0,0 @@
-- Created on: 1993-02-24
-- Created by: Laurent PAINNOT
-- Copyright (c) 1993-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.
class ConstraintCouple from AppParCurves
---Purpose: associates an index and a constraint for an object.
-- This couple is used by AppDef_TheVariational when performing approximations.
uses Constraint from AppParCurves
is
Create returns ConstraintCouple;
---Purpose: returns an indefinite ConstraintCouple.
Create(TheIndex: Integer; Cons: Constraint)
---Purpose: Create a couple the object <Index> will have the
-- constraint <Cons>.
returns ConstraintCouple;
Index(me)
---Purpose: returns the index of the constraint object.
returns Integer
is static;
Constraint(me)
---Purpose: returns the constraint of the object.
returns Constraint
is static;
SetIndex(me: in out; TheIndex: Integer)
---Purpose: Changes the index of the constraint object.
is static;
SetConstraint(me: in out; Cons: Constraint)
---Purpose: Changes the constraint of the object.
is static;
fields
myIndex: Integer;
myConstraint: Constraint from AppParCurves;
end ConstraintCouple;

View File

@@ -12,9 +12,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AppParCurves_ConstraintCouple.ixx>
#include <AppParCurves_ConstraintCouple.hxx>
AppParCurves_ConstraintCouple::
AppParCurves_ConstraintCouple() {}

View File

@@ -0,0 +1,81 @@
// Created on: 1993-02-24
// Created by: Laurent PAINNOT
// Copyright (c) 1993-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.
#ifndef _AppParCurves_ConstraintCouple_HeaderFile
#define _AppParCurves_ConstraintCouple_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <AppParCurves_Constraint.hxx>
//! associates an index and a constraint for an object.
//! This couple is used by AppDef_TheVariational when performing approximations.
class AppParCurves_ConstraintCouple
{
public:
DEFINE_STANDARD_ALLOC
//! returns an indefinite ConstraintCouple.
Standard_EXPORT AppParCurves_ConstraintCouple();
//! Create a couple the object <Index> will have the
//! constraint <Cons>.
Standard_EXPORT AppParCurves_ConstraintCouple(const Standard_Integer TheIndex, const AppParCurves_Constraint Cons);
//! returns the index of the constraint object.
Standard_EXPORT Standard_Integer Index() const;
//! returns the constraint of the object.
Standard_EXPORT AppParCurves_Constraint Constraint() const;
//! Changes the index of the constraint object.
Standard_EXPORT void SetIndex (const Standard_Integer TheIndex);
//! Changes the constraint of the object.
Standard_EXPORT void SetConstraint (const AppParCurves_Constraint Cons);
protected:
private:
Standard_Integer myIndex;
AppParCurves_Constraint myConstraint;
};
#endif // _AppParCurves_ConstraintCouple_HeaderFile

View File

@@ -1,177 +0,0 @@
-- Created on: 1991-09-20
-- Created by: Laurent PAINNOT
-- Copyright (c) 1991-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 Function from AppParCurves (
MultiLine as any;
ToolLine as any; -- as ToolLine(MultiLine)
Squares as any;
ResolCons as any)
inherits MultipleVarFunctionWithGradient from math
---Purpose: This function inherits MultipleVarFunctionWithGradient to be
-- used in the mathematical algorithm BFGS.
-- It computes the value of the function
-- F=sum(||Qui - B*Pi||)2 where Pi are Poles of the Bezier curves
-- approximating the given MultiLine SSP and ui the parameters
-- associated to the points Qi of SSP.
-- It also computes the gradient for values ui of the parameter.
uses MultiCurve from AppParCurves,
HArray1OfConstraintCouple from AppParCurves,
Constraint from AppParCurves,
Vector from math,
Matrix from math,
HArray1OfInteger from TColStd
is
Create(SSP: MultiLine; FirstPoint, LastPoint: Integer;
TheConstraints: HArray1OfConstraintCouple;
Parameters: Vector; Deg: Integer)
---Purpose: initializes the fields of the function. The approximating
-- curve has the desired degree Deg.
returns Function from AppParCurves;
NbVariables(me)
---Purpose: returns the number of variables of the function. It
-- corresponds to the number of MultiPoints.
returns Integer
is static;
Perform(me: in out; X: Vector)
---Purpose: this method is used each time Value or Gradient is
-- needed.
is static protected;
Value(me: in out; X: Vector; F: out Real)
---Purpose: this method computes the new approximation of the
-- MultiLine
-- SSP and calculates F = sum (||Pui - Bi*Pi||2) for each
-- point of the MultiLine.
returns Boolean
is static;
Gradient(me: in out; X: Vector; G: out Vector)
---Purpose: returns the gradient G of the sum above for the
-- parameters Xi.
returns Boolean
is static;
Values(me: in out; X: Vector; F: out Real; G: out Vector)
---Purpose: returns the value F=sum(||Pui - Bi*Pi||)2.
-- returns the value G = grad(F) for the parameters Xi.
returns Boolean
is static;
NewParameters(me)
---Purpose: returns the new parameters of the MultiLine.
---C++: return const&
returns Vector
is static;
CurveValue(me: in out)
---Purpose: returns the MultiCurve approximating the set after
-- computing the value F or Grad(F).
---C++: return const&
returns MultiCurve from AppParCurves
is static;
Error(me; IPoint, CurveIndex: Integer)
---Purpose: returns the distance between the MultiPoint of range
-- IPoint and the curve CurveIndex.
returns Real
is static;
MaxError3d(me)
---Purpose: returns the maximum distance between the points
-- and the MultiCurve.
returns Real
is static;
MaxError2d(me)
---Purpose: returns the maximum distance between the points
-- and the MultiCurve.
returns Real
is static;
FirstConstraint(me; TheConstraints: HArray1OfConstraintCouple;
FirstPoint: Integer)
---Purpose:
returns Constraint from AppParCurves
is static;
LastConstraint(me; TheConstraints: HArray1OfConstraintCouple;
LastPoint: Integer)
---Purpose:
returns Constraint from AppParCurves
is static;
fields
Done: Boolean;
MyMultiLine : MultiLine;
MyMultiCurve: MultiCurve from AppParCurves;
Degre: Integer;
myParameters: Vector;
FVal: Real;
ValGrad_F: Vector from math;
MyF: Matrix from math;
PTLX : Matrix from math;
PTLY : Matrix from math;
PTLZ : Matrix from math;
A: Matrix from math;
DA: Matrix from math;
MyLeastSquare : Squares;
Contraintes: Boolean;
NbP: Integer;
NbCu: Integer;
Adeb: Integer;
Afin: Integer;
tabdim: HArray1OfInteger from TColStd;
ERR3d: Real;
ERR2d: Real;
FirstP: Integer;
LastP: Integer;
myConstraints: HArray1OfConstraintCouple from AppParCurves;
end Function;

View File

@@ -1,154 +0,0 @@
-- Created on: 1991-07-25
-- Created by: Laurent PAINNOT
-- Copyright (c) 1991-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 Gradient from AppParCurves
(MultiLine as any;
ToolLine as any) -- as ToolLine(MultiLine)
---Purpose: This algorithm uses the algorithms LeastSquare,
-- ResConstraint and a gradient method to approximate a set
-- of points (AppDef_MultiLine) with a minimization of the
-- sum(square(|F(i)-Qi|)) by changing the parameter.
-- The algorithm used is from of the mathematical
-- package: math_BFGS, a gradient method.
uses Vector from math,
MultipleVarFunctionWithGradient from math,
MultiCurve from AppParCurves,
HArray1OfConstraintCouple from AppParCurves
raises OutOfRange from Standard,
NotDone from StdFail
private class ParLeastSquare instantiates LeastSquare from AppParCurves
(MultiLine, ToolLine);
private class ResConstraint instantiates ResolConstraint from AppParCurves
(MultiLine, ToolLine);
private class ParFunction instantiates Function from AppParCurves
(MultiLine, ToolLine, ParLeastSquare, ResConstraint);
class Gradient_BFGS from AppParCurves
inherits BFGS from math
uses MultipleVarFunctionWithGradient from math,
Vector from math
is
Create ( F : in out MultipleVarFunctionWithGradient from math ;
StartingPoint : Vector from math ;
Tolerance3d : Real from Standard ;
Tolerance2d : Real from Standard ;
Eps : Real from Standard ;
NbIterations : Integer from Standard = 200 );
IsSolutionReached ( me ;
F : in out MultipleVarFunctionWithGradient from math )
returns Boolean from Standard is redefined ;
fields
myTol3d : Real from Standard ;
myTol2d : Real from Standard ;
end Gradient_BFGS from AppParCurves ;
is
Create(SSP: MultiLine; FirstPoint, LastPoint: Integer;
TheConstraints: HArray1OfConstraintCouple;
Parameters: in out Vector; Deg: Integer;
Tol3d, Tol2d: Real; NbIterations: Integer = 200)
---Purpose: Tries to minimize the sum (square(||Qui - Bi*Pi||))
-- where Pui describe the approximating Bezier curves'Poles
-- and Qi the MultiLine points with a parameter ui.
-- In this algorithm, the parameters ui are the unknowns.
-- The tolerance required on this sum is given by Tol.
-- The desired degree of the resulting curve is Deg.
returns Gradient from AppParCurves;
IsDone(me)
---Purpose: returns True if all has been correctly done.
returns Boolean
is static;
Value(me)
---Purpose: returns all the Bezier curves approximating the
-- MultiLine SSP after minimization of the parameter.
returns MultiCurve from AppParCurves
raises NotDone from StdFail
is static;
Error(me; Index: Integer)
---Purpose: returns the difference between the old and the new
-- approximation.
-- An exception is raised if NotDone.
-- An exception is raised if Index<1 or Index>NbParameters.
returns Real
raises NotDone from StdFail,
OutOfRange from Standard
is static;
MaxError3d(me)
---Purpose: returns the maximum difference between the old and the
-- new approximation.
returns Real
raises NotDone from StdFail
is static;
MaxError2d(me)
---Purpose: returns the maximum difference between the old and the
-- new approximation.
returns Real
raises NotDone from StdFail
is static;
AverageError(me)
---Purpose: returns the average error between the old and the
-- new approximation.
returns Real
raises NotDone from StdFail
is static;
fields
SCU: MultiCurve from AppParCurves;
ParError: Vector from math;
AvError: Real;
MError3d: Real;
MError2d: Real;
Done: Boolean;
end Gradient from AppParCurves;

View File

@@ -1,390 +0,0 @@
-- Created on: 1991-07-25
-- Created by: Laurent PAINNOT
-- Copyright (c) 1991-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 LeastSquare from AppParCurves
(MultiLine as any;
ToolLine as any) -- as ToolLine(MultiLine)
---Purpose: This class describes the least square fitting of a
-- MultiLine using the Householder method from the
-- mathematical package.
-- Computes in parallel the least square resolution of a
-- set of points (MultiLine). The result is a
-- set of Bezier curves (MultiCurve).
-- The problem to solve is the following one:
-- minimizing the sum(|C(ui)- Qi|)2 where Qi are the points of
-- the MultiLine and C(ui) the points of the approximating
-- curves.
uses Matrix from math,
Vector from math,
IntegerVector from math,
Constraint from AppParCurves,
MultiCurve from AppParCurves,
MultiBSpCurve from AppParCurves,
Array1OfInteger from TColStd,
Array1OfReal from TColStd,
HArray1OfInteger from TColStd,
HArray1OfReal from TColStd
raises NotDone from StdFail,
OutOfRange from Standard,
DimensionError from Standard,
NoSuchObject from Standard
is
Create(SSP: MultiLine; FirstPoint, LastPoint: Integer;
FirstCons, LastCons: Constraint;
Parameters: Vector from math; NbPol: Integer)
---Purpose: given a MultiLine, this algorithm computes the least
-- square resolution using the Householder-QR method.
-- If the first and/or the last point is a constraint
-- point, the value of the tangency or curvature is
-- computed in the resolution.
-- NbPol is the number of control points wanted
-- for the approximating curves.
-- The system to solve is the following:
-- A X = B.
-- Where A is the Bernstein matrix computed with the
-- parameters, B the points coordinates and X the poles
-- solutions.
-- The matrix A is the same for each coordinate x, y and z
-- and is also the same for each MultiLine point because
-- they are approximated in parallel(so with the same
-- parameter, only the vector B changes).
returns LeastSquare from AppParCurves
raises DimensionError from Standard;
Create(SSP: MultiLine; FirstPoint, LastPoint: Integer;
FirstCons, LastCons: Constraint; NbPol: Integer)
---Purpose: Initializes the fields of the object.
returns LeastSquare;
Create(SSP: MultiLine; Knots: Array1OfReal; Mults: Array1OfInteger;
FirstPoint, LastPoint: Integer;
FirstCons, LastCons: Constraint;
Parameters: Vector from math; NbPol: Integer)
---Purpose: given a MultiLine, this algorithm computes the least
-- square resolution using the Householder-QR method.
-- If the first and/or the last point is a constraint
-- point, the value of the tangency or curvature is
-- computed in the resolution.
-- Deg is the degree wanted for the approximating curves.
-- The system to solve is the following:
-- A X = B.
-- Where A is the BSpline functions matrix computed with
-- <parameters>, B the points coordinates and X the poles
-- solutions.
-- The matrix A is the same for each coordinate x, y and z
-- and is also the same for each MultiLine point because
-- they are approximated in parallel(so with the same
-- parameter, only the vector B changes).
returns LeastSquare from AppParCurves
raises DimensionError from Standard;
Create(SSP: MultiLine; Knots: Array1OfReal; Mults: Array1OfInteger;
FirstPoint, LastPoint: Integer;
FirstCons, LastCons: Constraint; NbPol: Integer)
---Purpose: Initializes the fields of the object.
returns LeastSquare;
Init(me: in out; SSP: MultiLine; FirstPoint, LastPoint: Integer)
---Purpose: is used by the constuctors above.
is static protected;
Perform(me: in out; Parameters: Vector)
---Purpose: Is used after having initialized the fields.
-- The case "CurvaturePoint" is not treated in this method.
is static;
Perform(me: in out; Parameters: Vector;
l1, l2: Real)
---Purpose: Is used after having initialized the fields.
is static;
----------------------------------------------------------------------
-- for the two following methods, vectors <V> must be constructed
-- as follow:
-- V(v1x, v1y, v1z, ....., vnx, vny, vnz, v1x, v1y, ....., vmx, vmy)
-- 3d curve 3d curve 2d curve 2d curve
--
-- the length of V must be Nb3dpoints*3 + Nb2dpoints*2
Perform(me: in out; Parameters: Vector;
V1t, V2t: Vector;
l1, l2: Real)
---Purpose: Is used after having initialized the fields.
--- <V1t> is the tangent vector at the first point.
--- <V2t> is the tangent vector at the last point.
is static;
Perform(me: in out; Parameters: Vector;
V1t, V2t, V1c, V2c: Vector;
l1, l2: Real)
---Purpose: Is used after having initialized the fields.
--- <V1t> is the tangent vector at the first point.
--- <V2t> is the tangent vector at the last point.
--- <V1c> is the tangent vector at the first point.
--- <V2c> is the tangent vector at the last point.
is static;
-------------------------------
--- Result methods:
-------------------------------
IsDone(me)
---Purpose: returns True if all has been correctly done.
returns Boolean
is static;
BezierValue(me: in out)
---Purpose: returns the result of the approximation, i.e. all the
-- Curves.
-- An exception is raised if NotDone.
returns MultiCurve from AppParCurves
raises NotDone from StdFail,
NoSuchObject from Standard
is static;
BSplineValue(me: in out)
---Purpose: returns the result of the approximation, i.e. all the
-- Curves.
-- An exception is raised if NotDone.
---C++: return const &
returns MultiBSpCurve from AppParCurves
raises NotDone from StdFail,
NoSuchObject from Standard
is static;
FunctionMatrix(me)
---Purpose: returns the function matrix used to approximate the
-- set.
---C++: return const &
returns Matrix from math
raises NotDone from StdFail
is static;
DerivativeFunctionMatrix(me)
---Purpose: returns the derivative function matrix used
-- to approximate the set.
---C++: return const &
returns Matrix from math
raises NotDone from StdFail
is static;
ErrorGradient(me: in out; Grad: in out Vector;
F: in out Real; MaxE3d, MaxE2d: in out Real)
---Purpose: returns the maximum errors between the MultiLine
-- and the approximation curves. F is the sum of the square
-- distances. Grad is the derivative vector of the
-- function F.
is static;
Distance(me: in out)
---Purpose: returns the distances between the points of the
-- multiline and the approximation curves.
---C++: return const&
returns Matrix from math
is static;
Error(me: in out; F: in out Real;
MaxE3d, MaxE2d: in out Real)
---Purpose: returns the maximum errors between the MultiLine
-- and the approximation curves. F is the sum of the square
-- distances.
is static;
FirstLambda(me)
---Purpose: returns the value (P2 - P1)/ V1 if the first point
-- was a tangency point.
returns Real
is static;
LastLambda(me)
---Purpose: returns the value (PN - PN-1)/ VN if the last point
-- was a tangency point.
returns Real
is static;
Points(me)
---Purpose: returns the matrix of points value.
---C++: return const&
returns Matrix
is static;
Poles(me)
---Purpose: returns the matrix of resulting control points value.
---C++: return const&
returns Matrix
is static;
KIndex(me)
---Purpose: Returns the indexes of the first non null values of
-- A and DA.
-- The values are non null from Index(ieme point) +1
-- to Index(ieme point) + degree +1.
---C++: return const&
returns IntegerVector
is static;
-------------------------------
--- internal methods:
-------------------------------
NbBColumns(me; SSP: MultiLine)
---Purpose: returns the number of second member columns.
-- Is used internally to initialize the fields.
returns Integer
is static protected;
TheFirstPoint(me; FirstCons: Constraint; FirstPoint: Integer)
---Purpose: returns the first point beeing fitted.
returns Integer
is static protected;
TheLastPoint(me; LastCons: Constraint; LastPoint: Integer)
---Purpose: returns the last point beeing fitted.
returns Integer
is static protected;
Affect(me: in out; SSP: MultiLine; Index: Integer;
Cons: in out Constraint; Vt, Vc: in out Vector)
---Purpose: Affects the fields in the case of a constraint point.
is static protected;
ComputeFunction(me: in out; Parameters: Vector)
---Purpose:
is static protected;
SearchIndex(me: in out; Index: in out IntegerVector)
is static protected;
MakeTAA(me: in out; TheA, TheB: in out Vector)
---Purpose: computes internal matrixes for the resolution
is static protected;
MakeTAA(me: in out; TheA: in out Vector)
---Purpose: computes internal matrixes for the resolution
is static protected;
MakeTAA(me: in out; TheA: in out Vector; TheB: in out Matrix)
---Purpose: computes internal matrixes for the resolution
is static protected;
fields
FirstConstraint : Constraint from AppParCurves;
LastConstraint : Constraint from AppParCurves;
SCU: MultiBSpCurve from AppParCurves;
myknots: HArray1OfReal from TColStd;
mymults: HArray1OfInteger from TColStd;
mypoles: Matrix from math;
A: Matrix from math;
DA: Matrix from math;
B2: Matrix from math;
mypoints: Matrix from math;
Vflatknots: Vector from math;
Vec1t: Vector from math;
Vec1c: Vector from math;
Vec2t: Vector from math;
Vec2c: Vector from math;
theError: Matrix from math;
myindex: IntegerVector from math;
lambda1: Real;
lambda2: Real;
FirstP: Integer;
LastP: Integer;
Nlignes: Integer;
Ninc: Integer;
NA: Integer;
myfirstp: Integer;
mylastp: Integer;
resinit: Integer;
resfin: Integer;
nbP2d: Integer;
nbP: Integer;
nbpoles: Integer;
deg: Integer;
done: Boolean;
iscalculated : Boolean;
isready : Boolean;
end LeastSquare;

View File

@@ -1,215 +0,0 @@
-- Created on: 1993-09-20
-- Created by: Modelistation
-- Copyright (c) 1993-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.
class MultiBSpCurve from AppParCurves
inherits MultiCurve from AppParCurves
---Purpose: This class describes a MultiBSpCurve approximating a Multiline.
-- Just as a Multiline is a set of a given number of lines, a MultiBSpCurve is a set
-- of a specified number of bsplines defined by:
-- - A specified number of MultiPoints - the poles of a specified number of curves
-- - The degree of approximation identical for each of the specified number of curves.
--
--
-- Example of a MultiBSpCurve composed of a specified number of MultiPoints:
--
-- P1______P2_____P3______P4________........_____PNbMPoints
--
-- Q1______Q2_____Q3______Q4________........_____QNbMPoints
-- . .
-- . .
-- . .
-- R1______R2_____R3______R4________........_____RNbMPoints
--
--
-- Pi, Qi, ..., Ri are points of dimension 2 or 3.
--
-- (Pi, Qi, ...Ri), i= 1,...NbPoles are MultiPoints.
-- each MultiPoint has got NbPol Poles.
-- MultiBSpCurves are created by the SplineValue method in the ComputeLine
-- class, and by the Value method in TheVariational class. MultiBSpCurve
-- provides the information required to create the BSpline defined by the approximation.
uses MultiPoint from AppParCurves,
HArray1OfMultiPoint from AppParCurves,
Array1OfMultiPoint from AppParCurves,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
Array1OfReal from TColStd,
Array1OfInteger from TColStd,
HArray1OfReal from TColStd,
HArray1OfInteger from TColStd,
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
OStream from Standard
raises OutOfRange from Standard,
DimensionError from Standard,
ConstructionError from Standard
is
Create returns MultiBSpCurve;
---Purpose: returns an indefinite MultiBSpCurve.
Create(NbPol: Integer)
---Purpose: creates a MultiBSpCurve, describing BSpline curves all
-- containing the same number of MultiPoint.
-- An exception is raised if Degree < 0.
returns MultiBSpCurve from AppParCurves
raises OutOfRange from Standard;
Create(tabMU: Array1OfMultiPoint; Knots: Array1OfReal;
Mults: Array1OfInteger)
---Purpose: creates a MultiBSpCurve, describing BSpline curves all
-- containing the same number of MultiPoint.
-- Each MultiPoint must have NbCurves Poles.
returns MultiBSpCurve from AppParCurves
raises ConstructionError from Standard;
Create(SC: MultiCurve; Knots: Array1OfReal;
Mults: Array1OfInteger)
---Purpose: creates a MultiBSpCurve, describing BSpline
-- curves, taking control points from <SC>.
returns MultiBSpCurve from AppParCurves
raises ConstructionError from Standard;
SetKnots(me: in out; theKnots: Array1OfReal)
---Purpose: Knots of the multiBSpCurve are assigned to <theknots>.
is static;
SetMultiplicities(me: in out; theMults: Array1OfInteger)
---Purpose: Multiplicities of the multiBSpCurve are assigned
-- to <theMults>.
is static;
Knots(me)
---Purpose: Returns an array of Reals containing
-- the multiplicities of curves resulting from the approximation.
---C++: return const&
returns Array1OfReal
is static;
Multiplicities(me)
---Purpose: Returns an array of Reals containing the
-- multiplicities of curves resulting from the approximation.
---C++: return const&
returns Array1OfInteger
is static;
Degree(me)
---Purpose: returns the degree of the curve(s).
returns Integer
is redefined;
Value(me; CuIndex: Integer; U: Real; Pt: out Pnt)
---Purpose: returns the value of the point with a parameter U
-- on the BSpline curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 2d.
raises OutOfRange from Standard,
DimensionError from Standard
is redefined;
Value(me; CuIndex: Integer; U: Real; Pt: out Pnt2d)
---Purpose: returns the value of the point with a parameter U
-- on the BSpline curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 3d.
raises OutOfRange from Standard,
DimensionError from Standard
is redefined;
D1(me; CuIndex: Integer; U: Real; Pt: out Pnt; V1: out Vec)
---Purpose: returns the value of the point with a parameter U
-- on the BSpline curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 3d.
raises OutOfRange from Standard,
DimensionError from Standard
is redefined;
D1(me; CuIndex: Integer; U: Real; Pt: out Pnt2d; V1: out Vec2d)
---Purpose: returns the value of the point with a parameter U
-- on the BSpline curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 2d.
raises OutOfRange from Standard,
DimensionError from Standard
is redefined;
D2(me; CuIndex: Integer; U: Real; Pt: out Pnt; V1: out Vec; V2: out Vec)
---Purpose: returns the value of the point with a parameter U
-- on the BSpline curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 3d.
raises OutOfRange from Standard,
DimensionError from Standard
is redefined;
D2(me; CuIndex: Integer; U: Real; Pt: out Pnt2d;
V1: out Vec2d; V2: out Vec2d)
---Purpose: returns the value of the point with a parameter U
-- on the BSpline curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 2d.
raises OutOfRange from Standard,
DimensionError from Standard
is redefined;
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
myknots: HArray1OfReal;
mymults: HArray1OfInteger;
myDegree : Integer;
end MultiBSpCurve;

View File

@@ -12,18 +12,25 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AppParCurves_MultiBSpCurve.ixx>
#include <AppParCurves_HArray1OfMultiPoint.hxx>
#include <AppParCurves_MultiBSpCurve.hxx>
#include <AppParCurves_MultiCurve.hxx>
#include <BSplCLib.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_OutOfRange.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Standard_OutOfRange.hxx>
#include <AppParCurves_HArray1OfMultiPoint.hxx>
#include <BSplCLib.hxx>
//=======================================================================
//function : ComputeDegree
//purpose :
//=======================================================================
static Standard_Integer ComputeDegree(const TColStd_Array1OfInteger& mults,
const Standard_Integer nbPoles)
{

View File

@@ -0,0 +1,175 @@
// Created on: 1993-09-20
// Created by: Modelistation
// Copyright (c) 1993-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.
#ifndef _AppParCurves_MultiBSpCurve_HeaderFile
#define _AppParCurves_MultiBSpCurve_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <Standard_Integer.hxx>
#include <AppParCurves_MultiCurve.hxx>
#include <AppParCurves_Array1OfMultiPoint.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
class Standard_OutOfRange;
class Standard_DimensionError;
class Standard_ConstructionError;
class AppParCurves_MultiCurve;
class gp_Pnt;
class gp_Pnt2d;
class gp_Vec;
class gp_Vec2d;
//! This class describes a MultiBSpCurve approximating a Multiline.
//! Just as a Multiline is a set of a given number of lines, a MultiBSpCurve is a set
//! of a specified number of bsplines defined by:
//! - A specified number of MultiPoints - the poles of a specified number of curves
//! - The degree of approximation identical for each of the specified number of curves.
//!
//! Example of a MultiBSpCurve composed of a specified number of MultiPoints:
//!
//! P1______P2_____P3______P4________........_____PNbMPoints
//!
//! Q1______Q2_____Q3______Q4________........_____QNbMPoints
//! . .
//! . .
//! . .
//! R1______R2_____R3______R4________........_____RNbMPoints
//!
//! Pi, Qi, ..., Ri are points of dimension 2 or 3.
//!
//! (Pi, Qi, ...Ri), i= 1,...NbPoles are MultiPoints.
//! each MultiPoint has got NbPol Poles.
//! MultiBSpCurves are created by the SplineValue method in the ComputeLine
//! class, and by the Value method in TheVariational class. MultiBSpCurve
//! provides the information required to create the BSpline defined by the approximation.
class AppParCurves_MultiBSpCurve : public AppParCurves_MultiCurve
{
public:
DEFINE_STANDARD_ALLOC
//! returns an indefinite MultiBSpCurve.
Standard_EXPORT AppParCurves_MultiBSpCurve();
//! creates a MultiBSpCurve, describing BSpline curves all
//! containing the same number of MultiPoint.
//! An exception is raised if Degree < 0.
Standard_EXPORT AppParCurves_MultiBSpCurve(const Standard_Integer NbPol);
//! creates a MultiBSpCurve, describing BSpline curves all
//! containing the same number of MultiPoint.
//! Each MultiPoint must have NbCurves Poles.
Standard_EXPORT AppParCurves_MultiBSpCurve(const AppParCurves_Array1OfMultiPoint& tabMU, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults);
//! creates a MultiBSpCurve, describing BSpline
//! curves, taking control points from <SC>.
Standard_EXPORT AppParCurves_MultiBSpCurve(const AppParCurves_MultiCurve& SC, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults);
//! Knots of the multiBSpCurve are assigned to <theknots>.
Standard_EXPORT void SetKnots (const TColStd_Array1OfReal& theKnots);
//! Multiplicities of the multiBSpCurve are assigned
//! to <theMults>.
Standard_EXPORT void SetMultiplicities (const TColStd_Array1OfInteger& theMults);
//! Returns an array of Reals containing
//! the multiplicities of curves resulting from the approximation.
Standard_EXPORT const TColStd_Array1OfReal& Knots() const;
//! Returns an array of Reals containing the
//! multiplicities of curves resulting from the approximation.
Standard_EXPORT const TColStd_Array1OfInteger& Multiplicities() const;
//! returns the degree of the curve(s).
Standard_EXPORT virtual Standard_Integer Degree() const Standard_OVERRIDE;
//! returns the value of the point with a parameter U
//! on the BSpline curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 2d.
Standard_EXPORT virtual void Value (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt) const Standard_OVERRIDE;
//! returns the value of the point with a parameter U
//! on the BSpline curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 3d.
Standard_EXPORT virtual void Value (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt) const Standard_OVERRIDE;
//! returns the value of the point with a parameter U
//! on the BSpline curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 3d.
Standard_EXPORT virtual void D1 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt, gp_Vec& V1) const Standard_OVERRIDE;
//! returns the value of the point with a parameter U
//! on the BSpline curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 2d.
Standard_EXPORT virtual void D1 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt, gp_Vec2d& V1) const Standard_OVERRIDE;
//! returns the value of the point with a parameter U
//! on the BSpline curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 3d.
Standard_EXPORT virtual void D2 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
//! returns the value of the point with a parameter U
//! on the BSpline curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 2d.
Standard_EXPORT virtual void D2 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE;
//! Prints on the stream o information on the current
//! state of the object.
//! Is used to redefine the operator <<.
Standard_EXPORT virtual void Dump (Standard_OStream& o) const Standard_OVERRIDE;
protected:
private:
Handle(TColStd_HArray1OfReal) myknots;
Handle(TColStd_HArray1OfInteger) mymults;
Standard_Integer myDegree;
};
#endif // _AppParCurves_MultiBSpCurve_HeaderFile

View File

@@ -1,286 +0,0 @@
-- Created on: 1991-12-02
-- Created by: Laurent PAINNOT
-- Copyright (c) 1991-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.
class MultiCurve from AppParCurves
---Purpose: This class describes a MultiCurve approximating a Multiline.
-- As a Multiline is a set of n lines, a MultiCurve is a set
-- of n curves. These curves are Bezier curves.
-- A MultiCurve is composed of m MultiPoint.
-- The approximating degree of these n curves is the same for
-- each one.
--
--
-- Example of a MultiCurve composed of MultiPoints:
--
-- P1______P2_____P3______P4________........_____PNbMPoints
--
-- Q1______Q2_____Q3______Q4________........_____QNbMPoints
-- . .
-- . .
-- . .
-- R1______R2_____R3______R4________........_____RNbMPoints
--
--
-- Pi, Qi, ..., Ri are points of dimension 2 or 3.
--
-- (Pi, Qi, ...Ri), i= 1,...NbPoles are MultiPoints.
-- each MultiPoint has got NbPol Poles.
uses MultiPoint from AppParCurves,
HArray1OfMultiPoint from AppParCurves,
Array1OfMultiPoint from AppParCurves,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
OStream from Standard
raises OutOfRange from Standard,
DimensionError from Standard,
ConstructionError from Standard
is
Create returns MultiCurve;
---Purpose: returns an indefinite MultiCurve.
Create(NbPol: Integer)
---Purpose: creates a MultiCurve, describing Bezier curves all
-- containing the same number of MultiPoint.
-- An exception is raised if Degree < 0.
returns MultiCurve from AppParCurves
raises OutOfRange from Standard;
Create(tabMU: Array1OfMultiPoint)
---Purpose: creates a MultiCurve, describing Bezier curves all
-- containing the same number of MultiPoint.
-- Each MultiPoint must have NbCurves Poles.
returns MultiCurve from AppParCurves
raises ConstructionError from Standard;
---C++: alias " Standard_EXPORT virtual ~AppParCurves_MultiCurve();"
SetNbPoles(me: in out; nbPoles: Integer)
---Purpose: The number of poles of the MultiCurve
-- will be set to <nbPoles>.
is static;
SetValue(me: in out; Index: Integer;
MPoint: MultiPoint from AppParCurves)
---Purpose: sets the MultiPoint of range Index to the value
-- <MPoint>.
-- An exception is raised if Index <0 or Index >NbMPoint.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
NbCurves(me)
---Purpose: Returns the number of curves resulting from the
-- approximation of a MultiLine.
returns Integer
is static;
NbPoles(me)
---Purpose: Returns the number of poles on curves resulting from the approximation of a MultiLine.
returns Integer
is virtual;
Degree(me)
---Purpose: returns the degree of the curves.
returns Integer
is virtual;
Dimension(me; CuIndex: Integer)
---Purpose: returns the dimension of the CuIndex curve.
-- An exception is raised if CuIndex<0 or CuIndex>NbCurves.
returns Integer
raises OutOfRange from Standard
is static;
Curve(me; CuIndex: Integer; TabPnt: in out Array1OfPnt)
---Purpose: returns the Pole array of the curve of range CuIndex.
-- An exception is raised if the dimension of the curve
-- is 2d.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
Curve(me; CuIndex: Integer; TabPnt: in out Array1OfPnt2d)
---Purpose: returns the Pole array of the curve of range CuIndex.
-- An exception is raised if the dimension of the curve
-- is 3d.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
Value(me; Index: Integer)
---Purpose: returns the Index MultiPoint.
-- An exception is raised if Index <0 or Index >Degree+1.
---C++: return const&
returns MultiPoint from AppParCurves
raises OutOfRange from Standard
is static;
Pole(me; CuIndex, Nieme: Integer)
---Purpose: returns the Nieme pole of the CuIndex curve.
-- the curve must be a 3D curve.
---C++: return const&
returns Pnt from gp
raises OutOfRange from Standard
is static;
Pole2d(me; CuIndex, Nieme: Integer)
---Purpose: returns the Nieme pole of the CuIndex curve.
-- the curve must be a 2D curve.
---C++: return const&
returns Pnt2d from gp
raises OutOfRange from Standard
is static;
Transform(me: in out; CuIndex: Integer; x, dx, y, dy, z, dz: Real)
---Purpose: Applies a transformation to the curve of range
-- <CuIndex>.
-- newx = x + dx*oldx
-- newy = y + dy*oldy for all points of the curve.
-- newz = z + dz*oldz
raises OutOfRange from Standard
is static;
Transform2d(me: in out; CuIndex: Integer; x, dx, y, dy: Real)
---Purpose: Applies a transformation to the Curve of range
-- <CuIndex>.
-- newx = x + dx*oldx
-- newy = y + dy*oldy for all points of the curve.
raises OutOfRange from Standard
is static;
Value(me; CuIndex: Integer; U: Real; Pt: out Pnt)
---Purpose: returns the value of the point with a parameter U
-- on the Bezier curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 2d.
raises OutOfRange from Standard,
DimensionError from Standard
is virtual;
Value(me; CuIndex: Integer; U: Real; Pt: out Pnt2d)
---Purpose: returns the value of the point with a parameter U
-- on the Bezier curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 3d.
raises OutOfRange from Standard,
DimensionError from Standard
is virtual;
D1(me; CuIndex: Integer; U: Real; Pt: out Pnt; V1: out Vec)
---Purpose: returns the value of the point with a parameter U
-- on the Bezier curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 3d.
raises OutOfRange from Standard,
DimensionError from Standard
is virtual;
D1(me; CuIndex: Integer; U: Real; Pt: out Pnt2d; V1: out Vec2d)
---Purpose: returns the value of the point with a parameter U
-- on the Bezier curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 2d.
raises OutOfRange from Standard,
DimensionError from Standard
is virtual;
D2(me; CuIndex: Integer; U: Real; Pt: out Pnt; V1: out Vec; V2: out Vec)
---Purpose: returns the value of the point with a parameter U
-- on the Bezier curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 3d.
raises OutOfRange from Standard,
DimensionError from Standard
is virtual;
D2(me; CuIndex: Integer; U: Real; Pt: out Pnt2d;
V1: out Vec2d; V2: out Vec2d)
---Purpose: returns the value of the point with a parameter U
-- on the Bezier curve number CuIndex.
-- An exception is raised if CuIndex <0 or > NbCurves.
-- An exception is raised if the curve dimension is 2d.
raises OutOfRange from Standard,
DimensionError from Standard
is virtual;
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 virtual;
fields
tabPoint: HArray1OfMultiPoint from AppParCurves is protected;
end MultiCurve;

View File

@@ -12,13 +12,20 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AppParCurves_MultiCurve.ixx>
#include <AppParCurves_MultiCurve.hxx>
#include <AppParCurves_MultiPoint.hxx>
#include <BSplCLib.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <PLib.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_OutOfRange.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Standard_OutOfRange.hxx>
#include <BSplCLib.hxx>
#include <PLib.hxx>
AppParCurves_MultiCurve::AppParCurves_MultiCurve() {}

View File

@@ -0,0 +1,206 @@
// Created on: 1991-12-02
// Created by: Laurent PAINNOT
// Copyright (c) 1991-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.
#ifndef _AppParCurves_MultiCurve_HeaderFile
#define _AppParCurves_MultiCurve_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <AppParCurves_HArray1OfMultiPoint.hxx>
#include <Standard_Integer.hxx>
#include <AppParCurves_Array1OfMultiPoint.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
class Standard_OutOfRange;
class Standard_DimensionError;
class Standard_ConstructionError;
class AppParCurves_MultiPoint;
class gp_Pnt;
class gp_Pnt2d;
class gp_Vec;
class gp_Vec2d;
//! This class describes a MultiCurve approximating a Multiline.
//! As a Multiline is a set of n lines, a MultiCurve is a set
//! of n curves. These curves are Bezier curves.
//! A MultiCurve is composed of m MultiPoint.
//! The approximating degree of these n curves is the same for
//! each one.
//!
//! Example of a MultiCurve composed of MultiPoints:
//!
//! P1______P2_____P3______P4________........_____PNbMPoints
//!
//! Q1______Q2_____Q3______Q4________........_____QNbMPoints
//! . .
//! . .
//! . .
//! R1______R2_____R3______R4________........_____RNbMPoints
//!
//! Pi, Qi, ..., Ri are points of dimension 2 or 3.
//!
//! (Pi, Qi, ...Ri), i= 1,...NbPoles are MultiPoints.
//! each MultiPoint has got NbPol Poles.
class AppParCurves_MultiCurve
{
public:
DEFINE_STANDARD_ALLOC
//! returns an indefinite MultiCurve.
Standard_EXPORT AppParCurves_MultiCurve();
//! creates a MultiCurve, describing Bezier curves all
//! containing the same number of MultiPoint.
//! An exception is raised if Degree < 0.
Standard_EXPORT AppParCurves_MultiCurve(const Standard_Integer NbPol);
//! creates a MultiCurve, describing Bezier curves all
//! containing the same number of MultiPoint.
//! Each MultiPoint must have NbCurves Poles.
Standard_EXPORT AppParCurves_MultiCurve(const AppParCurves_Array1OfMultiPoint& tabMU);
Standard_EXPORT virtual ~AppParCurves_MultiCurve();
//! The number of poles of the MultiCurve
//! will be set to <nbPoles>.
Standard_EXPORT void SetNbPoles (const Standard_Integer nbPoles);
//! sets the MultiPoint of range Index to the value
//! <MPoint>.
//! An exception is raised if Index <0 or Index >NbMPoint.
Standard_EXPORT void SetValue (const Standard_Integer Index, const AppParCurves_MultiPoint& MPoint);
//! Returns the number of curves resulting from the
//! approximation of a MultiLine.
Standard_EXPORT Standard_Integer NbCurves() const;
//! Returns the number of poles on curves resulting from the approximation of a MultiLine.
Standard_EXPORT virtual Standard_Integer NbPoles() const;
//! returns the degree of the curves.
Standard_EXPORT virtual Standard_Integer Degree() const;
//! returns the dimension of the CuIndex curve.
//! An exception is raised if CuIndex<0 or CuIndex>NbCurves.
Standard_EXPORT Standard_Integer Dimension (const Standard_Integer CuIndex) const;
//! returns the Pole array of the curve of range CuIndex.
//! An exception is raised if the dimension of the curve
//! is 2d.
Standard_EXPORT void Curve (const Standard_Integer CuIndex, TColgp_Array1OfPnt& TabPnt) const;
//! returns the Pole array of the curve of range CuIndex.
//! An exception is raised if the dimension of the curve
//! is 3d.
Standard_EXPORT void Curve (const Standard_Integer CuIndex, TColgp_Array1OfPnt2d& TabPnt) const;
//! returns the Index MultiPoint.
//! An exception is raised if Index <0 or Index >Degree+1.
Standard_EXPORT const AppParCurves_MultiPoint& Value (const Standard_Integer Index) const;
//! returns the Nieme pole of the CuIndex curve.
//! the curve must be a 3D curve.
Standard_EXPORT const gp_Pnt& Pole (const Standard_Integer CuIndex, const Standard_Integer Nieme) const;
//! returns the Nieme pole of the CuIndex curve.
//! the curve must be a 2D curve.
Standard_EXPORT const gp_Pnt2d& Pole2d (const Standard_Integer CuIndex, const Standard_Integer Nieme) const;
//! Applies a transformation to the curve of range
//! <CuIndex>.
//! newx = x + dx*oldx
//! newy = y + dy*oldy for all points of the curve.
//! newz = z + dz*oldz
Standard_EXPORT void Transform (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy, const Standard_Real z, const Standard_Real dz);
//! Applies a transformation to the Curve of range
//! <CuIndex>.
//! newx = x + dx*oldx
//! newy = y + dy*oldy for all points of the curve.
Standard_EXPORT void Transform2d (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy);
//! returns the value of the point with a parameter U
//! on the Bezier curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 2d.
Standard_EXPORT virtual void Value (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt) const;
//! returns the value of the point with a parameter U
//! on the Bezier curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 3d.
Standard_EXPORT virtual void Value (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt) const;
//! returns the value of the point with a parameter U
//! on the Bezier curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 3d.
Standard_EXPORT virtual void D1 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt, gp_Vec& V1) const;
//! returns the value of the point with a parameter U
//! on the Bezier curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 2d.
Standard_EXPORT virtual void D1 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt, gp_Vec2d& V1) const;
//! returns the value of the point with a parameter U
//! on the Bezier curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 3d.
Standard_EXPORT virtual void D2 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt, gp_Vec& V1, gp_Vec& V2) const;
//! returns the value of the point with a parameter U
//! on the Bezier curve number CuIndex.
//! An exception is raised if CuIndex <0 or > NbCurves.
//! An exception is raised if the curve dimension is 2d.
Standard_EXPORT virtual void D2 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt, gp_Vec2d& V1, gp_Vec2d& V2) const;
//! Prints on the stream o information on the current
//! state of the object.
//! Is used to redefine the operator <<.
Standard_EXPORT virtual void Dump (Standard_OStream& o) const;
protected:
Handle(AppParCurves_HArray1OfMultiPoint) tabPoint;
private:
};
#endif // _AppParCurves_MultiCurve_HeaderFile

View File

@@ -1,185 +0,0 @@
-- Created on: 1991-12-02
-- Created by: Laurent PAINNOT
-- Copyright (c) 1991-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.
class MultiPoint from AppParCurves
---Purpose: This class describes Points composing a MultiPoint.
-- These points can be 2D or 3D. The user must first give the
-- 3D Points and then the 2D Points.
-- They are Poles of a Bezier Curve.
-- This class is used either to define data input or
-- results when performing the approximation of several lines in parallel.
uses Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
HArray1OfPnt from TColgp,
HArray1OfPnt2d from TColgp,
OStream from Standard,
TShared from MMgt
raises OutOfRange from Standard,
DimensionError from Standard
is
Create returns MultiPoint;
---Purpose: creates an indefinite MultiPoint.
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.
-- NbPoints is the number of 3D Points.
-- NbPoints2d is the number of 2D Points.
returns MultiPoint from AppParCurves;
Create(tabP: Array1OfPnt)
---Purpose: creates a MultiPoint only composed of 3D points.
returns MultiPoint from AppParCurves;
Create(tabP2d: Array1OfPnt2d)
---Purpose: creates a MultiPoint only composed of 2D points.
returns MultiPoint from AppParCurves;
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.
-- NbPoints is the total number of Points.
returns MultiPoint from AppParCurves;
---C++: alias " Standard_EXPORT virtual ~AppParCurves_MultiPoint();"
SetPoint(me: in out; Index: Integer; Point: Pnt)
---Purpose: the 3d Point of range Index of this MultiPoint is
-- set to <Point>.
-- An exception is raised if Index < 0 or
-- Index > number of 3d Points.
raises OutOfRange from Standard
is static;
Point(me; Index: Integer)
---Purpose: returns the 3d Point of range Index.
-- An exception is raised if Index < 0 or
-- Index < number of 3d Points.
---C++: return const&
returns Pnt from gp
raises OutOfRange from Standard
is static;
SetPoint2d(me: in out; Index: Integer; Point: Pnt2d)
---Purpose: The 2d Point of range Index is set to <Point>.
-- An exception is raised if Index > 3d Points or
-- Index > total number of Points.
raises OutOfRange from Standard,
DimensionError from Standard
is static;
Point2d(me; Index: Integer)
---Purpose: returns the 2d Point of range Index.
-- An exception is raised if index <= number of
-- 3d Points or Index > total number of Points.
---C++: return const&
returns Pnt2d from gp
raises OutOfRange from Standard
is static;
Dimension(me; Index: Integer)
---Purpose: returns the dimension of the point of range Index.
-- An exception is raised if Index <0 or Index > NbCurves.
---C++: inline
returns Integer
raises OutOfRange from Standard
is static;
NbPoints(me)
---Purpose: returns the number of points of dimension 3D.
---C++: inline
returns Integer
is static;
NbPoints2d(me)
---Purpose: returns the number of points of dimension 2D.
---C++: inline
returns Integer
is static;
Transform(me: in out; CuIndex: Integer; x, dx, y, dy, z, dz: Real)
---Purpose: Applies a transformation to the curve of range
-- <CuIndex>.
-- newx = x + dx*oldx
-- newy = y + dy*oldy for all points of the curve.
-- newz = z + dz*oldz
raises OutOfRange from Standard
is static;
Transform2d(me: in out; CuIndex: Integer; x, dx, y, dy: Real)
---Purpose: Applies a transformation to the Curve of range
-- <CuIndex>.
-- newx = x + dx*oldx
-- newy = y + dy*oldy for all points of the curve.
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 virtual;
fields
ttabPoint : TShared from MMgt is protected;
ttabPoint2d: TShared from MMgt is protected;
nbP : Integer is protected;
nbP2d : Integer is protected;
end MultiPoint;

View File

@@ -12,12 +12,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AppParCurves_MultiPoint.ixx>
#include <AppParCurves_MultiPoint.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_OutOfRange.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TColgp_HArray1OfPnt2d.hxx>
#include <Standard_OutOfRange.hxx>
#define tabPoint Handle(TColgp_HArray1OfPnt)::DownCast (ttabPoint)
#define tabPoint2d Handle(TColgp_HArray1OfPnt2d)::DownCast (ttabPoint2d)

View File

@@ -0,0 +1,151 @@
// Created on: 1991-12-02
// Created by: Laurent PAINNOT
// Copyright (c) 1991-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.
#ifndef _AppParCurves_MultiPoint_HeaderFile
#define _AppParCurves_MultiPoint_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
class MMgt_TShared;
class Standard_OutOfRange;
class Standard_DimensionError;
class gp_Pnt;
class gp_Pnt2d;
//! This class describes Points composing a MultiPoint.
//! These points can be 2D or 3D. The user must first give the
//! 3D Points and then the 2D Points.
//! They are Poles of a Bezier Curve.
//! This class is used either to define data input or
//! results when performing the approximation of several lines in parallel.
class AppParCurves_MultiPoint
{
public:
DEFINE_STANDARD_ALLOC
//! creates an indefinite MultiPoint.
Standard_EXPORT AppParCurves_MultiPoint();
//! 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.
//! NbPoints is the number of 3D Points.
//! NbPoints2d is the number of 2D Points.
Standard_EXPORT AppParCurves_MultiPoint(const Standard_Integer NbPoints, const Standard_Integer NbPoints2d);
//! creates a MultiPoint only composed of 3D points.
Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt& tabP);
//! creates a MultiPoint only composed of 2D points.
Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt2d& tabP2d);
//! 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.
//! NbPoints is the total number of Points.
Standard_EXPORT AppParCurves_MultiPoint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfPnt2d& tabP2d);
Standard_EXPORT virtual ~AppParCurves_MultiPoint();
//! the 3d Point of range Index of this MultiPoint is
//! set to <Point>.
//! An exception is raised if Index < 0 or
//! Index > number of 3d Points.
Standard_EXPORT void SetPoint (const Standard_Integer Index, const gp_Pnt& Point);
//! returns the 3d Point of range Index.
//! An exception is raised if Index < 0 or
//! Index < number of 3d Points.
Standard_EXPORT const gp_Pnt& Point (const Standard_Integer Index) const;
//! The 2d Point of range Index is set to <Point>.
//! An exception is raised if Index > 3d Points or
//! Index > total number of Points.
Standard_EXPORT void SetPoint2d (const Standard_Integer Index, const gp_Pnt2d& Point);
//! returns the 2d Point of range Index.
//! An exception is raised if index <= number of
//! 3d Points or Index > total number of Points.
Standard_EXPORT const gp_Pnt2d& Point2d (const Standard_Integer Index) const;
//! returns the dimension of the point of range Index.
//! An exception is raised if Index <0 or Index > NbCurves.
Standard_Integer Dimension (const Standard_Integer Index) const;
//! returns the number of points of dimension 3D.
Standard_Integer NbPoints() const;
//! returns the number of points of dimension 2D.
Standard_Integer NbPoints2d() const;
//! Applies a transformation to the curve of range
//! <CuIndex>.
//! newx = x + dx*oldx
//! newy = y + dy*oldy for all points of the curve.
//! newz = z + dz*oldz
Standard_EXPORT void Transform (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy, const Standard_Real z, const Standard_Real dz);
//! Applies a transformation to the Curve of range
//! <CuIndex>.
//! newx = x + dx*oldx
//! newy = y + dy*oldy for all points of the curve.
Standard_EXPORT void Transform2d (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy);
//! Prints on the stream o information on the current
//! state of the object.
//! Is used to redefine the operator <<.
Standard_EXPORT virtual void Dump (Standard_OStream& o) const;
protected:
Handle(MMgt_TShared) ttabPoint;
Handle(MMgt_TShared) ttabPoint2d;
Standard_Integer nbP;
Standard_Integer nbP2d;
private:
};
#include <AppParCurves_MultiPoint.lxx>
#endif // _AppParCurves_MultiPoint_HeaderFile

View File

@@ -1,140 +0,0 @@
-- Created on: 1991-07-25
-- Created by: Laurent PAINNOT
-- Copyright (c) 1991-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 ResolConstraint from AppParCurves
(MultiLine as any;
ToolLine as any) -- as ToolLine(MultiLine)
---Purpose: This classe describes the algorithm to find the approximate
-- solution of a MultiLine with constraints. The resolution
-- algorithm is the Uzawa method. See the math package
-- for more information.
-- All the tangencies of MultiPointConstraint's points
-- will be colinear.
-- Be careful of the curvature: it is possible to have some
-- curvAature points only for one curve. In this case, the Uzawa
-- method is used with a non-linear resolution, much more longer.
uses Matrix from math,
Vector from math,
Array1OfInteger from TColStd,
MultiCurve from AppParCurves,
HArray1OfConstraintCouple from AppParCurves
raises OutOfRange from Standard
is
Create(SSP: MultiLine; SCurv: in out MultiCurve;
FirstPoint, LastPoint: Integer;
Constraints: HArray1OfConstraintCouple;
Bern, DerivativeBern: Matrix; Tolerance: Real = 1.0e-10)
---Purpose: Given a MultiLine SSP with constraints points, this
-- algorithm finds the best curve solution to approximate it.
-- The poles from SCurv issued for example from the least
-- squares are used as a guess solution for the uzawa
-- algorithm. The tolerance used in the Uzawa algorithms
-- is Tolerance.
-- A is the Bernstein matrix associated to the MultiLine
-- and DA is the derivative bernstein matrix.(They can come
-- from an approximation with ParLeastSquare.)
-- The MultiCurve is modified. New MultiPoles are given.
returns ResolConstraint from AppParCurves;
IsDone(me)
---Purpose: returns True if all has been correctly done.
returns Boolean
is static;
Error(me)
---Purpose: returns the maximum difference value between the curve
-- and the given points.
returns Real
is static;
ConstraintMatrix(me)
---Purpose:
---C++: return const&
returns Matrix
is static;
Duale(me)
---Purpose: returns the duale variables of the system.
---C++: return const&
returns Vector
is static;
ConstraintDerivative(me: in out; SSP: MultiLine; Parameters: Vector;
Deg: Integer; DA: Matrix)
---Purpose: Returns the derivative of the constraint matrix.
---C++: return const&
returns Matrix
is static;
InverseMatrix(me)
---Purpose: returns the Inverse of Cont*Transposed(Cont), where
-- Cont is the constraint matrix for the algorithm.
---C++: return const&
returns Matrix
is static;
NbConstraints(me; SSP: MultiLine; FirstPoint, LastPoint: Integer;
TheConstraints: HArray1OfConstraintCouple)
---Purpose: is used internally to create the fields.
returns Integer
is static protected;
NbColumns(me; SSP: MultiLine; Deg: Integer)
---Purpose: is internally used for the fields creation.
returns Integer
is static protected;
fields
Done: Boolean;
Err: Real;
Cont: Matrix;
DeCont: Matrix;
Secont: Vector;
CTCinv: Matrix;
Vardua: Vector;
IncPass: Integer;
IncTan: Integer;
IncCurv: Integer;
IPas: Array1OfInteger;
ITan: Array1OfInteger;
ICurv: Array1OfInteger;
end ResolConstraint;

View File

@@ -1,10 +1,30 @@
AppParCurves.cxx
AppParCurves.hxx
AppParCurves_Array1OfConstraintCouple.hxx
AppParCurves_HArray1OfConstraintCouple.hxx
AppParCurves_Array1OfMultiPoint.hxx
AppParCurves_HArray1OfMultiPoint.hxx
AppParCurves_Array1OfMultiCurve.hxx
AppParCurves_HArray1OfMultiCurve.hxx
AppParCurves_SequenceOfMultiCurve.hxx
AppParCurves_Array1OfMultiBSpCurve.hxx
AppParCurves_Array1OfMultiCurve.hxx
AppParCurves_Array1OfMultiPoint.hxx
AppParCurves_BSpFunction.gxx
AppParCurves_BSpGradient.gxx
AppParCurves_BSpGradient_BFGS.gxx
AppParCurves_Constraint.hxx
AppParCurves_ConstraintCouple.cxx
AppParCurves_ConstraintCouple.hxx
AppParCurves_Function.gxx
AppParCurves_Gradient.gxx
AppParCurves_Gradient_BFGS.gxx
AppParCurves_HArray1OfConstraintCouple.hxx
AppParCurves_HArray1OfMultiBSpCurve.hxx
AppParCurves_HArray1OfMultiCurve.hxx
AppParCurves_HArray1OfMultiPoint.hxx
AppParCurves_LeastSquare.gxx
AppParCurves_MultiBSpCurve.cxx
AppParCurves_MultiBSpCurve.hxx
AppParCurves_MultiCurve.cxx
AppParCurves_MultiCurve.hxx
AppParCurves_MultiPoint.cxx
AppParCurves_MultiPoint.hxx
AppParCurves_MultiPoint.lxx
AppParCurves_ResolConstraint.gxx
AppParCurves_SequenceOfMultiBSpCurve.hxx
AppParCurves_SequenceOfMultiCurve.hxx