mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0026252: GeomAdaptor_Surface should use inner adaptor to calculate values of complex surfaces
* Implement GeomEvaluator package * Inject evaluators to GeomAdaptor_Surface to calculate values of complex surfaces * Inject evaluators to Geom_Surface classes to calculate values for offset surfaces, surfaces of revolution and surfaces of extrusion * Move Adaptor3d_SurfaceOfLinearExtrusion and Adaptor3d_SurfaceOfRevolution to GeomAdaptor and unify calculation of their values and derivatives * Code optimizations * Update test cases Update of test-cases according to the new behavior
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <GeomEvaluator_OffsetSurface.hxx>
|
||||
class Geom_Surface;
|
||||
class Standard_ConstructionError;
|
||||
class Standard_RangeError;
|
||||
@@ -120,6 +121,10 @@ public:
|
||||
//! Note: The basis surface can be an offset surface.
|
||||
inline const Handle(Geom_Surface) & BasisSurface() const
|
||||
{ return basisSurf; }
|
||||
|
||||
//! Returns osculating surface if base surface is B-spline or Bezier
|
||||
inline const Handle(Geom_OsculatingSurface)& OsculatingSurface() const
|
||||
{ return myOscSurf; }
|
||||
|
||||
//! Changes the orientation of this offset surface in the u
|
||||
//! parametric direction. The bounds of the surface
|
||||
@@ -289,44 +294,6 @@ public:
|
||||
//! raised if it is not possible to compute a unique offset
|
||||
//! direction.
|
||||
Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
|
||||
|
||||
|
||||
//! P (U, V) = Pbasis + Offset * Ndir where
|
||||
//! Ndir = D1Ubasis ^ D1Vbasis / ||D1Ubasis ^ D1Vbasis|| is
|
||||
//! the normal direction of the surface.
|
||||
//! If Ndir is undefined this method computes an approched normal
|
||||
//! direction using the following limited development :
|
||||
//! Ndir = N0 + DNdir/DU + DNdir/DV + Eps with Eps->0 which
|
||||
//! requires to compute the second derivatives on the basis surface.
|
||||
//! If the normal direction cannot be approximate for this order
|
||||
//! of derivation the exception UndefinedValue is raised.
|
||||
//!
|
||||
//! Raised if the continuity of the basis surface is not C1.
|
||||
//! Raised if the order of derivation required to compute the normal
|
||||
//! direction is greater than the second order.
|
||||
Standard_EXPORT void Value (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Pnt& Pbasis, gp_Vec& D1Ubasis, gp_Vec& D1Vbasis) const;
|
||||
|
||||
|
||||
//! Raised if the continuity of the basis surface is not C2.
|
||||
Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Pnt& Pbasis, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D1Ubasis, gp_Vec& D1Vbasis, gp_Vec& D2Ubasis, gp_Vec& D2Vbasis, gp_Vec& D2UVbasis) const;
|
||||
|
||||
|
||||
//! Raised if the continuity of the basis surface is not C3.
|
||||
//! The following private methods
|
||||
//! includes common part of local and global methods
|
||||
//! of derivative evaluations.
|
||||
Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Pnt& Pbasis, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D1Ubasis, gp_Vec& D1Vbasis, gp_Vec& D2Ubasis, gp_Vec& D2Vbasis, gp_Vec& D2UVbasis, gp_Vec& D3Ubasis, gp_Vec& D3Vbasis, gp_Vec& D3UUVbasis, gp_Vec& D3UVVbasis) const;
|
||||
|
||||
Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, gp_Pnt& P) const;
|
||||
|
||||
Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
|
||||
|
||||
Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
|
||||
|
||||
Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
|
||||
|
||||
Standard_EXPORT gp_Vec LocalDN (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, const Standard_Integer Nu, const Standard_Integer Nv) const;
|
||||
|
||||
|
||||
//! Applies the transformation T to this offset surface.
|
||||
//! Note: the basis surface is also modified.
|
||||
@@ -394,36 +361,12 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void SetD0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, const gp_Vec& D1U, const gp_Vec& D1V) const;
|
||||
|
||||
Standard_EXPORT void SetD1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, const gp_Vec& d2u, const gp_Vec& d2v, const gp_Vec& d2uv) const;
|
||||
|
||||
Standard_EXPORT void SetD2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, const gp_Vec& d3u, const gp_Vec& d3v, const gp_Vec& d3uuv, const gp_Vec& d3uvv) const;
|
||||
|
||||
Standard_EXPORT void SetD3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
|
||||
|
||||
//! The following functions evaluates the local
|
||||
//! derivatives on surface. Useful to manage discontinuities
|
||||
//! on the surface.
|
||||
//! if Side = 1 -> P = S( U+,V )
|
||||
//! if Side = -1 -> P = S( U-,V )
|
||||
//! else P is betveen discontinuities
|
||||
//! can be evaluated using methods of
|
||||
//! global evaluations P = S( U ,V )
|
||||
Standard_EXPORT gp_Vec SetDN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv, const gp_Vec& D1U, const gp_Vec& D1V) const;
|
||||
|
||||
//! This method locates U,V parameters on basis BSpline surface
|
||||
//! and calls LocalDi or Di methods corresponding an order
|
||||
//! of derivative and position
|
||||
//! of UV-point relatively the surface discontinuities.
|
||||
Standard_EXPORT void LocateSides (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer VSide, const Handle(Geom_BSplineSurface)& BSplS, const Standard_Integer NDir, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
|
||||
|
||||
Handle(Geom_Surface) basisSurf;
|
||||
Handle(Geom_Surface) equivSurf;
|
||||
Standard_Real offsetValue;
|
||||
Geom_OsculatingSurface myOscSurf;
|
||||
Handle(Geom_OsculatingSurface) myOscSurf;
|
||||
GeomAbs_Shape myBasisSurfContinuity;
|
||||
Handle(GeomEvaluator_OffsetSurface) myEvaluator;
|
||||
};
|
||||
|
||||
#endif // _Geom_OffsetSurface_HeaderFile
|
||||
|
@@ -37,6 +37,7 @@
|
||||
Geom_OsculatingSurface::Geom_OsculatingSurface()
|
||||
: myAlong(1,4)
|
||||
{
|
||||
myAlong.Init(Standard_False);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Geom_OffsetOsculatingSurface
|
||||
|
@@ -33,8 +33,10 @@ class Geom_Surface;
|
||||
class Geom_BSplineSurface;
|
||||
|
||||
|
||||
class Geom_OsculatingSurface;
|
||||
DEFINE_STANDARD_HANDLE(Geom_OsculatingSurface, MMgt_TShared)
|
||||
|
||||
class Geom_OsculatingSurface
|
||||
class Geom_OsculatingSurface : public MMgt_TShared
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -64,7 +66,7 @@ public:
|
||||
Standard_EXPORT Standard_Boolean VOscSurf (const Standard_Real U, const Standard_Real V, Standard_Boolean& t, Handle(Geom_BSplineSurface)& L) const;
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(Geom_OsculatingSurface, MMgt_TShared)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_UndefinedDerivative.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomEvaluator_SurfaceOfExtrusion.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
@@ -60,62 +61,6 @@ typedef gp_Trsf Trsf;
|
||||
typedef gp_Vec Vec;
|
||||
typedef gp_XYZ XYZ;
|
||||
|
||||
static void LocateSide(const Standard_Real U,
|
||||
const Standard_Integer Side,
|
||||
const Handle(Geom_BSplineCurve)& BSplC,
|
||||
const Standard_Integer NDir,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D2U,
|
||||
gp_Vec& D3U)
|
||||
{
|
||||
Standard_Integer Ideb, Ifin;
|
||||
Standard_Real ParTol=Precision::PConfusion()/2;
|
||||
BSplC->Geom_BSplineCurve::LocateU(U,ParTol,Ideb,Ifin,Standard_False);
|
||||
if(Side == 1)
|
||||
{
|
||||
if(Ideb<1) Ideb=1;
|
||||
if ((Ideb>=Ifin)) Ifin = Ideb+1;
|
||||
}else
|
||||
if(Side ==-1)
|
||||
{
|
||||
if(Ifin > BSplC -> NbKnots()) Ifin=BSplC->NbKnots();
|
||||
if ((Ideb>=Ifin)) Ideb = Ifin-1;
|
||||
}
|
||||
|
||||
switch(NDir)
|
||||
{
|
||||
case 0 : BSplC->Geom_BSplineCurve::LocalD0(U,Ideb,Ifin,P); break;
|
||||
case 1 : BSplC->Geom_BSplineCurve::LocalD1(U,Ideb,Ifin,P,D1U); break;
|
||||
case 2 : BSplC->Geom_BSplineCurve::LocalD2(U,Ideb,Ifin,P,D1U,D2U); break;
|
||||
case 3 : BSplC->Geom_BSplineCurve::LocalD3(U,Ideb,Ifin,P,D1U,D2U,D3U);break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static gp_Vec LocateSideN(const Standard_Real U,
|
||||
const Standard_Integer Side,
|
||||
const Handle(Geom_BSplineCurve)& BSplC,
|
||||
const Standard_Integer Nu,
|
||||
// const Standard_Integer Nv )
|
||||
const Standard_Integer )
|
||||
{
|
||||
Standard_Integer Ideb, Ifin;
|
||||
Standard_Real ParTol=Precision::PConfusion()/2;
|
||||
BSplC->Geom_BSplineCurve::LocateU(U,ParTol,Ideb,Ifin,Standard_False);
|
||||
if(Side == 1)
|
||||
{
|
||||
if(Ideb<1) Ideb=1;
|
||||
if ((Ideb>=Ifin)) Ifin = Ideb+1;
|
||||
}else
|
||||
if(Side ==-1)
|
||||
{
|
||||
if(Ifin > BSplC -> NbKnots()) Ifin=BSplC->NbKnots();
|
||||
if ((Ideb>=Ifin)) Ideb = Ifin-1;
|
||||
}
|
||||
return BSplC->Geom_BSplineCurve::LocalDN(U,Ideb,Ifin,Nu);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@@ -144,6 +89,7 @@ Geom_SurfaceOfLinearExtrusion::Geom_SurfaceOfLinearExtrusion
|
||||
basisCurve = Handle(Geom_Curve)::DownCast(C->Copy()); // Copy 10-03-93
|
||||
direction = V;
|
||||
smooth = C->Continuity();
|
||||
myEvaluator = new GeomEvaluator_SurfaceOfExtrusion(basisCurve, direction);
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +122,8 @@ Standard_Real Geom_SurfaceOfLinearExtrusion::UReversedParameter(const Standard_R
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::VReverse () {
|
||||
|
||||
direction.Reverse();
|
||||
direction.Reverse();
|
||||
myEvaluator->SetDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,12 +143,11 @@ Standard_Real Geom_SurfaceOfLinearExtrusion::VReversedParameter( const Standard_
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::SetDirection (const Dir& V) {
|
||||
|
||||
Handle(Geom_Curve) C;
|
||||
direction = V;
|
||||
C = basisCurve;
|
||||
}
|
||||
void Geom_SurfaceOfLinearExtrusion::SetDirection (const Dir& V)
|
||||
{
|
||||
direction = V;
|
||||
myEvaluator->SetDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@@ -213,6 +159,7 @@ void Geom_SurfaceOfLinearExtrusion::SetBasisCurve (const Handle(Geom_Curve)& C)
|
||||
|
||||
smooth = C->Continuity();
|
||||
basisCurve = Handle(Geom_Curve)::DownCast(C->Copy()); // Copy 10-03-93
|
||||
myEvaluator = new GeomEvaluator_SurfaceOfExtrusion(basisCurve, direction);
|
||||
}
|
||||
|
||||
|
||||
@@ -236,13 +183,11 @@ void Geom_SurfaceOfLinearExtrusion::Bounds ( Standard_Real& U1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::D0 (const Standard_Real U, const Standard_Real V,
|
||||
Pnt& P ) const {
|
||||
|
||||
XYZ Pxyz = direction.XYZ();
|
||||
Pxyz.Multiply (V);
|
||||
Pxyz.Add (basisCurve->Value (U).XYZ());
|
||||
P.SetXYZ(Pxyz);
|
||||
void Geom_SurfaceOfLinearExtrusion::D0 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
Pnt& P) const
|
||||
{
|
||||
myEvaluator->D0(U, V, P);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,17 +196,12 @@ void Geom_SurfaceOfLinearExtrusion::D0 (const Standard_Real U, const Standard_Re
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::D1 ( const Standard_Real U ,
|
||||
const Standard_Real V ,
|
||||
Pnt& P ,
|
||||
Vec& D1U, Vec& D1V) const {
|
||||
|
||||
basisCurve->D1 (U, P, D1U);
|
||||
D1V = direction;
|
||||
XYZ Pxyz = direction.XYZ();
|
||||
Pxyz.Multiply (V);
|
||||
Pxyz.Add (P.XYZ());
|
||||
P.SetXYZ (Pxyz);
|
||||
void Geom_SurfaceOfLinearExtrusion::D1 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
Pnt& P,
|
||||
Vec& D1U, Vec& D1V) const
|
||||
{
|
||||
myEvaluator->D1(U, V, P, D1U, D1V);
|
||||
}
|
||||
|
||||
|
||||
@@ -270,21 +210,13 @@ void Geom_SurfaceOfLinearExtrusion::D1 ( const Standard_Real U ,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::D2 ( const Standard_Real U ,
|
||||
const Standard_Real V ,
|
||||
Pnt& P ,
|
||||
Vec& D1U, Vec& D1V,
|
||||
Vec& D2U, Vec& D2V, Vec& D2UV)
|
||||
const {
|
||||
|
||||
basisCurve->D2 (U, P, D1U, D2U);
|
||||
D1V = direction;
|
||||
D2V.SetCoord (0.0, 0.0, 0.0);
|
||||
D2UV.SetCoord (0.0, 0.0, 0.0);
|
||||
XYZ Pxyz = direction.XYZ();
|
||||
Pxyz.Multiply (V);
|
||||
Pxyz.Add (P.XYZ());
|
||||
P.SetXYZ (Pxyz);
|
||||
void Geom_SurfaceOfLinearExtrusion::D2 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
Pnt& P,
|
||||
Vec& D1U, Vec& D1V,
|
||||
Vec& D2U, Vec& D2V, Vec& D2UV) const
|
||||
{
|
||||
myEvaluator->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV);
|
||||
}
|
||||
|
||||
|
||||
@@ -293,192 +225,30 @@ const {
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::D3
|
||||
( const Standard_Real U, const Standard_Real V,
|
||||
Pnt& P,
|
||||
Vec& D1U, Vec& D1V,
|
||||
Vec& D2U, Vec& D2V, Vec& D2UV,
|
||||
Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV ) const {
|
||||
|
||||
|
||||
basisCurve->D3 (U, P, D1U, D2U, D3U);
|
||||
D1V = direction;
|
||||
D2V.SetCoord (0.0, 0.0, 0.0);
|
||||
D3V.SetCoord (0.0, 0.0, 0.0);
|
||||
D3UUV.SetCoord (0.0, 0.0, 0.0);
|
||||
D3UVV.SetCoord (0.0, 0.0, 0.0);
|
||||
D2UV.SetCoord (0.0, 0.0, 0.0);
|
||||
XYZ Pxyz = direction.XYZ();
|
||||
Pxyz.Multiply (V);
|
||||
Pxyz.Add (P.XYZ());
|
||||
P.SetXYZ (Pxyz);
|
||||
void Geom_SurfaceOfLinearExtrusion::D3 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
Pnt& P,
|
||||
Vec& D1U, Vec& D1V,
|
||||
Vec& D2U, Vec& D2V, Vec& D2UV,
|
||||
Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV) const
|
||||
{
|
||||
myEvaluator->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DN
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Vec Geom_SurfaceOfLinearExtrusion::DN
|
||||
( const Standard_Real U, const Standard_Real ,
|
||||
const Standard_Integer Nu, const Standard_Integer Nv) const {
|
||||
|
||||
Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv <0, " ");
|
||||
if (Nu == 0 && Nv == 1) return Vec (direction);
|
||||
else if (Nv == 0) return basisCurve->DN (U, Nu);
|
||||
else return Vec (0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalD0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::LocalD0 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer USide,
|
||||
gp_Pnt& P ) const
|
||||
{
|
||||
if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Vec D1U,D2U,D3U;
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
|
||||
LocateSide(U,USide,BSplC,0,P,D1U,D2U,D3U);
|
||||
XYZ Pxyz = direction.XYZ();
|
||||
Pxyz.Multiply (V);
|
||||
Pxyz.Add (P.XYZ());
|
||||
P.SetXYZ (Pxyz);
|
||||
}
|
||||
else D0(U,V,P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalD1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::LocalD1 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer USide,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V) const
|
||||
{
|
||||
if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Vec D2U,D3U;
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
|
||||
LocateSide(U,USide,BSplC,1,P,D1U,D2U,D3U);
|
||||
D1V = direction;
|
||||
XYZ Pxyz = direction.XYZ();
|
||||
Pxyz.Multiply (V);
|
||||
Pxyz.Add (P.XYZ());
|
||||
P.SetXYZ (Pxyz);
|
||||
}
|
||||
else D1(U,V,P,D1U,D1V);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalD2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::LocalD2 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer USide,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V,
|
||||
gp_Vec& D2U,
|
||||
gp_Vec& D2V,
|
||||
gp_Vec& D2UV) const
|
||||
Vec Geom_SurfaceOfLinearExtrusion::DN (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer Nu,
|
||||
const Standard_Integer Nv) const
|
||||
{
|
||||
if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Vec D3U;
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
|
||||
LocateSide(U,USide,BSplC,2,P,D1U,D2U,D3U);
|
||||
D1V = direction;
|
||||
D2V.SetCoord (0.0, 0.0, 0.0);
|
||||
D2UV.SetCoord (0.0, 0.0, 0.0);
|
||||
XYZ Pxyz = direction.XYZ();
|
||||
Pxyz.Multiply (V);
|
||||
Pxyz.Add (P.XYZ());
|
||||
P.SetXYZ (Pxyz);
|
||||
}
|
||||
else D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
|
||||
return myEvaluator->DN(U, V, Nu, Nv);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalD3
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfLinearExtrusion::LocalD3 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer USide,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V,
|
||||
gp_Vec& D2U,
|
||||
gp_Vec& D2V,
|
||||
gp_Vec& D2UV,
|
||||
gp_Vec& D3U,
|
||||
gp_Vec& D3V,
|
||||
gp_Vec& D3UUV,
|
||||
gp_Vec& D3UVV) const
|
||||
{
|
||||
if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
|
||||
LocateSide(U,USide,BSplC,3,P,D1U,D2U,D3U);
|
||||
D1V = direction;
|
||||
D2V.SetCoord (0.0, 0.0, 0.0);
|
||||
D3V.SetCoord (0.0, 0.0, 0.0);
|
||||
D3UUV.SetCoord (0.0, 0.0, 0.0);
|
||||
D3UVV.SetCoord (0.0, 0.0, 0.0);
|
||||
D2UV.SetCoord (0.0, 0.0, 0.0);
|
||||
XYZ Pxyz = direction.XYZ();
|
||||
Pxyz.Multiply (V);
|
||||
Pxyz.Add (P.XYZ());
|
||||
P.SetXYZ (Pxyz);
|
||||
}
|
||||
else D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalDN
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Vec Geom_SurfaceOfLinearExtrusion::LocalDN (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer USide,
|
||||
const Standard_Integer Nu,
|
||||
const Standard_Integer Nv) const
|
||||
{
|
||||
Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv <0, " ");
|
||||
if (Nu == 0 && Nv == 1) return Vec (direction);
|
||||
else if (Nv == 0) {
|
||||
if((USide != 0) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
return LocateSideN(U,USide,BSplC,Nu,Nv);
|
||||
}
|
||||
else
|
||||
return DN(U,V,Nu,Nv);
|
||||
}
|
||||
return Vec (0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UIso
|
||||
@@ -540,6 +310,7 @@ void Geom_SurfaceOfLinearExtrusion::Transform (const Trsf& T) {
|
||||
|
||||
direction.Transform (T);
|
||||
basisCurve->Transform (T);
|
||||
myEvaluator->SetDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Geom_SweptSurface.hxx>
|
||||
#include <GeomEvaluator_SurfaceOfExtrusion.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
@@ -204,25 +205,7 @@ public:
|
||||
//! direction and CNv in the v direction.
|
||||
//! Raises RangeError if Nu + Nv < 1 or Nu < 0 or Nv < 0.
|
||||
Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
|
||||
|
||||
//! The following functions evaluates the local
|
||||
//! derivatives on surface. Useful to manage discontinuities
|
||||
//! on the surface.
|
||||
//! if Side = 1 -> P = S( U+,V )
|
||||
//! if Side = -1 -> P = S( U-,V )
|
||||
//! else P is betveen discontinuities
|
||||
//! can be evaluated using methods of
|
||||
//! global evaluations P = S( U ,V )
|
||||
Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P) const;
|
||||
|
||||
Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
|
||||
|
||||
Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
|
||||
|
||||
Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
|
||||
|
||||
Standard_EXPORT gp_Vec LocalDN (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer Nu, const Standard_Integer Nv) const;
|
||||
|
||||
|
||||
//! Applies the transformation T to this surface of linear extrusion.
|
||||
Standard_EXPORT void Transform (const gp_Trsf& T);
|
||||
|
||||
@@ -277,7 +260,7 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Handle(GeomEvaluator_SurfaceOfExtrusion) myEvaluator;
|
||||
|
||||
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <Geom_Geometry.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_UndefinedDerivative.hxx>
|
||||
#include <GeomEvaluator_SurfaceOfRevolution.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
@@ -59,70 +60,6 @@ typedef gp_Trsf Trsf;
|
||||
typedef gp_Vec Vec;
|
||||
typedef gp_XYZ XYZ;
|
||||
|
||||
//=======================================================================
|
||||
//function : LocateSide
|
||||
//purpose : This method locates U parameter on basis BSpline curve
|
||||
// and calls LocalDi methods corresponding an order of
|
||||
// derivative and position of the surface side contained
|
||||
// the point relatively the curve knots.
|
||||
//=======================================================================
|
||||
static void LocateSide(const Standard_Real U,
|
||||
const Standard_Integer Side,
|
||||
const Handle(Geom_BSplineCurve)& BSplC,
|
||||
const Standard_Integer NDir,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D2U,
|
||||
gp_Vec& D3U)
|
||||
{
|
||||
Standard_Integer Ideb, Ifin;
|
||||
Standard_Real ParTol=Precision::PConfusion()/2;
|
||||
BSplC->Geom_BSplineCurve::LocateU(U,ParTol,Ideb,Ifin,Standard_False);
|
||||
if(Side == 1)
|
||||
{
|
||||
if(Ideb<1) Ideb=1;
|
||||
if ((Ideb>=Ifin)) Ifin = Ideb+1;
|
||||
}else
|
||||
if(Side ==-1)
|
||||
{
|
||||
if(Ifin > BSplC -> NbKnots()) Ifin=BSplC->NbKnots();
|
||||
if ((Ideb>=Ifin)) Ideb = Ifin-1;
|
||||
}
|
||||
|
||||
switch(NDir) {
|
||||
case 0 : BSplC->Geom_BSplineCurve::LocalD0(U,Ideb,Ifin,P); break;
|
||||
case 1 : BSplC->Geom_BSplineCurve::LocalD1(U,Ideb,Ifin,P,D1U); break;
|
||||
case 2 : BSplC->Geom_BSplineCurve::LocalD2(U,Ideb,Ifin,P,D1U,D2U); break;
|
||||
case 3 : BSplC->Geom_BSplineCurve::LocalD3(U,Ideb,Ifin,P,D1U,D2U,D3U); break;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocateSideN
|
||||
//purpose : This method locates U parameter on basis BSpline curve
|
||||
// and calls LocalDN method corresponding position of surface side
|
||||
// contained the point relatively the curve knots.
|
||||
//=======================================================================
|
||||
static gp_Vec LocateSideN(const Standard_Real V,
|
||||
const Standard_Integer Side,
|
||||
const Handle(Geom_BSplineCurve)& BSplC,
|
||||
const Standard_Integer Nv )
|
||||
{
|
||||
Standard_Integer Ideb, Ifin;
|
||||
Standard_Real ParTol=Precision::PConfusion()/2;
|
||||
BSplC->Geom_BSplineCurve::LocateU(V,ParTol,Ideb,Ifin,Standard_False);
|
||||
if(Side == 1)
|
||||
{
|
||||
if(Ideb<1) Ideb=1;
|
||||
if ((Ideb>=Ifin)) Ifin = Ideb+1;
|
||||
}else
|
||||
if(Side ==-1)
|
||||
{
|
||||
if(Ifin > BSplC -> NbKnots()) Ifin=BSplC->NbKnots();
|
||||
if ((Ideb>=Ifin)) Ideb = Ifin-1;
|
||||
}
|
||||
return BSplC->Geom_BSplineCurve::LocalDN(V,Ideb,Ifin,Nv);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -147,9 +84,8 @@ Geom_SurfaceOfRevolution::Geom_SurfaceOfRevolution
|
||||
(const Handle(Geom_Curve)& C ,
|
||||
const Ax1& A1 ) : loc (A1.Location()) {
|
||||
|
||||
basisCurve = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||
direction = A1.Direction();
|
||||
smooth = C->Continuity();
|
||||
SetBasisCurve(C);
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +96,8 @@ Geom_SurfaceOfRevolution::Geom_SurfaceOfRevolution
|
||||
|
||||
void Geom_SurfaceOfRevolution::UReverse () {
|
||||
|
||||
direction.Reverse();
|
||||
direction.Reverse();
|
||||
myEvaluator->SetDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
@@ -290,6 +227,7 @@ void Geom_SurfaceOfRevolution::SetAxis (const Ax1& A1) {
|
||||
|
||||
direction = A1.Direction();
|
||||
loc = A1.Location();
|
||||
myEvaluator->SetAxis(A1);
|
||||
}
|
||||
|
||||
|
||||
@@ -301,6 +239,7 @@ void Geom_SurfaceOfRevolution::SetAxis (const Ax1& A1) {
|
||||
void Geom_SurfaceOfRevolution::SetDirection (const Dir& V) {
|
||||
|
||||
direction = V;
|
||||
myEvaluator->SetDirection(direction);
|
||||
}
|
||||
|
||||
|
||||
@@ -313,6 +252,7 @@ void Geom_SurfaceOfRevolution::SetBasisCurve (const Handle(Geom_Curve)& C) {
|
||||
|
||||
basisCurve = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||
smooth = C->Continuity();
|
||||
myEvaluator = new GeomEvaluator_SurfaceOfRevolution(basisCurve, direction, loc);
|
||||
}
|
||||
|
||||
|
||||
@@ -324,6 +264,7 @@ void Geom_SurfaceOfRevolution::SetBasisCurve (const Handle(Geom_Curve)& C) {
|
||||
void Geom_SurfaceOfRevolution::SetLocation (const Pnt& P) {
|
||||
|
||||
loc = P;
|
||||
myEvaluator->SetLocation(loc);
|
||||
}
|
||||
|
||||
|
||||
@@ -349,30 +290,10 @@ void Geom_SurfaceOfRevolution::Bounds ( Standard_Real& U1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfRevolution::D0
|
||||
(const Standard_Real U, const Standard_Real V, Pnt& P) const {
|
||||
|
||||
// C origine sur l'axe de revolution
|
||||
// Vdir vecteur unitaire definissant la direction de l'axe de revolution
|
||||
// Q(v) point de parametre V sur la courbe de revolution
|
||||
// OM (u,v) = OC + CQ * Cos(U) + (CQ.Vdir)(1-Cos(U)) * Vdir +
|
||||
// (Vdir^CQ)* Sin(U)
|
||||
|
||||
|
||||
Pnt Pc = basisCurve->Value (V); //Q(v)
|
||||
XYZ Q = Pc.XYZ(); //Q
|
||||
XYZ C = loc.XYZ(); //C
|
||||
Q.Subtract(C); //CQ
|
||||
XYZ Vdir = direction.XYZ(); //Vdir
|
||||
XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
|
||||
VcrossCQ.Multiply (Sin(U)); //(Vdir^CQ)*Sin(U)
|
||||
XYZ VdotCQ =
|
||||
Vdir.Multiplied ((Vdir.Dot(Q))*(1.0 - Cos(U)));//(CQ.Vdir)(1-Cos(U))Vdir
|
||||
VdotCQ.Add (VcrossCQ); //addition des composantes
|
||||
Q.Multiply (Cos(U));
|
||||
Q.Add (VdotCQ);
|
||||
Q.Add (C);
|
||||
P.SetXYZ(Q);
|
||||
void Geom_SurfaceOfRevolution::D0
|
||||
(const Standard_Real U, const Standard_Real V, Pnt& P) const
|
||||
{
|
||||
myEvaluator->D0(U, V, P);
|
||||
}
|
||||
|
||||
|
||||
@@ -384,56 +305,10 @@ void Geom_SurfaceOfRevolution::D0
|
||||
void Geom_SurfaceOfRevolution::D1
|
||||
(const Standard_Real U, const Standard_Real V,
|
||||
Pnt& P,
|
||||
Vec& D1U, Vec& D1V ) const {
|
||||
|
||||
// C origine sur l'axe de revolution
|
||||
// Vdir vecteur unitaire definissant la direction de l'axe de revolution
|
||||
// Q(v) point de parametre V sur la courbe de revolution
|
||||
// Q'(v) = DQ/DV
|
||||
// OM (u,v) = OC + CQ * Cos(U) + (CQ.Vdir)(1-Cos(U)) * Vdir +
|
||||
// (Vdir^CQ) * Sin(U)
|
||||
// D1U_M(u,v) = - CQ * Sin(U) + (CQ.Vdir)(Sin(U)) * Vdir +
|
||||
// (Vdir^CQ) * Cos(U)
|
||||
// D1V_M(u,v) = Q' * Cos(U) + (Q'.Vdir)(1-Cos(U)) * Vdir +
|
||||
// (Vdir^Q') * Sin(U)
|
||||
|
||||
Pnt Pc;
|
||||
Vec V1;
|
||||
basisCurve->D1 (V, Pc, V1);
|
||||
XYZ Q = Pc.XYZ(); //Q
|
||||
XYZ DQv = V1.XYZ(); //Q'
|
||||
XYZ C = loc.XYZ(); //C
|
||||
XYZ Vdir = direction.XYZ(); //Vdir
|
||||
Q.Subtract(C); //CQ
|
||||
XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
|
||||
// If the point is placed on the axis of revolution then derivatives on U are undefined.
|
||||
// Manually set them to zero.
|
||||
if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
|
||||
VcrossCQ.SetCoord(0.0, 0.0, 0.0);
|
||||
XYZ VcrossDQv = Vdir.Crossed (DQv); //(Vdir^Q')
|
||||
XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
|
||||
XYZ VdotDQv = Vdir.Multiplied (Vdir.Dot(DQv)); //(Vdir.Q')Vdir
|
||||
|
||||
VcrossDQv.Multiply (Sin(U));
|
||||
VdotDQv.Multiply (1.0 - Cos(U));
|
||||
VdotDQv.Add (VcrossDQv);
|
||||
DQv.Multiply (Cos(U));
|
||||
DQv.Add (VdotDQv);
|
||||
D1V.SetXYZ (DQv);
|
||||
|
||||
XYZ DQu = Q.Multiplied (-Sin(U));
|
||||
DQu.Add (VcrossCQ.Multiplied (Cos(U)));
|
||||
DQu.Add (VdotCQ.Multiplied (Sin(U)));
|
||||
D1U.SetXYZ (DQu);
|
||||
|
||||
Q.Multiply (Cos(U));
|
||||
Q.Add (C);
|
||||
VcrossCQ.Multiply (Sin(U));
|
||||
Q.Add (VcrossCQ);
|
||||
VdotCQ.Multiply (1.0-Cos(U));
|
||||
Q.Add (VdotCQ);
|
||||
P.SetXYZ (Q);
|
||||
}
|
||||
Vec& D1U, Vec& D1V ) const
|
||||
{
|
||||
myEvaluator->D1(U, V, P, D1U, D1V);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D2
|
||||
@@ -444,83 +319,9 @@ void Geom_SurfaceOfRevolution::D2
|
||||
(const Standard_Real U, const Standard_Real V,
|
||||
Pnt& P,
|
||||
Vec& D1U, Vec& D1V,
|
||||
Vec& D2U, Vec& D2V, Vec& D2UV ) const {
|
||||
|
||||
|
||||
// C origine sur l'axe de revolution
|
||||
// V vecteur unitaire definissant la direction de l'axe de revolution
|
||||
// Q(v) point de parametre V sur la courbe de revolution
|
||||
// Q'(v) = D1Q/DV
|
||||
// Q"(v) = D2Q/DV
|
||||
// OM (u,v) = OC + CQ * Cos(U) + (CQ.Vdir)(1-Cos(U)) * Vdir +
|
||||
// (Vdir^CQ) * Sin(U)
|
||||
// D1U_M(u,v) = - CQ * Sin(U) + (CQ.Vdir)(Sin(U)) * Vdir +
|
||||
// (Vdir^CQ) * Cos(U)
|
||||
// D1V_M(u,v) = Q' * Cos(U) + (Q'.Vdir)(1-Cos(U)) * Vdir +
|
||||
// (Vdir^Q') * Sin(U)
|
||||
// D2U_M(u,v) = -CQ * Cos(U) + (CQ.Vdir)(Cos(U)) * Vdir +
|
||||
// (Vdir^CQ) * -(Sin(U))
|
||||
// D2V_M(u,v) = Q" * Cos(U) + (Q".Vdir)(1-Cos(U)) * Vdir +
|
||||
// (Vdir^Q") * Sin(U)
|
||||
// D2UV_M(u,v)= -Q' * Sin(U) + (Q'.Vdir)(Sin(U)) * Vdir +
|
||||
// (Vdir^Q') * Cos(U)
|
||||
|
||||
|
||||
Pnt Pc;
|
||||
Vec V1 , V2;
|
||||
basisCurve->D2 (V, Pc, V1, V2);
|
||||
XYZ Q = Pc.XYZ(); //Q
|
||||
XYZ D1Qv = V1.XYZ(); //Q'
|
||||
XYZ D2Qv = V2.XYZ(); //Q"
|
||||
XYZ C = loc.XYZ(); //C
|
||||
XYZ Vdir = direction.XYZ(); //Vdir
|
||||
Q.Subtract(C); //CQ
|
||||
XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
|
||||
// If the point is placed on the axis of revolution then derivatives on U are undefined.
|
||||
// Manually set them to zero.
|
||||
if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
|
||||
VcrossCQ.SetCoord(0.0, 0.0, 0.0);
|
||||
XYZ VcrossD1Qv = Vdir.Crossed (D1Qv); //(Vdir^Q')
|
||||
XYZ VcrossD2Qv = Vdir.Crossed (D2Qv); //(Vdir^Q")
|
||||
XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
|
||||
XYZ VdotD1Qv = Vdir.Multiplied (Vdir.Dot(D1Qv)); //(Vdir.Q')Vdir
|
||||
XYZ VdotD2Qv = Vdir.Multiplied (Vdir.Dot(D2Qv)); //(Vdir.Q")Vdir
|
||||
|
||||
|
||||
XYZ D2Quv = D1Qv.Multiplied(-Sin(U));
|
||||
D2Quv.Add (VcrossD1Qv.Multiplied (Cos(U)));
|
||||
D2Quv.Add (VdotD1Qv.Multiplied (Sin(U)));
|
||||
D2UV.SetXYZ (D2Quv);
|
||||
|
||||
D1Qv.Multiply (Cos(U));
|
||||
VcrossD1Qv.Multiply (Sin(U));
|
||||
VdotD1Qv.Multiply (1.0 - Cos(U));
|
||||
D1Qv.Add (VcrossD1Qv);
|
||||
D1Qv.Add (VdotD1Qv);
|
||||
D1V.SetXYZ (D1Qv);
|
||||
|
||||
VcrossD2Qv.Multiply (Sin(U));
|
||||
VdotD2Qv.Multiply (1.0 - Cos(U));
|
||||
VdotD2Qv.Add (VcrossD2Qv);
|
||||
D2Qv.Multiply (Cos(U));
|
||||
D2Qv.Add (VdotD2Qv);
|
||||
D2V.SetXYZ (D2Qv);
|
||||
|
||||
XYZ D1Qu = Q.Multiplied (-Sin(U));
|
||||
D1Qu.Add (VcrossCQ.Multiplied (Cos(U)));
|
||||
D1Qu.Add (VdotCQ.Multiplied (Sin(U)));
|
||||
D1U.SetXYZ (D1Qu);
|
||||
|
||||
Q.Multiply (Cos(U));
|
||||
VcrossCQ.Multiply (Sin(U));
|
||||
Q.Add (VcrossCQ);
|
||||
XYZ D2Qu = Q.Multiplied(-1.0);
|
||||
D2Qu.Add (VdotCQ.Multiplied (Cos(U)));
|
||||
D2U.SetXYZ (D2Qu);
|
||||
VdotCQ.Multiply (1.0-Cos(U));
|
||||
Q.Add (VdotCQ);
|
||||
Q.Add (C);
|
||||
P.SetXYZ (Q);
|
||||
Vec& D2U, Vec& D2V, Vec& D2UV ) const
|
||||
{
|
||||
myEvaluator->D2(U, V, P, D1U, D1V, D2U, D2V, D2UV);
|
||||
}
|
||||
|
||||
|
||||
@@ -535,112 +336,9 @@ void Geom_SurfaceOfRevolution::D3
|
||||
Pnt& P,
|
||||
Vec& D1U, Vec& D1V,
|
||||
Vec& D2U, Vec& D2V, Vec& D2UV,
|
||||
Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV ) const {
|
||||
|
||||
// C origine sur l'axe de revolution
|
||||
// Vdir vecteur unitaire definissant la direction de l'axe de revolution
|
||||
// Q(v) point de parametre V sur la courbe de revolution
|
||||
// Q'(v) = D1Q/DV
|
||||
// Q"(v) = D2Q/DV
|
||||
// OM (u,v) = OC + CQ * Cos(u) + (CQ.Vdir)(1-Cos(u)) * Vdir +
|
||||
// (Vdir^CQ) * Sin(u)
|
||||
// D1U_M(u,v) = - CQ * Sin(u) + (CQ.Vdir)(Sin(u)) * Vdir +
|
||||
// (Vdir^CQ) * Cos(u)
|
||||
// D2U_M(u,v) = -CQ * Cos(u) + (CQ.Vdir)(Cos(u)) * Vdir +
|
||||
// (Vdir^CQ) * -Sin(u)
|
||||
// D2UV_M(u,v)= -Q' * Sin(u) + (Q'.Vdir)(Sin(u)) * Vdir +
|
||||
// (Vdir^Q') * Cos(u)
|
||||
// D3UUV_M(u,v) = -Q' * Cos(u) + (Q'.Vdir)(Cos(u)) * Vdir +
|
||||
// (Vdir^Q') * -Sin(u)
|
||||
// D3U_M(u,v) = CQ * Sin(u) + (CQ.Vdir)(-Sin(u)) * Vdir +
|
||||
// (Vdir^CQ) * -Cos(u)
|
||||
// D1V_M(u,v) = Q' * Cos(u) + (Q'.Vdir)(1-Cos(u)) * Vdir +
|
||||
// (Vdir^Q') * Sin(u)
|
||||
// D2V_M(u,v) = Q" * Cos(u) + (Q".Vdir)(1-Cos(u)) * Vdir +
|
||||
// (Vdir^Q") * Sin(u)
|
||||
// D3UVV_M(u,v) = -Q" * Sin(u) + (Q".Vdir)(Sin(u)) * Vdir +
|
||||
// (Vdir^Q") * Cos(u)
|
||||
// D3V_M(u,v) = Q'''* Cos(u) + (Q'''.Vdir)(1-Cos(u)) * Vdir +
|
||||
// (Vdir^Q''') * Sin(u)
|
||||
|
||||
|
||||
Pnt Pc;
|
||||
Vec V1 , V2, V3;
|
||||
basisCurve->D3 (V, Pc, V1, V2, V3);
|
||||
XYZ Q = Pc.XYZ(); //Q
|
||||
XYZ D1Qv = V1.XYZ(); //Q'
|
||||
XYZ D2Qv = V2.XYZ(); //Q"
|
||||
XYZ D3Qv = V3.XYZ(); //Q'''
|
||||
XYZ C = loc.XYZ(); //C
|
||||
XYZ Vdir = direction.XYZ(); //Vdir
|
||||
Q.Subtract(C); //CQ
|
||||
XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
|
||||
// If the point is placed on the axis of revolution then derivatives on U are undefined.
|
||||
// Manually set them to zero.
|
||||
if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
|
||||
VcrossCQ.SetCoord(0.0, 0.0, 0.0);
|
||||
XYZ VcrossD1Qv = Vdir.Crossed (D1Qv); //(Vdir^Q')
|
||||
XYZ VcrossD2Qv = Vdir.Crossed (D2Qv); //(Vdir^Q")
|
||||
XYZ VcrossD3Qv = Vdir.Crossed (D3Qv); //(Vdir^Q''')
|
||||
XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
|
||||
XYZ VdotD1Qv = Vdir.Multiplied (Vdir.Dot(D1Qv)); //(Vdir.Q')Vdir
|
||||
XYZ VdotD2Qv = Vdir.Multiplied (Vdir.Dot(D2Qv)); //(Vdir.Q")Vdir
|
||||
XYZ VdotD3Qv = Vdir.Multiplied (Vdir.Dot(D3Qv)); //(Vdir.Q''')Vdir
|
||||
|
||||
XYZ D3Quuv = D1Qv.Multiplied (-Cos(U));
|
||||
D3Quuv.Add (VcrossD1Qv.Multiplied (-Sin(U)));
|
||||
D3Quuv.Add (VdotD1Qv.Multiplied (Cos(U)));
|
||||
D3UUV.SetXYZ (D3Quuv);
|
||||
|
||||
XYZ D2Quv = D1Qv.Multiplied (-Sin(U));
|
||||
D2Quv.Add (VcrossD1Qv.Multiplied (Cos(U)));
|
||||
D2Quv.Add (VdotD1Qv.Multiplied (Sin(U)));
|
||||
D2UV.SetXYZ (D2Quv);
|
||||
|
||||
D1Qv.Multiply (Cos(U));
|
||||
VcrossD1Qv.Multiply (Sin(U));
|
||||
VdotD1Qv.Multiply (1.0 - Cos(U));
|
||||
D1Qv.Add (VcrossD1Qv);
|
||||
D1Qv.Add (VdotD1Qv);
|
||||
D1V.SetXYZ (D1Qv);
|
||||
|
||||
XYZ D3Qvvu = D2Qv.Multiplied (-Sin(U));
|
||||
D3Qvvu.Add (VcrossD2Qv.Multiplied (Cos(U)));
|
||||
D3Qvvu.Add (VdotD2Qv.Multiplied (Sin(U)));
|
||||
D3UVV.SetXYZ (D3Qvvu);
|
||||
|
||||
VcrossD2Qv.Multiply (Sin(U));
|
||||
VdotD2Qv.Multiply (1.0 - Cos(U));
|
||||
VdotD2Qv.Add (VcrossD2Qv);
|
||||
D2Qv.Multiply (Cos(U));
|
||||
D2Qv.Add (VdotD2Qv);
|
||||
D2V.SetXYZ (D2Qv);
|
||||
|
||||
VcrossD3Qv.Multiply (Sin(U));
|
||||
VdotD3Qv.Multiply (1.0 - Cos(U));
|
||||
VdotD3Qv.Add (VcrossD2Qv);
|
||||
D3Qv.Multiply (Cos(U));
|
||||
D3Qv.Add (VdotD3Qv);
|
||||
D3V.SetXYZ (D3Qv);
|
||||
|
||||
XYZ D1Qu = Q.Multiplied (- Sin(U));
|
||||
D1Qu.Add (VcrossCQ.Multiplied (Cos(U)));
|
||||
XYZ D3Qu = D1Qu.Multiplied (-1.0);
|
||||
D1Qu.Add (VdotCQ.Multiplied (Sin(U)));
|
||||
D3Qu.Add (VdotCQ.Multiplied (-Sin(U)));
|
||||
D1U.SetXYZ (D1Qu);
|
||||
D3U.SetXYZ (D3Qu);
|
||||
|
||||
Q.Multiply (Cos(U));
|
||||
VcrossCQ.Multiply (Sin(U));
|
||||
Q.Add (VcrossCQ);
|
||||
XYZ D2Qu = Q.Multiplied(-1.0);
|
||||
D2Qu.Add (VdotCQ.Multiplied (Cos(U)));
|
||||
D2U.SetXYZ (D2Qu);
|
||||
VdotCQ.Multiply (1.0-Cos(U));
|
||||
Q.Add (VdotCQ);
|
||||
Q.Add (C);
|
||||
P.SetXYZ (Q);
|
||||
Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV ) const
|
||||
{
|
||||
myEvaluator->D3(U, V, P, D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV);
|
||||
}
|
||||
|
||||
|
||||
@@ -650,458 +348,11 @@ void Geom_SurfaceOfRevolution::D3
|
||||
//=======================================================================
|
||||
|
||||
Vec Geom_SurfaceOfRevolution::DN (const Standard_Real U , const Standard_Real V,
|
||||
const Standard_Integer Nu, const Standard_Integer Nv) const {
|
||||
|
||||
Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv < 0, " ");
|
||||
if (Nu == 0) {
|
||||
XYZ Vn = (basisCurve->DN (V, Nv)).XYZ();
|
||||
XYZ Vdir = direction.XYZ();
|
||||
XYZ VDot = Vdir.Multiplied (Vn.Dot (Vdir));
|
||||
VDot.Multiply (1-Cos(U));
|
||||
XYZ VCross = Vdir.Crossed (Vn);
|
||||
VCross.Multiply (Sin(U));
|
||||
Vn.Multiply (Cos(U));
|
||||
Vn.Add (VDot);
|
||||
Vn.Add (VCross);
|
||||
return Vec (Vn);
|
||||
}
|
||||
else if (Nv == 0) {
|
||||
XYZ CQ = (basisCurve->Value (V)).XYZ() - loc.XYZ();
|
||||
XYZ Vdir = direction.XYZ();
|
||||
XYZ VDot = Vdir.Multiplied (CQ.Dot (Vdir));
|
||||
XYZ VCross = Vdir.Crossed (CQ);
|
||||
if ((Nu + 6) % 4 == 0) {
|
||||
CQ.Multiply (-Cos (U));
|
||||
VDot.Multiply (Cos(U));
|
||||
VCross.Multiply (-Sin(U));
|
||||
}
|
||||
else if ((Nu + 5) % 4 == 0) {
|
||||
CQ.Multiply (Sin (U));
|
||||
VDot.Multiply (-Sin(U));
|
||||
VCross.Multiply (-Cos(U));
|
||||
}
|
||||
else if ((Nu+3) % 4 == 0) {
|
||||
CQ.Multiply (-Sin (U));
|
||||
VDot.Multiply (+Sin(U));
|
||||
VCross.Multiply (Cos(U));
|
||||
}
|
||||
else if (Nu+4 % 4 == 0) {
|
||||
CQ.Multiply (Cos (U));
|
||||
VDot.Multiply (-Cos(U));
|
||||
VCross.Multiply (Sin(U));
|
||||
}
|
||||
CQ.Add (VDot);
|
||||
CQ.Add (VCross);
|
||||
return Vec (CQ);
|
||||
}
|
||||
else {
|
||||
XYZ Vn = (basisCurve->DN (V, Nv)).XYZ();
|
||||
XYZ Vdir = direction.XYZ();
|
||||
XYZ VDot = Vdir.Multiplied (Vn.Dot (Vdir));
|
||||
XYZ VCross = Vdir.Crossed (Vn);
|
||||
if ((Nu + 6) % 4 == 0) {
|
||||
Vn.Multiply (-Cos (U));
|
||||
VDot.Multiply (Cos(U));
|
||||
VCross.Multiply (-Sin(U));
|
||||
}
|
||||
else if ((Nu + 5) % 4 == 0) {
|
||||
Vn.Multiply (Sin (U));
|
||||
VDot.Multiply (-Sin(U));
|
||||
VCross.Multiply (-Cos(U));
|
||||
}
|
||||
else if ((Nu+3) % 4 == 0) {
|
||||
Vn.Multiply (-Sin (U));
|
||||
VDot.Multiply (+Sin(U));
|
||||
VCross.Multiply (Cos(U));
|
||||
}
|
||||
else if (Nu+4 % 4 == 0) {
|
||||
Vn.Multiply (Cos (U));
|
||||
VDot.Multiply (-Cos(U));
|
||||
VCross.Multiply (Sin(U));
|
||||
}
|
||||
Vn.Add (VDot);
|
||||
Vn.Add (VCross);
|
||||
return Vec (Vn);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalD0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfRevolution::LocalD0 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer VSide,
|
||||
gp_Pnt& P ) const
|
||||
const Standard_Integer Nu, const Standard_Integer Nv) const
|
||||
{
|
||||
if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
gp_Vec D1V,D2V,D3V;
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
|
||||
LocateSide(V,VSide,BSplC,0,P,D1V,D2V,D3V);
|
||||
XYZ Q = P.XYZ(); //Q
|
||||
XYZ C = loc.XYZ(); //C
|
||||
Q.Subtract(C); //CQ
|
||||
XYZ Vdir = direction.XYZ(); //Vdir
|
||||
XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
|
||||
VcrossCQ.Multiply (Sin(U)); //(Vdir^CQ)*Sin(U)
|
||||
XYZ VdotCQ =
|
||||
Vdir.Multiplied ((Vdir.Dot(Q))*(1.0 - Cos(U)));//(CQ.Vdir)(1-Cos(U))Vdir
|
||||
VdotCQ.Add (VcrossCQ); //addition des composantes
|
||||
Q.Multiply (Cos(U));
|
||||
Q.Add (VdotCQ);
|
||||
Q.Add (C);
|
||||
P.SetXYZ(Q);
|
||||
}
|
||||
else D0(U,V,P);
|
||||
return myEvaluator->DN(U, V, Nu, Nv);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalD1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfRevolution::LocalD1 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer VSide,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V) const
|
||||
{
|
||||
if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
Vec D2V,D3V;
|
||||
Vec V1;
|
||||
LocateSide(V,VSide,BSplC,1,P,V1,D2V,D3V);
|
||||
XYZ Q = P.XYZ(); //Q
|
||||
XYZ DQv = V1.XYZ(); //Q'
|
||||
XYZ C = loc.XYZ(); //C
|
||||
XYZ Vdir = direction.XYZ(); //Vdir
|
||||
Q.Subtract(C); //CQ
|
||||
XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
|
||||
// If the point is placed on the axis of revolution then derivatives on U are undefined.
|
||||
// Manually set them to zero.
|
||||
if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
|
||||
VcrossCQ.SetCoord(0.0, 0.0, 0.0);
|
||||
|
||||
XYZ VcrossDQv = Vdir.Crossed (DQv); //(Vdir^Q')
|
||||
XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
|
||||
XYZ VdotDQv = Vdir.Multiplied (Vdir.Dot(DQv)); //(Vdir.Q')Vdir
|
||||
|
||||
VcrossDQv.Multiply (Sin(U));
|
||||
VdotDQv.Multiply (1.0 - Cos(U));
|
||||
VdotDQv.Add (VcrossDQv);
|
||||
DQv.Multiply (Cos(U));
|
||||
DQv.Add (VdotDQv);
|
||||
D1V.SetXYZ (DQv);
|
||||
|
||||
XYZ DQu = Q.Multiplied (-Sin(U));
|
||||
DQu.Add (VcrossCQ.Multiplied (Cos(U)));
|
||||
DQu.Add (VdotCQ.Multiplied (Sin(U)));
|
||||
D1U.SetXYZ (DQu);
|
||||
|
||||
Q.Multiply (Cos(U));
|
||||
Q.Add (C);
|
||||
VcrossCQ.Multiply (Sin(U));
|
||||
Q.Add (VcrossCQ);
|
||||
VdotCQ.Multiply (1.0-Cos(U));
|
||||
Q.Add (VdotCQ);
|
||||
P.SetXYZ (Q);
|
||||
}else
|
||||
D1(U,V,P,D1U,D1V);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LocalD2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfRevolution::LocalD2 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer VSide,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V,
|
||||
gp_Vec& D2U,
|
||||
gp_Vec& D2V,
|
||||
gp_Vec& D2UV) const
|
||||
{
|
||||
if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
Vec d3v;
|
||||
LocateSide(V,VSide,BSplC,2,P,D1V,D2V,d3v);
|
||||
XYZ Q = P.XYZ(); //Q
|
||||
XYZ D1Qv = D1V.XYZ(); //Q'
|
||||
XYZ D2Qv = D2V.XYZ(); //Q"
|
||||
XYZ C = loc.XYZ(); //C
|
||||
XYZ Vdir = direction.XYZ(); //Vdir
|
||||
Q.Subtract(C); //CQ
|
||||
XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
|
||||
// If the point is placed on the axis of revolution then derivatives on U are undefined.
|
||||
// Manually set them to zero.
|
||||
if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
|
||||
VcrossCQ.SetCoord(0.0, 0.0, 0.0);
|
||||
|
||||
XYZ VcrossD1Qv = Vdir.Crossed (D1Qv); //(Vdir^Q')
|
||||
XYZ VcrossD2Qv = Vdir.Crossed (D2Qv); //(Vdir^Q")
|
||||
XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
|
||||
XYZ VdotD1Qv = Vdir.Multiplied (Vdir.Dot(D1Qv)); //(Vdir.Q')Vdir
|
||||
XYZ VdotD2Qv = Vdir.Multiplied (Vdir.Dot(D2Qv)); //(Vdir.Q")Vdir
|
||||
|
||||
|
||||
XYZ D2Quv = D1Qv.Multiplied(-Sin(U));
|
||||
D2Quv.Add (VcrossD1Qv.Multiplied (Cos(U)));
|
||||
D2Quv.Add (VdotD1Qv.Multiplied (Sin(U)));
|
||||
D2UV.SetXYZ (D2Quv);
|
||||
|
||||
D1Qv.Multiply (Cos(U));
|
||||
VcrossD1Qv.Multiply (Sin(U));
|
||||
VdotD1Qv.Multiply (1.0 - Cos(U));
|
||||
D1Qv.Add (VcrossD1Qv);
|
||||
D1Qv.Add (VdotD1Qv);
|
||||
D1V.SetXYZ (D1Qv);
|
||||
|
||||
VcrossD2Qv.Multiply (Sin(U));
|
||||
VdotD2Qv.Multiply (1.0 - Cos(U));
|
||||
VdotD2Qv.Add (VcrossD2Qv);
|
||||
D2Qv.Multiply (Cos(U));
|
||||
D2Qv.Add (VdotD2Qv);
|
||||
D2V.SetXYZ (D2Qv);
|
||||
|
||||
XYZ D1Qu = Q.Multiplied (-Sin(U));
|
||||
D1Qu.Add (VcrossCQ.Multiplied (Cos(U)));
|
||||
D1Qu.Add (VdotCQ.Multiplied (Sin(U)));
|
||||
D1U.SetXYZ (D1Qu);
|
||||
|
||||
Q.Multiply (Cos(U));
|
||||
VcrossCQ.Multiply (Sin(U));
|
||||
Q.Add (VcrossCQ);
|
||||
XYZ D2Qu = Q.Multiplied(-1.0);
|
||||
D2Qu.Add (VdotCQ.Multiplied (Cos(U)));
|
||||
D2U.SetXYZ (D2Qu);
|
||||
VdotCQ.Multiply (1.0-Cos(U));
|
||||
Q.Add (VdotCQ);
|
||||
Q.Add (C);
|
||||
P.SetXYZ (Q);
|
||||
}
|
||||
else
|
||||
D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : LocalD3
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_SurfaceOfRevolution::LocalD3 (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer VSide,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V,
|
||||
gp_Vec& D2U,
|
||||
gp_Vec& D2V,
|
||||
gp_Vec& D2UV,
|
||||
gp_Vec& D3U,
|
||||
gp_Vec& D3V,
|
||||
gp_Vec& D3UUV,
|
||||
gp_Vec& D3UVV) const
|
||||
{
|
||||
if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
|
||||
LocateSide(V,VSide,BSplC,3,P,D1V,D2V,D3V);
|
||||
XYZ Q = P.XYZ(); //Q
|
||||
XYZ D1Qv = D1V.XYZ(); //Q'
|
||||
XYZ D2Qv = D2V.XYZ(); //Q"
|
||||
XYZ D3Qv = D3V.XYZ(); //Q'''
|
||||
XYZ C = loc.XYZ(); //C
|
||||
XYZ Vdir = direction.XYZ(); //Vdir
|
||||
Q.Subtract(C); //CQ
|
||||
XYZ VcrossCQ = Vdir.Crossed (Q); //Vdir^CQ
|
||||
// If the point is placed on the axis of revolution then derivatives on U are undefined.
|
||||
// Manually set them to zero.
|
||||
if (VcrossCQ.SquareModulus() < Precision::SquareConfusion())
|
||||
VcrossCQ.SetCoord(0.0, 0.0, 0.0);
|
||||
|
||||
XYZ VcrossD1Qv = Vdir.Crossed (D1Qv); //(Vdir^Q')
|
||||
XYZ VcrossD2Qv = Vdir.Crossed (D2Qv); //(Vdir^Q")
|
||||
XYZ VcrossD3Qv = Vdir.Crossed (D3Qv); //(Vdir^Q''')
|
||||
XYZ VdotCQ = Vdir.Multiplied (Vdir.Dot(Q)); //(Vdir.CQ)Vdir
|
||||
XYZ VdotD1Qv = Vdir.Multiplied (Vdir.Dot(D1Qv)); //(Vdir.Q')Vdir
|
||||
XYZ VdotD2Qv = Vdir.Multiplied (Vdir.Dot(D2Qv)); //(Vdir.Q")Vdir
|
||||
XYZ VdotD3Qv = Vdir.Multiplied (Vdir.Dot(D3Qv)); //(Vdir.Q''')Vdir
|
||||
|
||||
XYZ D3Quuv = D1Qv.Multiplied (-Cos(U));
|
||||
D3Quuv.Add (VcrossD1Qv.Multiplied (-Sin(U)));
|
||||
D3Quuv.Add (VdotD1Qv.Multiplied (Cos(U)));
|
||||
D3UUV.SetXYZ (D3Quuv);
|
||||
|
||||
XYZ D2Quv = D1Qv.Multiplied (-Sin(U));
|
||||
D2Quv.Add (VcrossD1Qv.Multiplied (Cos(U)));
|
||||
D2Quv.Add (VdotD1Qv.Multiplied (Sin(U)));
|
||||
D2UV.SetXYZ (D2Quv);
|
||||
|
||||
D1Qv.Multiply (Cos(U));
|
||||
VcrossD1Qv.Multiply (Sin(U));
|
||||
VdotD1Qv.Multiply (1.0 - Cos(U));
|
||||
D1Qv.Add (VcrossD1Qv);
|
||||
D1Qv.Add (VdotD1Qv);
|
||||
D1V.SetXYZ (D1Qv);
|
||||
|
||||
XYZ D3Qvvu = D2Qv.Multiplied (-Sin(U));
|
||||
D3Qvvu.Add (VcrossD2Qv.Multiplied (Cos(U)));
|
||||
D3Qvvu.Add (VdotD2Qv.Multiplied (Sin(U)));
|
||||
D3UVV.SetXYZ (D3Qvvu);
|
||||
|
||||
VcrossD2Qv.Multiply (Sin(U));
|
||||
VdotD2Qv.Multiply (1.0 - Cos(U));
|
||||
VdotD2Qv.Add (VcrossD2Qv);
|
||||
D2Qv.Multiply (Cos(U));
|
||||
D2Qv.Add (VdotD2Qv);
|
||||
D2V.SetXYZ (D2Qv);
|
||||
|
||||
VcrossD3Qv.Multiply (Sin(U));
|
||||
VdotD3Qv.Multiply (1.0 - Cos(U));
|
||||
VdotD3Qv.Add (VcrossD2Qv);
|
||||
D3Qv.Multiply (Cos(U));
|
||||
D3Qv.Add (VdotD3Qv);
|
||||
D3V.SetXYZ (D3Qv);
|
||||
|
||||
XYZ D1Qu = Q.Multiplied (- Sin(U));
|
||||
D1Qu.Add (VcrossCQ.Multiplied (Cos(U)));
|
||||
XYZ D3Qu = D1Qu.Multiplied (-1.0);
|
||||
D1Qu.Add (VdotCQ.Multiplied (Sin(U)));
|
||||
D3Qu.Add (VdotCQ.Multiplied (-Sin(U)));
|
||||
D1U.SetXYZ (D1Qu);
|
||||
D3U.SetXYZ (D3Qu);
|
||||
|
||||
Q.Multiply (Cos(U));
|
||||
VcrossCQ.Multiply (Sin(U));
|
||||
Q.Add (VcrossCQ);
|
||||
XYZ D2Qu = Q.Multiplied(-1.0);
|
||||
D2Qu.Add (VdotCQ.Multiplied (Cos(U)));
|
||||
D2U.SetXYZ (D2Qu);
|
||||
VdotCQ.Multiply (1.0-Cos(U));
|
||||
Q.Add (VdotCQ);
|
||||
Q.Add (C);
|
||||
P.SetXYZ (Q);
|
||||
}
|
||||
else
|
||||
D3(U,V,P,D1U,D1V,D2U,D2V,D2UV,D3U,D3V,D3UUV,D3UVV);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : LocalDN
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Vec Geom_SurfaceOfRevolution::LocalDN (const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer VSide,
|
||||
const Standard_Integer Nu,
|
||||
const Standard_Integer Nv) const
|
||||
{
|
||||
Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv < 0, " ");
|
||||
XYZ Vn, CQ;
|
||||
if (Nu == 0) {
|
||||
if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
Vn = LocateSideN(V,VSide,BSplC,Nv).XYZ();
|
||||
}else
|
||||
return DN(U,V,Nu,Nv);
|
||||
XYZ Vdir = direction.XYZ();
|
||||
XYZ VDot = Vdir.Multiplied (Vn.Dot (Vdir));
|
||||
VDot.Multiply (1-Cos(U));
|
||||
XYZ VCross = Vdir.Crossed (Vn);
|
||||
VCross.Multiply (Sin(U));
|
||||
Vn.Multiply (Cos(U));
|
||||
Vn.Add (VDot);
|
||||
Vn.Add (VCross);
|
||||
return Vec (Vn);
|
||||
}
|
||||
|
||||
else if (Nv == 0) {
|
||||
if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
CQ = LocateSideN(V,VSide,BSplC,Nv).XYZ() - loc.XYZ();
|
||||
}else
|
||||
return DN(U,V,Nu,Nv);
|
||||
XYZ Vdir = direction.XYZ();
|
||||
XYZ VDot = Vdir.Multiplied (CQ.Dot (Vdir));
|
||||
XYZ VCross = Vdir.Crossed (CQ);
|
||||
if ((Nu + 6) % 4 == 0) {
|
||||
CQ.Multiply (-Cos (U));
|
||||
VDot.Multiply (Cos(U));
|
||||
VCross.Multiply (-Sin(U));
|
||||
}
|
||||
else if ((Nu + 5) % 4 == 0) {
|
||||
CQ.Multiply (Sin (U));
|
||||
VDot.Multiply (-Sin(U));
|
||||
VCross.Multiply (-Cos(U));
|
||||
}
|
||||
else if ((Nu+3) % 4 == 0) {
|
||||
CQ.Multiply (-Sin (U));
|
||||
VDot.Multiply (+Sin(U));
|
||||
VCross.Multiply (Cos(U));
|
||||
}
|
||||
else if (Nu+4 % 4 == 0) {
|
||||
CQ.Multiply (Cos (U));
|
||||
VDot.Multiply (-Cos(U));
|
||||
VCross.Multiply (Sin(U));
|
||||
}
|
||||
CQ.Add (VDot);
|
||||
CQ.Add (VCross);
|
||||
return Vec (CQ);
|
||||
}
|
||||
|
||||
else {
|
||||
if((VSide !=0 ) && basisCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||
{
|
||||
Handle( Geom_BSplineCurve) BSplC;
|
||||
BSplC= Handle(Geom_BSplineCurve)::DownCast(basisCurve);
|
||||
Vn = LocateSideN(V,VSide,BSplC,Nv).XYZ();
|
||||
}else
|
||||
return DN(U,V,Nu,Nv);
|
||||
XYZ Vdir = direction.XYZ();
|
||||
XYZ VDot = Vdir.Multiplied (Vn.Dot (Vdir));
|
||||
XYZ VCross = Vdir.Crossed (Vn);
|
||||
if ((Nu + 6) % 4 == 0) {
|
||||
Vn.Multiply (-Cos (U));
|
||||
VDot.Multiply (Cos(U));
|
||||
VCross.Multiply (-Sin(U));
|
||||
}
|
||||
else if ((Nu + 5) % 4 == 0) {
|
||||
Vn.Multiply (Sin (U));
|
||||
VDot.Multiply (-Sin(U));
|
||||
VCross.Multiply (-Cos(U));
|
||||
}
|
||||
else if ((Nu+3) % 4 == 0) {
|
||||
Vn.Multiply (-Sin (U));
|
||||
VDot.Multiply (+Sin(U));
|
||||
VCross.Multiply (Cos(U));
|
||||
}
|
||||
else if (Nu+4 % 4 == 0) {
|
||||
Vn.Multiply (Cos (U));
|
||||
VDot.Multiply (-Cos(U));
|
||||
VCross.Multiply (Sin(U));
|
||||
}
|
||||
Vn.Add (VDot);
|
||||
Vn.Add (VCross);
|
||||
return Vec (Vn);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReferencePlane
|
||||
@@ -1174,6 +425,8 @@ void Geom_SurfaceOfRevolution::Transform (const Trsf& T) {
|
||||
direction.Transform (T);
|
||||
basisCurve->Transform (T);
|
||||
if(T.ScaleFactor()*T.HVectorialPart().Determinant() < 0.) UReverse();
|
||||
myEvaluator->SetDirection(direction);
|
||||
myEvaluator->SetLocation(loc);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Geom_SweptSurface.hxx>
|
||||
#include <GeomEvaluator_SurfaceOfRevolution.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
@@ -264,25 +265,21 @@ public:
|
||||
//! The direction of this axis gives the sense of rotation.
|
||||
//! V is the parameter of the revolved curve.
|
||||
Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const;
|
||||
|
||||
|
||||
//! Computes the current point and the first derivatives
|
||||
//! in the directions U and V.
|
||||
//! Raised if the continuity of the surface is not C1.
|
||||
Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
|
||||
|
||||
|
||||
//! Computes the current point, the first and the second derivatives
|
||||
//! in the directions U and V.
|
||||
//! Raised if the continuity of the surface is not C2.
|
||||
Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
|
||||
|
||||
|
||||
//! Computes the current point, the first,the second and the third
|
||||
//! derivatives in the directions U and V.
|
||||
//! Raised if the continuity of the surface is not C3.
|
||||
Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
|
||||
|
||||
|
||||
//! Computes the derivative of order Nu in the direction u and
|
||||
//! Nv in the direction v.
|
||||
@@ -299,17 +296,7 @@ public:
|
||||
//! can be evaluated using methods of
|
||||
//! global evaluations P = S( U ,V )
|
||||
Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
|
||||
|
||||
Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P) const;
|
||||
|
||||
Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
|
||||
|
||||
Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const;
|
||||
|
||||
Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const;
|
||||
|
||||
Standard_EXPORT gp_Vec LocalDN (const Standard_Real U, const Standard_Real V, const Standard_Integer USide, const Standard_Integer Nu, const Standard_Integer Nv) const;
|
||||
|
||||
|
||||
//! Applies the transformation T to this surface of revolution.
|
||||
Standard_EXPORT void Transform (const gp_Trsf& T);
|
||||
|
||||
@@ -317,27 +304,11 @@ public:
|
||||
Standard_EXPORT Handle(Geom_Geometry) Copy() const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(Geom_SurfaceOfRevolution,Geom_SweptSurface)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(GeomEvaluator_SurfaceOfRevolution) myEvaluator;
|
||||
gp_Pnt loc;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Geom_SurfaceOfRevolution_HeaderFile
|
||||
|
Reference in New Issue
Block a user