mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
88
src/BlendFunc/BlendFunc.cdl
Executable file
88
src/BlendFunc/BlendFunc.cdl
Executable file
@@ -0,0 +1,88 @@
|
||||
-- File: BlendFunc.cdl
|
||||
-- Created: Fri Dec 3 15:43:52 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
-- <jag@topsn2>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
package BlendFunc
|
||||
|
||||
---Purpose: This package provides a set of generic functions, that can
|
||||
-- instantiated to compute blendings between two surfaces
|
||||
-- (Constant radius, Evolutive radius, Ruled surface).
|
||||
|
||||
|
||||
uses Blend, Adaptor2d, Adaptor3d, math, gp, Convert, TColgp, TColStd, GeomAbs, Law
|
||||
|
||||
is
|
||||
|
||||
class ConstRad;
|
||||
|
||||
class ConstRadInv;
|
||||
|
||||
class Ruled;
|
||||
|
||||
class RuledInv;
|
||||
|
||||
class EvolRad;
|
||||
|
||||
class EvolRadInv;
|
||||
|
||||
class CSConstRad;
|
||||
|
||||
class CSCircular;
|
||||
|
||||
class Corde;
|
||||
|
||||
class Chamfer;
|
||||
|
||||
class ChamfInv;
|
||||
|
||||
class ChAsym;
|
||||
|
||||
class ChAsymInv;
|
||||
|
||||
class Tensor;
|
||||
|
||||
enumeration SectionShape is
|
||||
Rational, -- default in algoritmes
|
||||
QuasiAngular,
|
||||
Polynomial,
|
||||
Linear -- for chamfers ??
|
||||
end SectionShape;
|
||||
|
||||
|
||||
GetShape(SectShape: SectionShape from BlendFunc;
|
||||
MaxAng: Real from Standard;
|
||||
NbPoles,NbKnots,Degree : out Integer from Standard;
|
||||
TypeConv : out ParameterisationType from Convert);
|
||||
|
||||
Knots(SectShape: SectionShape from BlendFunc;
|
||||
TKnots: out Array1OfReal from TColStd);
|
||||
|
||||
Mults(SectShape: SectionShape from BlendFunc;
|
||||
TMults: out Array1OfInteger from TColStd);
|
||||
|
||||
GetMinimalWeights(SectShape: SectionShape from BlendFunc;
|
||||
TConv : ParameterisationType from Convert;
|
||||
AngleMin : Real;
|
||||
AngleMax : Real;
|
||||
Weigths : out Array1OfReal from TColStd);
|
||||
|
||||
NextShape(S : Shape from GeomAbs)
|
||||
---Purpose: Used to obtain the next level of continuity.
|
||||
---Level: Internal
|
||||
returns Shape from GeomAbs;
|
||||
|
||||
ComputeNormal(Surf : HSurface from Adaptor3d;
|
||||
p2d : Pnt2d from gp;
|
||||
Normal : out Vec from gp)
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeDNormal(Surf : HSurface from Adaptor3d;
|
||||
p2d : Pnt2d from gp;
|
||||
Normal, DNu, DNv : out Vec from gp)
|
||||
returns Boolean from Standard;
|
||||
|
||||
end BlendFunc;
|
242
src/BlendFunc/BlendFunc.cxx
Executable file
242
src/BlendFunc/BlendFunc.cxx
Executable file
@@ -0,0 +1,242 @@
|
||||
// File: BlendFunc.cxx
|
||||
// Created: Wed Oct 4 11:35:28 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1995
|
||||
|
||||
// 09/09/1996 PMN Ajout des methodes GetCircle et GetTolerance.
|
||||
// 30/12/1996 PMN Ajout de GetMinimalWeight
|
||||
// 23/09/1997 PMN Supprimme GetCircle et GetTol (passe dans GeomFill)
|
||||
|
||||
#include <BlendFunc.ixx>
|
||||
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <TColgp_Array2OfVec.hxx>
|
||||
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <CSLib.hxx>
|
||||
#include <CSLib_NormalStatus.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc::GetShape (const BlendFunc_SectionShape SShape,
|
||||
const Standard_Real MaxAng,
|
||||
Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots,
|
||||
Standard_Integer& Degree,
|
||||
Convert_ParameterisationType& TConv)
|
||||
{
|
||||
switch (SShape) {
|
||||
case BlendFunc_Rational:
|
||||
{
|
||||
Standard_Integer NbSpan =
|
||||
(Standard_Integer)(Ceiling(3.*Abs(MaxAng)/2./PI));
|
||||
NbPoles = 2*NbSpan+1;
|
||||
NbKnots = NbSpan+1;
|
||||
Degree = 2;
|
||||
if (NbSpan == 1) {
|
||||
TConv = Convert_TgtThetaOver2_1;
|
||||
}
|
||||
else { // QuasiAngular affin d'etre C1 (et meme beaucoup plus)
|
||||
NbPoles = 7 ;
|
||||
NbKnots = 2 ;
|
||||
Degree = 6 ;
|
||||
TConv = Convert_QuasiAngular;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BlendFunc_QuasiAngular:
|
||||
{
|
||||
NbPoles = 7 ;
|
||||
NbKnots = 2 ;
|
||||
Degree = 6 ;
|
||||
TConv = Convert_QuasiAngular;
|
||||
}
|
||||
break;
|
||||
case BlendFunc_Polynomial:
|
||||
{
|
||||
NbPoles = 8;
|
||||
NbKnots = 2;
|
||||
Degree = 7;
|
||||
TConv = Convert_Polynomial;
|
||||
}
|
||||
break;
|
||||
case BlendFunc_Linear:
|
||||
{
|
||||
NbPoles = 2;
|
||||
NbKnots = 2;
|
||||
Degree = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalWeights
|
||||
//purpose : On suppose les extremum de poids sont obtenus pour les
|
||||
// extremums d'angles (A verifier eventuelement pour Quasi-Angular)
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc::GetMinimalWeights(const BlendFunc_SectionShape SShape,
|
||||
const Convert_ParameterisationType TConv,
|
||||
const Standard_Real MinAng,
|
||||
const Standard_Real MaxAng,
|
||||
TColStd_Array1OfReal& Weights)
|
||||
|
||||
{
|
||||
switch (SShape) {
|
||||
case BlendFunc_Polynomial:
|
||||
case BlendFunc_Linear:
|
||||
{
|
||||
Weights.Init(1);
|
||||
}
|
||||
break;
|
||||
case BlendFunc_Rational:
|
||||
case BlendFunc_QuasiAngular:
|
||||
{
|
||||
gp_Ax2 popAx2(gp_Pnt(0, 0, 0), gp_Dir(0,0,1));
|
||||
gp_Circ C (popAx2, 1);
|
||||
Handle(Geom_TrimmedCurve) Sect1 =
|
||||
new Geom_TrimmedCurve(new Geom_Circle(C), 0., MaxAng);
|
||||
Handle(Geom_BSplineCurve) CtoBspl =
|
||||
GeomConvert::CurveToBSplineCurve(Sect1, TConv);
|
||||
CtoBspl->Weights(Weights);
|
||||
|
||||
TColStd_Array1OfReal poids (Weights.Lower(), Weights.Upper());
|
||||
Standard_Real angle_min = Max(Precision::PConfusion(), MinAng);
|
||||
|
||||
Handle(Geom_TrimmedCurve) Sect2 =
|
||||
new Geom_TrimmedCurve(new Geom_Circle(C), 0., angle_min);
|
||||
CtoBspl = GeomConvert::CurveToBSplineCurve(Sect2, TConv);
|
||||
CtoBspl->Weights(poids);
|
||||
|
||||
for (Standard_Integer ii=Weights.Lower(); ii<=Weights.Upper(); ii++) {
|
||||
if (poids(ii) < Weights(ii)) {
|
||||
Weights(ii) = poids(ii);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IncrementeShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_Shape BlendFunc::NextShape (const GeomAbs_Shape S)
|
||||
{
|
||||
switch (S)
|
||||
{
|
||||
case GeomAbs_C0 : return GeomAbs_C1;
|
||||
case GeomAbs_C1 : return GeomAbs_C2;
|
||||
case GeomAbs_C2 : return GeomAbs_C3;
|
||||
default : break;
|
||||
}
|
||||
return GeomAbs_CN;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeNormal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc::ComputeNormal (const Handle(Adaptor3d_HSurface)& Surf,
|
||||
const gp_Pnt2d& p2d, gp_Vec& Normal)
|
||||
{
|
||||
const Standard_Integer MaxOrder=3;
|
||||
const Standard_Real U = p2d.X();
|
||||
const Standard_Real V = p2d.Y();
|
||||
|
||||
Standard_Integer i,j;
|
||||
|
||||
TColgp_Array2OfVec DerSurf(0,MaxOrder+1,0,MaxOrder+1);
|
||||
for(i=1;i<=MaxOrder+1;i++)
|
||||
DerSurf.SetValue(i,0,Surf->DN(U,V,i,0));
|
||||
for(i=0;i<=MaxOrder+1;i++)
|
||||
for(j=1;j<=MaxOrder+1;j++)
|
||||
DerSurf.SetValue(i,j,Surf->DN(U,V,i,j));
|
||||
|
||||
TColgp_Array2OfVec DerNUV(0,MaxOrder,0,MaxOrder);
|
||||
for(i=0;i<=MaxOrder;i++)
|
||||
for(j=0;j<=MaxOrder;j++)
|
||||
DerNUV.SetValue(i,j,CSLib::DNNUV(i,j,DerSurf));
|
||||
|
||||
gp_Dir thenormal;
|
||||
CSLib_NormalStatus stat;
|
||||
Standard_Integer OrderU,OrderV;
|
||||
const Standard_Real Umin = Surf->FirstUParameter();
|
||||
const Standard_Real Umax = Surf->LastUParameter();
|
||||
const Standard_Real Vmin = Surf->FirstVParameter();
|
||||
const Standard_Real Vmax = Surf->LastVParameter(); //szv: was FirstVParameter!
|
||||
CSLib::Normal(MaxOrder,DerNUV,Standard_Real(1.e-9),U,V,Umin,Umax,Vmin,Vmax,
|
||||
stat,thenormal,OrderU,OrderV);
|
||||
if (stat == CSLib_Defined)
|
||||
{
|
||||
Normal.SetXYZ(thenormal.XYZ());
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeDNormal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc::ComputeDNormal (const Handle(Adaptor3d_HSurface)& Surf,
|
||||
const gp_Pnt2d& p2d, gp_Vec& Normal,
|
||||
gp_Vec& DNu, gp_Vec& DNv)
|
||||
{
|
||||
const Standard_Integer MaxOrder=3;
|
||||
const Standard_Real U = p2d.X();
|
||||
const Standard_Real V = p2d.Y();
|
||||
|
||||
Standard_Integer i,j;
|
||||
|
||||
TColgp_Array2OfVec DerSurf(0,MaxOrder+1,0,MaxOrder+1);
|
||||
for(i=1;i<=MaxOrder+1;i++)
|
||||
DerSurf.SetValue(i,0,Surf->DN(U,V,i,0));
|
||||
for(i=0;i<=MaxOrder+1;i++)
|
||||
for(j=1;j<=MaxOrder+1;j++)
|
||||
DerSurf.SetValue(i,j,Surf->DN(U,V,i,j));
|
||||
|
||||
TColgp_Array2OfVec DerNUV(0,MaxOrder,0,MaxOrder);
|
||||
for(i=0;i<=MaxOrder;i++)
|
||||
for(j=0;j<=MaxOrder;j++)
|
||||
DerNUV.SetValue(i,j,CSLib::DNNUV(i,j,DerSurf));
|
||||
|
||||
gp_Dir thenormal;
|
||||
CSLib_NormalStatus stat;
|
||||
Standard_Integer OrderU,OrderV;
|
||||
const Standard_Real Umin = Surf->FirstUParameter();
|
||||
const Standard_Real Umax = Surf->LastUParameter();
|
||||
const Standard_Real Vmin = Surf->FirstVParameter();
|
||||
const Standard_Real Vmax = Surf->LastVParameter(); //szv: was FirstVParameter!
|
||||
CSLib::Normal(MaxOrder,DerNUV,Standard_Real(1.e-9),U,V,Umin,Umax,Vmin,Vmax,
|
||||
stat,thenormal,OrderU,OrderV);
|
||||
if (stat == CSLib_Defined)
|
||||
{
|
||||
Normal.SetXYZ(thenormal.XYZ());
|
||||
DNu = CSLib::DNNormal(1, 0, DerNUV, OrderU, OrderV);
|
||||
DNv = CSLib::DNNormal(0, 1, DerNUV, OrderU, OrderV);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
343
src/BlendFunc/BlendFunc_CSCircular.cdl
Executable file
343
src/BlendFunc/BlendFunc_CSCircular.cdl
Executable file
@@ -0,0 +1,343 @@
|
||||
-- File: BlendFunc_CSCircular.cdl
|
||||
-- Created: Wed Jan 4 10:32:38 1995
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
class CSCircular from BlendFunc
|
||||
|
||||
inherits CSFunction from Blend
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Ax1 from gp,
|
||||
Vec from gp,
|
||||
Vec2d from gp,
|
||||
Pnt from gp,
|
||||
Pnt2d from gp,
|
||||
Circ from gp,
|
||||
Array1OfPnt from TColgp,
|
||||
Array1OfVec from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfVec2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Shape from GeomAbs,
|
||||
Point from Blend,
|
||||
SectionShape from BlendFunc,
|
||||
ParameterisationType from Convert,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d,
|
||||
Function from Law
|
||||
|
||||
is
|
||||
|
||||
Create(S: HSurface from Adaptor3d; C: HCurve from Adaptor3d; CGuide: HCurve from Adaptor3d;
|
||||
L: Function from Law)
|
||||
|
||||
---Purpose: Creates a function for a circular blending between
|
||||
-- a curve <C> and a surface <S>. The direction of
|
||||
-- the planes are given by <CGuide>. The position of
|
||||
-- the plane is determined on the curve <C>. <L>
|
||||
-- defines the change of parameter between <C> and
|
||||
-- <CGuide>. So, the planes are defined as described
|
||||
-- below :
|
||||
-- t is the current parameter on the guide line.
|
||||
-- Pguide = C(L(t)); Nguide = CGuide'(t)/||CGuide'(t)||
|
||||
|
||||
returns CSCircular from BlendFunc;
|
||||
|
||||
|
||||
NbVariables(me)
|
||||
|
||||
returns Integer from Standard
|
||||
is redefined;
|
||||
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function (3).
|
||||
returns Integer from Standard;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Set(me: in out; Param: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
Set(me: in out; First, Last: Real from Standard)
|
||||
;
|
||||
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
PointOnS(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
PointOnC(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
Pnt2d(me)
|
||||
|
||||
---Purpose: Returns U,V coordinates of the point on the surface.
|
||||
|
||||
returns Pnt2d from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
ParameterOnC(me)
|
||||
|
||||
---Purpose: Returns parameter of the point on the curve.
|
||||
|
||||
returns Real from Standard
|
||||
;
|
||||
|
||||
|
||||
IsTangencyPoint(me)
|
||||
|
||||
returns Boolean from Standard
|
||||
;
|
||||
|
||||
TangentOnS(me)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
Tangent2d(me)
|
||||
|
||||
returns Vec2d from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
TangentOnC(me)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
Tangent(me; U,V: Real from Standard;
|
||||
TgS,NormS: out Vec from gp);
|
||||
|
||||
---Purpose: Returns the tangent vector at the section,
|
||||
-- at the beginning and the end of the section, and
|
||||
-- returns the normal (of the surface) at
|
||||
-- these points.
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out; Radius : Real from Standard;
|
||||
Choix: Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Set(me: in out; TypeSection: SectionShape from BlendFunc)
|
||||
---Purpose: Sets the type of section generation for the
|
||||
-- approximations.
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
Section(me: in out; Param: Real from Standard;
|
||||
U,V,W: Real from Standard;
|
||||
Pdeb,Pfin: out Real from Standard;
|
||||
C: out Circ from gp)
|
||||
|
||||
is static;
|
||||
|
||||
Section(me: in out; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
D2Poles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
D2Poles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd;
|
||||
D2Weigths : out Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: Used for the first and last section
|
||||
-- The method returns Standard_True if the derivatives
|
||||
-- are computed, otherwise it returns Standard_False.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is redefined;
|
||||
|
||||
|
||||
GetSection(me: in out; Param: Real from Standard;
|
||||
U,V,W: Real from Standard;
|
||||
tabP : out Array1OfPnt from TColgp;
|
||||
tabV : out Array1OfVec from TColgp)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
--- Pour les approximations
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
---Purpose: Returns if the section is rationnal
|
||||
is static;
|
||||
|
||||
GetSectionSize(me) returns Real
|
||||
---Purpose: Returns the length of the maximum section
|
||||
is static;
|
||||
|
||||
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the minimal value of weight for each poles
|
||||
-- of all sections.
|
||||
is static;
|
||||
|
||||
NbIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: Returns the number of intervals for continuity
|
||||
-- <S>. May be one if Continuity(me) >= <S>
|
||||
is static;
|
||||
|
||||
Intervals(me; T : in out Array1OfReal from TColStd;
|
||||
S : Shape from GeomAbs)
|
||||
---Purpose: Stores in <T> the parameters bounding the intervals
|
||||
-- of continuity <S>.
|
||||
--
|
||||
-- The array must provide enough room to accomodate
|
||||
-- for the parameters. i.e. T.Length() > NbIntervals()
|
||||
-- raises
|
||||
-- OutOfRange from Standard
|
||||
is static;
|
||||
|
||||
GetShape(me: in out;
|
||||
NbPoles : out Integer from Standard;
|
||||
NbKnots : out Integer from Standard;
|
||||
Degree : out Integer from Standard;
|
||||
NbPoles2d : out Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
GetTolerance(me;
|
||||
BoundTol, SurfTol, AngleTol : Real;
|
||||
Tol3d : out Vector;
|
||||
Tol1D : out Vector )
|
||||
---Purpose: Returns the tolerance to reach in approximation
|
||||
-- to respecte
|
||||
-- BoundTol error at the Boundary
|
||||
-- AngleTol tangent error at the Boundary
|
||||
-- SurfTol error inside the surface.
|
||||
is static;
|
||||
|
||||
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: Used for the first and last section
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd)
|
||||
|
||||
|
||||
is static;
|
||||
|
||||
Resolution(me;
|
||||
IC2d : Integer from Standard;
|
||||
Tol : Real from Standard;
|
||||
TolU, TolV : out Real from Standard);
|
||||
|
||||
fields
|
||||
surf : HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
guide : HCurve from Adaptor3d;
|
||||
law : Function from Law;
|
||||
|
||||
pts : Pnt from gp;
|
||||
ptc : Pnt from gp;
|
||||
pt2d : Pnt2d from gp;
|
||||
prmc : Real from Standard;
|
||||
dprmc : Real from Standard;
|
||||
istangent: Boolean from Standard;
|
||||
tgs : Vec from gp;
|
||||
tg2d : Vec2d from gp;
|
||||
tgc : Vec from gp;
|
||||
|
||||
ray : Real from Standard;
|
||||
choix : Integer from Standard;
|
||||
d1gui : Vec from gp;
|
||||
d2gui : Vec from gp;
|
||||
nplan : Vec from gp;
|
||||
normtg : Real from Standard;
|
||||
|
||||
maxang : Real from Standard;
|
||||
minang : Real from Standard;
|
||||
mySShape : SectionShape from BlendFunc;
|
||||
myTConv : ParameterisationType from Convert;
|
||||
|
||||
end CSCircular;
|
1050
src/BlendFunc/BlendFunc_CSCircular.cxx
Executable file
1050
src/BlendFunc/BlendFunc_CSCircular.cxx
Executable file
File diff suppressed because it is too large
Load Diff
323
src/BlendFunc/BlendFunc_CSConstRad.cdl
Executable file
323
src/BlendFunc/BlendFunc_CSConstRad.cdl
Executable file
@@ -0,0 +1,323 @@
|
||||
-- File: BlendFunc_CSConstRad.cdl
|
||||
-- Created: Thu Dec 2 10:18:55 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class CSConstRad from BlendFunc
|
||||
|
||||
inherits CSFunction from Blend
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Ax1 from gp,
|
||||
Vec from gp,
|
||||
Vec2d from gp,
|
||||
Pnt from gp,
|
||||
Pnt2d from gp,
|
||||
Circ from gp,
|
||||
Array1OfPnt from TColgp,
|
||||
Array1OfVec from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfVec2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Shape from GeomAbs,
|
||||
Point from Blend,
|
||||
SectionShape from BlendFunc,
|
||||
ParameterisationType from Convert,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d
|
||||
|
||||
is
|
||||
|
||||
Create(S: HSurface from Adaptor3d; C: HCurve from Adaptor3d; CGuide: HCurve from Adaptor3d)
|
||||
|
||||
returns CSConstRad from BlendFunc;
|
||||
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function (3).
|
||||
returns Integer from Standard;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Set(me: in out; Param: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
Set(me: in out; First, Last: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
PointOnS(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
PointOnC(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
Pnt2d(me)
|
||||
|
||||
---Purpose: Returns U,V coordinates of the point on the surface.
|
||||
|
||||
returns Pnt2d from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
ParameterOnC(me)
|
||||
|
||||
---Purpose: Returns parameter of the point on the curve.
|
||||
|
||||
returns Real from Standard
|
||||
;
|
||||
|
||||
|
||||
IsTangencyPoint(me)
|
||||
|
||||
returns Boolean from Standard
|
||||
;
|
||||
|
||||
TangentOnS(me)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
Tangent2d(me)
|
||||
|
||||
returns Vec2d from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
TangentOnC(me)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
Tangent(me; U,V: Real from Standard;
|
||||
TgS,NormS: out Vec from gp);
|
||||
|
||||
---Purpose: Returns the tangent vector at the section,
|
||||
-- at the beginning and the end of the section, and
|
||||
-- returns the normal (of the surface) at
|
||||
-- these points.
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out; Radius: Real from Standard; Choix: Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Set(me: in out; TypeSection: SectionShape from BlendFunc)
|
||||
---Purpose: Sets the type of section generation for the
|
||||
-- approximations.
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
Section(me: in out; Param: Real from Standard;
|
||||
U,V,W: Real from Standard;
|
||||
Pdeb,Pfin: out Real from Standard;
|
||||
C: out Circ from gp)
|
||||
|
||||
is static;
|
||||
|
||||
Section(me: in out; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
D2Poles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
D2Poles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd;
|
||||
D2Weigths : out Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: Used for the first and last section
|
||||
-- The method returns Standard_True if the derivatives
|
||||
-- are computed, otherwise it returns Standard_False.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is redefined;
|
||||
|
||||
GetSection(me: in out; Param: Real from Standard;
|
||||
U,V,W: Real from Standard;
|
||||
tabP : out Array1OfPnt from TColgp;
|
||||
tabV : out Array1OfVec from TColgp)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
--- Pour les approximations
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
---Purpose: Returns if the section is rationnal
|
||||
is static;
|
||||
|
||||
GetSectionSize(me) returns Real
|
||||
---Purpose: Returns the length of the maximum section
|
||||
is static;
|
||||
|
||||
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the minimal value of weight for each poles
|
||||
-- of all sections.
|
||||
is static;
|
||||
|
||||
NbIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: Returns the number of intervals for continuity
|
||||
-- <S>. May be one if Continuity(me) >= <S>
|
||||
is static;
|
||||
|
||||
Intervals(me; T : in out Array1OfReal from TColStd;
|
||||
S : Shape from GeomAbs)
|
||||
---Purpose: Stores in <T> the parameters bounding the intervals
|
||||
-- of continuity <S>.
|
||||
-- The array must provide enough room to accomodate
|
||||
-- for the parameters. i.e. T.Length() > NbIntervals()
|
||||
-- raises
|
||||
-- OutOfRange from Standard
|
||||
is static;
|
||||
|
||||
GetShape(me: in out;
|
||||
NbPoles : out Integer from Standard;
|
||||
NbKnots : out Integer from Standard;
|
||||
Degree : out Integer from Standard;
|
||||
NbPoles2d : out Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
GetTolerance(me;
|
||||
BoundTol, SurfTol, AngleTol : Real;
|
||||
Tol3d : out Vector;
|
||||
Tol1D : out Vector )
|
||||
---Purpose: Returns the tolerance to reach in approximation
|
||||
-- to respecte
|
||||
-- BoundTol error at the Boundary
|
||||
-- AngleTol tangent error at the Boundary
|
||||
-- SurfTol error inside the surface.
|
||||
is static;
|
||||
|
||||
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: Used for the first and last section
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd)
|
||||
|
||||
|
||||
is static;
|
||||
|
||||
Resolution(me;
|
||||
IC2d : Integer from Standard;
|
||||
Tol : Real from Standard;
|
||||
TolU, TolV : out Real from Standard);
|
||||
|
||||
|
||||
fields
|
||||
|
||||
surf : HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
guide : HCurve from Adaptor3d;
|
||||
pts : Pnt from gp;
|
||||
ptc : Pnt from gp;
|
||||
pt2d : Pnt2d from gp;
|
||||
prmc : Real from Standard;
|
||||
istangent: Boolean from Standard;
|
||||
tgs : Vec from gp;
|
||||
tg2d : Vec2d from gp;
|
||||
tgc : Vec from gp;
|
||||
|
||||
ray : Real from Standard;
|
||||
choix : Integer from Standard;
|
||||
ptgui : Pnt from gp;
|
||||
d1gui : Vec from gp;
|
||||
d2gui : Vec from gp;
|
||||
nplan : Vec from gp;
|
||||
normtg : Real from Standard;
|
||||
theD : Real from Standard;
|
||||
|
||||
maxang : Real from Standard;
|
||||
minang : Real from Standard;
|
||||
mySShape : SectionShape from BlendFunc;
|
||||
myTConv : ParameterisationType from Convert;
|
||||
|
||||
end CSConstRad;
|
1021
src/BlendFunc/BlendFunc_CSConstRad.cxx
Executable file
1021
src/BlendFunc/BlendFunc_CSConstRad.cxx
Executable file
File diff suppressed because it is too large
Load Diff
270
src/BlendFunc/BlendFunc_ChAsym.cdl
Executable file
270
src/BlendFunc/BlendFunc_ChAsym.cdl
Executable file
@@ -0,0 +1,270 @@
|
||||
-- File: BlendFunc_ChAsym.cdl
|
||||
-- Created: Tue Jun 2 10:48:31 1998
|
||||
-- Author: Philippe NOUAILLE
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class ChAsym from BlendFunc
|
||||
|
||||
inherits Function from Blend
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Tensor from BlendFunc,
|
||||
Vec from gp,
|
||||
Vec2d from gp,
|
||||
Pnt from gp,
|
||||
Lin from gp,
|
||||
Array1OfPnt from TColgp,
|
||||
Array1OfVec from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfVec2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Point from Blend,
|
||||
Shape from GeomAbs,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d
|
||||
is
|
||||
|
||||
Create(S1, S2 : HSurface from Adaptor3d; C : HCurve from Adaptor3d)
|
||||
returns ChAsym from BlendFunc;
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static;
|
||||
|
||||
Set(me: in out; Param : Real from Standard);
|
||||
|
||||
Set(me: in out; First, Last : Real from Standard);
|
||||
|
||||
GetTolerance(me; Tolerance : out Vector from math; Tol : Real from Standard);
|
||||
|
||||
GetBounds(me; InfBound,SupBound : out Vector from math);
|
||||
|
||||
IsSolution(me: in out; Sol : Vector from math; Tol : Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetMinimalDistance(me)
|
||||
---Purpose: Returns the minimal Distance beetween two
|
||||
-- extremitys of calculed sections.
|
||||
returns Real from Standard;
|
||||
|
||||
ComputeValues(me : in out;
|
||||
X : Vector from math;
|
||||
DegF : Integer from Standard;
|
||||
DegL : Integer from Standard)
|
||||
---Purpose: computes the values <F> of the derivatives for the
|
||||
-- variable <X> between DegF and DegL.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
Value(me: in out; X : Vector; F : out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static;
|
||||
|
||||
Derivatives(me: in out; X : Vector; D : out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
Values(me: in out; X : Vector; F : out Vector; D : out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static;
|
||||
|
||||
|
||||
PointOnS1(me) returns Pnt from gp;
|
||||
---C++: return const&
|
||||
|
||||
PointOnS2(me) returns Pnt from gp;
|
||||
---C++: return const&
|
||||
|
||||
IsTangencyPoint(me) returns Boolean from Standard;
|
||||
|
||||
TangentOnS1(me) returns Vec from gp;
|
||||
---C++: return const&
|
||||
|
||||
Tangent2dOnS1(me) returns Vec2d from gp;
|
||||
---C++: return const&
|
||||
|
||||
TangentOnS2(me) returns Vec from gp;
|
||||
---C++: return const&
|
||||
|
||||
Tangent2dOnS2(me) returns Vec2d from gp;
|
||||
---C++: return const&
|
||||
|
||||
TwistOnS1(me)
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
TwistOnS2(me)
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
Tangent(me; U1,V1,U2,V2: Real from Standard;
|
||||
TgFirst,TgLast,NormFirst,NormLast: out Vec from gp)
|
||||
|
||||
---Purpose: Returns the tangent vector at the section,
|
||||
-- at the beginning and the end of the section, and
|
||||
-- returns the normal (of the surfaces) at
|
||||
-- these points.
|
||||
|
||||
;
|
||||
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Section(me: in out; Param: Real from Standard;
|
||||
U1,V1,U2,V2: Real from Standard;
|
||||
Pdeb,Pfin: out Real from Standard;
|
||||
C: out Lin from gp)
|
||||
---Purpose: Utile pour une visu rapide et approximative de la surface.
|
||||
is static;
|
||||
|
||||
--- Pour les approximations
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
---Purpose: Returns if the section is rationnal
|
||||
is static;
|
||||
|
||||
GetSectionSize(me) returns Real
|
||||
---Purpose: Returns the length of the maximum section
|
||||
is static;
|
||||
|
||||
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the minimal value of weight for each poles
|
||||
-- of all sections.
|
||||
is static;
|
||||
|
||||
NbIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: Returns the number of intervals for continuity
|
||||
-- <S>. May be one if Continuity(me) >= <S>
|
||||
is static;
|
||||
|
||||
Intervals(me; T : in out Array1OfReal from TColStd;
|
||||
S : Shape from GeomAbs)
|
||||
---Purpose: Stores in <T> the parameters bounding the intervals
|
||||
-- of continuity <S>.
|
||||
--
|
||||
-- The array must provide enough room to accomodate
|
||||
-- for the parameters. i.e. T.Length() > NbIntervals()
|
||||
is static;
|
||||
|
||||
GetShape(me: in out;
|
||||
NbPoles : out Integer from Standard;
|
||||
NbKnots : out Integer from Standard;
|
||||
Degree : out Integer from Standard;
|
||||
NbPoles2d : out Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
GetTolerance(me;
|
||||
BoundTol, SurfTol, AngleTol : Real;
|
||||
Tol3d : out Vector;
|
||||
Tol1D : out Vector )
|
||||
---Purpose: Returns the tolerance to reach in approximation
|
||||
-- to respecte
|
||||
-- BoundTol error at the Boundary
|
||||
-- AngleTol tangent error at the Boundary
|
||||
-- SurfTol error inside the surface.
|
||||
is static;
|
||||
|
||||
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
|
||||
is static;
|
||||
|
||||
|
||||
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd)
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Used for the first and last section
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
D2Poles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
D2Poles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd;
|
||||
D2Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Used for the first and last section
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
|
||||
Resolution(me;
|
||||
IC2d : Integer from Standard;
|
||||
Tol : Real from Standard;
|
||||
TolU, TolV : out Real from Standard);
|
||||
|
||||
Set(me : in out;
|
||||
Dist1 : Real from Standard;
|
||||
Angle : Real from Standard;
|
||||
Choix : Integer from Standard)
|
||||
---Purpose: Sets the distances and the angle.
|
||||
is static;
|
||||
|
||||
fields
|
||||
surf1 : HSurface from Adaptor3d;
|
||||
surf2 : HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
tcurv : HCurve from Adaptor3d;
|
||||
|
||||
param : Real from Standard;
|
||||
dist1 : Real from Standard;
|
||||
angle : Real from Standard;
|
||||
tgang : Real from Standard;
|
||||
|
||||
nplan : Vec from gp;
|
||||
pt1 : Pnt from gp;
|
||||
tsurf1 : Vec from gp;
|
||||
pt2 : Pnt from gp;
|
||||
FX : Vector from math;
|
||||
DX : Matrix from math;
|
||||
|
||||
istangent: Boolean from Standard;
|
||||
tg1 : Vec from gp;
|
||||
tg12d : Vec2d from gp;
|
||||
tg2 : Vec from gp;
|
||||
tg22d : Vec2d from gp;
|
||||
|
||||
choix : Integer from Standard;
|
||||
distmin : Real from Standard;
|
||||
|
||||
|
||||
end ChAsym;
|
831
src/BlendFunc/BlendFunc_ChAsym.cxx
Executable file
831
src/BlendFunc/BlendFunc_ChAsym.cxx
Executable file
@@ -0,0 +1,831 @@
|
||||
// File: BlendFunc_ChAsym.cxx
|
||||
// Created: Tue Jun 2 13:13:21 1998
|
||||
// Author: Philippe NOUAILLE
|
||||
// Copyright: OPEN CASCADE 1998
|
||||
|
||||
#include <BlendFunc_ChAsym.ixx>
|
||||
|
||||
#include <math_Gauss.hxx>
|
||||
#include <math_SVD.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_ChAsym
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_ChAsym::BlendFunc_ChAsym(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C) :
|
||||
surf1(S1),surf2(S2),
|
||||
curv(C), tcurv(C),
|
||||
FX(1, 4),
|
||||
DX(1, 4, 1, 4),
|
||||
istangent(Standard_True),
|
||||
distmin(RealLast())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEquations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_ChAsym::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::Set(const Standard_Real Param)
|
||||
{
|
||||
param = Param;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose : Segmente la courbe a sa partie utile.
|
||||
// La precision est prise arbitrairement petite !?
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::Set(const Standard_Real First, const Standard_Real Last)
|
||||
{
|
||||
tcurv = curv->Trim(First, Last, 1.e-12);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = surf1->UResolution(Tol);
|
||||
Tolerance(2) = surf1->VResolution(Tol);
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = surf1->FirstUParameter();
|
||||
InfBound(2) = surf1->FirstVParameter();
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(1) = surf1->LastUParameter();
|
||||
SupBound(2) = surf1->LastVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
|
||||
for(Standard_Integer i = 1; i <= 4; i++){
|
||||
if(!Precision::IsInfinite(InfBound(i)) &&
|
||||
!Precision::IsInfinite(SupBound(i))) {
|
||||
const Standard_Real range = (SupBound(i) - InfBound(i));
|
||||
InfBound(i) -= range;
|
||||
SupBound(i) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::IsSolution(const math_Vector& Sol, const Standard_Real Tol)
|
||||
{
|
||||
math_Vector valsol(1, 4), secmember(1, 4);
|
||||
math_Matrix gradsol(1, 4, 1, 4);
|
||||
|
||||
gp_Pnt ptgui;
|
||||
gp_Vec np, dnp, d1gui, d2gui, Nsurf1, dwtsurf1;
|
||||
gp_Vec d1u1, d1v1, d1u2, d1v2;
|
||||
Standard_Real Normg;
|
||||
|
||||
tcurv->D2(param, ptgui, d1gui, d2gui);
|
||||
Normg = d1gui.Magnitude();
|
||||
np = d1gui.Normalized();
|
||||
dnp = (d2gui - np.Dot(d2gui) * np) / Normg;
|
||||
|
||||
if (choix%2 != 0) {
|
||||
np.Reverse();
|
||||
dnp.Reverse();
|
||||
Normg = -Normg;
|
||||
}
|
||||
|
||||
surf1->D1(Sol(1), Sol(2), pt1, d1u1, d1v1);
|
||||
Nsurf1 = d1u1.Crossed(d1v1);
|
||||
tsurf1 = Nsurf1.Crossed(np);
|
||||
dwtsurf1 = Nsurf1.Crossed(dnp);
|
||||
|
||||
surf2->D1(Sol(3), Sol(4), pt2, d1u2, d1v2);
|
||||
|
||||
gp_Vec pguis1(ptgui, pt1), pguis2(ptgui, pt2);
|
||||
gp_Vec CrossVec, s1s2(pt1, pt2);
|
||||
Standard_Real PScaInv = 1. / tsurf1.Dot(s1s2), F4, temp;
|
||||
Standard_Real maxpiv = 1.e-9;
|
||||
Standard_Real Nordu1 = d1u1.Magnitude(),
|
||||
Nordv1 = d1v1.Magnitude();
|
||||
|
||||
temp = 2. * (Nordu1 + Nordv1) * s1s2.Magnitude() + 2. * Nordu1 * Nordv1;
|
||||
|
||||
Values(Sol, valsol, gradsol);
|
||||
|
||||
if (Abs(valsol(1)) < Tol &&
|
||||
Abs(valsol(2)) < Tol &&
|
||||
Abs(valsol(3)) < 2. * dist1 * Tol &&
|
||||
Abs(valsol(4)) < Tol * (1. + tgang) * Abs(PScaInv) * temp) {
|
||||
|
||||
secmember(1) = Normg - dnp.Dot(pguis1);
|
||||
secmember(2) = Normg - dnp.Dot(pguis2);
|
||||
secmember(3) = - 2. * d1gui.Dot(pguis1);
|
||||
|
||||
CrossVec = tsurf1.Crossed(s1s2);
|
||||
F4 = np.Dot(CrossVec) * PScaInv;
|
||||
temp = dnp.Dot(CrossVec) + np.Dot(dwtsurf1.Crossed(s1s2));
|
||||
|
||||
temp -= F4 * dwtsurf1.Dot(s1s2);
|
||||
secmember(4) = PScaInv * temp;
|
||||
|
||||
math_Gauss Resol(gradsol, maxpiv);
|
||||
|
||||
if (Resol.IsDone()) {
|
||||
Resol.Solve(secmember);
|
||||
istangent = Standard_False;
|
||||
}
|
||||
else {
|
||||
math_SVD SingRS (gradsol);
|
||||
if (SingRS.IsDone()) {
|
||||
math_Vector DEDT(1,4);
|
||||
DEDT = secmember;
|
||||
SingRS.Solve(DEDT, secmember, 1.e-6);
|
||||
istangent = Standard_False;
|
||||
}
|
||||
else istangent = Standard_True;
|
||||
}
|
||||
|
||||
if (!istangent) {
|
||||
tg1.SetLinearForm(secmember(1), d1u1, secmember(2), d1v1);
|
||||
tg2.SetLinearForm(secmember(3), d1u2, secmember(4), d1v2);
|
||||
tg12d.SetCoord(secmember(1),secmember(2));
|
||||
tg22d.SetCoord(secmember(3),secmember(4));
|
||||
}
|
||||
|
||||
distmin = Min( distmin, pt1.Distance(pt2));
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
istangent = Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BlendFunc_ChAsym::GetMinimalDistance() const
|
||||
{
|
||||
return distmin;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeValues
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BlendFunc_ChAsym::ComputeValues(const math_Vector& X,
|
||||
const Standard_Integer DegF,
|
||||
const Standard_Integer DegL)
|
||||
{
|
||||
if (DegF > DegL) return Standard_False;
|
||||
|
||||
gp_Vec np, d1gui, d1u1, d1v1, d2u1, d2v1, d2uv1, d1u2, d1v2, Nsurf1;
|
||||
gp_Pnt ptgui;
|
||||
Standard_Real PScaInv, F4;
|
||||
|
||||
tcurv->D1(param, ptgui, d1gui);
|
||||
nplan = d1gui.Normalized();
|
||||
np = nplan;
|
||||
|
||||
if (choix%2 != 0) np.Reverse();
|
||||
|
||||
if ( (DegF == 0) && (DegL == 0) ) {
|
||||
surf1->D1(X(1), X(2), pt1, d1u1, d1v1);
|
||||
pt2 = surf2->Value(X(3), X(4));
|
||||
}
|
||||
else {
|
||||
surf1->D2(X(1), X(2), pt1, d1u1, d1v1, d2u1, d2v1, d2uv1);
|
||||
surf2->D1(X(3), X(4), pt2, d1u2, d1v2);
|
||||
}
|
||||
|
||||
Nsurf1 = d1u1.Crossed(d1v1);
|
||||
tsurf1 = Nsurf1.Crossed(np);
|
||||
|
||||
gp_Vec nps1(ptgui, pt1), s1s2(pt1, pt2);//, tempVec;
|
||||
PScaInv = 1. / tsurf1.Dot(s1s2);
|
||||
F4 = np.Dot(tsurf1.Crossed(s1s2)) * PScaInv;
|
||||
|
||||
if (DegF == 0) {
|
||||
Standard_Real Dist;
|
||||
Dist = ptgui.XYZ().Dot(np.XYZ());
|
||||
|
||||
FX(1) = pt1.XYZ().Dot(np.XYZ()) - Dist;
|
||||
FX(2) = pt2.XYZ().Dot(np.XYZ()) - Dist;
|
||||
FX(3) = dist1 * dist1 - nps1.SquareMagnitude();
|
||||
FX(4) = tgang - F4;
|
||||
}
|
||||
|
||||
if (DegL == 1) {
|
||||
Standard_Real temp;
|
||||
gp_Vec tempVec;
|
||||
gp_Vec d1utsurf1, d1vtsurf1;
|
||||
d1utsurf1 = (d2u1.Crossed(d1v1) + d1u1.Crossed(d2uv1)).Crossed(np);
|
||||
d1vtsurf1 = (d2uv1.Crossed(d1v1) + d1u1.Crossed(d2v1)).Crossed(np);
|
||||
|
||||
DX(1, 1) = np.Dot(d1u1);
|
||||
DX(1, 2) = np.Dot(d1v1);
|
||||
DX(1, 3) = 0.;
|
||||
DX(1, 4) = 0.;
|
||||
|
||||
DX(2, 1) = 0.;
|
||||
DX(2, 2) = 0.;
|
||||
DX(2, 3) = np.Dot(d1u2);
|
||||
DX(2, 4) = np.Dot(d1v2);
|
||||
|
||||
tempVec = -2. * nps1;
|
||||
DX(3, 1) = d1u1.Dot(tempVec);
|
||||
DX(3, 2) = d1v1.Dot(tempVec);
|
||||
DX(3, 3) = 0.;
|
||||
DX(3, 4) = 0.;
|
||||
|
||||
temp = F4 * (d1utsurf1.Dot(s1s2) - tsurf1.Dot(d1u1));
|
||||
temp += np.Dot(tsurf1.Crossed(d1u1) - d1utsurf1.Crossed(s1s2));
|
||||
DX(4, 1) = temp * PScaInv;
|
||||
|
||||
temp = F4 * (d1vtsurf1.Dot(s1s2) - tsurf1.Dot(d1v1));
|
||||
temp += np.Dot(tsurf1.Crossed(d1v1) - d1vtsurf1.Crossed(s1s2));
|
||||
DX(4, 2) = temp * PScaInv;
|
||||
|
||||
temp = F4 * tsurf1.Dot(d1u2) - np.Dot(tsurf1.Crossed(d1u2));
|
||||
DX(4, 3) = temp * PScaInv;
|
||||
|
||||
temp = F4 * tsurf1.Dot(d1v2) - np.Dot(tsurf1.Crossed(d1v2));
|
||||
DX(4, 4) = temp * PScaInv;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
const Standard_Boolean Error = ComputeValues(X, 0, 0);
|
||||
F = FX;
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
const Standard_Boolean Error = ComputeValues(X, 1, 1);
|
||||
D = DX;
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
const Standard_Boolean Error = ComputeValues(X, 0, 1);
|
||||
F = FX;
|
||||
D = DX;
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Pnt& BlendFunc_ChAsym::PointOnS1 () const
|
||||
{
|
||||
return pt1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Pnt& BlendFunc_ChAsym::PointOnS2 () const
|
||||
{
|
||||
return pt2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsTangencyPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::IsTangencyPoint () const
|
||||
{
|
||||
return istangent;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_ChAsym::TangentOnS1 () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_ChAsym::TangentOnS1");
|
||||
return tg1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_ChAsym::Tangent2dOnS1 () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_ChAsym::Tangent2dOnS1");
|
||||
return tg12d;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_ChAsym::TangentOnS2 () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_ChAsym::TangentOnS2");
|
||||
return tg2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_ChAsym::Tangent2dOnS2 () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_ChAsym::Tangent2dOnS2");
|
||||
return tg22d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TwistOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::TwistOnS1() const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_ChAsym::TwistOnS1");
|
||||
return tg1.Dot(nplan) < 0.;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TwistOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::TwistOnS2() const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_ChAsym::TwistOnS2");
|
||||
return tg2.Dot(nplan) < 0.;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent
|
||||
//purpose : TgF,NmF et TgL,NmL les tangentes et normales respectives
|
||||
// aux surfaces S1 et S2
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::Tangent(const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
gp_Vec& TgF,
|
||||
gp_Vec& TgL,
|
||||
gp_Vec& NmF,
|
||||
gp_Vec& NmL) const
|
||||
{
|
||||
gp_Pnt Pt1,Pt2,ptgui;
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
gp_Vec np, d1gui;
|
||||
Standard_Boolean revF = Standard_False;
|
||||
Standard_Boolean revL = Standard_False;
|
||||
|
||||
tcurv->D1(param, ptgui, d1gui);
|
||||
np = d1gui.Normalized();
|
||||
|
||||
surf1->D1(U1,V1,Pt1,d1u1,d1v1);
|
||||
NmF = d1u1.Crossed(d1v1);
|
||||
|
||||
surf2->D1(U2,V2,Pt2,d1u2,d1v2);
|
||||
NmL = d1u2.Crossed(d1v2);
|
||||
|
||||
TgF = (np.Crossed(NmF)).Normalized();
|
||||
TgL = (np.Crossed(NmL)).Normalized();
|
||||
|
||||
if ( (choix == 2)||(choix == 5) ){
|
||||
revF = Standard_True;
|
||||
revL = Standard_True;
|
||||
}
|
||||
|
||||
if ( (choix == 4)||(choix == 7) )
|
||||
revL = Standard_True;
|
||||
|
||||
if ( (choix == 3)||(choix == 8) )
|
||||
revF = Standard_True;
|
||||
|
||||
if ( revF )
|
||||
TgF.Reverse();
|
||||
if ( revL )
|
||||
TgL.Reverse();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::Section(const Standard_Real Param,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
Standard_Real& Pdeb,
|
||||
Standard_Real& Pfin,
|
||||
gp_Lin& C)
|
||||
{
|
||||
const gp_Pnt Pt1 = surf1->Value(U1,V1);
|
||||
const gp_Pnt Pt2 = surf2->Value(U2,V2);
|
||||
const gp_Dir dir( gp_Vec(Pt1,Pt2) );
|
||||
|
||||
C.SetLocation(Pt1);
|
||||
C.SetDirection(dir);
|
||||
|
||||
Pdeb = 0.;
|
||||
Pfin = ElCLib::Parameter(C, Pt2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsRational
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::IsRational () const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSectionSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BlendFunc_ChAsym::GetSectionSize() const
|
||||
{
|
||||
Standard_NotImplemented::Raise("BlendFunc_ChAsym::GetSectionSize()");
|
||||
return 0.;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BlendFunc_ChAsym::GetMinimalWeight(TColStd_Array1OfReal& Weights) const
|
||||
{
|
||||
Weights.Init(1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_ChAsym::NbIntervals (const GeomAbs_Shape S) const
|
||||
{
|
||||
return curv->NbIntervals(BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
|
||||
{
|
||||
curv->Intervals(T, BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::GetShape (Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots,
|
||||
Standard_Integer& Degree,
|
||||
Standard_Integer& NbPoles2d)
|
||||
{
|
||||
NbPoles = 2;
|
||||
NbPoles2d = 2;
|
||||
NbKnots = 2;
|
||||
Degree = 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose : Determine les Tolerances a utiliser dans les approximations.
|
||||
//=======================================================================
|
||||
void BlendFunc_ChAsym::GetTolerance(const Standard_Real BoundTol,
|
||||
const Standard_Real SurfTol,
|
||||
const Standard_Real AngleTol,
|
||||
math_Vector& Tol3d,
|
||||
math_Vector& Tol1d) const
|
||||
{
|
||||
Tol3d.Init(BoundTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Knots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::Knots(TColStd_Array1OfReal& TKnots)
|
||||
{
|
||||
TKnots(1) = 0.;
|
||||
TKnots(2) = 1.;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Mults
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::Mults(TColStd_Array1OfInteger& TMults)
|
||||
{
|
||||
TMults(1) = 2;
|
||||
TMults(2) = 2;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsym::Section(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColStd_Array1OfReal& Weights)
|
||||
{
|
||||
Standard_Real u1, v1, u2, v2, prm = P.Parameter();
|
||||
Standard_Integer low = Poles.Lower();
|
||||
Standard_Integer upp = Poles.Upper();
|
||||
math_Vector X(1,4), F(1,4);
|
||||
|
||||
P.ParametersOnS1(u1, v1);
|
||||
P.ParametersOnS2(u2, v2);
|
||||
X(1) = u1;
|
||||
X(2) = v1;
|
||||
X(3) = u2;
|
||||
X(4) = v2;
|
||||
Poles2d(Poles2d.Lower()).SetCoord(u1,v1);
|
||||
Poles2d(Poles2d.Upper()).SetCoord(u2,v2);
|
||||
|
||||
Set(prm);
|
||||
Value(X,F);
|
||||
Poles(low) = PointOnS1();
|
||||
Poles(upp) = PointOnS2();
|
||||
Weights(low) = 1.0;
|
||||
Weights(upp) = 1.0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::Section
|
||||
(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& DWeights)
|
||||
{
|
||||
math_Vector Sol(1, 4), valsol(1, 4), secmember(1, 4);
|
||||
math_Matrix gradsol(1, 4, 1, 4);
|
||||
Standard_Real prm = P.Parameter();
|
||||
Standard_Integer low = Poles.Lower();
|
||||
Standard_Integer upp = Poles.Upper();
|
||||
|
||||
P.ParametersOnS1(Sol(1),Sol(2));
|
||||
P.ParametersOnS2(Sol(3),Sol(4));
|
||||
Set(prm);
|
||||
|
||||
Poles2d(Poles2d.Lower()).SetCoord(Sol(1),Sol(2));
|
||||
Poles2d(Poles2d.Upper()).SetCoord(Sol(3),Sol(4));
|
||||
Poles(low) = PointOnS1();
|
||||
Poles(upp) = PointOnS2();
|
||||
Weights(low) = 1.0;
|
||||
Weights(upp) = 1.0;
|
||||
|
||||
gp_Pnt ptgui;
|
||||
gp_Vec np, dnp, d1gui, d2gui, Nsurf1, dwtsurf1;
|
||||
gp_Vec d1u1, d1v1, d1u2, d1v2;
|
||||
Standard_Real Normg;
|
||||
|
||||
tcurv->D2(param, ptgui, d1gui, d2gui);
|
||||
Normg = d1gui.Magnitude();
|
||||
np = d1gui.Normalized();
|
||||
dnp = (d2gui - np.Dot(d2gui) * np) / Normg;
|
||||
|
||||
if (choix%2 != 0) {
|
||||
np.Reverse();
|
||||
dnp.Reverse();
|
||||
Normg = -Normg;
|
||||
}
|
||||
|
||||
surf1->D1(Sol(1), Sol(2), pt1, d1u1, d1v1);
|
||||
Nsurf1 = d1u1.Crossed(d1v1);
|
||||
tsurf1 = Nsurf1.Crossed(np);
|
||||
dwtsurf1 = Nsurf1.Crossed(dnp);
|
||||
|
||||
surf2->D1(Sol(3), Sol(4), pt2, d1u2, d1v2);
|
||||
|
||||
gp_Vec pguis1(ptgui, pt1), pguis2(ptgui, pt2);
|
||||
gp_Vec CrossVec, s1s2(pt1, pt2);
|
||||
Standard_Real PScaInv = 1. / tsurf1.Dot(s1s2), F4, temp;
|
||||
Standard_Real maxpiv = 1.e-9;
|
||||
Standard_Real Nordu1 = d1u1.Magnitude(),
|
||||
Nordv1 = d1v1.Magnitude();
|
||||
|
||||
temp = 2. * (Nordu1 + Nordv1) * s1s2.Magnitude() + 2. * Nordu1 * Nordv1;
|
||||
|
||||
Values(Sol, valsol, gradsol);
|
||||
|
||||
secmember(1) = Normg - dnp.Dot(pguis1);
|
||||
secmember(2) = Normg - dnp.Dot(pguis2);
|
||||
secmember(3) = - 2. * d1gui.Dot(pguis1);
|
||||
|
||||
CrossVec = tsurf1.Crossed(s1s2);
|
||||
F4 = np.Dot(CrossVec) * PScaInv;
|
||||
temp = dnp.Dot(CrossVec) + np.Dot(dwtsurf1.Crossed(s1s2));
|
||||
temp -= F4 * dwtsurf1.Dot(s1s2);
|
||||
secmember(4) = PScaInv * temp;
|
||||
|
||||
math_Gauss Resol(gradsol, maxpiv);
|
||||
|
||||
if (Resol.IsDone()) {
|
||||
Resol.Solve(secmember);
|
||||
istangent = Standard_False;
|
||||
}
|
||||
else {
|
||||
math_SVD SingRS (gradsol);
|
||||
if (SingRS.IsDone()) {
|
||||
math_Vector DEDT(1,4);
|
||||
DEDT = secmember;
|
||||
SingRS.Solve(DEDT, secmember, 1.e-6);
|
||||
istangent = Standard_False;
|
||||
}
|
||||
else istangent = Standard_True;
|
||||
}
|
||||
|
||||
if (!istangent) {
|
||||
tg1.SetLinearForm(secmember(1), d1u1, secmember(2), d1v1);
|
||||
tg2.SetLinearForm(secmember(3), d1u2, secmember(4), d1v2);
|
||||
tg12d.SetCoord(secmember(1),secmember(2));
|
||||
tg22d.SetCoord(secmember(3),secmember(4));
|
||||
}
|
||||
|
||||
distmin = Min( distmin, pt1.Distance(pt2));
|
||||
|
||||
if (!istangent) {
|
||||
DPoles2d(Poles2d.Lower()).SetCoord(Tangent2dOnS1().X(),
|
||||
Tangent2dOnS1().Y());
|
||||
DPoles2d(Poles2d.Upper()).SetCoord(Tangent2dOnS2().X(),
|
||||
Tangent2dOnS2().Y());
|
||||
|
||||
DPoles(low) = TangentOnS1();
|
||||
DPoles(upp) = TangentOnS2();
|
||||
DWeights(low) = 0.0;
|
||||
DWeights(upp) = 0.0;
|
||||
}
|
||||
|
||||
return (!istangent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsym::Section
|
||||
(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfVec& D2Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColgp_Array1OfVec2d& D2Poles2d,
|
||||
TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& DWeights,
|
||||
TColStd_Array1OfReal& D2Weights)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Resolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BlendFunc_ChAsym::Resolution(const Standard_Integer IC2d, const Standard_Real Tol,
|
||||
Standard_Real& TolU, Standard_Real& TolV) const
|
||||
{
|
||||
if(IC2d == 1){
|
||||
TolU = surf1->UResolution(Tol);
|
||||
TolV = surf1->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
TolU = surf2->UResolution(Tol);
|
||||
TolV = surf2->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BlendFunc_ChAsym::Set(const Standard_Real Dist1,
|
||||
const Standard_Real Angle,
|
||||
const Standard_Integer Choix)
|
||||
{
|
||||
dist1 = Abs(Dist1);
|
||||
angle = Angle;
|
||||
tgang = Tan(Angle);
|
||||
choix = Choix;
|
||||
}
|
115
src/BlendFunc/BlendFunc_ChAsymInv.cdl
Executable file
115
src/BlendFunc/BlendFunc_ChAsymInv.cdl
Executable file
@@ -0,0 +1,115 @@
|
||||
-- File: BlendFunc_ChAsymInv.cdl
|
||||
-- Created: Thu Jun 4 09:42:08 1998
|
||||
-- Author: Philippe NOUAILLE
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class ChAsymInv from BlendFunc
|
||||
|
||||
inherits FuncInv from Blend
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
HCurve2d from Adaptor2d,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d
|
||||
|
||||
is
|
||||
Create(S1,S2: HSurface from Adaptor3d; C: HCurve from Adaptor3d)
|
||||
|
||||
returns ChAsymInv from BlendFunc;
|
||||
|
||||
Set(me: in out; OnFirst: Boolean from Standard;
|
||||
COnSurf: HCurve2d from Adaptor2d)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static ;
|
||||
|
||||
ComputeValues(me : in out;
|
||||
X : Vector from math;
|
||||
DegF : Integer from Standard;
|
||||
DegL : Integer from Standard)
|
||||
---Purpose: computes the values <F> of the derivatives for the
|
||||
-- variable <X> between DegF and DegL.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out;
|
||||
Dist1 : Real from Standard;
|
||||
Angle : Real from Standard;
|
||||
Choix : Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
surf1 : HSurface from Adaptor3d;
|
||||
surf2 : HSurface from Adaptor3d;
|
||||
dist1 : Real from Standard;
|
||||
angle : Real from Standard;
|
||||
tgang : Real from Standard;
|
||||
curv : HCurve from Adaptor3d;
|
||||
csurf : HCurve2d from Adaptor2d;
|
||||
choix : Integer from Standard;
|
||||
first : Boolean from Standard;
|
||||
|
||||
FX : Vector from math;
|
||||
DX : Matrix from math;
|
||||
|
||||
end ChAsymInv;
|
416
src/BlendFunc/BlendFunc_ChAsymInv.cxx
Executable file
416
src/BlendFunc/BlendFunc_ChAsymInv.cxx
Executable file
@@ -0,0 +1,416 @@
|
||||
// File: BlendFunc_ChAsymInv.cxx
|
||||
// Created: Thu Jun 4 09:49:05 1998
|
||||
// Author: Philippe NOUAILLE
|
||||
// Copyright: OPEN CASCADE 1998
|
||||
|
||||
#include <BlendFunc_ChAsymInv.ixx>
|
||||
|
||||
#include <BlendFunc.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_ChAsymInv
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
|
||||
BlendFunc_ChAsymInv::BlendFunc_ChAsymInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C) :
|
||||
surf1(S1),surf2(S2),curv(C),
|
||||
FX(1, 4),
|
||||
DX(1, 4, 1, 4)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsymInv::Set(const Standard_Real Dist1,
|
||||
const Standard_Real Angle,
|
||||
const Standard_Integer Choix)
|
||||
{
|
||||
dist1 = Abs(Dist1);
|
||||
angle = Angle;
|
||||
tgang = Tan(Angle);
|
||||
choix = Choix;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEquations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_ChAsymInv::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsymInv::Set(const Standard_Boolean OnFirst,
|
||||
const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
first = OnFirst;
|
||||
csurf = C;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsymInv::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = csurf->Resolution(Tol);
|
||||
Tolerance(2) = curv->Resolution(Tol);
|
||||
if (first) {
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
Tolerance(3) = surf1->UResolution(Tol);
|
||||
Tolerance(4) = surf1->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChAsymInv::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = csurf->FirstParameter();
|
||||
InfBound(2) = curv->FirstParameter();
|
||||
SupBound(1) = csurf->LastParameter();
|
||||
SupBound(2) = curv->LastParameter();
|
||||
|
||||
if (first) {
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfBound(3) = surf1->FirstUParameter();
|
||||
InfBound(4) = surf1->FirstVParameter();
|
||||
SupBound(3) = surf1->LastUParameter();
|
||||
SupBound(4) = surf1->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsymInv::IsSolution(const math_Vector& Sol,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
math_Vector valsol(1, 4);
|
||||
gp_Pnt pts1, pts2, ptgui;
|
||||
gp_Vec nplan, d1gui, Nsurf1, tsurf1;
|
||||
gp_Vec d1u1, d1v1;
|
||||
|
||||
curv->D1(Sol(2), ptgui, d1gui);
|
||||
nplan = d1gui.Normalized();
|
||||
|
||||
gp_Pnt2d pt2d(csurf->Value(Sol(1)));
|
||||
|
||||
if (first) {
|
||||
surf1->D1(pt2d.X(), pt2d.Y(), pts1, d1u1, d1v1);
|
||||
pts2 = surf2->Value(Sol(3), Sol(4));
|
||||
}
|
||||
else {
|
||||
surf1->D1(Sol(3), Sol(4), pts1, d1u1, d1v1);
|
||||
pts2 = surf2->Value(pt2d.X(), pt2d.Y());
|
||||
}
|
||||
|
||||
Nsurf1 = d1u1.Crossed(d1v1);
|
||||
tsurf1 = Nsurf1.Crossed(nplan);
|
||||
|
||||
gp_Vec s1s2(pts1, pts2);
|
||||
Standard_Real PScaInv = 1. / tsurf1.Dot(s1s2), temp;// ,F4;
|
||||
Standard_Real Nordu1 = d1u1.Magnitude(),
|
||||
Nordv1 = d1v1.Magnitude();
|
||||
|
||||
temp = 2. * (Nordu1 + Nordv1) * s1s2.Magnitude() + 2. * Nordu1 * Nordv1;
|
||||
|
||||
Value(Sol, valsol);
|
||||
|
||||
if (Abs(valsol(1)) < Tol &&
|
||||
Abs(valsol(2)) < Tol &&
|
||||
Abs(valsol(3)) < 2. * dist1 * Tol &&
|
||||
Abs(valsol(4)) < Tol * (1. + tgang) * Abs(PScaInv) * temp) {
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeValues
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BlendFunc_ChAsymInv::ComputeValues(const math_Vector& X,
|
||||
const Standard_Integer DegF,
|
||||
const Standard_Integer DegL)
|
||||
{
|
||||
if (DegF > DegL) return Standard_False;
|
||||
|
||||
gp_Vec nplan, dnplan, d1gui, d2gui, d1u1, d1v1, d2u1, d2v1, d2uv1, d1u2, d1v2;
|
||||
gp_Vec Nsurf1, tsurf1;
|
||||
gp_Pnt pts1, pts2, ptgui;
|
||||
Standard_Real PScaInv, F4;
|
||||
Standard_Real Normg = 0.;
|
||||
gp_Pnt2d pt2d;
|
||||
gp_Vec2d v2d;
|
||||
|
||||
if ( (DegF == 0) && (DegL == 0) ) {
|
||||
curv->D1(X(2), ptgui, d1gui);
|
||||
nplan = d1gui.Normalized();
|
||||
|
||||
if (choix%2 != 0) nplan.Reverse();
|
||||
pt2d = csurf->Value(X(1));
|
||||
|
||||
if (first) {
|
||||
surf1->D1(pt2d.X(), pt2d.Y(), pts1, d1u1, d1v1);
|
||||
pts2 = surf2->Value(X(3), X(4));
|
||||
}
|
||||
else {
|
||||
surf1->D1(X(3), X(4), pts1, d1u1, d1v1);
|
||||
pts2 = surf2->Value(pt2d.X(), pt2d.Y());
|
||||
}
|
||||
}
|
||||
else {
|
||||
curv->D2(X(2), ptgui, d1gui, d2gui);
|
||||
nplan = d1gui.Normalized();
|
||||
Normg = d1gui.Magnitude();
|
||||
dnplan = (d2gui - nplan.Dot(d2gui) * nplan) / Normg;
|
||||
|
||||
if (choix%2 != 0) {
|
||||
nplan.Reverse();
|
||||
dnplan.Reverse();
|
||||
Normg = - Normg;
|
||||
}
|
||||
|
||||
csurf->D1(X(1), pt2d, v2d);
|
||||
|
||||
if (first) {
|
||||
surf1->D2(pt2d.X(), pt2d.Y(), pts1, d1u1, d1v1, d2u1, d2v1, d2uv1);
|
||||
surf2->D1(X(3), X(4), pts2, d1u2, d1v2);
|
||||
}
|
||||
else {
|
||||
surf1->D2(X(3), X(4), pts1, d1u1, d1v1, d2u1, d2v1, d2uv1);
|
||||
surf2->D1(pt2d.X(), pt2d.Y(), pts2, d1u2, d1v2);
|
||||
}
|
||||
}
|
||||
|
||||
gp_Vec nps1(ptgui, pts1), s1s2(pts1, pts2);
|
||||
Nsurf1 = d1u1.Crossed(d1v1);
|
||||
tsurf1 = Nsurf1.Crossed(nplan);
|
||||
PScaInv = 1. / s1s2.Dot(tsurf1);
|
||||
F4 = nplan.Dot(tsurf1.Crossed(s1s2)) * PScaInv;
|
||||
|
||||
if (DegF == 0) {
|
||||
Standard_Real Dist;
|
||||
Dist = ptgui.XYZ().Dot(nplan.XYZ());
|
||||
FX(1) = pts1.XYZ().Dot(nplan.XYZ()) - Dist;
|
||||
FX(2) = pts2.XYZ().Dot(nplan.XYZ()) - Dist;
|
||||
FX(3) = dist1 * dist1 - nps1.SquareMagnitude();
|
||||
FX(4) = tgang - F4;
|
||||
|
||||
}
|
||||
|
||||
if (DegL == 1) {
|
||||
gp_Vec dwtsurf1, tempVec;
|
||||
Standard_Real temp;
|
||||
gp_Vec nps2(ptgui, pts2);
|
||||
|
||||
if (first) {
|
||||
gp_Vec dw1du1, dw1dv1, dw1csurf, dw1pts1;
|
||||
dw1pts1 = v2d.X() * d1u1 + v2d.Y() * d1v1;
|
||||
dw1du1 = v2d.X() * d2u1 + v2d.Y() * d2uv1;
|
||||
dw1dv1 = v2d.X() * d2uv1 + v2d.Y() * d2v1;
|
||||
dw1csurf = (dw1du1.Crossed(d1v1) + d1u1.Crossed(dw1dv1)).Crossed(nplan);
|
||||
dwtsurf1 = Nsurf1.Crossed(dnplan);
|
||||
|
||||
DX(1, 1) = nplan.Dot(dw1pts1);
|
||||
DX(1, 2) = dnplan.Dot(nps1) - Normg;
|
||||
DX(1, 3) = 0.;
|
||||
DX(1, 4) = 0.;
|
||||
|
||||
DX(2, 1) = 0.;
|
||||
DX(2, 2) = dnplan.Dot(nps2) - Normg;
|
||||
DX(2, 3) = nplan.Dot(d1u2);
|
||||
DX(2, 4) = nplan.Dot(d1v2);
|
||||
|
||||
tempVec = 2. * nps1;
|
||||
DX(3, 1) = -dw1pts1.Dot(tempVec);
|
||||
DX(3, 2) = d1gui.Dot(tempVec);
|
||||
DX(3, 3) = 0.;
|
||||
DX(3, 4) = 0.;
|
||||
|
||||
temp = F4 * (dw1csurf.Dot(s1s2) - tsurf1.Dot(dw1pts1));
|
||||
temp += nplan.Dot(tsurf1.Crossed(dw1pts1) - dw1csurf.Crossed(s1s2));
|
||||
DX(4, 1) = PScaInv * temp;
|
||||
|
||||
temp = F4 * dwtsurf1.Dot(s1s2);
|
||||
temp -= dnplan.Dot(tempVec) + nplan.Dot(dwtsurf1.Crossed(s1s2));
|
||||
DX(4, 2) = PScaInv * temp;
|
||||
temp = F4 * tsurf1.Dot(d1u2) - nplan.Dot(tsurf1.Crossed(d1u2));
|
||||
DX(4, 3) = PScaInv * temp;
|
||||
|
||||
temp = F4 * tsurf1.Dot(d1v2) - nplan.Dot(tsurf1.Crossed(d1v2));
|
||||
DX(4, 4) = PScaInv * temp;
|
||||
}
|
||||
else {
|
||||
gp_Vec d1utsurf1, d1vtsurf1, dw2pts2;
|
||||
d1utsurf1 = (d2u1.Crossed(d1v1) + d1u1.Crossed(d2uv1)).Crossed(nplan);
|
||||
d1vtsurf1 = (d2uv1.Crossed(d1v1) + d1u1.Crossed(d2v1)).Crossed(nplan);
|
||||
dw2pts2 = v2d.X() * d1u2 + v2d.Y() * d1v2;
|
||||
dwtsurf1 = Nsurf1.Crossed(dnplan);
|
||||
|
||||
DX(1, 1) = 0.;
|
||||
DX(1, 2) = dnplan.Dot(nps1) - Normg;
|
||||
DX(1, 3) = nplan.Dot(d1u1);
|
||||
DX(1, 4) = nplan.Dot(d1v1);
|
||||
|
||||
DX(2, 1) = nplan.Dot(dw2pts2);
|
||||
DX(2, 2) = dnplan.Dot(nps2) - Normg;
|
||||
DX(2, 3) = 0.;
|
||||
DX(2, 4) = 0.;
|
||||
|
||||
tempVec = 2. * nps1;
|
||||
DX(3, 1) = 0.;
|
||||
DX(3, 2) = d1gui.Dot(tempVec);
|
||||
|
||||
tempVec.Reverse();
|
||||
DX(3, 3) = d1u1.Dot(tempVec);
|
||||
DX(3, 4) = d1v1.Dot(tempVec);
|
||||
|
||||
temp = F4 * tsurf1.Dot(dw2pts2) - nplan.Dot(tsurf1.Crossed(dw2pts2));
|
||||
DX(4, 1) = PScaInv * temp;
|
||||
|
||||
temp = F4 * dwtsurf1.Dot(s1s2);
|
||||
temp -= dnplan.Dot(tempVec) + nplan.Dot(dwtsurf1.Crossed(s1s2));
|
||||
DX(4, 2) = PScaInv * temp;
|
||||
|
||||
temp = F4 * (d1utsurf1.Dot(s1s2) - tsurf1.Dot(d1u1));
|
||||
temp += nplan.Dot(tsurf1.Crossed(d1u1) - d1utsurf1.Crossed(s1s2));
|
||||
DX(4, 3) = PScaInv * temp;
|
||||
|
||||
temp = F4 * (d1vtsurf1.Dot(s1s2) - tsurf1.Dot(d1v1));
|
||||
temp += nplan.Dot(tsurf1.Crossed(d1v1) - d1vtsurf1.Crossed(s1s2));
|
||||
DX(4, 4) = PScaInv * temp;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsymInv::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
const Standard_Boolean Error = ComputeValues(X, 0, 0);
|
||||
F = FX;
|
||||
return Error;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsymInv::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
const Standard_Boolean Error = ComputeValues(X, 1, 1);
|
||||
D = DX;
|
||||
return Error;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChAsymInv::Values(const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D)
|
||||
{
|
||||
const Standard_Boolean Error = ComputeValues(X, 0, 1);
|
||||
F = FX;
|
||||
D = DX;
|
||||
return Error;
|
||||
/* cout<<endl;
|
||||
cout<<" test ChAsymInv"<<endl;
|
||||
cout<<"calcul exact <--> approche"<<endl;
|
||||
|
||||
math_Vector X1(1,4);
|
||||
math_Vector F1(1,4);
|
||||
X1 = X; X1(1) += 1.e-10;
|
||||
Value(X1,F1);
|
||||
cout<<"D(1,1) : "<<D(1,1)<<" "<<(F1(1) - F(1)) * 1.e10<<endl;
|
||||
cout<<"D(2,1) : "<<D(2,1)<<" "<<(F1(2) - F(2)) * 1.e10<<endl;
|
||||
cout<<"D(3,1) : "<<D(3,1)<<" "<<(F1(3) - F(3)) * 1.e10<<endl;
|
||||
cout<<"D(4,1) : "<<D(4,1)<<" "<<(F1(4) - F(4)) * 1.e10<<endl;
|
||||
X1 = X; X1(2) += 1.e-10;
|
||||
Value(X1,F1);
|
||||
cout<<"D(1,2) : "<<D(1,2)<<" "<<(F1(1) - F(1)) * 1.e10<<endl;
|
||||
cout<<"D(2,2) : "<<D(2,2)<<" "<<(F1(2) - F(2)) * 1.e10<<endl;
|
||||
cout<<"D(3,2) : "<<D(3,2)<<" "<<(F1(3) - F(3)) * 1.e10<<endl;
|
||||
cout<<"D(4,2) : "<<D(4,2)<<" "<<(F1(4) - F(4)) * 1.e10<<endl;
|
||||
X1 = X; X1(3) += 1.e-10;
|
||||
Value(X1,F1);
|
||||
cout<<"D(1,3) : "<<D(1,3)<<" "<<(F1(1) - F(1)) * 1.e10<<endl;
|
||||
cout<<"D(2,3) : "<<D(2,3)<<" "<<(F1(2) - F(2)) * 1.e10<<endl;
|
||||
cout<<"D(3,3) : "<<D(3,3)<<" "<<(F1(3) - F(3)) * 1.e10<<endl;
|
||||
cout<<"D(4,3) : "<<D(4,3)<<" "<<(F1(4) - F(4)) * 1.e10<<endl;
|
||||
X1 = X; X1(4) += 1.e-10;
|
||||
Value(X1,F1);
|
||||
cout<<"D(1,4) : "<<D(1,4)<<" "<<(F1(1) - F(1)) * 1.e10<<endl;
|
||||
cout<<"D(2,4) : "<<D(2,4)<<" "<<(F1(2) - F(2)) * 1.e10<<endl;
|
||||
cout<<"D(3,4) : "<<D(3,4)<<" "<<(F1(3) - F(3)) * 1.e10<<endl;
|
||||
cout<<"D(4,4) : "<<D(4,4)<<" "<<(F1(4) - F(4)) * 1.e10<<endl;*/
|
||||
}
|
102
src/BlendFunc/BlendFunc_ChamfInv.cdl
Executable file
102
src/BlendFunc/BlendFunc_ChamfInv.cdl
Executable file
@@ -0,0 +1,102 @@
|
||||
-- File: BlendFunc_ChamfInv.cdl
|
||||
-- Created: Thu Jun 6 14:49:31 1996
|
||||
-- Author: Stagiaire Xuan Trang PHAMPHU
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class ChamfInv from BlendFunc
|
||||
|
||||
inherits FuncInv from Blend
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
HCurve2d from Adaptor2d,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d,
|
||||
Corde from BlendFunc
|
||||
|
||||
is
|
||||
Create(S1,S2: HSurface from Adaptor3d; C: HCurve from Adaptor3d)
|
||||
|
||||
returns ChamfInv from BlendFunc;
|
||||
|
||||
Set(me: in out; OnFirst: Boolean from Standard;
|
||||
COnSurf: HCurve2d from Adaptor2d)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static ;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out; Dist1, Dist2: Real from Standard; Choix: Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
surf1 : HSurface from Adaptor3d;
|
||||
surf2 : HSurface from Adaptor3d;
|
||||
dis1 : Real from Standard;
|
||||
dis2 : Real from Standard;
|
||||
curv : HCurve from Adaptor3d;
|
||||
csurf : HCurve2d from Adaptor2d;
|
||||
choix : Integer from Standard;
|
||||
first : Boolean from Standard;
|
||||
corde1: Corde from BlendFunc;
|
||||
corde2: Corde from BlendFunc;
|
||||
|
||||
end ChamfInv;
|
325
src/BlendFunc/BlendFunc_ChamfInv.cxx
Executable file
325
src/BlendFunc/BlendFunc_ChamfInv.cxx
Executable file
@@ -0,0 +1,325 @@
|
||||
// File: BlendFunc_ChamfInv.cxx
|
||||
// Created: Thu Jun 6 14:23:10 1996
|
||||
// Author: Stagiaire Xuan Trang PHAMPHU
|
||||
// Copyright: OPEN CASCADE 1996
|
||||
|
||||
#include <BlendFunc_ChamfInv.ixx>
|
||||
|
||||
#include <BlendFunc.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_ChamfInv
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
|
||||
BlendFunc_ChamfInv::BlendFunc_ChamfInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C) :
|
||||
surf1(S1),surf2(S2),curv(C),corde1(surf1,curv),corde2(surf2,curv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChamfInv::Set(const Standard_Real Dist1, const Standard_Real Dist2,
|
||||
const Standard_Integer Choix)
|
||||
{
|
||||
Standard_Real dis1,dis2;
|
||||
|
||||
choix = Choix;
|
||||
switch (choix) {
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
dis1 = -Dist1;
|
||||
dis2 = -Dist2;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
dis1 = Dist1;
|
||||
dis2 = -Dist2;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
dis1 = Dist1;
|
||||
dis2 = Dist2;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
{
|
||||
dis1 = -Dist1;
|
||||
dis2 = Dist2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dis1 = -Dist1;
|
||||
dis2 = -Dist2;
|
||||
}
|
||||
corde1.SetDist(dis1);
|
||||
corde2.SetDist(dis2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEquations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_ChamfInv::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChamfInv::Set(const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
first = OnFirst;
|
||||
csurf = C;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChamfInv::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = csurf->Resolution(Tol);
|
||||
Tolerance(2) = curv->Resolution(Tol);
|
||||
if (first) {
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
Tolerance(3) = surf1->UResolution(Tol);
|
||||
Tolerance(4) = surf1->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_ChamfInv::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = csurf->FirstParameter();
|
||||
InfBound(2) = curv->FirstParameter();
|
||||
SupBound(1) = csurf->LastParameter();
|
||||
SupBound(2) = curv->LastParameter();
|
||||
|
||||
if (first) {
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfBound(3) = surf1->FirstUParameter();
|
||||
InfBound(4) = surf1->FirstVParameter();
|
||||
SupBound(3) = surf1->LastUParameter();
|
||||
SupBound(4) = surf1->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChamfInv::IsSolution(const math_Vector& Sol, const Standard_Real Tol)
|
||||
{
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
csurf->D1(Sol(1),p2d,v2d);
|
||||
|
||||
math_Vector Sol1(1,2), Sol2(1,2);
|
||||
Standard_Boolean issol;
|
||||
|
||||
Sol1(1) = p2d.X();
|
||||
Sol1(2) = p2d.Y();
|
||||
|
||||
Sol2(1) = Sol(3);
|
||||
Sol2(2) = Sol(4);
|
||||
|
||||
if( first ){
|
||||
issol = corde1.IsSolution(Sol1,Tol);
|
||||
issol = issol && corde2.IsSolution(Sol2,Tol);
|
||||
}
|
||||
else{
|
||||
issol = corde1.IsSolution(Sol2,Tol);
|
||||
issol = issol && corde2.IsSolution(Sol1,Tol);
|
||||
}
|
||||
|
||||
return issol;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChamfInv::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
corde1.SetParam(X(2));
|
||||
corde2.SetParam(X(2));
|
||||
|
||||
math_Vector x1(1,2), f1(1,2), x2(1,2), f2(1,2);
|
||||
x1(1) = p2d.X(); x1(2) = p2d.Y();
|
||||
x2(1) = X(3); x2(2) = X(4);
|
||||
|
||||
if(first){
|
||||
corde1.Value(x1,f1);
|
||||
corde2.Value(x2,f2);
|
||||
}
|
||||
|
||||
else{
|
||||
corde1.Value(x2,f1);
|
||||
corde2.Value(x1,f2);
|
||||
}
|
||||
F(1) = f1(1);
|
||||
F(2) = f1(2);
|
||||
F(3) = f2(1);
|
||||
F(4) = f2(2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChamfInv::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
Standard_Integer i, j;
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d, df1, df2;
|
||||
gp_Pnt pts, ptgui;
|
||||
gp_Vec temp, d1u, d1v, nplan;
|
||||
math_Vector x1(1,2), x2(1,2);
|
||||
math_Matrix d1(1,2,1,2), d2(1,2,1,2);
|
||||
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
corde1.SetParam(X(2));
|
||||
corde2.SetParam(X(2));
|
||||
|
||||
x1(1) = p2d.X(); x1(2) = p2d.Y();
|
||||
x2(1) = X(3); x2(2) = X(4);
|
||||
|
||||
if( first ){
|
||||
// p2d = pts est sur surf1
|
||||
ptgui = corde1.PointOnGuide();
|
||||
nplan = corde1.NPlan();
|
||||
corde2.Derivatives(x2,d2);
|
||||
corde1.DerFguide(x1,df1);
|
||||
corde2.DerFguide(x2,df2);
|
||||
surf1->D1(x1(1),x1(2),pts,d1u,d1v);
|
||||
}
|
||||
else{
|
||||
// p2d = pts est sur surf2
|
||||
ptgui = corde2.PointOnGuide();
|
||||
nplan = corde2.NPlan();
|
||||
corde1.Derivatives(x2,d1);
|
||||
corde1.DerFguide(x2,df1);
|
||||
corde2.DerFguide(x1,df2);
|
||||
surf2->D1(x1(1),x1(2),pts,d1u,d1v);
|
||||
}
|
||||
|
||||
// derivees par rapport a T
|
||||
temp.SetLinearForm(v2d.X(),d1u,v2d.Y(),d1v);
|
||||
if( first ){
|
||||
D(1,1) = nplan.Dot(temp);
|
||||
D(2,1) = 2*(gp_Vec(ptgui,pts).Dot(temp));
|
||||
D(3,1) = 0.;
|
||||
D(4,1) = 0.;
|
||||
}
|
||||
else{
|
||||
D(1,1) = 0.;
|
||||
D(2,1) = 0.;
|
||||
D(3,1) = nplan.Dot(temp);
|
||||
D(4,1) = 2*(gp_Vec(ptgui,pts).Dot(temp));
|
||||
}
|
||||
|
||||
// derivees par rapport a W
|
||||
D(1,2) = df1.X();
|
||||
D(2,2) = df1.Y();
|
||||
D(3,2) = df2.X();
|
||||
D(4,2) = df2.Y();
|
||||
|
||||
// derivees par rapport a U et V
|
||||
if( first ){
|
||||
for( i=1; i<3; i++ ){
|
||||
for( j=3; j<5; j++ ){
|
||||
D(i,j) = 0.;
|
||||
D(i+2,j) = d2(i,j-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
for( i=1; i<3; i++ ){
|
||||
for( j=3; j<5; j++ ){
|
||||
D(i,j) = d1(i,j-2);
|
||||
D(i+2,j) = 0.;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_ChamfInv::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
Value(X,F);
|
||||
Derivatives(X,D);
|
||||
return Standard_True;
|
||||
}
|
289
src/BlendFunc/BlendFunc_Chamfer.cdl
Executable file
289
src/BlendFunc/BlendFunc_Chamfer.cdl
Executable file
@@ -0,0 +1,289 @@
|
||||
-- File: BlendFunc_Chamfer.cdl
|
||||
-- Created: Thu Jun 6 14:09:19 1996
|
||||
-- Author: Stagiaire Xuan Trang PHAMPHU
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class Chamfer from BlendFunc
|
||||
|
||||
inherits Function from Blend
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Ax1 from gp,
|
||||
Vec from gp,
|
||||
Vec2d from gp,
|
||||
Pnt from gp,
|
||||
Lin from gp,
|
||||
Array1OfPnt from TColgp,
|
||||
Array1OfVec from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfVec2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Point from Blend,
|
||||
SectionShape from BlendFunc,
|
||||
Shape from GeomAbs,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d,
|
||||
Corde from BlendFunc
|
||||
|
||||
is
|
||||
|
||||
Create(S1,S2: HSurface from Adaptor3d; CG: HCurve from Adaptor3d)
|
||||
|
||||
returns Chamfer from BlendFunc;
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static ;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
|
||||
Set(me: in out; Param: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
Set(me: in out; First, Last: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
GetMinimalDistance(me)
|
||||
---Purpose: Returns the minimal Distance beetween two
|
||||
-- extremitys of calculed sections.
|
||||
returns Real from Standard;
|
||||
|
||||
PointOnS1(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
PointOnS2(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
IsTangencyPoint(me)
|
||||
|
||||
returns Boolean from Standard
|
||||
;
|
||||
|
||||
TangentOnS1(me)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
Tangent2dOnS1(me)
|
||||
|
||||
returns Vec2d from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
TangentOnS2(me)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
Tangent2dOnS2(me)
|
||||
|
||||
returns Vec2d from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
Tangent(me; U1,V1,U2,V2: Real from Standard;
|
||||
TgFirst,TgLast,NormFirst,NormLast: out Vec from gp)
|
||||
|
||||
---Purpose: Returns the tangent vector at the section,
|
||||
-- at the beginning and the end of the section, and
|
||||
-- returns the normal (of the surfaces) at
|
||||
-- these points.
|
||||
|
||||
;
|
||||
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out; Dist1,Dist2: Real from Standard; Choix: Integer from Standard)
|
||||
---Purpose: Sets the distances and the "quadrant".
|
||||
is static;
|
||||
|
||||
|
||||
--- Pour les approximations
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
---Purpose: Returns False
|
||||
is static;
|
||||
|
||||
GetSectionSize(me) returns Real
|
||||
---Purpose: Returns the length of the maximum section
|
||||
is static;
|
||||
|
||||
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the minimal value of weight for each poles
|
||||
-- of all sections.
|
||||
is static;
|
||||
|
||||
NbIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: Returns the number of intervals for continuity
|
||||
-- <S>. May be one if Continuity(me) >= <S>
|
||||
is static;
|
||||
|
||||
Intervals(me; T : in out Array1OfReal from TColStd;
|
||||
S : Shape from GeomAbs)
|
||||
---Purpose: Stores in <T> the parameters bounding the intervals
|
||||
-- of continuity <S>.
|
||||
--
|
||||
-- The array must provide enough room to accomodate
|
||||
-- for the parameters. i.e. T.Length() > NbIntervals()
|
||||
-- raises
|
||||
-- OutOfRange from Standard
|
||||
is static;
|
||||
|
||||
GetShape(me: in out;
|
||||
NbPoles : out Integer from Standard;
|
||||
NbKnots : out Integer from Standard;
|
||||
Degree : out Integer from Standard;
|
||||
NbPoles2d : out Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
GetTolerance(me;
|
||||
BoundTol, SurfTol, AngleTol : Real;
|
||||
Tol3d : out Vector;
|
||||
Tol1D : out Vector )
|
||||
---Purpose: Returns the tolerance to reach in approximation
|
||||
-- to respecte
|
||||
-- BoundTol error at the Boundary
|
||||
-- AngleTol tangent error at the Boundary
|
||||
-- SurfTol error inside the surface.
|
||||
is static;
|
||||
|
||||
|
||||
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out; Param: Real from Standard;
|
||||
U1,V1,U2,V2: Real from Standard;
|
||||
Pdeb,Pfin: out Real from Standard;
|
||||
C: out Lin from gp)
|
||||
---Purpose: Obsolete method
|
||||
is static;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
D2Poles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
D2Poles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd;
|
||||
D2Weigths : out Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: Used for the first and last section
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: Used for the first and last section
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd)
|
||||
|
||||
|
||||
is static;
|
||||
|
||||
Resolution(me;
|
||||
IC2d : Integer from Standard;
|
||||
Tol : Real from Standard;
|
||||
TolU, TolV : out Real from Standard);
|
||||
|
||||
|
||||
fields
|
||||
|
||||
surf1 : HSurface from Adaptor3d;
|
||||
surf2 : HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
|
||||
choix : Integer from Standard;
|
||||
tol : Real from Standard;
|
||||
distmin : Real from Standard;
|
||||
corde1 : Corde from BlendFunc;
|
||||
corde2 : Corde from BlendFunc;
|
||||
|
||||
end Chamfer;
|
579
src/BlendFunc/BlendFunc_Chamfer.cxx
Executable file
579
src/BlendFunc/BlendFunc_Chamfer.cxx
Executable file
@@ -0,0 +1,579 @@
|
||||
// File: BlendFunc_Chamfer.cxx
|
||||
// Created: Wed Jun 5 09:41:42 1996
|
||||
// Author: Stagiaire Xuan Trang PHAMPHU
|
||||
// Copyright: OPEN CASCADE 1996
|
||||
|
||||
// Modified : 20/08/96 PMN Ajout des methodes (Nb)Intervals et IsRationnal
|
||||
// Modified : 30/12/96 PMN Ajout GetMinimalWeight, GetSectionSize;
|
||||
|
||||
#include <BlendFunc_Chamfer.ixx>
|
||||
|
||||
#include <BlendFunc.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#ifdef DEB
|
||||
static Standard_Boolean putsderivatives = 0;
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_Chamfer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_Chamfer::BlendFunc_Chamfer(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& CG) :
|
||||
surf1(S1),surf2(S2),
|
||||
curv(CG),
|
||||
distmin(RealLast()),
|
||||
corde1(S1,CG),corde2(S2,CG)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEquations
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_Chamfer::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Set(const Standard_Real Dist1, const Standard_Real Dist2,
|
||||
const Standard_Integer Choix)
|
||||
{
|
||||
corde1.SetDist(Dist1);
|
||||
corde2.SetDist(Dist2);
|
||||
choix = Choix;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Set(const Standard_Real Param)
|
||||
{
|
||||
corde1.SetParam(Param);
|
||||
corde2.SetParam(Param);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Set(const Standard_Real First, const Standard_Real Last)
|
||||
{
|
||||
// corde1.SetParam(First, Last);
|
||||
// corde2.SetParam(First, Last);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = surf1->UResolution(Tol);
|
||||
Tolerance(2) = surf1->VResolution(Tol);
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = surf1->FirstUParameter();
|
||||
InfBound(2) = surf1->FirstVParameter();
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(1) = surf1->LastUParameter();
|
||||
SupBound(2) = surf1->LastVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
|
||||
for(Standard_Integer i = 1; i <= 4; i++){
|
||||
if(!Precision::IsInfinite(InfBound(i)) &&
|
||||
!Precision::IsInfinite(SupBound(i))) {
|
||||
const Standard_Real range = (SupBound(i) - InfBound(i));
|
||||
InfBound(i) -= range;
|
||||
SupBound(i) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::IsSolution(const math_Vector& Sol, const Standard_Real Tol)
|
||||
{
|
||||
math_Vector Sol1(1,2), Sol2(1,2);
|
||||
|
||||
Sol1(1) = Sol(1);
|
||||
Sol1(2) = Sol(2);
|
||||
Sol2(1) = Sol(3);
|
||||
Sol2(2) = Sol(4);
|
||||
|
||||
Standard_Boolean issol = corde1.IsSolution(Sol1,Tol);
|
||||
issol = issol && corde2.IsSolution(Sol2,Tol);
|
||||
tol = Tol;
|
||||
if (issol)
|
||||
distmin = Min (distmin, corde1.PointOnS().Distance(corde2.PointOnS()));
|
||||
|
||||
return issol;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BlendFunc_Chamfer::GetMinimalDistance() const
|
||||
{
|
||||
return distmin;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
math_Vector x(1,2), f(1,2);
|
||||
|
||||
x(1) = X(1); x(2) = X(2);
|
||||
corde1.Value(x,f);
|
||||
F(1) = f(1); F(2) = f(2);
|
||||
|
||||
x(1) = X(3); x(2) = X(4);
|
||||
corde2.Value(x,f);
|
||||
F(3) = f(1); F(4) = f(2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
Standard_Integer i,j;
|
||||
math_Vector x(1,2);
|
||||
math_Matrix d(1,2,1,2);
|
||||
|
||||
x(1) = X(1); x(2) = X(2);
|
||||
corde1.Derivatives(x,d);
|
||||
for( i=1; i<3; i++ ){
|
||||
for( j=1; j<3; j++ ){
|
||||
D(i,j) = d(i,j);
|
||||
D(i,j+2) = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
x(1) = X(3); x(2) = X(4);
|
||||
corde2.Derivatives(x,d);
|
||||
for( i=1; i<3; i++ ){
|
||||
for( j=1; j<3; j++ ){
|
||||
D(i+2,j+2) = d(i,j);
|
||||
D(i+2,j) = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
Standard_Boolean val = Value(X,F);
|
||||
return (val && Derivatives(X,D));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Pnt& BlendFunc_Chamfer::PointOnS1 () const
|
||||
{
|
||||
return corde1.PointOnS();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Pnt& BlendFunc_Chamfer::PointOnS2 () const
|
||||
{
|
||||
return corde2.PointOnS();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsTangencyPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::IsTangencyPoint () const
|
||||
{
|
||||
return corde1.IsTangencyPoint() && corde2.IsTangencyPoint();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_Chamfer::TangentOnS1 () const
|
||||
{
|
||||
return corde1.TangentOnS();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_Chamfer::TangentOnS2 () const
|
||||
{
|
||||
return corde2.TangentOnS();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_Chamfer::Tangent2dOnS1 () const
|
||||
{
|
||||
return corde1.Tangent2dOnS();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_Chamfer::Tangent2dOnS2 () const
|
||||
{
|
||||
return corde2.Tangent2dOnS();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent
|
||||
//purpose : TgF,NmF et TgL,NmL les tangentes et normales respectives
|
||||
// aux surfaces S1 et S2
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Tangent(const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
gp_Vec& TgF,
|
||||
gp_Vec& TgL,
|
||||
gp_Vec& NmF,
|
||||
gp_Vec& NmL) const
|
||||
{
|
||||
gp_Pnt pt1,pt2,ptgui;
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
gp_Vec nplan;
|
||||
Standard_Boolean revF = Standard_False;
|
||||
Standard_Boolean revL = Standard_False;
|
||||
|
||||
ptgui = corde1.PointOnGuide();
|
||||
nplan = corde1.NPlan();
|
||||
surf1->D1(U1,V1,pt1,d1u1,d1v1);
|
||||
NmF = d1u1.Crossed(d1v1);
|
||||
|
||||
surf2->D1(U2,V2,pt2,d1u2,d1v2);
|
||||
NmL = d1u2.Crossed(d1v2);
|
||||
|
||||
TgF = (nplan.Crossed(NmF)).Normalized();
|
||||
TgL = (nplan.Crossed(NmL)).Normalized();
|
||||
|
||||
if( (choix == 2)||(choix == 5) ){
|
||||
revF = Standard_True;
|
||||
revL = Standard_True;
|
||||
}
|
||||
if( (choix == 4)||(choix == 7) )
|
||||
revL = Standard_True;
|
||||
if( (choix == 3)||(choix == 8) )
|
||||
revF = Standard_True;
|
||||
|
||||
if( revF )
|
||||
TgF.Reverse();
|
||||
if( revL )
|
||||
TgL.Reverse();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Section(const Standard_Real Param,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
Standard_Real& Pdeb,
|
||||
Standard_Real& Pfin,
|
||||
gp_Lin& C)
|
||||
{
|
||||
const gp_Pnt pts1 = surf1->Value(U1,V1);
|
||||
const gp_Pnt pts2 = surf2->Value(U2,V2);
|
||||
const gp_Dir dir( gp_Vec(pts1,pts2) );
|
||||
|
||||
C.SetLocation(pts1);
|
||||
C.SetDirection(dir);
|
||||
|
||||
Pdeb = 0.;
|
||||
Pfin = ElCLib::Parameter(C,pts2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsRational
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::IsRational() const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSectionSize
|
||||
//purpose : Non implementee (non necessaire car non rationel)
|
||||
//=======================================================================
|
||||
Standard_Real BlendFunc_Chamfer::GetSectionSize() const
|
||||
{
|
||||
Standard_NotImplemented::Raise("BlendFunc_Chamfer::GetSectionSize()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BlendFunc_Chamfer::GetMinimalWeight(TColStd_Array1OfReal& Weights) const
|
||||
{
|
||||
Weights.Init(1);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_Chamfer::NbIntervals (const GeomAbs_Shape S) const
|
||||
{
|
||||
return curv->NbIntervals(BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
|
||||
{
|
||||
curv->Intervals(T, BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::GetShape (Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots,
|
||||
Standard_Integer& Degree,
|
||||
Standard_Integer& NbPoles2d)
|
||||
{
|
||||
NbPoles = 2;
|
||||
NbPoles2d = 2;
|
||||
NbKnots = 2;
|
||||
Degree = 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose : Determine les Tolerance a utiliser dans les approximations.
|
||||
//=======================================================================
|
||||
void BlendFunc_Chamfer::GetTolerance(const Standard_Real BoundTol,
|
||||
const Standard_Real SurfTol,
|
||||
const Standard_Real AngleTol,
|
||||
math_Vector& Tol3d,
|
||||
math_Vector& Tol1D) const
|
||||
{
|
||||
Tol3d.Init(BoundTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Knots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Knots(TColStd_Array1OfReal& TKnots)
|
||||
{
|
||||
TKnots(1) = 0.;
|
||||
TKnots(2) = 1.;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Mults
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Mults(TColStd_Array1OfInteger& TMults)
|
||||
{
|
||||
TMults(1) = 2;
|
||||
TMults(2) = 2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::Section
|
||||
(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfVec& D2Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColgp_Array1OfVec2d& D2Poles2d,
|
||||
TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& DWeights,
|
||||
TColStd_Array1OfReal& D2Weights)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Chamfer::Section
|
||||
(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& DWeights)
|
||||
{
|
||||
math_Vector sol(1,4),valsol(1,4),secmember(1,4);
|
||||
math_Matrix gradsol(1,4,1,4);
|
||||
|
||||
Standard_Real prm = P.Parameter();
|
||||
Standard_Integer low = Poles.Lower();
|
||||
Standard_Integer upp = Poles.Upper();
|
||||
Standard_Boolean istgt;
|
||||
|
||||
P.ParametersOnS1(sol(1),sol(2));
|
||||
P.ParametersOnS2(sol(3),sol(4));
|
||||
|
||||
Set(prm);
|
||||
|
||||
Values(sol,valsol,gradsol);
|
||||
IsSolution(sol,tol);
|
||||
|
||||
istgt = IsTangencyPoint();
|
||||
|
||||
Poles2d(Poles2d.Lower()).SetCoord(sol(1),sol(2));
|
||||
Poles2d(Poles2d.Upper()).SetCoord(sol(3),sol(4));
|
||||
if (!istgt) {
|
||||
DPoles2d(Poles2d.Lower()).SetCoord(Tangent2dOnS1().X(),
|
||||
Tangent2dOnS1().Y());
|
||||
DPoles2d(Poles2d.Upper()).SetCoord(Tangent2dOnS2().X(),
|
||||
Tangent2dOnS2().Y());
|
||||
}
|
||||
Poles(low) = PointOnS1();
|
||||
Poles(upp) = PointOnS2();
|
||||
Weights(low) = 1.0;
|
||||
Weights(upp) = 1.0;
|
||||
if (!istgt) {
|
||||
DPoles(low) = TangentOnS1();
|
||||
DPoles(upp) = TangentOnS2();
|
||||
DWeights(low) = 0.0;
|
||||
DWeights(upp) = 0.0;
|
||||
}
|
||||
|
||||
return (!istgt);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Section
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Chamfer::Section(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColStd_Array1OfReal& Weights)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2,prm = P.Parameter();
|
||||
Standard_Integer low = Poles.Lower();
|
||||
Standard_Integer upp = Poles.Upper();
|
||||
math_Vector X(1,4), F(1,4);
|
||||
|
||||
P.ParametersOnS1(u1,v1);
|
||||
P.ParametersOnS2(u2,v2);
|
||||
X(1)=u1;
|
||||
X(2)=v1;
|
||||
X(3)=u2;
|
||||
X(4)=v2;
|
||||
Poles2d(Poles2d.Lower()).SetCoord(u1,v1);
|
||||
Poles2d(Poles2d.Upper()).SetCoord(u2,v2);
|
||||
|
||||
Set(prm);
|
||||
Value(X,F);
|
||||
Poles(low) = PointOnS1();
|
||||
Poles(upp) = PointOnS2();
|
||||
Weights(low) = 1.0;
|
||||
Weights(upp) = 1.0;
|
||||
}
|
||||
|
||||
void BlendFunc_Chamfer::Resolution(const Standard_Integer IC2d, const Standard_Real Tol,
|
||||
Standard_Real& TolU, Standard_Real& TolV) const
|
||||
{
|
||||
if(IC2d == 1){
|
||||
TolU = surf1->UResolution(Tol);
|
||||
TolV = surf1->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
TolU = surf2->UResolution(Tol);
|
||||
TolV = surf2->VResolution(Tol);
|
||||
}
|
||||
}
|
312
src/BlendFunc/BlendFunc_ConstRad.cdl
Executable file
312
src/BlendFunc/BlendFunc_ConstRad.cdl
Executable file
@@ -0,0 +1,312 @@
|
||||
-- File: BlendFunc_ConstRad.cdl
|
||||
-- Created: Thu Dec 2 10:18:55 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class ConstRad from BlendFunc
|
||||
|
||||
inherits Function from Blend
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Tensor from BlendFunc,
|
||||
Ax1 from gp,
|
||||
Vec from gp,
|
||||
Vec2d from gp,
|
||||
Pnt from gp,
|
||||
Circ from gp,
|
||||
Array1OfPnt from TColgp,
|
||||
Array1OfVec from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfVec2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Point from Blend,
|
||||
SectionShape from BlendFunc,
|
||||
Shape from GeomAbs,
|
||||
ParameterisationType from Convert,
|
||||
HSurface from Adaptor3d,
|
||||
HCurve from Adaptor3d
|
||||
|
||||
is
|
||||
|
||||
Create(S1,S2: HSurface from Adaptor3d; C: HCurve from Adaptor3d)
|
||||
returns ConstRad from BlendFunc;
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static;
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static;
|
||||
|
||||
ComputeValues(me : in out;
|
||||
X : Vector from math;
|
||||
Order : Integer;
|
||||
ByParam : Boolean = Standard_False;
|
||||
Param : Real = 0)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
|
||||
Set(me: in out; Param: Real from Standard);
|
||||
|
||||
Set(me: in out; First, Last: Real from Standard);
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard);
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math);
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetMinimalDistance(me)
|
||||
---Purpose: Returns the minimal Distance beetween two
|
||||
-- extremitys of calculed sections.
|
||||
returns Real from Standard;
|
||||
|
||||
PointOnS1(me) returns Pnt from gp;
|
||||
---C++: return const&
|
||||
|
||||
PointOnS2(me) returns Pnt from gp;
|
||||
---C++: return const&
|
||||
|
||||
IsTangencyPoint(me) returns Boolean from Standard;
|
||||
|
||||
TangentOnS1(me) returns Vec from gp;
|
||||
---C++: return const&
|
||||
|
||||
Tangent2dOnS1(me) returns Vec2d from gp;
|
||||
---C++: return const&
|
||||
|
||||
TangentOnS2(me) returns Vec from gp;
|
||||
---C++: return const&
|
||||
|
||||
Tangent2dOnS2(me) returns Vec2d from gp;
|
||||
---C++: return const&
|
||||
|
||||
Tangent(me;
|
||||
U1,V1,U2,V2 : Real from Standard;
|
||||
TgFirst,TgLast,NormFirst,NormLast : out Vec from gp);
|
||||
---Purpose: Returns the tangent vector at the section,
|
||||
-- at the beginning and the end of the section, and
|
||||
-- returns the normal (of the surfaces) at
|
||||
-- these points.
|
||||
|
||||
TwistOnS1(me)
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
TwistOnS2(me)
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out; Radius: Real from Standard; Choix: Integer from Standard)
|
||||
---Purpose: Inits the value of radius, and the "quadrant".
|
||||
is static;
|
||||
|
||||
Set(me: in out; TypeSection: SectionShape from BlendFunc)
|
||||
---Purpose: Sets the type of section generation for the
|
||||
-- approximations.
|
||||
is static;
|
||||
|
||||
Section(me: in out; Param: Real from Standard;
|
||||
U1,V1,U2,V2: Real from Standard;
|
||||
Pdeb,Pfin: out Real from Standard;
|
||||
C: out Circ from gp)
|
||||
---Purpose: Utile pour une visu rapide et approximative de la surface.
|
||||
is static;
|
||||
|
||||
--- Pour les approximations
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
---Purpose: Returns if the section is rationnal
|
||||
is static;
|
||||
|
||||
GetSectionSize(me) returns Real
|
||||
---Purpose: Returns the length of the maximum section
|
||||
is static;
|
||||
|
||||
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the minimal value of weight for each poles
|
||||
-- of all sections.
|
||||
is static;
|
||||
|
||||
NbIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: Returns the number of intervals for continuity
|
||||
-- <S>. May be one if Continuity(me) >= <S>
|
||||
is static;
|
||||
|
||||
Intervals(me; T : in out Array1OfReal from TColStd;
|
||||
S : Shape from GeomAbs)
|
||||
---Purpose: Stores in <T> the parameters bounding the intervals
|
||||
-- of continuity <S>.
|
||||
--
|
||||
-- The array must provide enough room to accomodate
|
||||
-- for the parameters. i.e. T.Length() > NbIntervals()
|
||||
is static;
|
||||
|
||||
GetShape(me: in out;
|
||||
NbPoles : out Integer from Standard;
|
||||
NbKnots : out Integer from Standard;
|
||||
Degree : out Integer from Standard;
|
||||
NbPoles2d : out Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
GetTolerance(me;
|
||||
BoundTol, SurfTol, AngleTol : Real;
|
||||
Tol3d : out Vector;
|
||||
Tol1D : out Vector )
|
||||
---Purpose: Returns the tolerance to reach in approximation
|
||||
-- to respecte
|
||||
-- BoundTol error at the Boundary
|
||||
-- AngleTol tangent error at the Boundary
|
||||
-- SurfTol error inside the surface.
|
||||
is static;
|
||||
|
||||
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
|
||||
is static;
|
||||
|
||||
|
||||
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
|
||||
is static;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
D2Poles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
D2Poles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd;
|
||||
D2Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Used for the first and last section
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Used for the first and last section
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd)
|
||||
is static;
|
||||
|
||||
AxeRot(me: in out; Prm: Real from Standard) returns Ax1 from gp
|
||||
is static;
|
||||
|
||||
Resolution(me;
|
||||
IC2d : Integer from Standard;
|
||||
Tol : Real from Standard;
|
||||
TolU, TolV : out Real from Standard);
|
||||
|
||||
|
||||
fields
|
||||
|
||||
-- the basic inpout geometry
|
||||
surf1 : HSurface from Adaptor3d;
|
||||
surf2 : HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
tcurv : HCurve from Adaptor3d;
|
||||
|
||||
-- the basic output geometry
|
||||
pts1 : Pnt from gp;
|
||||
pts2 : Pnt from gp;
|
||||
istangent: Boolean from Standard;
|
||||
tg1 : Vec from gp;
|
||||
tg12d : Vec2d from gp;
|
||||
tg2 : Vec from gp;
|
||||
tg22d : Vec2d from gp;
|
||||
|
||||
-- auxiliary scalar
|
||||
param : Real from Standard;
|
||||
ray1 : Real from Standard;
|
||||
ray2 : Real from Standard;
|
||||
choix : Integer from Standard;
|
||||
myXOrder : Integer from Standard;
|
||||
myTOrder : Integer from Standard;
|
||||
xval : Vector from math;
|
||||
tval : Real from Standard;
|
||||
|
||||
|
||||
-- Auxiliary Geometry
|
||||
-- the normal
|
||||
d1u1, d1u2 : Vec from gp;
|
||||
d1v1, d1v2 : Vec from gp;
|
||||
d2u1, d2v1, d2uv1 : Vec from gp;
|
||||
d2u2, d2v2, d2uv2 : Vec from gp;
|
||||
dn1w, dn2w : Vec from gp;
|
||||
d2n1w, d2n2w : Vec from gp;
|
||||
nplan : Vec from gp;
|
||||
nsurf1 : Vec from gp;
|
||||
dns1u1, dns1u2 : Vec from gp;
|
||||
dns1v1, dns1v2 : Vec from gp;
|
||||
nsurf2 : Vec from gp;
|
||||
dnplan : Vec from gp;
|
||||
d2nplan : Vec from gp;
|
||||
dnsurf1 : Vec from gp;
|
||||
dnsurf2 : Vec from gp;
|
||||
|
||||
-- Auxilary math Object
|
||||
dndu1, dndu2 : Vec from gp;
|
||||
dndv1, dndv2 : Vec from gp;
|
||||
d2ndu1, d2ndu2 : Vec from gp;
|
||||
d2ndv1, d2ndv2 : Vec from gp;
|
||||
d2nduv1, d2nduv2 : Vec from gp;
|
||||
d2ndtu1, d2ndtu2 : Vec from gp;
|
||||
d2ndtv1, d2ndtv2 : Vec from gp;
|
||||
|
||||
E : Vector from math;
|
||||
DEDX : Matrix from math;
|
||||
DEDT : Vector from math;
|
||||
D2EDX2 : Tensor from BlendFunc;
|
||||
D2EDXDT : Matrix from math;
|
||||
D2EDT2 : Vector from math;
|
||||
|
||||
-- Information on sections
|
||||
maxang : Real from Standard;
|
||||
minang : Real from Standard;
|
||||
distmin : Real from Standard;
|
||||
mySShape : SectionShape from BlendFunc;
|
||||
myTConv : ParameterisationType from Convert;
|
||||
|
||||
end ConstRad;
|
1937
src/BlendFunc/BlendFunc_ConstRad.cxx
Executable file
1937
src/BlendFunc/BlendFunc_ConstRad.cxx
Executable file
File diff suppressed because it is too large
Load Diff
98
src/BlendFunc/BlendFunc_ConstRadInv.cdl
Executable file
98
src/BlendFunc/BlendFunc_ConstRadInv.cdl
Executable file
@@ -0,0 +1,98 @@
|
||||
-- File: BlendFunc_ConstRadInv.cdl
|
||||
-- Created: Thu Dec 2 10:25:35 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class ConstRadInv from BlendFunc
|
||||
|
||||
inherits FuncInv from Blend
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
HCurve2d from Adaptor2d,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d
|
||||
is
|
||||
|
||||
Create(S1,S2: HSurface from Adaptor3d; C: HCurve from Adaptor3d)
|
||||
|
||||
returns ConstRadInv from BlendFunc;
|
||||
|
||||
Set(me: in out; OnFirst: Boolean from Standard;
|
||||
COnSurf: HCurve2d from Adaptor2d)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static ;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out; R: Real from Standard; Choix: Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
surf1: HSurface from Adaptor3d;
|
||||
surf2: HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
csurf: HCurve2d from Adaptor2d;
|
||||
ray1 : Real from Standard;
|
||||
ray2 : Real from Standard;
|
||||
choix: Integer from Standard;
|
||||
first : Boolean from Standard;
|
||||
|
||||
end ConstRadInv;
|
582
src/BlendFunc/BlendFunc_ConstRadInv.cxx
Executable file
582
src/BlendFunc/BlendFunc_ConstRadInv.cxx
Executable file
@@ -0,0 +1,582 @@
|
||||
// File: BlendFunc_ConstRadInv.cxx
|
||||
// Created: Thu Dec 2 10:25:35 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: Matra Datavision 1993
|
||||
|
||||
#include <BlendFunc_ConstRadInv.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
|
||||
#define Eps 1.e-15
|
||||
|
||||
|
||||
BlendFunc_ConstRadInv::BlendFunc_ConstRadInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C):
|
||||
surf1(S1),surf2(S2),curv(C)
|
||||
{}
|
||||
|
||||
void BlendFunc_ConstRadInv::Set(const Standard_Real R,
|
||||
const Standard_Integer Choix)
|
||||
|
||||
{
|
||||
choix = Choix;
|
||||
switch (choix) {
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
ray1 = -R;
|
||||
ray2 = -R;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
ray1 = R;
|
||||
ray2 = -R;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
ray1 = R;
|
||||
ray2 = R;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
{
|
||||
ray1 = -R;
|
||||
ray2 = R;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ray1 = ray2 = -R;
|
||||
}
|
||||
}
|
||||
|
||||
void BlendFunc_ConstRadInv::Set(const Standard_Boolean OnFirst,
|
||||
const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
first = OnFirst;
|
||||
csurf = C;
|
||||
}
|
||||
|
||||
Standard_Integer BlendFunc_ConstRadInv::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
void BlendFunc_ConstRadInv::GetTolerance(math_Vector& Tolerance,
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = csurf->Resolution(Tol);
|
||||
Tolerance(2) = curv->Resolution(Tol);
|
||||
if (first) {
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
Tolerance(3) = surf1->UResolution(Tol);
|
||||
Tolerance(4) = surf1->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BlendFunc_ConstRadInv::GetBounds(math_Vector& InfBound,
|
||||
math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = csurf->FirstParameter();
|
||||
InfBound(2) = curv->FirstParameter();
|
||||
SupBound(1) = csurf->LastParameter();
|
||||
SupBound(2) = curv->LastParameter();
|
||||
|
||||
if (first) {
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfBound(3) = surf1->FirstUParameter();
|
||||
InfBound(4) = surf1->FirstVParameter();
|
||||
SupBound(3) = surf1->LastUParameter();
|
||||
SupBound(4) = surf1->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_ConstRadInv::IsSolution(const math_Vector& Sol,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
math_Vector valsol(1,4);
|
||||
Value(Sol,valsol);
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
valsol(2)*valsol(2) + valsol(3)*valsol(3) +
|
||||
valsol(4)*valsol(4) <= Tol*Tol) {
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean BlendFunc_ConstRadInv::Value(const math_Vector& X,
|
||||
math_Vector& F)
|
||||
{
|
||||
gp_Pnt ptcur;
|
||||
gp_Vec d1cur;
|
||||
curv->D1(X(2),ptcur,d1cur);
|
||||
|
||||
const gp_Vec nplan = d1cur.Normalized();
|
||||
const Standard_Real theD = -(nplan.XYZ().Dot(ptcur.XYZ()));
|
||||
|
||||
const gp_Pnt2d pt2d(csurf->Value(X(1)));
|
||||
|
||||
gp_Pnt pts1,pts2;
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
if (first)
|
||||
{
|
||||
surf1->D1(pt2d.X(),pt2d.Y(),pts1,d1u1,d1v1);
|
||||
surf2->D1(X(3),X(4),pts2,d1u2,d1v2);
|
||||
}
|
||||
else
|
||||
{
|
||||
surf1->D1(X(3),X(4),pts1,d1u1,d1v1);
|
||||
surf2->D1(pt2d.X(),pt2d.Y(),pts2,d1u2,d1v2);
|
||||
}
|
||||
|
||||
F(1) = (nplan.X() * (pts1.X() + pts2.X()) +
|
||||
nplan.Y() * (pts1.Y() + pts2.Y()) +
|
||||
nplan.Z() * (pts1.Z() + pts2.Z())) /2. + theD;
|
||||
|
||||
gp_Vec ns1 = d1u1.Crossed(d1v1);
|
||||
if (ns1.Magnitude() < Eps) {
|
||||
if (first) BlendFunc::ComputeNormal(surf1, pt2d, ns1);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf1, P, ns1);
|
||||
}
|
||||
}
|
||||
|
||||
gp_Vec ns2 = d1u2.Crossed(d1v2);
|
||||
if (ns2.Magnitude() < Eps) {
|
||||
if (!first) BlendFunc::ComputeNormal(surf2, pt2d, ns2);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf2, P, ns2);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real norm1 = nplan.Crossed(ns1).Magnitude();
|
||||
Standard_Real norm2 = nplan.Crossed(ns2).Magnitude();
|
||||
if (norm1 < Eps) {
|
||||
norm1 = 1;
|
||||
//#if DEB
|
||||
// cout << " ConstRadInv : Surface singuliere " << endl;
|
||||
//#endif
|
||||
}
|
||||
if (norm2 < Eps) {
|
||||
norm2 = 1; // Insufisant, mais il ne faut pas planter
|
||||
//#if DEB
|
||||
// cout << " ConstRadInv : Surface singuliere " << endl;
|
||||
//#endif
|
||||
}
|
||||
|
||||
gp_Vec resul;
|
||||
ns1.SetLinearForm(nplan.Dot(ns1)/norm1,nplan, -1./norm1,ns1);
|
||||
ns2.SetLinearForm(nplan.Dot(ns2)/norm2,nplan, -1./norm2,ns2);
|
||||
resul.SetLinearForm(ray1,ns1,-1.,pts2.XYZ(),-ray2,ns2,pts1.XYZ());
|
||||
F(2) = resul.X();
|
||||
F(3) = resul.Y();
|
||||
F(4) = resul.Z();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean BlendFunc_ConstRadInv::Derivatives(const math_Vector& X,
|
||||
math_Matrix& D)
|
||||
{
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
gp_Vec d2u1,d2v1,d2uv1,d2u2,d2v2,d2uv2;
|
||||
gp_Vec d1cur,d2cur;
|
||||
gp_Vec ns1,ns2,nplan,dnplan,ncrossns1,ncrossns2,resul1,resul2,temp;
|
||||
gp_Pnt pts1,pts2,ptcur;
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
Standard_Real norm1,norm2,ndotns1,ndotns2,normtgcur;
|
||||
Standard_Real grosterme,theD;
|
||||
|
||||
curv->D2(X(2),ptcur,d1cur,d2cur);
|
||||
normtgcur = d1cur.Magnitude();
|
||||
nplan = d1cur.Normalized();
|
||||
theD = -(nplan.XYZ().Dot(ptcur.XYZ()));
|
||||
|
||||
dnplan.SetLinearForm(theD, nplan, d2cur);
|
||||
dnplan /= normtgcur;
|
||||
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
if (first)
|
||||
{
|
||||
surf1->D2(p2d.X(),p2d.Y(),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(X(3),X(4),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
temp.SetLinearForm(v2d.X(),d1u1,v2d.Y(),d1v1);
|
||||
D(1,1) = nplan.Dot(temp)/2.;
|
||||
temp.SetXYZ(0.5*(pts1.XYZ()+pts2.XYZ()) - ptcur.XYZ());
|
||||
D(1,2) = dnplan.Dot(temp) - normtgcur;
|
||||
D(1,3) = nplan.Dot(d1u2)/2.;
|
||||
D(1,4) = nplan.Dot(d1v2)/2.;
|
||||
}
|
||||
else
|
||||
{
|
||||
surf1->D2(X(3),X(4),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(p2d.X(),p2d.Y(),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
temp.SetLinearForm(v2d.X(),d1u2,v2d.Y(),d1v2);
|
||||
D(1,1) = nplan.Dot(temp)/2.;
|
||||
temp.SetXYZ(0.5*(pts1.XYZ()+pts2.XYZ()) - ptcur.XYZ());
|
||||
D(1,2) = dnplan.Dot(temp) - normtgcur;
|
||||
D(1,3) = nplan.Dot(d1u1)/2.;
|
||||
D(1,4) = nplan.Dot(d1v1)/2.;
|
||||
}
|
||||
|
||||
ns1 = d1u1.Crossed(d1v1);
|
||||
if (ns1.Magnitude() < Eps) {
|
||||
if (first) BlendFunc::ComputeNormal(surf1, p2d, ns1);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf1, P, ns1);
|
||||
}
|
||||
}
|
||||
|
||||
ns2 = d1u2.Crossed(d1v2);
|
||||
if (ns2.Magnitude() < Eps) {
|
||||
if (!first) BlendFunc::ComputeNormal(surf2, p2d, ns2);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf2, P, ns2);
|
||||
}
|
||||
}
|
||||
|
||||
ncrossns1 = nplan.Crossed(ns1);
|
||||
ncrossns2 = nplan.Crossed(ns2);
|
||||
norm1 = ncrossns1.Magnitude();
|
||||
norm2 = ncrossns2.Magnitude();
|
||||
if (norm1 < Eps) {
|
||||
norm1 = 1; // Insufisant, mais il ne faut pas planter
|
||||
#if DEB
|
||||
cout << " ConstRadInv : Surface singuliere " << endl;
|
||||
#endif
|
||||
}
|
||||
if (norm2 < Eps) {
|
||||
norm2 = 1; // Insufisant, mais il ne faut pas planter
|
||||
#if DEB
|
||||
cout << " ConstRadInv : Surface singuliere " << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
ndotns1 = nplan.Dot(ns1);
|
||||
ndotns2 = nplan.Dot(ns2);
|
||||
|
||||
// Derivee par rapport a u1
|
||||
|
||||
temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul1.SetLinearForm(-ray1/norm1*(grosterme*ndotns1-nplan.Dot(temp)),nplan,
|
||||
ray1*grosterme/norm1,ns1,
|
||||
-ray1/norm1,temp,
|
||||
d1u1);
|
||||
|
||||
|
||||
// Derivee par rapport a v1
|
||||
|
||||
temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul2.SetLinearForm(-ray1/norm1*(grosterme*ndotns1-nplan.Dot(temp)),nplan,
|
||||
ray1*grosterme/norm1,ns1,
|
||||
-ray1/norm1,temp,
|
||||
d1v1);
|
||||
|
||||
if (first) {
|
||||
D(2,1) = v2d.X()*resul1.X() + v2d.Y()*resul2.X();
|
||||
D(3,1) = v2d.X()*resul1.Y() + v2d.Y()*resul2.Y();
|
||||
D(4,1) = v2d.X()*resul1.Z() + v2d.Y()*resul2.Z();
|
||||
}
|
||||
else {
|
||||
D(2,3) = resul1.X();
|
||||
D(3,3) = resul1.Y();
|
||||
D(4,3) = resul1.Z();
|
||||
|
||||
D(2,4) = resul2.X();
|
||||
D(3,4) = resul2.Y();
|
||||
D(4,4) = resul2.Z();
|
||||
}
|
||||
|
||||
|
||||
// derivee par rapport a w (parametre sur ligne guide)
|
||||
// On considere ici que le rayon est constant
|
||||
|
||||
grosterme = ncrossns1.Dot(dnplan.Crossed(ns1))/norm1/norm1;
|
||||
resul1.SetLinearForm(-ray1/norm1*(grosterme*ndotns1-dnplan.Dot(ns1)),nplan,
|
||||
ray1*ndotns1/norm1,dnplan,
|
||||
ray1*grosterme/norm1,ns1);
|
||||
|
||||
|
||||
grosterme = ncrossns2.Dot(dnplan.Crossed(ns2))/norm2/norm2;
|
||||
resul2.SetLinearForm(ray2/norm2*(grosterme*ndotns2-dnplan.Dot(ns2)),nplan,
|
||||
-ray2*ndotns2/norm2,dnplan,
|
||||
-ray2*grosterme/norm2,ns2);
|
||||
|
||||
|
||||
D(2,2) = resul1.X() + resul2.X();
|
||||
D(3,2) = resul1.Y() + resul2.Y();
|
||||
D(4,2) = resul1.Z() + resul2.Z();
|
||||
|
||||
|
||||
|
||||
// Derivee par rapport a u2
|
||||
temp = d2u2.Crossed(d1v2).Added(d1u2.Crossed(d2uv2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul1.SetLinearForm(ray2/norm2*(grosterme*ndotns2-nplan.Dot(temp)),nplan,
|
||||
-ray2*grosterme/norm2,ns2,
|
||||
ray2/norm2,temp);
|
||||
resul1.Subtract(d1u2);
|
||||
|
||||
// Derivee par rapport a v2
|
||||
temp = d2uv2.Crossed(d1v2).Added(d1u2.Crossed(d2v2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul2.SetLinearForm(ray2/norm2*(grosterme*ndotns2-nplan.Dot(temp)),nplan,
|
||||
-ray2*grosterme/norm2,ns2,
|
||||
ray2/norm2,temp);
|
||||
resul2.Subtract(d1v2);
|
||||
|
||||
if (!first) {
|
||||
D(2,1) = v2d.X()*resul1.X() + v2d.Y()*resul2.X();
|
||||
D(3,1) = v2d.X()*resul1.Y() + v2d.Y()*resul2.Y();
|
||||
D(4,1) = v2d.X()*resul1.Z() + v2d.Y()*resul2.Z();
|
||||
}
|
||||
else {
|
||||
D(2,3) = resul1.X();
|
||||
D(3,3) = resul1.Y();
|
||||
D(4,3) = resul1.Z();
|
||||
|
||||
D(2,4) = resul2.X();
|
||||
D(3,4) = resul2.Y();
|
||||
D(4,4) = resul2.Z();
|
||||
}
|
||||
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_ConstRadInv::Values(const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D)
|
||||
{
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2,d1cur;
|
||||
gp_Vec d2u1,d2v1,d2uv1,d2u2,d2v2,d2uv2,d2cur;
|
||||
gp_Vec ns1,ns2,nplan,dnplan,ncrossns1,ncrossns2,resul1,resul2,temp;
|
||||
gp_Pnt ptcur,pts1,pts2;
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
Standard_Real norm1,norm2,ndotns1,ndotns2,normtgcur;
|
||||
Standard_Real grosterme,theD;
|
||||
|
||||
curv->D2(X(2),ptcur,d1cur,d2cur);
|
||||
normtgcur = d1cur.Magnitude();
|
||||
nplan = d1cur.Normalized();
|
||||
theD = -(nplan.XYZ().Dot(ptcur.XYZ()));
|
||||
dnplan.SetLinearForm(-nplan.Dot(d2cur),nplan,d2cur);
|
||||
dnplan /= normtgcur;
|
||||
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
|
||||
if (first)
|
||||
{
|
||||
surf1->D2(p2d.X(),p2d.Y(),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(X(3),X(4),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
|
||||
temp.SetLinearForm(v2d.X(),d1u1,v2d.Y(),d1v1);
|
||||
D(1,1) = nplan.Dot(temp)/2.;
|
||||
temp.SetXYZ(0.5*(pts1.XYZ()+pts2.XYZ())-ptcur.XYZ());
|
||||
D(1,2) = dnplan.Dot(temp) - normtgcur;
|
||||
D(1,3) = nplan.Dot(d1u2)/2.;
|
||||
D(1,4) = nplan.Dot(d1v2)/2.;
|
||||
}
|
||||
else
|
||||
{
|
||||
surf1->D2(X(3),X(4),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(p2d.X(),p2d.Y(),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
|
||||
temp.SetLinearForm(v2d.X(),d1u2,v2d.Y(),d1v2);
|
||||
D(1,1) = nplan.Dot(temp)/2.;
|
||||
temp.SetXYZ(0.5*(pts1.XYZ()+pts2.XYZ())-ptcur.XYZ());
|
||||
D(1,2) = dnplan.Dot(temp) - normtgcur;
|
||||
D(1,3) = nplan.Dot(d1u1)/2.;
|
||||
D(1,4) = nplan.Dot(d1v1)/2.;
|
||||
}
|
||||
|
||||
F(1) = (nplan.X()* (pts1.X() + pts2.X()) +
|
||||
nplan.Y()* (pts1.Y() + pts2.Y()) +
|
||||
nplan.Z()* (pts1.Z() + pts2.Z())) /2. + theD;
|
||||
|
||||
|
||||
ns1 = d1u1.Crossed(d1v1);
|
||||
if (ns1.Magnitude() < Eps) {
|
||||
if (first) BlendFunc::ComputeNormal(surf1, p2d, ns1);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf1, P, ns1);
|
||||
}
|
||||
}
|
||||
|
||||
ns2 = d1u2.Crossed(d1v2);
|
||||
if (ns2.Magnitude() < Eps) {
|
||||
if (!first) BlendFunc::ComputeNormal(surf2, p2d, ns2);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf2, P, ns2);
|
||||
}
|
||||
}
|
||||
|
||||
ncrossns1 = nplan.Crossed(ns1);
|
||||
ncrossns2 = nplan.Crossed(ns2);
|
||||
norm1 = ncrossns1.Magnitude();
|
||||
norm2 = ncrossns2.Magnitude();
|
||||
if (norm1 < Eps) {
|
||||
norm1 = 1; // Insufisant, mais il ne faut pas planter
|
||||
#if DEB
|
||||
cout << " ConstRadInv : Surface singuliere " << endl;
|
||||
#endif
|
||||
}
|
||||
if (norm2 < Eps) {
|
||||
norm2 = 1; // Insufisant, mais il ne faut pas planter
|
||||
#if DEB
|
||||
cout << " ConstRadInv : Surface singuliere " << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
ndotns1 = nplan.Dot(ns1);
|
||||
ndotns2 = nplan.Dot(ns2);
|
||||
|
||||
temp.SetLinearForm(ndotns1/norm1,nplan, -1./norm1,ns1);
|
||||
resul1.SetLinearForm(ray1,temp,gp_Vec(pts2,pts1));
|
||||
temp.SetLinearForm(ndotns2/norm2,nplan,-1./norm2,ns2);
|
||||
resul1.Subtract(ray2*temp);
|
||||
|
||||
F(2) = resul1.X();
|
||||
F(3) = resul1.Y();
|
||||
F(4) = resul1.Z();
|
||||
|
||||
// Derivee par rapport a u1
|
||||
|
||||
temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul1.SetLinearForm(-ray1/norm1*(grosterme*ndotns1-nplan.Dot(temp)),nplan,
|
||||
ray1*grosterme/norm1,ns1,
|
||||
-ray1/norm1,temp,
|
||||
d1u1);
|
||||
|
||||
|
||||
// Derivee par rapport a v1
|
||||
|
||||
temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul2.SetLinearForm(-ray1/norm1*(grosterme*ndotns1-nplan.Dot(temp)),nplan,
|
||||
ray1*grosterme/norm1,ns1,
|
||||
-ray1/norm1,temp,
|
||||
d1v1);
|
||||
|
||||
if (first) {
|
||||
D(2,1) = v2d.X()*resul1.X() + v2d.Y()*resul2.X();
|
||||
D(3,1) = v2d.X()*resul1.Y() + v2d.Y()*resul2.Y();
|
||||
D(4,1) = v2d.X()*resul1.Z() + v2d.Y()*resul2.Z();
|
||||
}
|
||||
else {
|
||||
D(2,3) = resul1.X();
|
||||
D(3,3) = resul1.Y();
|
||||
D(4,3) = resul1.Z();
|
||||
|
||||
D(2,4) = resul2.X();
|
||||
D(3,4) = resul2.Y();
|
||||
D(4,4) = resul2.Z();
|
||||
}
|
||||
|
||||
// derivee par rapport a w (parametre sur ligne guide)
|
||||
// On considere ici que le rayon est constant
|
||||
|
||||
grosterme = ncrossns1.Dot(dnplan.Crossed(ns1))/norm1/norm1;
|
||||
resul1.SetLinearForm(-ray1/norm1*(grosterme*ndotns1-dnplan.Dot(ns1)),nplan,
|
||||
ray1*ndotns1/norm1,dnplan,
|
||||
ray1*grosterme/norm1,ns1);
|
||||
|
||||
|
||||
grosterme = ncrossns2.Dot(dnplan.Crossed(ns2))/norm2/norm2;
|
||||
resul2.SetLinearForm(ray2/norm2*(grosterme*ndotns2-dnplan.Dot(ns2)),nplan,
|
||||
-ray2*ndotns2/norm2,dnplan,
|
||||
-ray2*grosterme/norm2,ns2);
|
||||
|
||||
|
||||
D(2,2) = resul1.X() + resul2.X();
|
||||
D(3,2) = resul1.Y() + resul2.Y();
|
||||
D(4,2) = resul1.Z() + resul2.Z();
|
||||
|
||||
|
||||
|
||||
// Derivee par rapport a u2
|
||||
temp = d2u2.Crossed(d1v2).Added(d1u2.Crossed(d2uv2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul1.SetLinearForm(ray2/norm2*(grosterme*ndotns2-nplan.Dot(temp)),nplan,
|
||||
-ray2*grosterme/norm2,ns2,
|
||||
ray2/norm2,temp);
|
||||
resul1.Subtract(d1u2);
|
||||
|
||||
// Derivee par rapport a v2
|
||||
temp = d2uv2.Crossed(d1v2).Added(d1u2.Crossed(d2v2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul2.SetLinearForm(ray2/norm2*(grosterme*ndotns2-nplan.Dot(temp)),nplan,
|
||||
-ray2*grosterme/norm2,ns2,
|
||||
ray2/norm2,temp);
|
||||
resul2.Subtract(d1v2);
|
||||
|
||||
if (!first) {
|
||||
D(2,1) = v2d.X()*resul1.X() + v2d.Y()*resul2.X();
|
||||
D(3,1) = v2d.X()*resul1.Y() + v2d.Y()*resul2.Y();
|
||||
D(4,1) = v2d.X()*resul1.Z() + v2d.Y()*resul2.Z();
|
||||
}
|
||||
else {
|
||||
D(2,3) = resul1.X();
|
||||
D(3,3) = resul1.Y();
|
||||
D(4,3) = resul1.Z();
|
||||
|
||||
D(2,4) = resul2.X();
|
||||
D(3,4) = resul2.Y();
|
||||
D(4,4) = resul2.Z();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
142
src/BlendFunc/BlendFunc_Corde.cdl
Executable file
142
src/BlendFunc/BlendFunc_Corde.cdl
Executable file
@@ -0,0 +1,142 @@
|
||||
-- File: BlendFunc_Corde.cdl
|
||||
-- Created: Tue Jun 4 18:41:25 1996
|
||||
-- Author: Stagiaire Xuan Trang PHAMPHU
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class Corde from BlendFunc
|
||||
|
||||
---Purpose: Cette fonction calcule le point pts sur la courbe intersection
|
||||
-- entre la normale a une courbe (guide) en un parametre choisi
|
||||
-- et une surface (surf), tel que pts soit a une distance
|
||||
-- donnee de guide.
|
||||
-- X(1),X(2) sont les parametres U,V de pts sur surf.
|
||||
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Gauss from math,
|
||||
Vec from gp,
|
||||
Vec2d from gp,
|
||||
Pnt from gp,
|
||||
Pnt2d from gp,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d
|
||||
|
||||
raises
|
||||
DomainError from Standard
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create(S: HSurface from Adaptor3d; CGuide: HCurve from Adaptor3d)
|
||||
returns Corde from BlendFunc;
|
||||
|
||||
|
||||
SetParam(me: in out; Param: Real from Standard);
|
||||
|
||||
|
||||
SetDist(me: in out; Dist: Real from Standard);
|
||||
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Function for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
PointOnS(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
PointOnGuide(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---Purpose: returns the point of parameter <Param> on CGuide
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
NPlan(me)
|
||||
|
||||
returns Vec from gp
|
||||
---Purpose: returns the normal to CGuide at Ptgui.
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
IsTangencyPoint(me)
|
||||
|
||||
---Purpose: Returns True when it is not possible to compute
|
||||
-- the tangent vectors at PointOnS.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
TangentOnS(me)
|
||||
|
||||
---Purpose: Returns the tangent vector at PointOnS, in 3d space.
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
raises DomainError from Standard;
|
||||
--- The exception is raised when IsTangencyPoint
|
||||
-- returns Standard_True.
|
||||
|
||||
|
||||
Tangent2dOnS(me)
|
||||
|
||||
---Purpose: Returns the tangent vector at PointOnS, in the
|
||||
-- parametric space of the first surface.
|
||||
|
||||
returns Vec2d from gp
|
||||
---C++: return const&
|
||||
raises DomainError from Standard;
|
||||
--- The exception is raised when IsTangencyPoint
|
||||
-- returns Standard_True.
|
||||
|
||||
|
||||
DerFguide(me: in out; Sol : Vector from math; DerF : out Vec2d from gp);
|
||||
---Purpose: Derivee de la fonction par rapport au parametre
|
||||
-- de la ligne guide
|
||||
|
||||
|
||||
IsSolution(me : in out;
|
||||
Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
---Purpose: Returns False if Sol is not solution else returns
|
||||
-- True and updates the fields tgs and tg2d
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
fields
|
||||
|
||||
surf : HSurface from Adaptor3d;
|
||||
guide : HCurve from Adaptor3d;
|
||||
pts : Pnt from gp;
|
||||
pt2d : Pnt2d from gp;
|
||||
dis : Real from Standard;
|
||||
normtg : Real from Standard;
|
||||
theD : Real from Standard;
|
||||
ptgui : Pnt from gp;
|
||||
nplan : Vec from gp;
|
||||
d1gui : Vec from gp;
|
||||
d2gui : Vec from gp;
|
||||
tgs : Vec from gp;
|
||||
tg2d : Vec2d from gp;
|
||||
istangent : Boolean from Standard;
|
||||
|
||||
end Corde;
|
218
src/BlendFunc/BlendFunc_Corde.cxx
Executable file
218
src/BlendFunc/BlendFunc_Corde.cxx
Executable file
@@ -0,0 +1,218 @@
|
||||
// File: BlendFunc_Corde.cxx
|
||||
// Created: Tue Jun 4 18:12:59 1996
|
||||
// Author: Stagiaire Xuan Trang PHAMPHU
|
||||
// Copyright: OPEN CASCADE 1996
|
||||
|
||||
#include <BlendFunc_Corde.ixx>
|
||||
|
||||
#include <math_Gauss.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : BlendFunc_Corde
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BlendFunc_Corde::BlendFunc_Corde(const Handle(Adaptor3d_HSurface)& S,
|
||||
const Handle(Adaptor3d_HCurve)& CG) :
|
||||
surf(S),guide(CG)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Corde::SetDist(const Standard_Real Dist)
|
||||
{
|
||||
dis = Dist;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetParam
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Corde::SetParam(const Standard_Real Param)
|
||||
{
|
||||
guide->D2(Param,ptgui,d1gui,d2gui);
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose : returns F(U,V)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Corde::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
gp_Vec d1u,d1v;
|
||||
surf->D1(X(1),X(2),pts,d1u,d1v);
|
||||
|
||||
F(1) = nplan.XYZ().Dot(pts.XYZ()) + theD;
|
||||
const gp_Vec vref(ptgui,pts);
|
||||
F(2) = vref.SquareMagnitude() - dis*dis;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Derivatives
|
||||
//purpose : D = grad F(U,V)
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Corde::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
gp_Vec d1u,d1v;
|
||||
surf->D1(X(1),X(2),pts,d1u,d1v);
|
||||
|
||||
D(1,1) = nplan.Dot(d1u);
|
||||
D(1,2) = nplan.Dot(d1v);
|
||||
D(2,1) = 2.*gp_Vec(ptgui,pts).Dot(d1u);
|
||||
D(2,2) = 2.*gp_Vec(ptgui,pts).Dot(d1v);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Pnt& BlendFunc_Corde::PointOnS () const
|
||||
{
|
||||
return pts;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PointOnGuide
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Pnt& BlendFunc_Corde::PointOnGuide () const
|
||||
{
|
||||
return ptgui;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Nplan
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_Corde::NPlan () const
|
||||
{
|
||||
return nplan;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsTangencyPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Corde::IsTangencyPoint () const
|
||||
{
|
||||
return istangent;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TangentOnS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec& BlendFunc_Corde::TangentOnS () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_Corde::TangentOnS");
|
||||
return tgs;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Tangent2dOnS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Vec2d& BlendFunc_Corde::Tangent2dOnS () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_Corde::Tangent2dOnS");
|
||||
return tg2d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DerFguide
|
||||
//purpose : dF/dw
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Corde::DerFguide (const math_Vector& Sol, gp_Vec2d& DerF)
|
||||
{
|
||||
gp_Vec d1u,d1v;
|
||||
surf->D1(Sol(1),Sol(2),pts,d1u,d1v);
|
||||
|
||||
gp_Vec dnplan;
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
const gp_Vec temp(pts.XYZ()-ptgui.XYZ());
|
||||
|
||||
DerF.SetX( dnplan.Dot(temp)-nplan.Dot(d1gui) );
|
||||
DerF.SetY( -2.*d1gui.Dot(temp) );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSolution
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Corde::IsSolution(const math_Vector& Sol, const Standard_Real Tol)
|
||||
{
|
||||
math_Vector secmember(1,2),valsol(1,2);
|
||||
math_Matrix gradsol(1,2,1,2);
|
||||
|
||||
gp_Vec dnplan,temp,d1u,d1v;
|
||||
|
||||
Value(Sol,valsol);
|
||||
Derivatives(Sol,gradsol);
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
Abs(valsol(2)) <= Tol*Tol) {
|
||||
|
||||
surf->D1(Sol(1),Sol(2),pts,d1u,d1v);
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,
|
||||
-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
temp.SetXYZ(pts.XYZ()-ptgui.XYZ());
|
||||
|
||||
secmember(1) = nplan.Dot(d1gui) - dnplan.Dot(temp);
|
||||
secmember(2) = 2.*d1gui.Dot(temp);
|
||||
|
||||
// gradsol*der = secmember
|
||||
// avec der(1) = dU/dW, der(2) = dU/dW, W est le parametre de guide
|
||||
|
||||
math_Gauss Resol(gradsol);
|
||||
if (Resol.IsDone()) {
|
||||
Resol.Solve(secmember);
|
||||
tgs.SetLinearForm(secmember(1),d1u,secmember(2),d1v);
|
||||
tg2d.SetCoord(secmember(1),secmember(2));
|
||||
istangent = Standard_False;
|
||||
}
|
||||
else {
|
||||
istangent = Standard_True;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
313
src/BlendFunc/BlendFunc_EvolRad.cdl
Executable file
313
src/BlendFunc/BlendFunc_EvolRad.cdl
Executable file
@@ -0,0 +1,313 @@
|
||||
-- File: BlendFunc_EvolRad.cdl
|
||||
-- Created: Mon Dec 20 17:38:45 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class EvolRad from BlendFunc
|
||||
|
||||
inherits Function from Blend
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Tensor from BlendFunc,
|
||||
Vec from gp,
|
||||
Vec2d from gp,
|
||||
Pnt from gp,
|
||||
Circ from gp,
|
||||
Array1OfPnt from TColgp,
|
||||
Array1OfVec from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfVec2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Point from Blend,
|
||||
SectionShape from BlendFunc,
|
||||
Shape from GeomAbs,
|
||||
ParameterisationType from Convert,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d,
|
||||
Function from Law
|
||||
|
||||
is
|
||||
|
||||
Create(S1,S2: HSurface from Adaptor3d; C: HCurve from Adaptor3d; Law: Function from Law)
|
||||
returns EvolRad from BlendFunc;
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static;
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
returns Boolean from Standard
|
||||
is redefined static;
|
||||
|
||||
ComputeValues(me : in out;
|
||||
X : Vector from math;
|
||||
Order : Integer;
|
||||
ByParam : Boolean = Standard_False;
|
||||
Param : Real = 0)
|
||||
returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
|
||||
Set(me: in out; Param: Real from Standard);
|
||||
|
||||
Set(me: in out; First, Last: Real from Standard);
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard);
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math);
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetMinimalDistance(me)
|
||||
---Purpose: Returns the minimal Distance beetween two
|
||||
-- extremitys of calculed sections.
|
||||
returns Real from Standard;
|
||||
|
||||
PointOnS1(me) returns Pnt from gp;
|
||||
---C++: return const&
|
||||
|
||||
PointOnS2(me) returns Pnt from gp;
|
||||
---C++: return const&
|
||||
|
||||
IsTangencyPoint(me) returns Boolean from Standard;
|
||||
|
||||
TangentOnS1(me) returns Vec from gp;
|
||||
---C++: return const&
|
||||
|
||||
Tangent2dOnS1(me) returns Vec2d from gp;
|
||||
---C++: return const&
|
||||
|
||||
TangentOnS2(me) returns Vec from gp;
|
||||
---C++: return const&
|
||||
|
||||
Tangent2dOnS2(me) returns Vec2d from gp;
|
||||
---C++: return const&
|
||||
|
||||
Tangent(me;
|
||||
U1,V1,U2,V2 : Real from Standard;
|
||||
TgFirst,TgLast,NormFirst,NormLast : out Vec from gp);
|
||||
---Purpose: Returns the tangent vector at the section,
|
||||
-- at the beginning and the end of the section, and
|
||||
-- returns the normal (of the surfaces) at
|
||||
-- these points.
|
||||
|
||||
TwistOnS1(me)
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
TwistOnS2(me)
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out; Choix: Integer from Standard) is static;
|
||||
|
||||
Set(me: in out; TypeSection: SectionShape from BlendFunc)
|
||||
---Purpose: Sets the type of section generation for the
|
||||
-- approximations.
|
||||
is static;
|
||||
|
||||
Section(me: in out; Param: Real from Standard;
|
||||
U1,V1,U2,V2: Real from Standard;
|
||||
Pdeb,Pfin: out Real from Standard;
|
||||
C: out Circ from gp)
|
||||
---Purpose: Method for graphic traces
|
||||
is static;
|
||||
|
||||
--- Pour les approximations
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
---Purpose: Returns if the section is rationnal
|
||||
is static;
|
||||
|
||||
GetSectionSize(me) returns Real
|
||||
---Purpose: Returns the length of the maximum section
|
||||
is static;
|
||||
|
||||
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the minimal value of weight for each poles
|
||||
-- of all sections.
|
||||
is static;
|
||||
|
||||
NbIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: Returns the number of intervals for continuity
|
||||
-- <S>. May be one if Continuity(me) >= <S>
|
||||
is static;
|
||||
|
||||
Intervals(me; T : in out Array1OfReal from TColStd;
|
||||
S : Shape from GeomAbs)
|
||||
---Purpose: Stores in <T> the parameters bounding the intervals
|
||||
-- of continuity <S>.
|
||||
--
|
||||
-- The array must provide enough room to accomodate
|
||||
-- for the parameters. i.e. T.Length() > NbIntervals()
|
||||
is static;
|
||||
|
||||
GetShape(me: in out;
|
||||
NbPoles : out Integer from Standard;
|
||||
NbKnots : out Integer from Standard;
|
||||
Degree : out Integer from Standard;
|
||||
NbPoles2d : out Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
GetTolerance(me;
|
||||
BoundTol, SurfTol, AngleTol : Real;
|
||||
Tol3d : out Vector;
|
||||
Tol1D : out Vector )
|
||||
---Purpose: Returns the tolerance to reach in approximation
|
||||
-- to respecte
|
||||
-- BoundTol error at the Boundary
|
||||
-- AngleTol tangent error at the Boundary
|
||||
-- SurfTol error inside the surface.
|
||||
is static;
|
||||
|
||||
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
|
||||
is static;
|
||||
|
||||
|
||||
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
|
||||
is static;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
D2Poles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
D2Poles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd;
|
||||
D2Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Used for the first and last section
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Used for the first and last section
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd)
|
||||
is static;
|
||||
|
||||
Resolution(me;
|
||||
IC2d : Integer from Standard;
|
||||
Tol : Real from Standard;
|
||||
TolU, TolV : out Real from Standard);
|
||||
|
||||
fields
|
||||
-- the basic inpout geometry
|
||||
surf1 : HSurface from Adaptor3d;
|
||||
surf2 : HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
tcurv : HCurve from Adaptor3d;
|
||||
fevol : Function from Law;
|
||||
tevol : Function from Law;
|
||||
|
||||
|
||||
-- the basic output geometry
|
||||
pts1 : Pnt from gp;
|
||||
pts2 : Pnt from gp;
|
||||
istangent: Boolean from Standard;
|
||||
tg1 : Vec from gp;
|
||||
tg12d : Vec2d from gp;
|
||||
tg2 : Vec from gp;
|
||||
tg22d : Vec2d from gp;
|
||||
|
||||
-- auxiliary scalar
|
||||
param : Real from Standard;
|
||||
sg1 : Real from Standard;
|
||||
sg2 : Real from Standard;
|
||||
ray : Real from Standard;
|
||||
dray : Real from Standard;
|
||||
d2ray : Real from Standard;
|
||||
choix : Integer from Standard;
|
||||
myXOrder : Integer from Standard;
|
||||
myTOrder : Integer from Standard;
|
||||
xval : Vector from math;
|
||||
tval : Real from Standard;
|
||||
|
||||
|
||||
-- Auxiliary Geometry
|
||||
-- the normal
|
||||
d1u1, d1u2 : Vec from gp;
|
||||
d1v1, d1v2 : Vec from gp;
|
||||
d2u1, d2v1, d2uv1 : Vec from gp;
|
||||
d2u2, d2v2, d2uv2 : Vec from gp;
|
||||
dn1w, dn2w : Vec from gp;
|
||||
d2n1w, d2n2w : Vec from gp;
|
||||
nplan : Vec from gp;
|
||||
nsurf1 : Vec from gp;
|
||||
nsurf2 : Vec from gp;
|
||||
dns1u1, dns1u2 : Vec from gp;
|
||||
dns1v1, dns1v2 : Vec from gp;
|
||||
dnplan : Vec from gp;
|
||||
d2nplan : Vec from gp;
|
||||
dnsurf1 : Vec from gp;
|
||||
dnsurf2 : Vec from gp;
|
||||
|
||||
-- Auxilary math Object
|
||||
dndu1, dndu2 : Vec from gp;
|
||||
dndv1, dndv2 : Vec from gp;
|
||||
d2ndu1, d2ndu2 : Vec from gp;
|
||||
d2ndv1, d2ndv2 : Vec from gp;
|
||||
d2nduv1, d2nduv2 : Vec from gp;
|
||||
d2ndtu1, d2ndtu2 : Vec from gp;
|
||||
d2ndtv1, d2ndtv2 : Vec from gp;
|
||||
|
||||
E : Vector from math;
|
||||
DEDX : Matrix from math;
|
||||
DEDT : Vector from math;
|
||||
D2EDX2 : Tensor from BlendFunc;
|
||||
D2EDXDT : Matrix from math;
|
||||
D2EDT2 : Vector from math;
|
||||
|
||||
-- Information on sections
|
||||
minang : Real from Standard;
|
||||
maxang : Real from Standard;
|
||||
lengthmin: Real from Standard;
|
||||
lengthmax: Real from Standard;
|
||||
distmin : Real from Standard;
|
||||
mySShape : SectionShape from BlendFunc;
|
||||
myTConv : ParameterisationType from Convert;
|
||||
|
||||
end EvolRad;
|
2020
src/BlendFunc/BlendFunc_EvolRad.cxx
Executable file
2020
src/BlendFunc/BlendFunc_EvolRad.cxx
Executable file
File diff suppressed because it is too large
Load Diff
100
src/BlendFunc/BlendFunc_EvolRadInv.cdl
Executable file
100
src/BlendFunc/BlendFunc_EvolRadInv.cdl
Executable file
@@ -0,0 +1,100 @@
|
||||
-- File: BlendFunc_EvolRadInv.cdl
|
||||
-- Created: Tue Dec 21 18:18:43 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class EvolRadInv from BlendFunc
|
||||
|
||||
---Purpose:
|
||||
|
||||
inherits FuncInv from Blend
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
HCurve2d from Adaptor2d,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d,
|
||||
Function from Law
|
||||
|
||||
is
|
||||
|
||||
Create(S1,S2: HSurface from Adaptor3d; C: HCurve from Adaptor3d; Law: Function from Law)
|
||||
|
||||
returns EvolRadInv from BlendFunc;
|
||||
|
||||
|
||||
Set(me: in out; OnFirst: Boolean from Standard;
|
||||
COnSurf: HCurve2d from Adaptor2d)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard;
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
Set(me: in out; Choix: Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
surf1: HSurface from Adaptor3d;
|
||||
surf2: HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
csurf: HCurve2d from Adaptor2d;
|
||||
fevol: Function from Law;
|
||||
sg1 : Real from Standard;
|
||||
sg2 : Real from Standard;
|
||||
choix: Integer from Standard;
|
||||
first: Boolean from Standard;
|
||||
|
||||
end EvolRadInv;
|
436
src/BlendFunc/BlendFunc_EvolRadInv.cxx
Executable file
436
src/BlendFunc/BlendFunc_EvolRadInv.cxx
Executable file
@@ -0,0 +1,436 @@
|
||||
// File: BlendFunc_EvolRadInv.cxx
|
||||
// Created: Tue Dec 21 18:18:43 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1993
|
||||
|
||||
#include <BlendFunc_EvolRadInv.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
#define Eps 1.e-15
|
||||
|
||||
|
||||
BlendFunc_EvolRadInv::BlendFunc_EvolRadInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C,
|
||||
const Handle(Law_Function)& Law) :
|
||||
surf1(S1),surf2(S2),curv(C)
|
||||
{
|
||||
fevol = Law;
|
||||
}
|
||||
|
||||
void BlendFunc_EvolRadInv::Set(const Standard_Integer Choix)
|
||||
|
||||
{
|
||||
choix = Choix;
|
||||
switch (choix) {
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
sg1 = -1.;
|
||||
sg2 = -1.;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
sg1 = 1.;
|
||||
sg2 = -1.;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
sg1 = 1.;
|
||||
sg2 = 1.;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
{
|
||||
sg1 = -1.;
|
||||
sg2 = 1.;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sg1 = sg2 = -1.;
|
||||
}
|
||||
}
|
||||
|
||||
void BlendFunc_EvolRadInv::Set(const Standard_Boolean OnFirst,
|
||||
const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
first = OnFirst;
|
||||
csurf = C;
|
||||
}
|
||||
|
||||
Standard_Integer BlendFunc_EvolRadInv::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
void BlendFunc_EvolRadInv::GetTolerance(math_Vector& Tolerance,
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = csurf->Resolution(Tol);
|
||||
Tolerance(2) = curv->Resolution(Tol);
|
||||
if (first) {
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
Tolerance(3) = surf1->UResolution(Tol);
|
||||
Tolerance(4) = surf1->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BlendFunc_EvolRadInv::GetBounds(math_Vector& InfBound,
|
||||
math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = csurf->FirstParameter();
|
||||
InfBound(2) = curv->FirstParameter();
|
||||
SupBound(1) = csurf->LastParameter();
|
||||
SupBound(2) = curv->LastParameter();
|
||||
|
||||
if (first) {
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfBound(3) = surf1->FirstUParameter();
|
||||
InfBound(4) = surf1->FirstVParameter();
|
||||
SupBound(3) = surf1->LastUParameter();
|
||||
SupBound(4) = surf1->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_EvolRadInv::IsSolution(const math_Vector& Sol,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
math_Vector valsol(1,4);
|
||||
Value(Sol,valsol);
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
(valsol(2)*valsol(2) + valsol(3)*valsol(3) + valsol(4)*valsol(4)) <= Tol*Tol)
|
||||
return Standard_True;
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean BlendFunc_EvolRadInv::Value(const math_Vector& X,
|
||||
math_Vector& F)
|
||||
{
|
||||
const Standard_Real ray = fevol->Value(X(2));
|
||||
|
||||
gp_Pnt ptcur;
|
||||
gp_Vec d1cur;
|
||||
curv->D1(X(2),ptcur,d1cur);
|
||||
|
||||
const gp_Vec nplan = d1cur.Normalized();
|
||||
const Standard_Real theD = -(nplan.XYZ().Dot(ptcur.XYZ()));
|
||||
|
||||
const gp_Pnt2d pt2d(csurf->Value(X(1)));
|
||||
|
||||
gp_Pnt pts1,pts2;
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
if (first)
|
||||
{
|
||||
surf1->D1(pt2d.X(),pt2d.Y(),pts1,d1u1,d1v1);
|
||||
surf2->D1(X(3),X(4),pts2,d1u2,d1v2);
|
||||
}
|
||||
else
|
||||
{
|
||||
surf1->D1(X(3),X(4),pts1,d1u1,d1v1);
|
||||
surf2->D1(pt2d.X(),pt2d.Y(),pts2,d1u2,d1v2);
|
||||
}
|
||||
|
||||
F(1) = (nplan.X() * (pts1.X() + pts2.X()) +
|
||||
nplan.Y() * (pts1.Y() + pts2.Y()) +
|
||||
nplan.Z() * (pts1.Z() + pts2.Z())) /2. + theD;
|
||||
|
||||
gp_Vec ns1 = d1u1.Crossed(d1v1);
|
||||
if (ns1.Magnitude() < Eps) {
|
||||
if (first) BlendFunc::ComputeNormal(surf1, pt2d, ns1);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf1, P, ns1);
|
||||
}
|
||||
}
|
||||
|
||||
gp_Vec ns2 = d1u2.Crossed(d1v2).XYZ();
|
||||
if (ns2.Magnitude() < Eps) {
|
||||
if (!first) BlendFunc::ComputeNormal(surf2, pt2d, ns2);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf2, P, ns2);
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Vec ncrossns1 = nplan.Crossed(ns1);
|
||||
const gp_Vec ncrossns2 = nplan.Crossed(ns2);
|
||||
Standard_Real norm1 = ncrossns1.Magnitude();
|
||||
Standard_Real norm2 = ncrossns2.Magnitude();
|
||||
|
||||
if (norm1 < Eps) {
|
||||
norm1 = 1.;
|
||||
//#if DEB
|
||||
// cout << "EvolRadInv : Surface singuliere " << endl;
|
||||
//#endif
|
||||
}
|
||||
if (norm2 < Eps) {
|
||||
norm2 = 1.;
|
||||
//#if DEB
|
||||
// cout << "EvolRadInv : Surface singuliere " << endl;
|
||||
//#endif
|
||||
}
|
||||
|
||||
gp_Vec resul;
|
||||
const Standard_Real ndotns1 = nplan.Dot(ns1);
|
||||
const Standard_Real ndotns2 = nplan.Dot(ns2);
|
||||
ns1.SetLinearForm(ndotns1/norm1,nplan, -1./norm1,ns1);
|
||||
ns2.SetLinearForm(ndotns2/norm2,nplan, -1./norm2,ns2);
|
||||
resul.SetLinearForm(sg1*ray,ns1,-1.,pts2.XYZ(),-sg2*ray,ns2,pts1.XYZ());
|
||||
F(2) = resul.X();
|
||||
F(3) = resul.Y();
|
||||
F(4) = resul.Z();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_EvolRadInv::Derivatives(const math_Vector& X,
|
||||
math_Matrix& D)
|
||||
{
|
||||
math_Vector F(1, 4);
|
||||
return Values (X, F, D);
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_EvolRadInv::Values(const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D)
|
||||
{
|
||||
Standard_Real ray,dray;
|
||||
fevol->D1(X(2),ray,dray);
|
||||
|
||||
gp_Pnt ptcur;
|
||||
gp_Vec d1cur,d2cur;
|
||||
curv->D2(X(2),ptcur,d1cur,d2cur);
|
||||
|
||||
const Standard_Real normtgcur = d1cur.Magnitude();
|
||||
const gp_Vec nplan = d1cur.Normalized();
|
||||
const Standard_Real theD = -(nplan.XYZ().Dot(ptcur.XYZ()));
|
||||
|
||||
gp_Vec dnplan;
|
||||
dnplan.SetLinearForm(-nplan.Dot(d2cur),nplan,d2cur);
|
||||
dnplan /= normtgcur;
|
||||
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
|
||||
gp_Pnt pts1,pts2;
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
gp_Vec d2u1,d2v1,d2u2,d2v2,d2uv1,d2uv2;
|
||||
gp_Vec temp;
|
||||
if (first)
|
||||
{
|
||||
surf1->D2(p2d.X(),p2d.Y(),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(X(3),X(4),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
|
||||
temp.SetLinearForm(v2d.X(),d1u1,v2d.Y(),d1v1);
|
||||
D(1,1) = nplan.Dot(temp)/2.;
|
||||
temp.SetXYZ(0.5*(pts1.XYZ()+pts2.XYZ())-ptcur.XYZ());
|
||||
D(1,2) = dnplan.Dot(temp) - normtgcur;
|
||||
D(1,3) = nplan.Dot(d1u2)/2.;
|
||||
D(1,4) = nplan.Dot(d1v2)/2.;
|
||||
}
|
||||
else
|
||||
{
|
||||
surf1->D2(X(3),X(4),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(p2d.X(),p2d.Y(),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
|
||||
temp.SetLinearForm(v2d.X(),d1u2,v2d.Y(),d1v2);
|
||||
D(1,1) = nplan.Dot(temp)/2.;
|
||||
temp.SetXYZ(0.5*(pts1.XYZ()+pts2.XYZ())-ptcur.XYZ());
|
||||
D(1,2) = dnplan.Dot(temp) - normtgcur;
|
||||
D(1,3) = nplan.Dot(d1u1)/2.;
|
||||
D(1,4) = nplan.Dot(d1v1)/2.;
|
||||
}
|
||||
|
||||
F(1) = (nplan.X()* (pts1.X() + pts2.X()) +
|
||||
nplan.Y()* (pts1.Y() + pts2.Y()) +
|
||||
nplan.Z()* (pts1.Z() + pts2.Z())) /2. + theD;
|
||||
|
||||
gp_Vec ns1 = d1u1.Crossed(d1v1);
|
||||
if (ns1.Magnitude() < Eps) {
|
||||
if (first) BlendFunc::ComputeNormal(surf1, p2d, ns1);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf1, P, ns1);
|
||||
}
|
||||
}
|
||||
|
||||
gp_Vec ns2 = d1u2.Crossed(d1v2);
|
||||
if (ns2.Magnitude() < Eps) {
|
||||
if (!first) BlendFunc::ComputeNormal(surf2, p2d, ns2);
|
||||
else {
|
||||
gp_Pnt2d P(X(3), X(4));
|
||||
BlendFunc::ComputeNormal(surf2, P, ns2);
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Vec ncrossns1 = nplan.Crossed(ns1);
|
||||
const gp_Vec ncrossns2 = nplan.Crossed(ns2);
|
||||
Standard_Real norm1 = ncrossns1.Magnitude();
|
||||
Standard_Real norm2 = ncrossns2.Magnitude();
|
||||
if (norm1 < Eps) {
|
||||
norm1 = 1.;
|
||||
//#if DEB
|
||||
// cout << "EvolRadInv : Surface singuliere " << endl;
|
||||
//#endif
|
||||
}
|
||||
if (norm2 < Eps) {
|
||||
norm2 = 1.;
|
||||
//#if DEB
|
||||
// cout << "EvolRadInv : Surface singuliere " << endl;
|
||||
//#endif
|
||||
}
|
||||
|
||||
gp_Vec resul1,resul2;
|
||||
Standard_Real grosterme;
|
||||
|
||||
const Standard_Real ndotns1 = nplan.Dot(ns1);
|
||||
const Standard_Real ndotns2 = nplan.Dot(ns2);
|
||||
temp.SetLinearForm(ndotns1/norm1,nplan, -1./norm1,ns1);
|
||||
resul1.SetLinearForm(sg1*ray,temp,gp_Vec(pts2,pts1));
|
||||
temp.SetLinearForm(ndotns2/norm2,nplan,-1./norm2,ns2);
|
||||
resul1.Subtract(sg2*ray*temp);
|
||||
|
||||
F(2) = resul1.X();
|
||||
F(3) = resul1.Y();
|
||||
F(4) = resul1.Z();
|
||||
|
||||
// Derivee par rapport a u1
|
||||
|
||||
temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul1.SetLinearForm
|
||||
(-sg1*ray/norm1*(grosterme*ndotns1-nplan.Dot(temp)),nplan,
|
||||
sg1*ray*grosterme/norm1,ns1,
|
||||
-sg1*ray/norm1,temp,
|
||||
d1u1);
|
||||
|
||||
|
||||
// Derivee par rapport a v1
|
||||
|
||||
temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul2.SetLinearForm
|
||||
(-sg1*ray/norm1*(grosterme*ndotns1-nplan.Dot(temp)),nplan,
|
||||
sg1*ray*grosterme/norm1,ns1,
|
||||
-sg1*ray/norm1,temp,
|
||||
d1v1);
|
||||
|
||||
if (first) {
|
||||
D(2,1) = v2d.X()*resul1.X() + v2d.Y()*resul2.X();
|
||||
D(3,1) = v2d.X()*resul1.Y() + v2d.Y()*resul2.Y();
|
||||
D(4,1) = v2d.X()*resul1.Z() + v2d.Y()*resul2.Z();
|
||||
}
|
||||
else {
|
||||
D(2,3) = resul1.X();
|
||||
D(3,3) = resul1.Y();
|
||||
D(4,3) = resul1.Z();
|
||||
|
||||
D(2,4) = resul2.X();
|
||||
D(3,4) = resul2.Y();
|
||||
D(4,4) = resul2.Z();
|
||||
}
|
||||
|
||||
// derivee par rapport a w (parametre sur ligne guide)
|
||||
|
||||
grosterme = ncrossns1.Dot(dnplan.Crossed(ns1))/norm1/norm1;
|
||||
resul1.SetLinearForm(-sg1/norm1*(grosterme*ndotns1-dnplan.Dot(ns1)),nplan,
|
||||
sg1*ndotns1/norm1,dnplan,
|
||||
sg1*grosterme/norm1,ns1);
|
||||
|
||||
|
||||
grosterme = ncrossns2.Dot(dnplan.Crossed(ns2))/norm2/norm2;
|
||||
resul2.SetLinearForm(sg2/norm2*(grosterme*ndotns2-dnplan.Dot(ns2)),nplan,
|
||||
-sg2*ndotns2/norm2,dnplan,
|
||||
-sg2*grosterme/norm2,ns2);
|
||||
|
||||
|
||||
D(2,2) = ray*(resul1.X() + resul2.X());
|
||||
D(3,2) = ray*(resul1.Y() + resul2.Y());
|
||||
D(4,2) = ray*(resul1.Z() + resul2.Z());
|
||||
|
||||
temp.SetLinearForm(sg1*ndotns1/norm1 - sg2*ndotns2/norm2,nplan,
|
||||
-sg1/norm1,ns1,
|
||||
sg2/norm2,ns2);
|
||||
|
||||
D(2,2) += dray*temp.X();
|
||||
D(3,2) += dray*temp.Y();
|
||||
D(4,2) += dray*temp.Z();
|
||||
|
||||
|
||||
|
||||
// Derivee par rapport a u2
|
||||
temp = d2u2.Crossed(d1v2).Added(d1u2.Crossed(d2uv2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul1.SetLinearForm(sg2*ray/norm2*(grosterme*ndotns2-nplan.Dot(temp)),nplan,
|
||||
-sg2*ray*grosterme/norm2,ns2,
|
||||
sg2*ray/norm2,temp);
|
||||
resul1.Subtract(d1u2);
|
||||
|
||||
// Derivee par rapport a v2
|
||||
temp = d2uv2.Crossed(d1v2).Added(d1u2.Crossed(d2v2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul2.SetLinearForm(sg2*ray/norm2*(grosterme*ndotns2-nplan.Dot(temp)),nplan,
|
||||
-sg2*ray*grosterme/norm2,ns2,
|
||||
sg2*ray/norm2,temp);
|
||||
resul2.Subtract(d1v2);
|
||||
|
||||
if (!first) {
|
||||
D(2,1) = v2d.X()*resul1.X() + v2d.Y()*resul2.X();
|
||||
D(3,1) = v2d.X()*resul1.Y() + v2d.Y()*resul2.Y();
|
||||
D(4,1) = v2d.X()*resul1.Z() + v2d.Y()*resul2.Z();
|
||||
}
|
||||
else {
|
||||
D(2,3) = resul1.X();
|
||||
D(3,3) = resul1.Y();
|
||||
D(4,3) = resul1.Z();
|
||||
|
||||
D(2,4) = resul2.X();
|
||||
D(3,4) = resul2.Y();
|
||||
D(4,4) = resul2.Z();
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
298
src/BlendFunc/BlendFunc_Ruled.cdl
Executable file
298
src/BlendFunc/BlendFunc_Ruled.cdl
Executable file
@@ -0,0 +1,298 @@
|
||||
-- File: BlendFunc_Ruled.cdl
|
||||
-- Created: Thu Dec 2 10:22:10 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class Ruled from BlendFunc
|
||||
|
||||
inherits Function from Blend
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
Ax1 from gp,
|
||||
Vec from gp,
|
||||
Vec2d from gp,
|
||||
Pnt from gp,
|
||||
Point from Blend,
|
||||
Array1OfPnt from TColgp,
|
||||
Array1OfVec from TColgp,
|
||||
Array1OfPnt2d from TColgp,
|
||||
Array1OfVec2d from TColgp,
|
||||
Array1OfReal from TColStd,
|
||||
Array1OfInteger from TColStd,
|
||||
Shape from GeomAbs,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d
|
||||
|
||||
is
|
||||
|
||||
Create(S1,S2: HSurface from Adaptor3d; C: HCurve from Adaptor3d)
|
||||
|
||||
returns Ruled from BlendFunc;
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static ;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Set(me: in out; Param: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
Set(me: in out; First, Last: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
GetMinimalDistance(me)
|
||||
---Purpose: Returns the minimal Distance beetween two
|
||||
-- extremitys of calculed sections.
|
||||
returns Real from Standard;
|
||||
|
||||
|
||||
|
||||
PointOnS1(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
PointOnS2(me)
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
IsTangencyPoint(me)
|
||||
|
||||
returns Boolean from Standard
|
||||
;
|
||||
|
||||
TangentOnS1(me)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
Tangent2dOnS1(me)
|
||||
|
||||
returns Vec2d from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
TangentOnS2(me)
|
||||
|
||||
returns Vec from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
Tangent2dOnS2(me)
|
||||
|
||||
returns Vec2d from gp
|
||||
---C++: return const&
|
||||
;
|
||||
|
||||
|
||||
Tangent(me; U1,V1,U2,V2: Real from Standard;
|
||||
TgFirst,TgLast,NormFirst,NormLast: out Vec from gp)
|
||||
|
||||
---Purpose: Returns the tangent vector at the section,
|
||||
-- at the beginning and the end of the section, and
|
||||
-- returns the normal (of the surfaces) at
|
||||
-- these points.
|
||||
|
||||
;
|
||||
|
||||
|
||||
-- methodes hors template (en plus du create)
|
||||
|
||||
GetSection(me: in out; Param: Real from Standard;
|
||||
U1 ,V1,U2,V2: Real from Standard;
|
||||
tabP : out Array1OfPnt from TColgp;
|
||||
tabV : out Array1OfVec from TColgp)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
--- Pour les approximations
|
||||
|
||||
IsRational(me) returns Boolean
|
||||
---Purpose: Returns False
|
||||
is static;
|
||||
|
||||
GetSectionSize(me) returns Real
|
||||
---Purpose: Returns the length of the maximum section
|
||||
is static;
|
||||
|
||||
GetMinimalWeight(me; Weigths : out Array1OfReal from TColStd)
|
||||
---Purpose: Compute the minimal value of weight for each poles
|
||||
-- of all sections.
|
||||
is static;
|
||||
|
||||
NbIntervals(me; S : Shape from GeomAbs) returns Integer
|
||||
---Purpose: Returns the number of intervals for continuity
|
||||
-- <S>. May be one if Continuity(me) >= <S>
|
||||
is static;
|
||||
|
||||
Intervals(me; T : in out Array1OfReal from TColStd;
|
||||
S : Shape from GeomAbs)
|
||||
---Purpose: Stores in <T> the parameters bounding the intervals
|
||||
-- of continuity <S>.
|
||||
--
|
||||
-- The array must provide enough room to accomodate
|
||||
-- for the parameters. i.e. T.Length() > NbIntervals()
|
||||
-- raises
|
||||
-- OutOfRange from Standard
|
||||
is static;
|
||||
|
||||
GetShape(me: in out;
|
||||
NbPoles : out Integer from Standard;
|
||||
NbKnots : out Integer from Standard;
|
||||
Degree : out Integer from Standard;
|
||||
NbPoles2d : out Integer from Standard)
|
||||
|
||||
is static;
|
||||
|
||||
GetTolerance(me;
|
||||
BoundTol, SurfTol, AngleTol : Real;
|
||||
Tol3d : out Vector;
|
||||
Tol1D : out Vector )
|
||||
---Purpose: Returns the tolerance to reach in approximation
|
||||
-- to respecte
|
||||
-- BoundTol error at the Boundary
|
||||
-- AngleTol tangent error at the Boundary
|
||||
-- SurfTol error inside the surface.
|
||||
is static;
|
||||
|
||||
Knots(me: in out; TKnots: out Array1OfReal from TColStd)
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Mults(me: in out; TMults: out Array1OfInteger from TColStd)
|
||||
|
||||
is static;
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
D2Poles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
D2Poles2d: out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd;
|
||||
D2Weigths: out Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: Used for the first and last section
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
DPoles : out Array1OfVec from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
DPoles2d : out Array1OfVec2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd;
|
||||
DWeigths : out Array1OfReal from TColStd)
|
||||
|
||||
---Purpose: Used for the first and last section
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Section(me: in out ; P: Point from Blend;
|
||||
Poles : out Array1OfPnt from TColgp;
|
||||
Poles2d : out Array1OfPnt2d from TColgp;
|
||||
Weigths : out Array1OfReal from TColStd)
|
||||
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
AxeRot(me: in out; Prm: Real from Standard)
|
||||
returns Ax1 from gp
|
||||
is static;
|
||||
|
||||
Resolution(me;
|
||||
IC2d : Integer from Standard;
|
||||
Tol : Real from Standard;
|
||||
TolU, TolV : out Real from Standard);
|
||||
|
||||
fields
|
||||
|
||||
surf1 : HSurface from Adaptor3d;
|
||||
surf2 : HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
pts1 : Pnt from gp;
|
||||
pts2 : Pnt from gp;
|
||||
istangent: Boolean from Standard;
|
||||
tg1 : Vec from gp;
|
||||
tg12d : Vec2d from gp;
|
||||
tg2 : Vec from gp;
|
||||
tg22d : Vec2d from gp;
|
||||
|
||||
ptgui : Pnt from gp;
|
||||
d1gui : Vec from gp;
|
||||
d2gui : Vec from gp;
|
||||
nplan : Vec from gp;
|
||||
normtg : Real from Standard;
|
||||
theD : Real from Standard;
|
||||
distmin : Real from Standard;
|
||||
|
||||
end Ruled;
|
716
src/BlendFunc/BlendFunc_Ruled.cxx
Executable file
716
src/BlendFunc/BlendFunc_Ruled.cxx
Executable file
@@ -0,0 +1,716 @@
|
||||
// File: BlendFunc_Ruled.cxx
|
||||
// Created: Thu Dec 2 10:22:10 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1993
|
||||
|
||||
#include <BlendFunc_Ruled.ixx>
|
||||
|
||||
#include <math_Gauss.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <BlendFunc.hxx>
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
|
||||
BlendFunc_Ruled::BlendFunc_Ruled(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C) :
|
||||
|
||||
surf1(S1),surf2(S2),curv(C),
|
||||
istangent(Standard_True),
|
||||
distmin(RealLast())
|
||||
{}
|
||||
|
||||
Standard_Integer BlendFunc_Ruled::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
void BlendFunc_Ruled::Set(const Standard_Real Param)
|
||||
{
|
||||
curv->D2(Param,ptgui,d1gui,d2gui);
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
|
||||
istangent = Standard_True;
|
||||
}
|
||||
|
||||
void BlendFunc_Ruled::Set(const Standard_Real First,
|
||||
const Standard_Real Last)
|
||||
{
|
||||
Standard_NotImplemented::Raise("BlendFunc_Ruled::Set");
|
||||
}
|
||||
|
||||
void BlendFunc_Ruled::GetTolerance(math_Vector& Tolerance,
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = surf1->UResolution(Tol);
|
||||
Tolerance(2) = surf1->VResolution(Tol);
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
|
||||
void BlendFunc_Ruled::GetBounds(math_Vector& InfBound,
|
||||
math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = surf1->FirstUParameter();
|
||||
InfBound(2) = surf1->FirstVParameter();
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(1) = surf1->LastUParameter();
|
||||
SupBound(2) = surf1->LastVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
|
||||
for(Standard_Integer i = 1; i <= 4; i++){
|
||||
if(!Precision::IsInfinite(InfBound(i)) &&
|
||||
!Precision::IsInfinite(SupBound(i))) {
|
||||
const Standard_Real range = (SupBound(i) - InfBound(i));
|
||||
InfBound(i) -= range;
|
||||
SupBound(i) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::IsSolution(const math_Vector& Sol,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
math_Vector valsol(1,4),secmember(1,4);
|
||||
math_Matrix gradsol(1,4,1,4);
|
||||
|
||||
gp_Vec dnplan,d1u1,d1v1,d1u2,d1v2,temp,ns,ncrossns;
|
||||
Standard_Real norm,ndotns,grosterme;
|
||||
|
||||
Values(Sol,valsol,gradsol);
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
Abs(valsol(2)) <= Tol &&
|
||||
Abs(valsol(3)) <= Tol &&
|
||||
Abs(valsol(4)) <= Tol) {
|
||||
|
||||
|
||||
// Calcul des tangentes
|
||||
|
||||
surf1->D1(Sol(1),Sol(2),pts1,d1u1,d1v1);
|
||||
surf2->D1(Sol(3),Sol(4),pts2,d1u2,d1v2);
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,
|
||||
-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
secmember(1) = normtg - dnplan.Dot(gp_Vec(ptgui,pts1));
|
||||
secmember(2) = normtg - dnplan.Dot(gp_Vec(ptgui,pts2));
|
||||
|
||||
ns = d1u1.Crossed(d1v1);
|
||||
ncrossns = nplan.Crossed(ns);
|
||||
ndotns = nplan.Dot(ns);
|
||||
norm = ncrossns.Magnitude();
|
||||
|
||||
// Derivee de nor1 par rapport au parametre sur la ligne guide
|
||||
grosterme = ncrossns.Dot(dnplan.Crossed(ns))/norm/norm;
|
||||
temp.SetLinearForm((dnplan.Dot(ns)-grosterme*ndotns)/norm,nplan,
|
||||
ndotns/norm,dnplan,
|
||||
grosterme/norm,ns);
|
||||
|
||||
|
||||
secmember(3) = -(temp.Dot(gp_Vec(pts1,pts2)));
|
||||
|
||||
ns = d1u2.Crossed(d1v2);
|
||||
ncrossns = nplan.Crossed(ns);
|
||||
ndotns = nplan.Dot(ns);
|
||||
norm = ncrossns.Magnitude();
|
||||
|
||||
// Derivee de nor2 par rapport au parametre sur la ligne guide
|
||||
grosterme = ncrossns.Dot(dnplan.Crossed(ns))/norm/norm;
|
||||
temp.SetLinearForm((dnplan.Dot(ns)-grosterme*ndotns)/norm,nplan,
|
||||
ndotns/norm,dnplan,
|
||||
grosterme/norm,ns);
|
||||
|
||||
secmember(4) = -(temp.Dot(gp_Vec(pts1,pts2)));
|
||||
|
||||
math_Gauss Resol(gradsol);
|
||||
if (Resol.IsDone()) {
|
||||
|
||||
Resol.Solve(secmember);
|
||||
|
||||
tg1.SetLinearForm(secmember(1),d1u1,secmember(2),d1v1);
|
||||
tg2.SetLinearForm(secmember(3),d1u2,secmember(4),d1v2);
|
||||
tg12d.SetCoord(secmember(1),secmember(2));
|
||||
tg22d.SetCoord(secmember(3),secmember(4));
|
||||
istangent = Standard_False;
|
||||
}
|
||||
else {
|
||||
istangent = Standard_True;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
istangent = Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real BlendFunc_Ruled::GetMinimalDistance() const
|
||||
{
|
||||
return distmin;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::Value(const math_Vector& X,
|
||||
math_Vector& F)
|
||||
{
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
surf1->D1(X(1),X(2),pts1,d1u1,d1v1);
|
||||
surf2->D1(X(3),X(4),pts2,d1u2,d1v2);
|
||||
|
||||
const gp_Vec temp(pts1,pts2);
|
||||
|
||||
gp_Vec ns1 = d1u1.Crossed(d1v1);
|
||||
gp_Vec ns2 = d1u2.Crossed(d1v2);
|
||||
|
||||
const Standard_Real norm1 = nplan.Crossed(ns1).Magnitude();
|
||||
const Standard_Real norm2 = nplan.Crossed(ns2).Magnitude();
|
||||
ns1.SetLinearForm(nplan.Dot(ns1)/norm1,nplan, -1./norm1,ns1);
|
||||
ns2.SetLinearForm(nplan.Dot(ns2)/norm2,nplan, -1./norm2,ns2);
|
||||
|
||||
F(1) = (nplan.XYZ().Dot(pts1.XYZ())) + theD;
|
||||
F(2) = (nplan.XYZ().Dot(pts2.XYZ())) + theD;
|
||||
|
||||
F(3) = temp.Dot(ns1);
|
||||
F(4) = temp.Dot(ns2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::Derivatives(const math_Vector& X,
|
||||
math_Matrix& D)
|
||||
{
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
gp_Vec d2u1,d2v1,d2uv1,d2u2,d2v2,d2uv2;
|
||||
gp_Vec nor1,nor2,p1p2;
|
||||
gp_Vec ns1,ns2,ncrossns1,ncrossns2,resul,temp;
|
||||
|
||||
Standard_Real norm1,norm2,ndotns1,ndotns2,grosterme;
|
||||
|
||||
surf1->D2(X(1),X(2),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(X(3),X(4),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
|
||||
D(1,1) = nplan.Dot(d1u1);
|
||||
D(1,2) = nplan.Dot(d1v1);
|
||||
D(1,3) = 0.;
|
||||
D(1,4) = 0.;
|
||||
|
||||
D(2,1) = 0.;
|
||||
D(2,2) = 0.;
|
||||
D(2,3) = nplan.Dot(d1u2);
|
||||
D(2,4) = nplan.Dot(d1v2);
|
||||
|
||||
ns1 = d1u1.Crossed(d1v1);
|
||||
ns2 = d1u2.Crossed(d1v2);
|
||||
ncrossns1 = nplan.Crossed(ns1);
|
||||
ncrossns2 = nplan.Crossed(ns2);
|
||||
norm1 = ncrossns1.Magnitude();
|
||||
norm2 = ncrossns2.Magnitude();
|
||||
|
||||
ndotns1 = nplan.Dot(ns1);
|
||||
ndotns2 = nplan.Dot(ns2);
|
||||
|
||||
nor1.SetLinearForm(ndotns1/norm1,nplan, -1./norm1,ns1);
|
||||
nor2.SetLinearForm(ndotns2/norm2,nplan, -1./norm2,ns2);
|
||||
|
||||
p1p2 = gp_Vec(pts1,pts2);
|
||||
|
||||
// Derivee de nor1 par rapport a u1
|
||||
temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul.SetLinearForm(-(grosterme*ndotns1-nplan.Dot(temp))/norm1,nplan,
|
||||
grosterme/norm1,ns1,
|
||||
-1./norm1,temp);
|
||||
|
||||
D(3,1) = -(d1u1.Dot(nor1)) + p1p2.Dot(resul);
|
||||
|
||||
// Derivee par rapport a v1
|
||||
temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul.SetLinearForm(-(grosterme*ndotns1-nplan.Dot(temp))/norm1,nplan,
|
||||
grosterme/norm1,ns1,
|
||||
-1./norm1,temp);
|
||||
|
||||
D(3,2) = -(d1v1.Dot(nor1)) + p1p2.Dot(resul);
|
||||
|
||||
D(3,3) = d1u2.Dot(nor1);
|
||||
D(3,4) = d1v2.Dot(nor1);
|
||||
|
||||
|
||||
D(4,1) = -(d1u1.Dot(nor2));
|
||||
D(4,2) = -(d1v1.Dot(nor2));
|
||||
|
||||
// Derivee de nor2 par rapport a u2
|
||||
temp = d2u2.Crossed(d1v2).Added(d1u2.Crossed(d2uv2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul.SetLinearForm(-(grosterme*ndotns2-nplan.Dot(temp))/norm2,nplan,
|
||||
grosterme/norm2,ns2,
|
||||
-1./norm2,temp);
|
||||
|
||||
D(4,3) = d1u2.Dot(nor2) + p1p2.Dot(resul);
|
||||
|
||||
// Derivee par rapport a v2
|
||||
temp = d2uv2.Crossed(d1v2).Added(d1u2.Crossed(d2v2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul.SetLinearForm(-(grosterme*ndotns2-nplan.Dot(temp))/norm2,nplan,
|
||||
grosterme/norm2,ns2,
|
||||
-1./norm2,temp);
|
||||
|
||||
D(4,4) = d1v2.Dot(nor2) + p1p2.Dot(resul);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::Values(const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D)
|
||||
{
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
gp_Vec d2u1,d2v1,d2uv1,d2u2,d2v2,d2uv2;
|
||||
gp_Vec nor1,nor2,p1p2;
|
||||
gp_Vec ns1,ns2,ncrossns1,ncrossns2,resul,temp;
|
||||
|
||||
Standard_Real norm1,norm2,ndotns1,ndotns2,grosterme;
|
||||
|
||||
surf1->D2(X(1),X(2),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(X(3),X(4),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
|
||||
p1p2 = gp_Vec(pts1,pts2);
|
||||
|
||||
ns1 = d1u1.Crossed(d1v1);
|
||||
ns2 = d1u2.Crossed(d1v2);
|
||||
ncrossns1 = nplan.Crossed(ns1);
|
||||
ncrossns2 = nplan.Crossed(ns2);
|
||||
norm1 = ncrossns1.Magnitude();
|
||||
norm2 = ncrossns2.Magnitude();
|
||||
|
||||
ndotns1 = nplan.Dot(ns1);
|
||||
ndotns2 = nplan.Dot(ns2);
|
||||
|
||||
nor1.SetLinearForm(ndotns1/norm1,nplan,-1./norm1,ns1);
|
||||
nor2.SetLinearForm(ndotns2/norm2,nplan,-1./norm2,ns2);
|
||||
|
||||
F(1) = (nplan.XYZ().Dot(pts1.XYZ())) + theD;
|
||||
F(2) = (nplan.XYZ().Dot(pts2.XYZ())) + theD;
|
||||
F(3) = p1p2.Dot(nor1);
|
||||
F(4) = p1p2.Dot(nor2);
|
||||
|
||||
D(1,1) = nplan.Dot(d1u1);
|
||||
D(1,2) = nplan.Dot(d1v1);
|
||||
D(1,3) = 0.;
|
||||
D(1,4) = 0.;
|
||||
|
||||
D(2,1) = 0.;
|
||||
D(2,2) = 0.;
|
||||
D(2,3) = nplan.Dot(d1u2);
|
||||
D(2,4) = nplan.Dot(d1v2);
|
||||
|
||||
|
||||
// Derivee de nor1 par rapport a u1
|
||||
temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul.SetLinearForm(-(grosterme*ndotns1-nplan.Dot(temp))/norm1,nplan,
|
||||
grosterme/norm1,ns1,
|
||||
-1./norm1,temp);
|
||||
|
||||
D(3,1) = -(d1u1.Dot(nor1)) + p1p2.Dot(resul);
|
||||
|
||||
// Derivee par rapport a v1
|
||||
temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul.SetLinearForm(-(grosterme*ndotns1-nplan.Dot(temp))/norm1,nplan,
|
||||
grosterme/norm1,ns1,
|
||||
-1./norm1,temp);
|
||||
|
||||
D(3,2) = -(d1v1.Dot(nor1)) + p1p2.Dot(resul);
|
||||
|
||||
D(3,3) = d1u2.Dot(nor1);
|
||||
D(3,4) = d1v2.Dot(nor1);
|
||||
|
||||
D(4,1) = -(d1u1.Dot(nor2));
|
||||
D(4,2) = -(d1v1.Dot(nor2));
|
||||
|
||||
// Derivee de nor2 par rapport a u2
|
||||
temp = d2u2.Crossed(d1v2).Added(d1u2.Crossed(d2uv2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul.SetLinearForm(-(grosterme*ndotns2-nplan.Dot(temp))/norm2,nplan,
|
||||
grosterme/norm2,ns2,
|
||||
-1./norm2,temp);
|
||||
|
||||
D(4,3) = d1u2.Dot(nor2) + p1p2.Dot(resul);
|
||||
|
||||
// Derivee par rapport a v2
|
||||
temp = d2uv2.Crossed(d1v2).Added(d1u2.Crossed(d2v2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul.SetLinearForm(-(grosterme*ndotns2-nplan.Dot(temp))/norm2,nplan,
|
||||
grosterme/norm2,ns2,
|
||||
-1./norm2,temp);
|
||||
|
||||
D(4,4) = d1v2.Dot(nor2) + p1p2.Dot(resul);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
void BlendFunc_Ruled::Tangent(const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
gp_Vec& TgF,
|
||||
gp_Vec& TgL,
|
||||
gp_Vec& NmF,
|
||||
gp_Vec& NmL) const
|
||||
{
|
||||
gp_Pnt bid;
|
||||
gp_Vec d1u,d1v;
|
||||
gp_Vec ns1;
|
||||
|
||||
surf2->D1(U2,V2,bid,d1u,d1v);
|
||||
NmL = d1u.Crossed(d1v);
|
||||
|
||||
surf1->D1(U1,V1,bid,d1u,d1v);
|
||||
NmF = ns1 = d1u.Crossed(d1v);
|
||||
|
||||
TgF = TgL = gp_Vec(pts1,pts2);
|
||||
}
|
||||
|
||||
const gp_Pnt& BlendFunc_Ruled::PointOnS1 () const
|
||||
{
|
||||
return pts1;
|
||||
}
|
||||
|
||||
const gp_Pnt& BlendFunc_Ruled::PointOnS2 () const
|
||||
{
|
||||
return pts2;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::IsTangencyPoint () const
|
||||
{
|
||||
return istangent;
|
||||
}
|
||||
|
||||
const gp_Vec& BlendFunc_Ruled::TangentOnS1 () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_Ruled::TangentOnS1");
|
||||
return tg1;
|
||||
}
|
||||
|
||||
const gp_Vec& BlendFunc_Ruled::TangentOnS2 () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_Ruled::TangentOnS2");
|
||||
return tg2;
|
||||
}
|
||||
const gp_Vec2d& BlendFunc_Ruled::Tangent2dOnS1 () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_Ruled::Tangent2dOnS1");
|
||||
return tg12d;
|
||||
}
|
||||
|
||||
const gp_Vec2d& BlendFunc_Ruled::Tangent2dOnS2 () const
|
||||
{
|
||||
if (istangent)
|
||||
Standard_DomainError::Raise("BlendFunc_Ruled::Tangent2dOnS2");
|
||||
return tg22d;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::GetSection(const Standard_Real Param,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2,
|
||||
TColgp_Array1OfPnt& tabP,
|
||||
TColgp_Array1OfVec& tabV)
|
||||
|
||||
{
|
||||
Standard_Integer NbPoint=tabP.Length();
|
||||
if (NbPoint != tabV.Length() || NbPoint < 2) {Standard_RangeError::Raise();}
|
||||
|
||||
Standard_Integer i, lowp = tabP.Lower(), lowv = tabV.Lower();
|
||||
|
||||
|
||||
gp_Vec dnplan,d1u1,d1v1,d1u2,d1v2,temp,ns,ncrossns;
|
||||
Standard_Real norm,ndotns,grosterme,lambda;
|
||||
|
||||
math_Vector sol(1,4),valsol(1,4),secmember(1,4);
|
||||
math_Matrix gradsol(1,4,1,4);
|
||||
|
||||
curv->D2(Param,ptgui,d1gui,d2gui);
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
|
||||
|
||||
sol(1) = U1; sol(2) = V1; sol(3) = U2; sol(4) = V2;
|
||||
|
||||
Values(sol,valsol,gradsol);
|
||||
|
||||
surf1->D1(sol(1),sol(2),pts1,d1u1,d1v1);
|
||||
surf2->D1(sol(3),sol(4),pts2,d1u2,d1v2);
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,
|
||||
-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
secmember(1) = normtg - dnplan.Dot(gp_Vec(ptgui,pts1));
|
||||
secmember(2) = normtg - dnplan.Dot(gp_Vec(ptgui,pts2));
|
||||
|
||||
ns = d1u1.Crossed(d1v1);
|
||||
ncrossns = nplan.Crossed(ns);
|
||||
ndotns = nplan.Dot(ns);
|
||||
norm = ncrossns.Magnitude();
|
||||
|
||||
// Derivee de nor1 par rapport au parametre sur la ligne guide
|
||||
grosterme = ncrossns.Dot(dnplan.Crossed(ns))/norm/norm;
|
||||
temp.SetLinearForm((dnplan.Dot(ns)-grosterme*ndotns)/norm,nplan,
|
||||
ndotns/norm,dnplan,
|
||||
grosterme/norm,ns);
|
||||
|
||||
|
||||
secmember(3) = -(temp.Dot(gp_Vec(pts1,pts2)));
|
||||
|
||||
ns = d1u2.Crossed(d1v2);
|
||||
ncrossns = nplan.Crossed(ns);
|
||||
ndotns = nplan.Dot(ns);
|
||||
norm = ncrossns.Magnitude();
|
||||
|
||||
// Derivee de nor2 par rapport au parametre sur la ligne guide
|
||||
grosterme = ncrossns.Dot(dnplan.Crossed(ns))/norm/norm;
|
||||
temp.SetLinearForm((dnplan.Dot(ns)-grosterme*ndotns)/norm,nplan,
|
||||
ndotns/norm,dnplan,
|
||||
grosterme/norm,ns);
|
||||
|
||||
secmember(4) = -(temp.Dot(gp_Vec(pts1,pts2)));
|
||||
|
||||
math_Gauss Resol(gradsol);
|
||||
if (Resol.IsDone()) {
|
||||
|
||||
Resol.Solve(secmember);
|
||||
|
||||
tg1.SetLinearForm(secmember(1),d1u1,secmember(2),d1v1);
|
||||
tg2.SetLinearForm(secmember(3),d1u2,secmember(4),d1v2);
|
||||
|
||||
tabP(lowp) = pts1;
|
||||
tabP(lowp+NbPoint-1) = pts2;
|
||||
|
||||
tabV(lowv) = tg1;
|
||||
tabV(lowv+NbPoint-1) = tg2;
|
||||
|
||||
for (i=2; i <= NbPoint-1; i++) {
|
||||
|
||||
lambda = (Standard_Real)(i-1)/(Standard_Real)(NbPoint-1);
|
||||
tabP(lowp+i-1).SetXYZ((1.-lambda)*pts1.XYZ() + lambda*pts2.XYZ());
|
||||
tabV(lowv+i-1).SetLinearForm(1.-lambda,tg1,lambda,tg2);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsRationnal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::IsRational () const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSectionSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real BlendFunc_Ruled::GetSectionSize() const
|
||||
{
|
||||
Standard_NotImplemented::Raise("BlendFunc_Ruled::GetSectionSize()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMinimalWeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BlendFunc_Ruled::GetMinimalWeight(TColStd_Array1OfReal& Weigths) const
|
||||
{
|
||||
Weigths.Init(1);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NbIntervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BlendFunc_Ruled::NbIntervals (const GeomAbs_Shape S) const
|
||||
{
|
||||
return curv->NbIntervals(BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Intervals
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BlendFunc_Ruled::Intervals (TColStd_Array1OfReal& T,
|
||||
const GeomAbs_Shape S) const
|
||||
{
|
||||
curv->Intervals(T, BlendFunc::NextShape(S));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BlendFunc_Ruled::GetShape(Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots,
|
||||
Standard_Integer& Degree,
|
||||
Standard_Integer& NbPoles2d)
|
||||
{
|
||||
NbPoles = 2;
|
||||
NbKnots = 2;
|
||||
Degree = 1;
|
||||
NbPoles2d = 2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTolerance
|
||||
//purpose : Determine les Tolerance a utiliser dans les approximations.
|
||||
//=======================================================================
|
||||
void BlendFunc_Ruled::GetTolerance(const Standard_Real BoundTol,
|
||||
const Standard_Real SurfTol,
|
||||
const Standard_Real AngleTol,
|
||||
math_Vector& Tol3d,
|
||||
math_Vector& Tol1D) const
|
||||
{
|
||||
Tol3d.Init(BoundTol);
|
||||
}
|
||||
|
||||
void BlendFunc_Ruled::Knots(TColStd_Array1OfReal& TKnots)
|
||||
{
|
||||
TKnots(TKnots.Lower()) = 0.;
|
||||
TKnots(TKnots.Upper()) = 1.;
|
||||
}
|
||||
|
||||
void BlendFunc_Ruled::Mults(TColStd_Array1OfInteger& TMults)
|
||||
{
|
||||
TMults(TMults.Lower()) = TMults(TMults.Upper()) = 2;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::Section(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfVec& D2Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColgp_Array1OfVec2d& D2Poles2d,
|
||||
TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& DWeights,
|
||||
TColStd_Array1OfReal& D2Weights)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_Ruled::Section(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColStd_Array1OfReal& Weights,
|
||||
TColStd_Array1OfReal& DWeights)
|
||||
{
|
||||
Standard_Integer lowp = Poles.Lower(), lowp2d = Poles2d.Lower();
|
||||
Standard_Real u,v;
|
||||
|
||||
Poles(lowp) = P.PointOnS1();
|
||||
Poles(lowp+1) = P.PointOnS2();
|
||||
|
||||
P.ParametersOnS1(u,v);
|
||||
Poles2d(lowp2d).SetCoord(u,v);
|
||||
P.ParametersOnS2(u,v);
|
||||
Poles2d(lowp2d+1).SetCoord(u,v);
|
||||
|
||||
Weights(lowp) = 1.;
|
||||
Weights(lowp+1) = 1.;
|
||||
|
||||
if (!P.IsTangencyPoint()) {
|
||||
|
||||
DPoles(lowp)= P.TangentOnS1();
|
||||
DPoles(lowp+1)= P.TangentOnS2();
|
||||
|
||||
DPoles2d(lowp2d)= P.Tangent2dOnS1();
|
||||
DPoles2d(lowp2d+1)= P.Tangent2dOnS2();
|
||||
|
||||
DWeights(lowp) = 0.;
|
||||
DWeights(lowp+1) = 0.;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
void BlendFunc_Ruled::Section(const Blend_Point& P,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColStd_Array1OfReal& Weights)
|
||||
{
|
||||
Standard_Integer lowp = Poles.Lower(), lowp2d = Poles2d.Lower();
|
||||
Standard_Real u,v;
|
||||
|
||||
Poles(lowp) = P.PointOnS1();
|
||||
Poles(lowp+1) = P.PointOnS2();
|
||||
|
||||
P.ParametersOnS1(u,v);
|
||||
Poles2d(lowp2d).SetCoord(u,v);
|
||||
P.ParametersOnS2(u,v);
|
||||
Poles2d(lowp2d+1).SetCoord(u,v);
|
||||
|
||||
Weights(lowp) = 1.;
|
||||
Weights(lowp+1) = 1.;
|
||||
|
||||
}
|
||||
|
||||
|
||||
gp_Ax1 BlendFunc_Ruled::AxeRot (const Standard_Real Prm)
|
||||
{
|
||||
gp_Ax1 axrot;
|
||||
gp_Vec dirax, dnplan;
|
||||
gp_Pnt oriax;
|
||||
|
||||
curv->D2(Prm,ptgui,d1gui,d2gui);
|
||||
|
||||
normtg = d1gui.Magnitude();
|
||||
nplan = d1gui.Normalized();
|
||||
dnplan.SetLinearForm(1./normtg,d2gui,
|
||||
-1./normtg*(nplan.Dot(d2gui)),nplan);
|
||||
|
||||
dirax = nplan.Crossed(dnplan);
|
||||
axrot.SetDirection(dirax);
|
||||
oriax.SetXYZ(ptgui.XYZ()+(normtg/dnplan.Magnitude())*dnplan.Normalized().XYZ());
|
||||
axrot.SetLocation(oriax);
|
||||
return axrot;
|
||||
}
|
||||
|
||||
void BlendFunc_Ruled::Resolution(const Standard_Integer IC2d,
|
||||
const Standard_Real Tol,
|
||||
Standard_Real& TolU,
|
||||
Standard_Real& TolV) const
|
||||
{
|
||||
if(IC2d == 1){
|
||||
TolU = surf1->UResolution(Tol);
|
||||
TolV = surf1->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
TolU = surf2->UResolution(Tol);
|
||||
TolV = surf2->VResolution(Tol);
|
||||
}
|
||||
}
|
93
src/BlendFunc/BlendFunc_RuledInv.cdl
Executable file
93
src/BlendFunc/BlendFunc_RuledInv.cdl
Executable file
@@ -0,0 +1,93 @@
|
||||
-- File: BlendFunc_RuledInv.cdl
|
||||
-- Created: Thu Dec 2 10:28:44 1993
|
||||
-- Author: Jacques GOUSSARD
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class RuledInv from BlendFunc
|
||||
|
||||
---Purpose:
|
||||
|
||||
inherits FuncInv from Blend
|
||||
|
||||
|
||||
uses Vector from math,
|
||||
Matrix from math,
|
||||
HCurve2d from Adaptor2d,
|
||||
HCurve from Adaptor3d,
|
||||
HSurface from Adaptor3d
|
||||
|
||||
is
|
||||
|
||||
Create(S1,S2: HSurface from Adaptor3d; C: HCurve from Adaptor3d)
|
||||
|
||||
returns RuledInv from BlendFunc;
|
||||
|
||||
|
||||
Set(me: in out; OnFirst: Boolean from Standard;
|
||||
COnSurf: HCurve2d from Adaptor2d)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetTolerance(me; Tolerance: out Vector from math; Tol: Real from Standard)
|
||||
|
||||
;
|
||||
|
||||
|
||||
GetBounds(me; InfBound,SupBound: out Vector from math)
|
||||
|
||||
;
|
||||
|
||||
|
||||
IsSolution(me: in out; Sol: Vector from math; Tol: Real from Standard)
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
;
|
||||
|
||||
|
||||
NbEquations(me)
|
||||
---Purpose: returns the number of equations of the function.
|
||||
returns Integer from Standard
|
||||
is redefined static ;
|
||||
|
||||
Value(me: in out; X: Vector; F: out Vector)
|
||||
---Purpose: computes the values <F> of the Functions for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Derivatives(me: in out; X: Vector; D: out Matrix)
|
||||
---Purpose: returns the values <D> of the derivatives for the
|
||||
-- variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static ;
|
||||
|
||||
|
||||
Values(me: in out; X: Vector; F: out Vector; D: out Matrix)
|
||||
---Purpose: returns the values <F> of the functions and the derivatives
|
||||
-- <D> for the variable <X>.
|
||||
-- Returns True if the computation was done successfully,
|
||||
-- False otherwise.
|
||||
|
||||
returns Boolean from Standard
|
||||
is redefined static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
surf1: HSurface from Adaptor3d;
|
||||
surf2: HSurface from Adaptor3d;
|
||||
curv : HCurve from Adaptor3d;
|
||||
csurf: HCurve2d from Adaptor2d;
|
||||
first: Boolean from Standard;
|
||||
|
||||
end RuledInv;
|
460
src/BlendFunc/BlendFunc_RuledInv.cxx
Executable file
460
src/BlendFunc/BlendFunc_RuledInv.cxx
Executable file
@@ -0,0 +1,460 @@
|
||||
// File: BlendFunc_RuledInv.cxx
|
||||
// Created: Thu Dec 2 10:28:44 1993
|
||||
// Author: Jacques GOUSSARD
|
||||
// Copyright: OPEN CASCADE 1993
|
||||
|
||||
#include <BlendFunc_RuledInv.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
BlendFunc_RuledInv::BlendFunc_RuledInv(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_HCurve)& C) :
|
||||
surf1(S1),surf2(S2),curv(C)
|
||||
{}
|
||||
|
||||
void BlendFunc_RuledInv::Set(const Standard_Boolean OnFirst,
|
||||
const Handle(Adaptor2d_HCurve2d)& C)
|
||||
{
|
||||
first = OnFirst;
|
||||
csurf = C;
|
||||
}
|
||||
|
||||
Standard_Integer BlendFunc_RuledInv::NbEquations () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
void BlendFunc_RuledInv::GetTolerance(math_Vector& Tolerance,
|
||||
const Standard_Real Tol) const
|
||||
{
|
||||
Tolerance(1) = csurf->Resolution(Tol);
|
||||
Tolerance(2) = curv->Resolution(Tol);
|
||||
if (first) {
|
||||
Tolerance(3) = surf2->UResolution(Tol);
|
||||
Tolerance(4) = surf2->VResolution(Tol);
|
||||
}
|
||||
else {
|
||||
Tolerance(3) = surf1->UResolution(Tol);
|
||||
Tolerance(4) = surf1->VResolution(Tol);
|
||||
}
|
||||
}
|
||||
|
||||
void BlendFunc_RuledInv::GetBounds(math_Vector& InfBound,
|
||||
math_Vector& SupBound) const
|
||||
{
|
||||
InfBound(1) = csurf->FirstParameter();
|
||||
InfBound(2) = curv->FirstParameter();
|
||||
SupBound(1) = csurf->LastParameter();
|
||||
SupBound(2) = curv->LastParameter();
|
||||
|
||||
if (first) {
|
||||
InfBound(3) = surf2->FirstUParameter();
|
||||
InfBound(4) = surf2->FirstVParameter();
|
||||
SupBound(3) = surf2->LastUParameter();
|
||||
SupBound(4) = surf2->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfBound(3) = surf1->FirstUParameter();
|
||||
InfBound(4) = surf1->FirstVParameter();
|
||||
SupBound(3) = surf1->LastUParameter();
|
||||
SupBound(4) = surf1->LastVParameter();
|
||||
if(!Precision::IsInfinite(InfBound(3)) &&
|
||||
!Precision::IsInfinite(SupBound(3))) {
|
||||
const Standard_Real range = (SupBound(3) - InfBound(3));
|
||||
InfBound(3) -= range;
|
||||
SupBound(3) += range;
|
||||
}
|
||||
if(!Precision::IsInfinite(InfBound(4)) &&
|
||||
!Precision::IsInfinite(SupBound(4))) {
|
||||
const Standard_Real range = (SupBound(4) - InfBound(4));
|
||||
InfBound(4) -= range;
|
||||
SupBound(4) += range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_RuledInv::IsSolution(const math_Vector& Sol,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
math_Vector valsol(1,4);
|
||||
Value(Sol,valsol);
|
||||
if (Abs(valsol(1)) <= Tol &&
|
||||
Abs(valsol(2)) <= Tol &&
|
||||
Abs(valsol(3)) <= Tol &&
|
||||
Abs(valsol(4)) <= Tol)
|
||||
return Standard_True;
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean BlendFunc_RuledInv::Value(const math_Vector& X,
|
||||
math_Vector& F)
|
||||
{
|
||||
gp_Pnt ptcur;
|
||||
gp_Vec d1cur;
|
||||
curv->D1(X(2),ptcur,d1cur);
|
||||
|
||||
const gp_XYZ nplan = d1cur.Normalized().XYZ();
|
||||
const Standard_Real theD = -(nplan.Dot(ptcur.XYZ()));
|
||||
const gp_Pnt2d pt2d(csurf->Value(X(1)));
|
||||
|
||||
gp_Pnt pts1,pts2;
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
if (first)
|
||||
{
|
||||
surf1->D1(pt2d.X(),pt2d.Y(),pts1,d1u1,d1v1);
|
||||
surf2->D1(X(3),X(4),pts2,d1u2,d1v2);
|
||||
}
|
||||
else
|
||||
{
|
||||
surf1->D1(X(3),X(4),pts1,d1u1,d1v1);
|
||||
surf2->D1(pt2d.X(),pt2d.Y(),pts2,d1u2,d1v2);
|
||||
}
|
||||
|
||||
const gp_XYZ temp(pts2.XYZ()-pts1.XYZ());
|
||||
|
||||
gp_XYZ ns1 = d1u1.Crossed(d1v1).XYZ();
|
||||
gp_XYZ ns2 = d1u2.Crossed(d1v2).XYZ();
|
||||
const Standard_Real norm1 = nplan.Crossed(ns1).Modulus();
|
||||
const Standard_Real norm2 = nplan.Crossed(ns2).Modulus();
|
||||
ns1.SetLinearForm(nplan.Dot(ns1)/norm1,nplan, -1./norm1,ns1);
|
||||
ns2.SetLinearForm(nplan.Dot(ns2)/norm2,nplan, -1./norm2,ns2);
|
||||
|
||||
F(1) = (nplan.Dot(pts1.XYZ())) + theD;
|
||||
F(2) = (nplan.Dot(pts2.XYZ())) + theD;
|
||||
|
||||
F(3) = temp.Dot(ns1);
|
||||
F(4) = temp.Dot(ns2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean BlendFunc_RuledInv::Derivatives(const math_Vector& X,
|
||||
math_Matrix& D)
|
||||
{
|
||||
gp_Pnt ptcur;
|
||||
gp_Vec d1cur,d2cur;
|
||||
curv->D2(X(2),ptcur,d1cur,d2cur);
|
||||
|
||||
const Standard_Real normtgcur = d1cur.Magnitude();
|
||||
const gp_Vec nplan = d1cur.Normalized();
|
||||
const Standard_Real theD = -(nplan.XYZ().Dot(ptcur.XYZ()));
|
||||
|
||||
gp_Vec dnplan;
|
||||
dnplan.SetLinearForm(-nplan.Dot(d2cur),nplan,d2cur);
|
||||
dnplan /= normtgcur;
|
||||
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
|
||||
gp_Pnt pts1,pts2;
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
gp_Vec d2u1,d2v1,d2u2,d2v2,d2uv1,d2uv2;
|
||||
gp_Vec dpdt, p1p2;
|
||||
if (first)
|
||||
{
|
||||
surf1->D2(p2d.X(),p2d.Y(),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(X(3),X(4),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
dpdt.SetLinearForm(v2d.X(),d1u1,v2d.Y(),d1v1);
|
||||
p1p2 = gp_Vec(pts1,pts2);
|
||||
D(1,1) = dpdt.Dot(nplan);
|
||||
D(1,2) = dnplan.XYZ().Dot(pts1.XYZ()-ptcur.XYZ()) - normtgcur;
|
||||
D(1,3) = 0.;
|
||||
D(1,4) = 0.;
|
||||
|
||||
D(2,1) = 0.;
|
||||
D(2,2) = dnplan.XYZ().Dot(pts2.XYZ()-ptcur.XYZ()) - normtgcur;
|
||||
D(2,3) = d1u2.Dot(nplan);
|
||||
D(2,4) = d1v2.Dot(nplan);
|
||||
}
|
||||
else
|
||||
{
|
||||
surf1->D2(X(3),X(4),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(p2d.X(),p2d.Y(),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
dpdt.SetLinearForm(v2d.X(),d1u2,v2d.Y(),d1v2);
|
||||
p1p2 = gp_Vec(pts1,pts2);
|
||||
D(1,1) = 0.;
|
||||
D(1,2) = dnplan.XYZ().Dot(pts1.XYZ()-ptcur.XYZ()) - normtgcur;
|
||||
D(1,3) = d1u1.Dot(nplan);
|
||||
D(1,4) = d1v1.Dot(nplan);
|
||||
|
||||
D(2,1) = dpdt.Dot(nplan);
|
||||
D(2,2) = dnplan.XYZ().Dot(pts2.XYZ()-ptcur.XYZ()) - normtgcur;
|
||||
D(2,3) = 0.;
|
||||
D(2,4) = 0.;
|
||||
}
|
||||
|
||||
const gp_Vec ns1 = d1u1.Crossed(d1v1);
|
||||
const gp_Vec ns2 = d1u2.Crossed(d1v2);
|
||||
const gp_Vec ncrossns1 = nplan.Crossed(ns1);
|
||||
const gp_Vec ncrossns2 = nplan.Crossed(ns2);
|
||||
const Standard_Real norm1 = ncrossns1.Magnitude();
|
||||
const Standard_Real norm2 = ncrossns2.Magnitude();
|
||||
|
||||
const Standard_Real ndotns1 = nplan.Dot(ns1);
|
||||
const Standard_Real ndotns2 = nplan.Dot(ns2);
|
||||
|
||||
gp_Vec nor1,nor2;
|
||||
nor1.SetLinearForm(ndotns1/norm1,nplan,-1./norm1,ns1);
|
||||
nor2.SetLinearForm(ndotns2/norm2,nplan,-1./norm2,ns2);
|
||||
|
||||
if (first) {
|
||||
D(3,3) = d1u2.Dot(nor1);
|
||||
D(3,4) = d1v2.Dot(nor1);
|
||||
|
||||
D(4,1) = -(dpdt.Dot(nor2));
|
||||
}
|
||||
else {
|
||||
D(3,1) = dpdt.Dot(nor1);
|
||||
|
||||
D(4,3) = -(d1u1.Dot(nor2));
|
||||
D(4,4) = -(d1v1.Dot(nor2));
|
||||
}
|
||||
|
||||
gp_Vec resul1,resul2,temp;
|
||||
Standard_Real grosterme;
|
||||
|
||||
// Derivee de nor1 par rapport a u1
|
||||
|
||||
temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul1.SetLinearForm(-(grosterme*ndotns1-nplan.Dot(temp))/norm1,nplan,
|
||||
grosterme/norm1,ns1,
|
||||
-1./norm1,temp);
|
||||
|
||||
// Derivee par rapport a v1
|
||||
|
||||
temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul2.SetLinearForm(-(grosterme*ndotns1-nplan.Dot(temp))/norm1,nplan,
|
||||
grosterme/norm1,ns1,
|
||||
-1./norm1,temp);
|
||||
|
||||
if (first) {
|
||||
resul1.SetLinearForm(v2d.X(),resul1,v2d.Y(),resul2);
|
||||
D(3,1) = p1p2.Dot(resul1) - (dpdt.Dot(nor1));
|
||||
}
|
||||
else {
|
||||
D(3,3) = -(d1u1.Dot(nor1)) + p1p2.Dot(resul1);
|
||||
D(3,4) = -(d1v1.Dot(nor1)) + p1p2.Dot(resul2);
|
||||
}
|
||||
|
||||
// Derivee de nor2 par rapport a u2
|
||||
temp = d2u2.Crossed(d1v2).Added(d1u2.Crossed(d2uv2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul1.SetLinearForm(-(grosterme*ndotns2-nplan.Dot(temp))/norm2,nplan,
|
||||
grosterme/norm2,ns2,
|
||||
-1./norm2,temp);
|
||||
|
||||
// Derivee par rapport a v2
|
||||
temp = d2uv2.Crossed(d1v2).Added(d1u2.Crossed(d2v2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul2.SetLinearForm(-(grosterme*ndotns2-nplan.Dot(temp))/norm2,nplan,
|
||||
grosterme/norm2,ns2,
|
||||
-1./norm2,temp);
|
||||
|
||||
if (first) {
|
||||
D(4,3) = d1u2.Dot(nor2) + p1p2.Dot(resul1);
|
||||
D(4,4) = d1v2.Dot(nor2) + p1p2.Dot(resul2);
|
||||
}
|
||||
else {
|
||||
resul1.SetLinearForm(v2d.X(),resul1,v2d.Y(),resul2);
|
||||
D(4,1) = p1p2.Dot(resul1) + dpdt.Dot(nor2) ;
|
||||
}
|
||||
|
||||
|
||||
// derivee par rapport a w (parametre sur ligne guide)
|
||||
|
||||
grosterme = ncrossns1.Dot(dnplan.Crossed(ns1))/norm1/norm1;
|
||||
resul1.SetLinearForm(-(grosterme*ndotns1-dnplan.Dot(ns1))/norm1,nplan,
|
||||
ndotns1/norm1,dnplan,
|
||||
grosterme/norm1,ns1);
|
||||
|
||||
|
||||
grosterme = ncrossns2.Dot(dnplan.Crossed(ns2))/norm2/norm2;
|
||||
resul2.SetLinearForm(-(grosterme*ndotns2-dnplan.Dot(ns2))/norm2,nplan,
|
||||
ndotns2/norm2,dnplan,
|
||||
grosterme/norm2,ns2);
|
||||
|
||||
D(3,2) = p1p2.Dot(resul1);
|
||||
D(4,2) = p1p2.Dot(resul2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean BlendFunc_RuledInv::Values(const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D)
|
||||
{
|
||||
gp_Pnt ptcur;
|
||||
gp_Vec d1cur,d2cur;
|
||||
curv->D2(X(2),ptcur,d1cur,d2cur);
|
||||
|
||||
const Standard_Real normtgcur = d1cur.Magnitude();
|
||||
const gp_Vec nplan = d1cur.Normalized();
|
||||
const Standard_Real theD = -(nplan.XYZ().Dot(ptcur.XYZ()));
|
||||
|
||||
gp_Vec dnplan;
|
||||
dnplan.SetLinearForm(-nplan.Dot(d2cur),nplan,d2cur);
|
||||
dnplan /= normtgcur;
|
||||
|
||||
gp_Pnt2d p2d;
|
||||
gp_Vec2d v2d;
|
||||
csurf->D1(X(1),p2d,v2d);
|
||||
|
||||
gp_Pnt pts1,pts2;
|
||||
gp_Vec d1u1,d1v1,d1u2,d1v2;
|
||||
gp_Vec d2u1,d2v1,d2u2,d2v2,d2uv1,d2uv2;
|
||||
gp_Vec dpdt,p1p2;
|
||||
if (first)
|
||||
{
|
||||
surf1->D2(p2d.X(),p2d.Y(),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(X(3),X(4),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
dpdt.SetLinearForm(v2d.X(),d1u1,v2d.Y(),d1v1);
|
||||
p1p2 = gp_Vec(pts1,pts2);
|
||||
D(1,1) = dpdt.Dot(nplan);
|
||||
D(1,2) = dnplan.XYZ().Dot(pts1.XYZ()-ptcur.XYZ()) - normtgcur;
|
||||
D(1,3) = 0.;
|
||||
D(1,4) = 0.;
|
||||
|
||||
D(2,1) = 0.;
|
||||
D(2,2) = dnplan.XYZ().Dot(pts2.XYZ()-ptcur.XYZ()) - normtgcur;
|
||||
D(2,3) = d1u2.Dot(nplan);
|
||||
D(2,4) = d1v2.Dot(nplan);
|
||||
}
|
||||
else
|
||||
{
|
||||
surf1->D2(X(3),X(4),pts1,d1u1,d1v1,d2u1,d2v1,d2uv1);
|
||||
surf2->D2(p2d.X(),p2d.Y(),pts2,d1u2,d1v2,d2u2,d2v2,d2uv2);
|
||||
dpdt.SetLinearForm(v2d.X(),d1u2,v2d.Y(),d1v2);
|
||||
p1p2 = gp_Vec(pts1,pts2);
|
||||
D(1,1) = 0.;
|
||||
D(1,2) = dnplan.XYZ().Dot(pts1.XYZ()-ptcur.XYZ()) - normtgcur;
|
||||
D(1,3) = d1u1.Dot(nplan);
|
||||
D(1,4) = d1v1.Dot(nplan);
|
||||
|
||||
D(2,1) = dpdt.Dot(nplan);
|
||||
D(2,2) = dnplan.XYZ().Dot(pts2.XYZ()-ptcur.XYZ()) - normtgcur;
|
||||
D(2,3) = 0.;
|
||||
D(2,4) = 0.;
|
||||
}
|
||||
|
||||
const gp_Vec ns1 = d1u1.Crossed(d1v1);
|
||||
const gp_Vec ns2 = d1u2.Crossed(d1v2);
|
||||
const gp_Vec ncrossns1 = nplan.Crossed(ns1);
|
||||
const gp_Vec ncrossns2 = nplan.Crossed(ns2);
|
||||
const Standard_Real norm1 = ncrossns1.Magnitude();
|
||||
const Standard_Real norm2 = ncrossns2.Magnitude();
|
||||
|
||||
const Standard_Real ndotns1 = nplan.Dot(ns1);
|
||||
const Standard_Real ndotns2 = nplan.Dot(ns2);
|
||||
|
||||
gp_Vec nor1,nor2;
|
||||
nor1.SetLinearForm(ndotns1/norm1,nplan,-1./norm1,ns1);
|
||||
nor2.SetLinearForm(ndotns2/norm2,nplan,-1./norm2,ns2);
|
||||
|
||||
F(1) = (nplan.Dot(pts1.XYZ())) + theD;
|
||||
F(2) = (nplan.Dot(pts2.XYZ())) + theD;
|
||||
|
||||
F(3) = p1p2.Dot(nor1);
|
||||
F(4) = p1p2.Dot(nor2);
|
||||
|
||||
if (first) {
|
||||
D(3,3) = d1u2.Dot(nor1);
|
||||
D(3,4) = d1v2.Dot(nor1);
|
||||
|
||||
D(4,1) = -(dpdt.Dot(nor2));
|
||||
}
|
||||
else {
|
||||
D(3,1) = dpdt.Dot(nor1);
|
||||
|
||||
D(4,3) = -(d1u1.Dot(nor2));
|
||||
D(4,4) = -(d1v1.Dot(nor2));
|
||||
}
|
||||
|
||||
gp_Vec resul1,resul2,temp;
|
||||
Standard_Real grosterme;
|
||||
|
||||
// Derivee de nor1 par rapport a u1
|
||||
|
||||
temp = d2u1.Crossed(d1v1).Added(d1u1.Crossed(d2uv1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul1.SetLinearForm(-(grosterme*ndotns1-nplan.Dot(temp))/norm1,nplan,
|
||||
grosterme/norm1,ns1,
|
||||
-1./norm1,temp);
|
||||
|
||||
// Derivee par rapport a v1
|
||||
|
||||
temp = d2uv1.Crossed(d1v1).Added(d1u1.Crossed(d2v1));
|
||||
grosterme = ncrossns1.Dot(nplan.Crossed(temp))/norm1/norm1;
|
||||
resul2.SetLinearForm(-(grosterme*ndotns1-nplan.Dot(temp))/norm1,nplan,
|
||||
grosterme/norm1,ns1,
|
||||
-1./norm1,temp);
|
||||
|
||||
if (first) {
|
||||
resul1.SetLinearForm(v2d.X(),resul1,v2d.Y(),resul2);
|
||||
D(3,1) = p1p2.Dot(resul1) - (dpdt.Dot(nor1));
|
||||
}
|
||||
else {
|
||||
D(3,3) = -(d1u1.Dot(nor1)) + p1p2.Dot(resul1);
|
||||
D(3,4) = -(d1v1.Dot(nor1)) + p1p2.Dot(resul2);
|
||||
}
|
||||
|
||||
// Derivee de nor2 par rapport a u2
|
||||
temp = d2u2.Crossed(d1v2).Added(d1u2.Crossed(d2uv2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul1.SetLinearForm(-(grosterme*ndotns2-nplan.Dot(temp))/norm2,nplan,
|
||||
grosterme/norm2,ns2,
|
||||
-1./norm2,temp);
|
||||
|
||||
// Derivee par rapport a v2
|
||||
temp = d2uv2.Crossed(d1v2).Added(d1u2.Crossed(d2v2));
|
||||
grosterme = ncrossns2.Dot(nplan.Crossed(temp))/norm2/norm2;
|
||||
resul2.SetLinearForm(-(grosterme*ndotns2-nplan.Dot(temp))/norm2,nplan,
|
||||
grosterme/norm2,ns2,
|
||||
-1./norm2,temp);
|
||||
|
||||
if (first) {
|
||||
D(4,3) = d1u2.Dot(nor2) + p1p2.Dot(resul1);
|
||||
D(4,4) = d1v2.Dot(nor2) + p1p2.Dot(resul2);
|
||||
}
|
||||
else {
|
||||
resul1.SetLinearForm(v2d.X(),resul1,v2d.Y(),resul2);
|
||||
D(4,1) = p1p2.Dot(resul1) + dpdt.Dot(nor2) ;
|
||||
}
|
||||
|
||||
|
||||
// derivee par rapport a w (parametre sur ligne guide)
|
||||
|
||||
grosterme = ncrossns1.Dot(dnplan.Crossed(ns1))/norm1/norm1;
|
||||
resul1.SetLinearForm(-(grosterme*ndotns1-dnplan.Dot(ns1))/norm1,nplan,
|
||||
ndotns1/norm1,dnplan,
|
||||
grosterme/norm1,ns1);
|
||||
|
||||
|
||||
grosterme = ncrossns2.Dot(dnplan.Crossed(ns2))/norm2/norm2;
|
||||
resul2.SetLinearForm(-(grosterme*ndotns2-dnplan.Dot(ns2))/norm2,nplan,
|
||||
ndotns2/norm2,dnplan,
|
||||
grosterme/norm2,ns2);
|
||||
|
||||
D(3,2) = p1p2.Dot(resul1);
|
||||
D(4,2) = p1p2.Dot(resul2);
|
||||
|
||||
return Standard_True;
|
||||
}
|
61
src/BlendFunc/BlendFunc_Tensor.cdl
Executable file
61
src/BlendFunc/BlendFunc_Tensor.cdl
Executable file
@@ -0,0 +1,61 @@
|
||||
-- File: BlendFunc_Tensor.cdl
|
||||
-- Created: Thu Dec 5 09:27:33 1996
|
||||
-- Author: Philippe MANGIN
|
||||
-- <pmn@sgi29>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class Tensor from BlendFunc
|
||||
|
||||
---Purpose: used to store the "gradient of gradient"
|
||||
|
||||
uses
|
||||
Array1OfReal from TColStd,
|
||||
Vector from math,
|
||||
Matrix from math
|
||||
|
||||
raises DimensionError from Standard,
|
||||
RangeError from Standard
|
||||
|
||||
is
|
||||
Create(NbRow, NbCol, NbMat : Integer)
|
||||
returns Tensor;
|
||||
|
||||
Init(me : in out; InitialValue: Real)
|
||||
---Purpose:Initialize all the elements of a Tensor to InitialValue.
|
||||
is static;
|
||||
|
||||
Value(me; Row, Col, Mat: Integer)
|
||||
---Purpose: accesses (in read or write mode) the value of index <Row>,
|
||||
-- <Col> and <Mat> of a Tensor.
|
||||
-- An exception is raised if <Row>, <Col> or <Mat> are not
|
||||
-- in the correct range.
|
||||
---C++: alias operator()
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
returns Real
|
||||
is static;
|
||||
|
||||
ChangeValue(me : in out; Row, Col, Mat: Integer)
|
||||
---Purpose: accesses (in read or write mode) the value of index <Row>,
|
||||
-- <Col> and <Mat> of a Tensor.
|
||||
-- An exception is raised if <Row>, <Col> or <Mat> are not
|
||||
-- in the correct range.
|
||||
---C++: alias operator()
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
returns Real
|
||||
is static;
|
||||
|
||||
Multiply(me; Right: Vector; Product:out Matrix)
|
||||
raises DimensionError
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
Tab : Array1OfReal;
|
||||
nbrow : Integer;
|
||||
nbcol : Integer;
|
||||
nbmat : Integer;
|
||||
nbmtcl : Integer;
|
||||
end ;
|
48
src/BlendFunc/BlendFunc_Tensor.cxx
Executable file
48
src/BlendFunc/BlendFunc_Tensor.cxx
Executable file
@@ -0,0 +1,48 @@
|
||||
// File: BlendFunc_Tensor.cxx
|
||||
// Created: Thu Dec 5 09:52:07 1996
|
||||
// Author: Philippe MANGIN
|
||||
// <pmn@sgi29>
|
||||
|
||||
|
||||
#include <BlendFunc_Tensor.ixx>
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
//#include <math_StackMemoryManager.hxx>
|
||||
//#include <math_Memory.hxx>
|
||||
|
||||
BlendFunc_Tensor::BlendFunc_Tensor(const Standard_Integer NbRow,
|
||||
const Standard_Integer NbCol,
|
||||
const Standard_Integer NbMat) :
|
||||
Tab(1,NbRow*NbMat*NbCol),
|
||||
nbrow( NbRow ),
|
||||
nbcol( NbCol ),
|
||||
nbmat( NbMat ),
|
||||
nbmtcl( NbMat*NbCol )
|
||||
{
|
||||
}
|
||||
|
||||
void BlendFunc_Tensor::Init(const Standard_Real InitialValue)
|
||||
{
|
||||
// Standard_Integer I, T = nbrow * nbcol * nbmat;
|
||||
// for (I=1; I<=T; I++) {Tab(I) = InitialValue;}
|
||||
Tab.Init(InitialValue);
|
||||
}
|
||||
|
||||
void BlendFunc_Tensor::Multiply(const math_Vector& Right,
|
||||
math_Matrix& M) const
|
||||
{
|
||||
Standard_Integer i, j, k;
|
||||
Standard_Real Somme;
|
||||
for ( i=1; i<=nbrow; i++) {
|
||||
for ( j=1; j<=nbcol; j++) {
|
||||
Somme = 0;
|
||||
for ( k=1; k<=nbmat; k++) {
|
||||
Somme += Value(i,j,k)*Right(k);
|
||||
}
|
||||
M(i,j) = Somme;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
src/BlendFunc/BlendFunc_Tensor.lxx
Executable file
18
src/BlendFunc/BlendFunc_Tensor.lxx
Executable file
@@ -0,0 +1,18 @@
|
||||
// File: BlendFunc_Tensor.lxx
|
||||
// Created: Thu Dec 5 10:07:04 1996
|
||||
// Author: Philippe MANGIN
|
||||
// <pmn@sgi29>
|
||||
|
||||
inline const Standard_Real& BlendFunc_Tensor::Value(const Standard_Integer Row,
|
||||
const Standard_Integer Col,
|
||||
const Standard_Integer Mat) const
|
||||
{
|
||||
return Tab(Mat+nbmat*(Col-1)+nbmtcl*(Row-1));
|
||||
}
|
||||
|
||||
inline Standard_Real& BlendFunc_Tensor::ChangeValue(const Standard_Integer Row,
|
||||
const Standard_Integer Col,
|
||||
const Standard_Integer Mat)
|
||||
{
|
||||
return Tab(Mat+nbmat*(Col-1)+nbmtcl*(Row-1));
|
||||
}
|
Reference in New Issue
Block a user