1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0024763: Convertation of the generic classes to the non-generic. Part 6

Next generic classes:

 "Contap_ArcFunction",
 "Contap_ContourGen",
 "Contap_HContToolGen",
 "Contap_HCurve2dToolGen",
 "Contap_Line",
 "Contap_Point",
 "Contap_SurfFunction",
 "Contap_SurfProps"

from "Contap" package were converted to the non-generic classes. Names of several classes were changed:

 "Contap_Contour",
 "Contap_HContTool",
 "Contap_HCurve2dTool",
 "Contap_Line",
 "Contap_Point"

 Also all instantiations of the "internal" classes of this classes were moved to the "Contap.cdl". And sources of the "Contap_ContourGen" class were merged to one .cxx file.
This commit is contained in:
dln 2014-03-25 11:55:53 +04:00 committed by apn
parent 424cd6bb64
commit e2065c2fb9
30 changed files with 2753 additions and 2906 deletions

View File

@ -16,72 +16,82 @@
package Contap
---Purpose:
---Purpose:
uses Standard,StdFail,MMgt, GeomAbs, TopAbs, TCollection, gp, TColgp,
math, IntSurf, IntStart, IntWalk,
Geom2d, TColStd, Geom, Adaptor3d, Adaptor2d
is
generic class Point;
generic class Line;
class Point;
generic class SurfFunction;
class Line;
generic class ArcFunction;
class SurfFunction;
generic class SurfProps;
class ArcFunction;
class SurfProps;
class Contour;
class TheSequenceOfPoint instantiates Sequence from TCollection (Point from Contap);
class TheHSequenceOfPoint instantiates HSequence from TCollection
(Point from Contap,
TheSequenceOfPoint from Contap);
class TheSequenceOfLine instantiates Sequence from TCollection(Line from Contap);
class TheSearch instantiates SearchOnBoundaries from IntStart
(HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
HCurve2dTool from Contap,
HContTool from Contap,
TopolTool from Adaptor3d,
ArcFunction from Contap);
class TheIWalking instantiates IWalking from IntWalk
(PathPoint from IntSurf,
PathPointTool from IntSurf,
SequenceOfPathPoint from IntSurf,
InteriorPoint from IntSurf,
InteriorPointTool from IntSurf,
SequenceOfInteriorPoint from IntSurf,
HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d,
SurfFunction from Contap);
class TheSearchInside instantiates SearchInside from IntStart
(HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d,
TopolTool from Adaptor3d,
HContTool from Contap,
SurfFunction from Contap);
generic class ContourGen, ThePoint,TheSequenceOfPoint,TheHSequenceOfPoint,
TheLine, TheSequenceOfLine,
TheSurfProps, TheSurfFunction, TheArcFunction,
TheSearch, TheIWalking, TheSearchInside;
---TheLineConstructor;
class ContAna;
enumeration TFunction is
ContourStd,
ContourPrs,
DraftStd,
DraftPrs
ContourStd,
ContourPrs,
DraftStd,
DraftPrs
end TFunction;
enumeration IType is -- a replacer dans IntSurf et fusionner avec IntPatch
-- type of the line of contour
Lin, -- pour conflit avec deferred class Line
Circle,
Lin, -- pour conflit avec deferred class Line
Circle,
Walking,
Restriction
Restriction
end IType;
generic class HContToolGen;
generic class HCurve2dToolGen;
class HCurve2dTool instantiates
HCurve2dToolGen from Contap (
HCurve2d from Adaptor2d);
class HContTool instantiates
HContToolGen from Contap (
HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
HSurface from Adaptor3d,
HCurve2dTool from Contap,
HSurfaceTool from Adaptor3d);
class Contour instantiates ContourGen from Contap
(HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
HSurface from Adaptor3d,
HCurve2dTool from Contap,
HSurfaceTool from Adaptor3d,
HContTool from Contap,
TopolTool from Adaptor3d);
class HContTool;
class HCurve2dTool;
end Contap;

View File

@ -14,25 +14,21 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class ArcFunction from Contap
(TheArc as any;
TheSurface as any;
TheArcTool as any;
TheSurfaceTool as any;
TheSurfProps as any; -- as SurfProps from Contap(TheSurface,
-- TheSurfaceTool)
TheContTool as any) -- as ContTool from Contap()
inherits FunctionWithDerivative from math
class ArcFunction from Contap inherits FunctionWithDerivative from math
uses Pnt from gp,
Dir from gp,
SequenceOfPnt from TColgp,
TFunction from Contap,
--modified by NIZNHY-PKV Thu Mar 29 16:52:28 2001 f
Quadric from IntSurf
--modified by NIZNHY-PKV Thu Mar 29 16:52:31 2001 t
Quadric from IntSurf,
--modified by NIZNHY-PKV Thu Mar 29 16:52:31 2001
HCurve2d from Adaptor2d,
HSurface from Adaptor3d,
HCurve2dTool from Contap,
HSurfaceTool from Adaptor3d,
SurfProps from Contap,
HContTool from Contap
is
@ -42,7 +38,7 @@ is
returns ArcFunction from Contap;
Set(me: in out; S: TheSurface)
Set(me: in out; S: HSurface from Adaptor3d)
is static;
@ -70,7 +66,7 @@ is
is static;
Set(me: in out; A: TheArc)
Set(me: in out; A: HCurve2d from Adaptor2d)
---C++: inline
is static;
@ -121,8 +117,8 @@ is
fields
myArc : TheArc;
mySurf : TheSurface;
myArc : HCurve2d from Adaptor2d;
mySurf : HSurface from Adaptor3d;
myMean : Real from Standard;
myType : TFunction from Contap;
myDir : Dir from gp;

View File

@ -14,31 +14,34 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
#include <Contap_ArcFunction.ixx>
#include <Contap_HContTool.hxx>
#include <Contap_SurfProps.hxx>
#include <Contap_HCurve2dTool.hxx>
Contap_ArcFunction::Contap_ArcFunction ():
myMean(1.),
myType(Contap_ContourStd),
myDir(0.,0.,1.)
myMean(1.),
myType(Contap_ContourStd),
myDir(0.,0.,1.)
{}
void Contap_ArcFunction::Set(const TheSurface& S)
void Contap_ArcFunction::Set(const Handle(Adaptor3d_HSurface)& S)
{
mySurf = S;
Standard_Integer i;
Standard_Integer nbs = TheContTool::NbSamplePoints(S);
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
Standard_Real U,V;
// gp_Vec d1u,d1v;
// gp_Vec d1u,d1v;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
TheContTool::SamplePoint(S,i,U,V);
// TheSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
TheSurfProps::Normale(S,U,V,solpt,norm);
Contap_HContTool::SamplePoint(S,i,U,V);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);
myMean = myMean + norm.Magnitude();
}
myMean = myMean / ((Standard_Real)nbs);
@ -47,14 +50,14 @@ void Contap_ArcFunction::Set(const TheSurface& S)
Standard_Boolean Contap_ArcFunction::Value (const Standard_Real U,
Standard_Real& F)
Standard_Real& F)
{
//gp_Vec d1u,d1v;
gp_Pnt2d pt2d(TheArcTool::Value(myArc,U));
// TheSurfaceTool::D1(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Pnt2d pt2d(Contap_HCurve2dTool::Value(myArc,U));
// Adaptor3d_HSurfaceTool::D1(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Vec norm;
TheSurfProps::Normale(mySurf,pt2d.X(),pt2d.Y(),solpt,norm);
Contap_SurfProps::Normale(mySurf,pt2d.X(),pt2d.Y(),solpt,norm);
switch (myType) {
case Contap_ContourStd:
@ -82,22 +85,22 @@ Standard_Boolean Contap_ArcFunction::Value (const Standard_Real U,
Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
Standard_Real& D)
Standard_Real& D)
{
gp_Pnt2d pt2d;
gp_Vec2d d2d;
Standard_Real dfu =0.,dfv =0.;
// gp_Vec d1u,d1v,d2u,d2v,d2uv;
TheArcTool::D1(myArc,U,pt2d,d2d);
// TheSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec d1u,d1v,d2u,d2v,d2uv;
Contap_HCurve2dTool::D1(myArc,U,pt2d,d2d);
// Adaptor3d_HSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
gp_Vec norm,dnu,dnv;
TheSurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
Contap_SurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
dfu = (dnu.Dot(myDir))/myMean;
dfv = (dnv.Dot(myDir))/myMean;
}
@ -105,21 +108,21 @@ Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
case Contap_ContourPrs:
{
gp_Vec Ep(myEye,solpt);
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
dfu = (dnu.Dot(Ep))/myMean;
dfv = (dnv.Dot(Ep))/myMean;
}
break;
case Contap_DraftStd:
{
/*
/*
gp_Vec norm(d1u.Crossed(d1v).Normalized());
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
dfu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
dfv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
*/
norm.Normalized();
dfu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
dfv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
@ -135,25 +138,25 @@ Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
}
Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
Standard_Real& F,
Standard_Real& D)
Standard_Real& F,
Standard_Real& D)
{
gp_Pnt2d pt2d;
gp_Vec2d d2d;
Standard_Real dfu =0.,dfv =0.;
// gp_Vec d1u,d1v,d2u,d2v,d2uv;
TheArcTool::D1(myArc,U,pt2d,d2d);
// TheSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec norm(d1u.Crossed(d1v));
// gp_Vec d1u,d1v,d2u,d2v,d2uv;
Contap_HCurve2dTool::D1(myArc,U,pt2d,d2d);
// Adaptor3d_HSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Vec norm,dnu,dnv;
TheSurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
Contap_SurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
F = (norm.Dot(myDir))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
dfu = (dnu.Dot(myDir))/myMean;
dfv = (dnv.Dot(myDir))/myMean;
}
@ -162,8 +165,8 @@ Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
{
gp_Vec Ep(myEye,solpt);
F = (norm.Dot(Ep))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
dfu = (dnu.Dot(Ep))/myMean;
dfv = (dnv.Dot(Ep))/myMean;
}
@ -172,12 +175,12 @@ Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
{
F = (norm.Dot(myDir)-myCosAng*norm.Magnitude())/myMean;
norm.Normalize();
/*
/*
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
dfu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
dfv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
*/
dfu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
dfv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}
@ -200,9 +203,9 @@ Standard_Integer Contap_ArcFunction::GetStateNumber ()
Standard_Integer Contap_ArcFunction::NbSamples () const
{
return Max(Max(TheContTool::NbSamplesU(mySurf,0.,0.),
TheContTool::NbSamplesV(mySurf,0.,0.)),
TheContTool::NbSamplesOnArc(myArc));
return Max(Max(Contap_HContTool::NbSamplesU(mySurf,0.,0.),
Contap_HContTool::NbSamplesV(mySurf,0.,0.)),
Contap_HContTool::NbSamplesOnArc(myArc));
}
//modified by NIZNHY-PKV Thu Mar 29 16:53:07 2001f
@ -210,7 +213,7 @@ Standard_Integer Contap_ArcFunction::NbSamples () const
//function : Quadric
//purpose : returns empty Quadric
//=======================================================================
const IntSurf_Quadric& Contap_ArcFunction::Quadric() const
const IntSurf_Quadric& Contap_ArcFunction::Quadric() const
{
return(myQuad);
}

View File

@ -42,7 +42,7 @@ inline void Contap_ArcFunction::Set(const gp_Pnt& Eye)
myEye = Eye;
}
inline void Contap_ArcFunction::Set(const TheArc& A)
inline void Contap_ArcFunction::Set(const Handle(Adaptor2d_HCurve2d)& A)
{
myArc = A;
seqpt.Clear();

View File

@ -14,16 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class ContourGen from Contap
(TheVertex as any;
TheArc as any;
TheSurface as any;
TheArcTool as any;
TheSurfaceTool as any;
TheContTool as any; -- as ContTool from Contap(TheVertex,TheArc,
-- TheSurface)
TheTopolTool as Transient)
class Contour from Contap
uses PathPoint from IntSurf,
PathPointTool from IntSurf,
@ -32,130 +23,70 @@ uses PathPoint from IntSurf,
InteriorPointTool from IntSurf,
SequenceOfInteriorPoint from IntSurf,
Pnt from gp,
Vec from gp
Vec from gp,
Point from Contap,
Line from Contap,
SurfFunction from Contap,
ArcFunction from Contap,
TheSequenceOfLine from Contap,
TheSearch from Contap,
TheSearchInside from Contap,
HSurface from Adaptor3d,
TopolTool from Adaptor3d
raises NotDone from StdFail,
OutOfRange from Standard,
ConstructionError from Standard
class ThePoint instantiates Point from Contap
(TheVertex,
TheArc);
class TheSequenceOfPoint instantiates Sequence from TCollection
(ThePoint);
class TheHSequenceOfPoint instantiates HSequence from TCollection
(ThePoint,TheSequenceOfPoint);
class TheLine instantiates Line from Contap
(TheVertex,
TheArc,
ThePoint,
TheHSequenceOfPoint);
class TheSequenceOfLine instantiates Sequence from TCollection
(TheLine);
class TheSurfProps instantiates SurfProps from Contap
(TheSurface,
TheSurfaceTool);
class TheSurfFunction instantiates SurfFunction from Contap
(TheSurface,
TheSurfaceTool,
TheSurfProps from Contap,
TheContTool);
class TheArcFunction instantiates ArcFunction from Contap
(TheArc,
TheSurface,
TheArcTool,
TheSurfaceTool,
TheSurfProps from Contap,
TheContTool);
class TheSearch instantiates SearchOnBoundaries from IntStart
(TheVertex,
TheArc,
TheArcTool,
TheContTool,
TheTopolTool,
TheArcFunction from Contap);
class TheIWalking instantiates IWalking from IntWalk
(PathPoint from IntSurf,
PathPointTool from IntSurf,
SequenceOfPathPoint from IntSurf,
InteriorPoint from IntSurf,
InteriorPointTool from IntSurf,
SequenceOfInteriorPoint from IntSurf,
TheSurface,
TheSurfaceTool,
TheSurfFunction from Contap);
class TheSearchInside instantiates SearchInside from IntStart
(TheSurface,
TheSurfaceTool,
TheTopolTool,
TheContTool,
TheSurfFunction from Contap);
is
Create
returns ContourGen from Contap;
returns Contour from Contap;
Create(Direction: Vec from gp)
returns ContourGen from Contap;
returns Contour from Contap;
Create(Direction: Vec from gp; Angle: Real from Standard)
returns ContourGen from Contap;
returns Contour from Contap;
Create(Eye: Pnt from gp)
returns ContourGen from Contap;
returns Contour from Contap;
Create(Surf: TheSurface; Domain: TheTopolTool;
Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Direction: Vec from gp)
---Purpose: Creates the contour in a given direction.
returns ContourGen from Contap;
returns Contour from Contap;
Create(Surf: TheSurface; Domain: TheTopolTool;
Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Direction: Vec from gp; Angle: Real from Standard)
---Purpose: Creates the contour in a given direction.
returns ContourGen from Contap;
returns Contour from Contap;
Create(Surf: TheSurface; Domain: TheTopolTool;
Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Eye: Pnt from gp)
---Purpose: Creates the contour for a perspective view.
returns ContourGen from Contap;
returns Contour from Contap;
Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool)
Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d)
---Purpose: Creates the contour in a given direction.
@ -163,7 +94,7 @@ is
is static;
Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool;
Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Direction: Vec from gp)
---Purpose: Creates the contour in a given direction.
@ -171,7 +102,7 @@ is
is static;
Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool;
Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Direction: Vec from gp; Angle: Real from Standard)
---Purpose: Creates the contour in a given direction.
@ -179,7 +110,7 @@ is
is static;
Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool;
Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Eye: Pnt from gp)
---Purpose: Creates the contour for a perspective view.
@ -234,7 +165,7 @@ is
Line(me; Index: Integer from Standard)
returns TheLine from Contap
returns Line from Contap
---C++: return const&
---C++: inline
@ -245,7 +176,7 @@ is
SurfaceFunction(me : in out)
returns TheSurfFunction
returns SurfFunction
---Purpose: Returns a reference on the internal
-- SurfaceFunction. This is used to compute tangents
-- on the lines.
@ -254,12 +185,12 @@ is
is static;
Perform(me: in out; Domain: TheTopolTool)
Perform(me: in out; Domain: TopolTool from Adaptor3d)
is static private;
PerformAna(me: in out; Domain: TheTopolTool)
PerformAna(me: in out; Domain: TopolTool from Adaptor3d)
is static private;
@ -270,8 +201,8 @@ fields
slin : TheSequenceOfLine from Contap;
solrst : TheSearch from Contap;
solins : TheSearchInside from Contap;
mySFunc : TheSurfFunction from Contap;
myAFunc : TheArcFunction from Contap;
mySFunc : SurfFunction from Contap;
myAFunc : ArcFunction from Contap;
modeset : Boolean from Standard;
end ContourGen;
end Contour;

File diff suppressed because it is too large Load Diff

View File

@ -16,31 +16,31 @@
#include <StdFail_NotDone.hxx>
inline Standard_Boolean Contap_ContourGen::IsDone () const
inline Standard_Boolean Contap_Contour::IsDone () const
{
return done;
}
inline Standard_Boolean Contap_ContourGen::IsEmpty () const
inline Standard_Boolean Contap_Contour::IsEmpty () const
{
return NbLines()==0;
}
inline Standard_Integer Contap_ContourGen::NbLines () const
inline Standard_Integer Contap_Contour::NbLines () const
{
if (!done) {StdFail_NotDone::Raise();}
return slin.Length();
}
inline const Contap_TheLine &
Contap_ContourGen::Line (const Standard_Integer Index) const
inline const Contap_Line &
Contap_Contour::Line (const Standard_Integer Index) const
{
if (!done) {StdFail_NotDone::Raise();}
return slin(Index);
}
inline Contap_TheSurfFunction &
Contap_ContourGen::SurfaceFunction ()
inline Contap_SurfFunction &
Contap_Contour::SurfaceFunction ()
{
if (!done) {StdFail_NotDone::Raise();}
return mySFunc;

View File

@ -1,31 +0,0 @@
// Created on: 1993-02-05
// Created by: Jacques GOUSSARD
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ElCLib.hxx>
#include <gp_Pln.hxx>
#include <gp_Sphere.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Cone.hxx>
#include <gp_Lin.hxx>
#include <gp_Circ.hxx>
#include <Contap_ContAna.hxx>
#include <math_FunctionSetRoot.hxx>
#include <IntSurf.hxx>
#include <Contap_ContourGen_1.gxx>
#include <Contap_ContourGen_2.gxx>
#include <Contap_ContourGen_3.gxx>

View File

@ -1,167 +0,0 @@
// Created on: 1993-02-05
// Created by: Jacques GOUSSARD
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_ConstructionError.hxx>
Contap_ContourGen::Contap_ContourGen () :
done(Standard_False),modeset(Standard_False)
{}
Contap_ContourGen::Contap_ContourGen (const gp_Vec& Direction) :
done(Standard_False),modeset(Standard_True)
{
mySFunc.Set(Direction);
myAFunc.Set(Direction);
}
Contap_ContourGen::Contap_ContourGen (const gp_Vec& Direction,
const Standard_Real Angle) :
done(Standard_False),modeset(Standard_True)
{
mySFunc.Set(Direction,Angle);
myAFunc.Set(Direction,Angle);
}
Contap_ContourGen::Contap_ContourGen (const gp_Pnt& Eye) :
done(Standard_False),modeset(Standard_True)
{
mySFunc.Set(Eye);
myAFunc.Set(Eye);
}
Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Vec& Direction) :
done(Standard_False),modeset(Standard_True)
{
Perform(Surf,Domain,Direction);
}
Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Vec& Direction,
const Standard_Real Angle) :
done(Standard_False),modeset(Standard_True)
{
Perform(Surf,Domain,Direction,Angle);
}
Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Pnt& Eye) :
done(Standard_False),modeset(Standard_True)
{
Perform(Surf,Domain,Eye);
}
void Contap_ContourGen::Init (const gp_Vec& Direction)
{
done = Standard_False;
modeset = Standard_True;
mySFunc.Set(Direction);
myAFunc.Set(Direction);
}
void Contap_ContourGen::Init(const gp_Vec& Direction,
const Standard_Real Angle)
{
done = Standard_False;
modeset = Standard_True;
mySFunc.Set(Direction,Angle);
myAFunc.Set(Direction,Angle);
}
void Contap_ContourGen::Init (const gp_Pnt& Eye)
{
done = Standard_False;
modeset = Standard_True;
mySFunc.Set(Eye);
myAFunc.Set(Eye);
}
void Contap_ContourGen::Perform (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain)
{
if (!modeset) {Standard_ConstructionError::Raise();}
mySFunc.Set(Surf);
myAFunc.Set(Surf);
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
switch (typS) {
case GeomAbs_Plane:
case GeomAbs_Sphere:
case GeomAbs_Cylinder:
case GeomAbs_Cone:
{
PerformAna(Domain); //Surf,Domain,Direction,0.,gp_Pnt(0.,0.,0.),1);
}
break;
default:
{
Perform(Domain); //Surf,Domain,Direction,0.,gp_Pnt(0.,0.,0.),1);
}
break;
}
}
void Contap_ContourGen::Perform (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Vec& Direction)
{
Init(Direction);
Perform(Surf,Domain);
}
void Contap_ContourGen::Perform (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Vec& Direction,
const Standard_Real Angle)
{
Init(Direction,Angle);
Perform(Surf,Domain);
}
void Contap_ContourGen::Perform (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Pnt& Eye)
{
Init(Eye);
Perform(Surf,Domain);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,442 +0,0 @@
// Created on: 1993-02-05
// Created by: Jacques GOUSSARD
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#define Tolpetit 1.e-10 // pour dist au carre
#include <ElSLib.hxx>
#include <TColStd_SequenceOfInteger.hxx>
static Standard_Boolean FindLine(Contap_TheLine& Line,
const TheSurface& Surf,
const gp_Pnt2d& Pt2d,
gp_Pnt& Ptref,
Standard_Real& Paramin,
gp_Vec& Tgmin,
gp_Vec& Norm)
{
// Standard_Integer i;
gp_Pnt pt,ptmin;
gp_Vec tg;
Standard_Real para,dist;
Standard_Real dismin = RealLast();
Contap_TheSurfProps::Normale(Surf,Pt2d.X(),Pt2d.Y(),Ptref,Norm);
if (Line.TypeContour() == Contap_Lin) {
gp_Lin lin(Line.Line());
para = ElCLib::Parameter(lin,Ptref);
ElCLib::D1(para,lin,pt,tg);
dist = pt.Distance(Ptref) + Abs(Norm.Dot(lin.Direction()));
}
else { // Contap__Circle
gp_Circ cir(Line.Circle());
para = ElCLib::Parameter(cir,Ptref);
ElCLib::D1(para,cir,pt,tg);
dist = pt.Distance(Ptref)+Abs(Norm.Dot(tg/cir.Radius()));
}
if (dist < dismin) {
dismin = dist;
Paramin = para;
ptmin = pt;
Tgmin = tg;
}
if (ptmin.SquareDistance(Ptref) <= Tolpetit) {
return Standard_True;
}
else {
return Standard_False;
}
}
static void PutPointsOnLine (const Contap_TheSearch& solrst,
const TheSurface& Surf,
Contap_TheSequenceOfLine& slin)
{
Standard_Integer i,l;//,index;
Standard_Integer NbPoints = solrst.NbPoints();
Standard_Real theparam;
IntSurf_Transition TLine,TArc;
Standard_Boolean goon;
gp_Pnt2d pt2d;
gp_Vec2d d2d;
gp_Pnt ptonsurf;
gp_Vec vectg,normale,tgtrst;
Standard_Real paramlin = 0.0;
Standard_Integer nbLin = slin.Length();
for(l=1;l<=nbLin;l++) {
Contap_TheLine& Line=slin.ChangeValue(l);
for (i=1; i<= NbPoints; i++) {
const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
const TheArc& thearc = PStart.Arc();
theparam = PStart.Parameter();
TheArcTool::D1(thearc,theparam,pt2d,d2d);
goon = FindLine(Line,Surf,pt2d,ptonsurf,paramlin,vectg,normale);
Contap_ThePoint PPoint;
if (goon) {
gp_Vec d1u,d1v;
gp_Pnt bidpt;
TheSurfaceTool::D1(Surf,pt2d.X(),pt2d.Y(),bidpt,d1u,d1v);
PPoint.SetValue(ptonsurf,pt2d.X(),pt2d.Y());
if (normale.Magnitude() < RealEpsilon()) {
TLine.SetValue();
TArc.SetValue();
}
else {
// Petit test qui devrait permettre de bien traiter les pointes
// des cones, et les sommets d`une sphere. Il faudrait peut-etre
// rajouter une methode dans SurfProps
if (Abs(d2d.Y()) <= Precision::Confusion()) {
tgtrst = d1v.Crossed(normale);
if(d2d.X() < 0.0)
tgtrst.Reverse();
}
else {
tgtrst.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
}
IntSurf::MakeTransition(vectg,tgtrst,normale,TLine,TArc);
}
PPoint.SetArc(thearc,theparam, TLine, TArc);
PPoint.SetParameter(paramlin);
if (!PStart.IsNew()) {
PPoint.SetVertex(PStart.Vertex());
}
Line.Add(PPoint);
}
}
}
}
//----------------------------------------------------------------------------------
//-- Orientation des contours Apparents quand ceux-ci sont des lignes ou des cercles
//-- On prend un point de la ligne ou du cercle ---> P
//-- On projete ce point sur la surface P ---> u,v
//-- et on evalue la transition au point u,v
//----------------------------------------------------------------------------------
IntSurf_TypeTrans ComputeTransitionOngpLine
(Contap_TheSurfFunction& SFunc,
const gp_Lin& L)
{
const TheSurface& Surf=SFunc.Surface();
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
gp_Pnt P;
gp_Vec T;
ElCLib::D1(0.0,L,P,T);
Standard_Real u = 0.,v = 0.;
switch (typS) {
case GeomAbs_Cylinder: {
ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),P,u,v);
break;
}
case GeomAbs_Cone: {
ElSLib::Parameters(TheSurfaceTool::Cone(Surf),P,u,v);
break;
}
case GeomAbs_Sphere: {
ElSLib::Parameters(TheSurfaceTool::Sphere(Surf),P,u,v);
break;
}
default:
break;
}
return(ComputeTransitionOnLine(SFunc,u,v,T));
}
IntSurf_TypeTrans ComputeTransitionOngpCircle
(Contap_TheSurfFunction& SFunc,
const gp_Circ& C)
{
const TheSurface& Surf=SFunc.Surface();
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
gp_Pnt P;
gp_Vec T;
ElCLib::D1(0.0,C,P,T);
Standard_Real u = 0.,v = 0.;
switch (typS) {
case GeomAbs_Cylinder: {
ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),P,u,v);
break;
}
case GeomAbs_Cone: {
ElSLib::Parameters(TheSurfaceTool::Cone(Surf),P,u,v);
break;
}
case GeomAbs_Sphere: {
ElSLib::Parameters(TheSurfaceTool::Sphere(Surf),P,u,v);
break;
}
default:
break;
}
return(ComputeTransitionOnLine(SFunc,u,v,T));
}
void Contap_ContourGen::PerformAna(const Handle(TheTopolTool)& Domain)
{
done = Standard_False;
slin.Clear();
Standard_Real TolArc = 1.e-5;
Standard_Integer nbCont, nbPointRst, i;
//gp_Circ cirsol;
//gp_Lin linsol;
Contap_ContAna contana;
Contap_TheLine theline;
const TheSurface& Surf = mySFunc.Surface();
Contap_TFunction TypeFunc(mySFunc.FunctionType());
Standard_Boolean PerformSolRst = Standard_True;
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
switch (typS) {
case GeomAbs_Plane:
{
gp_Pln pl(TheSurfaceTool::Plane(Surf));
switch (TypeFunc) {
case Contap_ContourStd:
{
gp_Dir Dirpln(pl.Axis().Direction());
if (Abs(mySFunc.Direction().Dot(Dirpln)) > Precision::Angular()) {
// Aucun point du plan n`est solution, en particulier aucun point
// sur restriction.
PerformSolRst = Standard_False;
}
}
break;
case Contap_ContourPrs:
{
gp_Pnt Eye(mySFunc.Eye());
if (pl.Distance(Eye) > Precision::Confusion()) {
// Aucun point du plan n`est solution, en particulier aucun point
// sur restriction.
PerformSolRst = Standard_False;
}
}
break;
case Contap_DraftStd:
{
gp_Dir Dirpln(pl.Axis().Direction());
Standard_Real Sina = Sin(mySFunc.Angle());
if (Abs(mySFunc.Direction().Dot(Dirpln)+ Sina) > //voir SurfFunction
Precision::Angular()) {
PerformSolRst = Standard_False;
}
}
break;
case Contap_DraftPrs:
default:
{
}
}
}
break;
case GeomAbs_Sphere:
{
switch (TypeFunc) {
case Contap_ContourStd:
{
contana.Perform(TheSurfaceTool::Sphere(Surf),mySFunc.Direction());
}
break;
case Contap_ContourPrs:
{
contana.Perform(TheSurfaceTool::Sphere(Surf),mySFunc.Eye());
}
break;
case Contap_DraftStd:
{
contana.Perform(TheSurfaceTool::Sphere(Surf),
mySFunc.Direction(),mySFunc.Angle());
}
break;
case Contap_DraftPrs:
default:
{
}
}
}
break;
case GeomAbs_Cylinder:
{
switch (TypeFunc) {
case Contap_ContourStd:
{
contana.Perform(TheSurfaceTool::Cylinder(Surf),mySFunc.Direction());
}
break;
case Contap_ContourPrs:
{
contana.Perform(TheSurfaceTool::Cylinder(Surf),mySFunc.Eye());
}
break;
case Contap_DraftStd:
{
contana.Perform(TheSurfaceTool::Cylinder(Surf),
mySFunc.Direction(),mySFunc.Angle());
}
break;
case Contap_DraftPrs:
default:
{
}
}
}
break;
case GeomAbs_Cone:
{
switch (TypeFunc) {
case Contap_ContourStd:
{
contana.Perform(TheSurfaceTool::Cone(Surf),mySFunc.Direction());
}
break;
case Contap_ContourPrs:
{
contana.Perform(TheSurfaceTool::Cone(Surf),mySFunc.Eye());
}
break;
case Contap_DraftStd:
{
contana.Perform(TheSurfaceTool::Cone(Surf),
mySFunc.Direction(),mySFunc.Angle());
}
break;
case Contap_DraftPrs:
default:
{
}
}
default:
break;
}
break;
}
if (typS != GeomAbs_Plane) {
if (!contana.IsDone()) {
return;
}
nbCont = contana.NbContours();
if (contana.NbContours() == 0) {
done = Standard_True;
return;
}
GeomAbs_CurveType typL = contana.TypeContour();
if (typL == GeomAbs_Circle) {
theline.SetValue(contana.Circle());
IntSurf_TypeTrans TransCircle;
TransCircle = ComputeTransitionOngpCircle(mySFunc,contana.Circle());
theline.SetTransitionOnS(TransCircle);
slin.Append(theline);
}
else if (typL == GeomAbs_Line) {
for (i=1; i<=nbCont; i++) {
theline.SetValue(contana.Line(i));
IntSurf_TypeTrans TransLine;
TransLine = ComputeTransitionOngpLine(mySFunc,contana.Line(i));
theline.SetTransitionOnS(TransLine);
slin.Append(theline);
theline.Clear();
}
/*
if (typS == GeomAbs_Cone) {
Standard_Real u,v;
gp_Cone thecone(TheSurfaceTool::Cone(Surf));
ElSLib::Parameters(thecone,thecone.Apex(),u,v);
Contap_ThePoint vtxapex(thecone.Apex(),u,v);
vtxapex.SetInternal();
vtxapex.SetMultiple();
for (i=1; i<=nbCont i++) {
slin.ChangeValue(i).Add(vtxapex);
}
}
*/
}
}
if(PerformSolRst) {
solrst.Perform(myAFunc,Domain,TolArc,TolArc);
if (!solrst.IsDone()) {
return;
}
nbPointRst = solrst.NbPoints();
if (nbPointRst != 0) {
PutPointsOnLine(solrst,Surf,slin);
}
if (solrst.NbSegments() !=0) {
ProcessSegments(solrst,slin,TolArc,mySFunc,Domain);
}
//-- lbr
//Standard_Boolean oneremov;
Standard_Integer nblinto = slin.Length();
TColStd_SequenceOfInteger SeqToDestroy;
//-- cout<<" Construct Contour_3 nblin = "<<nblinto<<endl;
for(i=1; i<= nblinto ; i++) {
//-- cout<<" nbvtx : "<<slin.Value(i).NbVertex()<<endl;
//--if(slin.Value(i).NbVertex() > 1) {
if(slin.Value(i).TypeContour() != Contap_Restriction) {
LineConstructor(slin,Domain,slin.ChangeValue(i),Surf);
SeqToDestroy.Append(i);
}
//-- }
}
for(i=SeqToDestroy.Length(); i>=1; i--) {
slin.Remove(SeqToDestroy.Value(i));
}
}
done = Standard_True;
}

View File

@ -14,46 +14,44 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class HContToolGen from Contap (
TheHVertex as any;
TheHCurve2d as any;
TheHSurface as any;
TheHCurve2dTool as any;
TheHSurfaceTool as any)
class HContTool from Contap
---Purpose: Tool for the intersection between 2 surfaces.
-- Regroupe pour l instant les methodes hors Adaptor3d...
uses
Pnt2d from gp,
Pnt from gp
Pnt2d from gp,
Pnt from gp,
HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
HSurface from Adaptor3d,
HCurve2dTool from Contap,
HSurfaceTool from Adaptor3d
is
NbSamplesU(myclass; S: TheHSurface; u1,u2: Real from Standard)
NbSamplesU(myclass; S: HSurface from Adaptor3d; u1,u2: Real from Standard)
returns Integer from Standard;
NbSamplesV(myclass; S: TheHSurface; v1,v2: Real from Standard)
NbSamplesV(myclass; S: HSurface from Adaptor3d; v1,v2: Real from Standard)
returns Integer from Standard;
-- Methodes pour recherche des points interieurs
NbSamplePoints(myclass; S: TheHSurface)
NbSamplePoints(myclass; S: HSurface from Adaptor3d)
returns Integer from Standard;
SamplePoint(myclass; S : TheHSurface;
SamplePoint(myclass; S : HSurface from Adaptor3d;
Index: Integer from Standard;
U,V: out Real from Standard);
-- Methodes sur un arc de restriction
HasBeenSeen(myclass; C: TheHCurve2d)
HasBeenSeen(myclass; C: HCurve2d from Adaptor2d)
---Purpose: Returns True if all the intersection point and edges
-- are known on the Arc.
@ -63,7 +61,7 @@ is
returns Boolean from Standard;
NbSamplesOnArc(myclass; A: TheHCurve2d)
NbSamplesOnArc(myclass; A: HCurve2d from Adaptor2d)
---Purpose: returns the number of points which is used to make
-- a sample on the arc. this number is a function of
@ -72,7 +70,7 @@ is
returns Integer from Standard;
Bounds(myclass; C: TheHCurve2d;
Bounds(myclass; C: HCurve2d from Adaptor2d;
Ufirst,Ulast: out Real from Standard);
---Purpose: Returns the parametric limits on the arc C.
@ -81,7 +79,7 @@ is
-- or a bounding box for an infinite arc.
Project(myclass; C: TheHCurve2d;
Project(myclass; C: HCurve2d from Adaptor2d;
P: Pnt2d from gp;
Paramproj: out Real from Standard;
Ptproj : out Pnt2d from gp)
@ -100,7 +98,7 @@ is
-- Methods on a vertex
Tolerance(myclass; V: TheHVertex; C: TheHCurve2d)
Tolerance(myclass; V: HVertex from Adaptor3d; C: HCurve2d from Adaptor2d)
---Purpose: Returns the parametric tolerance used to consider
-- that the vertex and another point meet, i-e
@ -110,7 +108,7 @@ is
returns Real from Standard;
Parameter(myclass; V: TheHVertex; C: TheHCurve2d)
Parameter(myclass; V: HVertex from Adaptor3d; C: HCurve2d from Adaptor2d)
---Purpose: Returns the parameter of the vertex V on the arc A.
@ -119,14 +117,14 @@ is
-- The following methods are used when HasBeenSeen returns Standard_True
NbPoints(myclass; C: TheHCurve2d)
NbPoints(myclass; C: HCurve2d from Adaptor2d)
---Purpose: Returns the number of intersection points on the arc A.
returns Integer from Standard;
Value(myclass; C: TheHCurve2d; Index: Integer from Standard;
Value(myclass; C: HCurve2d from Adaptor2d; Index: Integer from Standard;
Pt: out Pnt from gp; Tol: out Real from Standard;
U: out Real from Standard);
@ -135,7 +133,7 @@ is
-- point of range Index.
IsVertex(myclass; C: TheHCurve2d;
IsVertex(myclass; C: HCurve2d from Adaptor2d;
Index: Integer from Standard)
---Purpose: Returns True if the intersection point of range Index
@ -144,14 +142,14 @@ is
returns Boolean from Standard;
Vertex(myclass; C: TheHCurve2d; Index: Integer from Standard;
V: out TheHVertex);
Vertex(myclass; C: HCurve2d from Adaptor2d; Index: Integer from Standard;
V: out HVertex from Adaptor3d);
---Purpose: When IsVertex returns True, this method returns the
-- vertex on the arc A.
NbSegments(myclass; C: TheHCurve2d)
NbSegments(myclass; C: HCurve2d from Adaptor2d)
---Purpose: returns the number of part of A solution of the
-- of intersection problem.
@ -159,7 +157,7 @@ is
returns Integer from Standard;
HasFirstPoint(myclass; C: TheHCurve2d;
HasFirstPoint(myclass; C: HCurve2d from Adaptor2d;
Index: Integer from Standard;
IndFirst: out Integer from Standard)
@ -173,7 +171,7 @@ is
returns Boolean from Standard;
HasLastPoint(myclass; C: TheHCurve2d;
HasLastPoint(myclass; C: HCurve2d from Adaptor2d;
Index: Integer from Standard;
IndLast: out Integer from Standard)
@ -187,7 +185,7 @@ is
returns Boolean from Standard;
IsAllSolution(myclass; C: TheHCurve2d)
IsAllSolution(myclass; C: HCurve2d from Adaptor2d)
---Purpose: Returns True when the whole restriction is solution
-- of the intersection problem.
@ -195,4 +193,4 @@ is
returns Boolean from Standard;
end HContToolGen;
end HContTool;

View File

@ -14,33 +14,17 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_HContTool.ixx>
#include <Extrema_EPCOfExtPC2d.hxx>
#include <Extrema_POnCurv2d.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <Standard_OutOfRange.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
static Standard_Real uinf,vinf,usup,vsup;
#include TheHSurface_hxx
#include TheHCurve2d_hxx
#include TheHVertex_hxx
Standard_Integer Contap_HContToolGen::NbSamplesV
(const TheHSurface& S,
const Standard_Real ,
const Standard_Real )
Standard_Integer Contap_HContTool::NbSamplesV
(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real ,
const Standard_Real )
{
Standard_Integer nbs;
GeomAbs_SurfaceType typS = S->GetType();
@ -84,10 +68,10 @@ Standard_Integer Contap_HContToolGen::NbSamplesV
return(nbs);
}
Standard_Integer Contap_HContToolGen::NbSamplesU
(const TheHSurface& S,
const Standard_Real ,
const Standard_Real )
Standard_Integer Contap_HContTool::NbSamplesU
(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real ,
const Standard_Real )
{
Standard_Integer nbs;
GeomAbs_SurfaceType typS = S->GetType();
@ -135,8 +119,8 @@ Standard_Integer Contap_HContToolGen::NbSamplesU
return(nbs);
}
Standard_Integer Contap_HContToolGen::NbSamplePoints
(const TheHSurface& S)
Standard_Integer Contap_HContTool::NbSamplePoints
(const Handle(Adaptor3d_HSurface)& S)
{
uinf = S->FirstUParameter();
usup = S->LastUParameter();
@ -147,8 +131,8 @@ Standard_Integer Contap_HContToolGen::NbSamplePoints
Standard_Real temp = uinf;
uinf = usup;
usup = temp;
}
if (vsup < vinf) {
}
if (vsup < vinf) {
Standard_Real temp = vinf;
vinf = vsup;
vsup = temp;
@ -183,10 +167,10 @@ Standard_Integer Contap_HContToolGen::NbSamplePoints
return 5;
}
void Contap_HContToolGen::SamplePoint (const TheHSurface& S,
const Standard_Integer Index,
Standard_Real& U,
Standard_Real& V )
void Contap_HContTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
const Standard_Integer Index,
Standard_Real& U,
Standard_Real& V )
{
if(S->GetType() == GeomAbs_BSplineSurface) {
Standard_Integer nbIntU = NbSamplesU(S,uinf,usup)/3;
@ -229,8 +213,8 @@ void Contap_HContToolGen::SamplePoint (const TheHSurface& S,
}
Standard_Integer Contap_HContToolGen::NbSamplesOnArc
(const TheHCurve2d& A) {
Standard_Integer Contap_HContTool::NbSamplesOnArc
(const Handle(Adaptor2d_HCurve2d)& A) {
GeomAbs_CurveType CurveType = A->GetType();
@ -252,7 +236,7 @@ Standard_Integer Contap_HContToolGen::NbSamplesOnArc
//-- Handle_Geom2d_BSplineCurve& BSC=A->BSpline();
nbsOnC = 2 + A->NbKnots() * A->Degree();
break;
}
}
default:
nbsOnC = 10;
}
@ -260,19 +244,19 @@ Standard_Integer Contap_HContToolGen::NbSamplesOnArc
}
void Contap_HContToolGen::Bounds(const TheHCurve2d& A,
Standard_Real& Ufirst,
Standard_Real& Ulast)
void Contap_HContTool::Bounds(const Handle(Adaptor2d_HCurve2d)& A,
Standard_Real& Ufirst,
Standard_Real& Ulast)
{
Ufirst = A->FirstParameter();
Ulast = A->LastParameter();
}
Standard_Boolean Contap_HContToolGen::Project (const TheHCurve2d& C,
const gp_Pnt2d& P,
Standard_Real& Paramproj,
gp_Pnt2d& Ptproj)
Standard_Boolean Contap_HContTool::Project (const Handle(Adaptor2d_HCurve2d)& C,
const gp_Pnt2d& P,
Standard_Real& Paramproj,
gp_Pnt2d& Ptproj)
{
@ -303,80 +287,80 @@ Standard_Boolean Contap_HContToolGen::Project (const TheHCurve2d& C,
}
Standard_Real Contap_HContToolGen::Tolerance (const TheHVertex& V,
const TheHCurve2d& C)
Standard_Real Contap_HContTool::Tolerance (const Handle(Adaptor3d_HVertex)& V,
const Handle(Adaptor2d_HCurve2d)& C)
{
// return BRepAdaptor2d_Curve2dTool::Resolution(C,BRep_Tool::Tolerance(V));
// return BRepAdaptor2d_Curve2dTool::Resolution(C,BRep_Tool::Tolerance(V));
return V->Resolution(C);
}
Standard_Real Contap_HContToolGen::Parameter (const TheHVertex& V,
const TheHCurve2d& C)
Standard_Real Contap_HContTool::Parameter (const Handle(Adaptor3d_HVertex)& V,
const Handle(Adaptor2d_HCurve2d)& C)
{
// return BRep_Tool::Parameter(V,C.Edge());
// return BRep_Tool::Parameter(V,C.Edge());
return V->Parameter(C);
}
Standard_Boolean Contap_HContToolGen::HasBeenSeen
(const TheHCurve2d&)
Standard_Boolean Contap_HContTool::HasBeenSeen
(const Handle(Adaptor2d_HCurve2d)&)
{
return Standard_False;
}
Standard_Integer Contap_HContToolGen::NbPoints(const TheHCurve2d&)
Standard_Integer Contap_HContTool::NbPoints(const Handle(Adaptor2d_HCurve2d)&)
{
return 0;
}
void Contap_HContToolGen::Value(const TheHCurve2d&,
const Standard_Integer,
gp_Pnt&,
Standard_Real&,
Standard_Real&)
void Contap_HContTool::Value(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer,
gp_Pnt&,
Standard_Real&,
Standard_Real&)
{
Standard_OutOfRange::Raise();
}
Standard_Boolean Contap_HContToolGen::IsVertex(const TheHCurve2d&,
const Standard_Integer)
Standard_Boolean Contap_HContTool::IsVertex(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer)
{
return Standard_False;
}
void Contap_HContToolGen::Vertex(const TheHCurve2d&,
const Standard_Integer,
TheHVertex&)
void Contap_HContTool::Vertex(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer,
Handle(Adaptor3d_HVertex)&)
{
Standard_OutOfRange::Raise();
}
Standard_Integer Contap_HContToolGen::NbSegments(const TheHCurve2d&)
Standard_Integer Contap_HContTool::NbSegments(const Handle(Adaptor2d_HCurve2d)&)
{
return 0;
}
Standard_Boolean Contap_HContToolGen::HasFirstPoint
(const TheHCurve2d&,
const Standard_Integer,
Standard_Integer&)
Standard_Boolean Contap_HContTool::HasFirstPoint
(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer,
Standard_Integer&)
{
Standard_OutOfRange::Raise();
return Standard_False;
return Standard_False;
}
Standard_Boolean Contap_HContToolGen::HasLastPoint
(const TheHCurve2d&,
const Standard_Integer,
Standard_Integer&)
Standard_Boolean Contap_HContTool::HasLastPoint
(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer,
Standard_Integer&)
{
Standard_OutOfRange::Raise();
return Standard_False;
return Standard_False;
}
Standard_Boolean Contap_HContToolGen::IsAllSolution
(const TheHCurve2d&)
Standard_Boolean Contap_HContTool::IsAllSolution
(const Handle(Adaptor2d_HCurve2d)&)
{
return Standard_False;

View File

@ -14,22 +14,22 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class HCurve2dToolGen from Contap (
CurveGen as any)
class HCurve2dTool from Contap
uses
Array1OfReal from TColStd,
Shape from GeomAbs,
CurveType from GeomAbs,
Vec2d from gp,
Pnt2d from gp,
Circ2d from gp,
Elips2d from gp,
Hypr2d from gp,
Parab2d from gp,
Lin2d from gp,
BezierCurve from Geom2d,
BSplineCurve from Geom2d
Array1OfReal from TColStd,
Shape from GeomAbs,
CurveType from GeomAbs,
Vec2d from gp,
Pnt2d from gp,
Circ2d from gp,
Elips2d from gp,
Hypr2d from gp,
Parab2d from gp,
Lin2d from gp,
BezierCurve from Geom2d,
BSplineCurve from Geom2d,
HCurve2d from Adaptor2d
raises
@ -43,12 +43,12 @@ is
-- Global methods - Apply to the whole curve.
--
FirstParameter(myclass; C: CurveGen) returns Real
FirstParameter(myclass; C: HCurve2d from Adaptor2d) returns Real
---C++: inline
;
LastParameter(myclass; C: CurveGen) returns Real
LastParameter(myclass; C: HCurve2d from Adaptor2d) returns Real
---C++: inline
;
@ -72,18 +72,18 @@ is
-- use the method Trim().
Continuity(myclass; C: CurveGen) returns Shape from GeomAbs
Continuity(myclass; C: HCurve2d from Adaptor2d) returns Shape from GeomAbs
---Purpose:
---C++: inline
;
NbIntervals(myclass; C: CurveGen; S : Shape from GeomAbs) returns Integer
NbIntervals(myclass; C: HCurve2d from Adaptor2d; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(myclass) >= <S>
---C++: inline
;
Intervals(myclass; C: CurveGen; T : in out Array1OfReal from TColStd;
Intervals(myclass; C: HCurve2d from Adaptor2d; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs)
---Purpose: Stores in <T> the parameters bounding the intervals
-- of continuity <S>.
@ -95,31 +95,31 @@ is
---C++: inline
;
IsClosed(myclass; C: CurveGen) returns Boolean
IsClosed(myclass; C: HCurve2d from Adaptor2d) returns Boolean
---C++: inline
;
IsPeriodic(myclass; C: CurveGen) returns Boolean
IsPeriodic(myclass; C: HCurve2d from Adaptor2d) returns Boolean
---C++: inline
;
Period(myclass; C: CurveGen) returns Real
Period(myclass; C: HCurve2d from Adaptor2d) returns Real
raises
DomainError from Standard -- if the curve is not periodic
---C++: inline
;
Value(myclass; C: CurveGen; U : Real) returns Pnt2d from gp
Value(myclass; C: HCurve2d from Adaptor2d; U : Real) returns Pnt2d from gp
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
;
D0 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp)
D0 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp)
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
;
D1 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp ; V : out Vec2d from gp)
D1 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp ; V : out Vec2d from gp)
--- Purpose : Computes the point of parameter U on the curve with its
-- first derivative.
raises
@ -129,7 +129,7 @@ is
---C++: inline
;
D2 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp; V1, V2 : out Vec2d from gp)
D2 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp; V1, V2 : out Vec2d from gp)
--- Purpose :
-- Returns the point P of parameter U, the first and second
-- derivatives V1 and V2.
@ -140,7 +140,7 @@ is
---C++: inline
;
D3 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp; V1, V2, V3 : out Vec2d from gp)
D3 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp; V1, V2, V3 : out Vec2d from gp)
--- Purpose :
-- Returns the point P of parameter U, the first, the second
-- and the third derivative.
@ -151,7 +151,7 @@ is
---C++: inline
;
DN (myclass; C: CurveGen; U : Real; N : Integer) returns Vec2d from gp
DN (myclass; C: HCurve2d from Adaptor2d; U : Real; N : Integer) returns Vec2d from gp
--- Purpose :
-- The returned vector gives the value of the derivative for the
-- order of derivation N.
@ -164,13 +164,13 @@ is
---C++: inline
;
Resolution(myclass; C: CurveGen; R3d : Real) returns Real
Resolution(myclass; C: HCurve2d from Adaptor2d; R3d : Real) returns Real
---Purpose : Returns the parametric resolution corresponding
-- to the real space resolution <R3d>.
---C++: inline
;
GetType(myclass; C: CurveGen) returns CurveType from GeomAbs
GetType(myclass; C: HCurve2d from Adaptor2d) returns CurveType from GeomAbs
---Purpose: Returns the type of the curve in the current
-- interval : Line, Circle, Ellipse, Hyperbola,
-- Parabola, BezierCurve, BSplineCurve, OtherCurve.
@ -182,43 +182,43 @@ is
-- the corresponding type.
--
Line(myclass; C: CurveGen) returns Lin2d from gp
Line(myclass; C: HCurve2d from Adaptor2d) returns Lin2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Circle(myclass; C: CurveGen) returns Circ2d from gp
Circle(myclass; C: HCurve2d from Adaptor2d) returns Circ2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Ellipse(myclass; C: CurveGen) returns Elips2d from gp
Ellipse(myclass; C: HCurve2d from Adaptor2d) returns Elips2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Hyperbola(myclass; C: CurveGen) returns Hypr2d from gp
Hyperbola(myclass; C: HCurve2d from Adaptor2d) returns Hypr2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Parabola(myclass; C: CurveGen) returns Parab2d from gp
Parabola(myclass; C: HCurve2d from Adaptor2d) returns Parab2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Bezier(myclass; C: CurveGen) returns BezierCurve from Geom2d
Bezier(myclass; C: HCurve2d from Adaptor2d) returns BezierCurve from Geom2d
raises
NoSuchObject from Standard
---C++: inline
;
BSpline(myclass; C: CurveGen) returns BSplineCurve from Geom2d
BSpline(myclass; C: HCurve2d from Adaptor2d) returns BSplineCurve from Geom2d
raises
NoSuchObject from Standard
---C++: inline
@ -228,7 +228,7 @@ is
NbSamples(myclass; C: CurveGen; U0,U1: Real from Standard)
NbSamples(myclass; C: HCurve2d from Adaptor2d; U0,U1: Real from Standard)
returns Integer from Standard;
end HCurve2dToolGen;
end HCurve2dTool;

View File

@ -14,37 +14,31 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include CurveGen_hxx
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Contap_HCurve2dTool.ixx>
//============================================================
Standard_Integer Contap_HCurve2dToolGen::NbSamples (const CurveGen& C,
const Standard_Real U0,
const Standard_Real U1)
Standard_Integer Contap_HCurve2dTool::NbSamples (const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real U0,
const Standard_Real U1)
{
Standard_Real nbs = 10.0;
switch (C->GetType())
{
case GeomAbs_Line:
nbs = 2.;
break;
case GeomAbs_BezierCurve:
nbs = 3. + C->NbPoles();
break;
case GeomAbs_BSplineCurve:
nbs = C->NbKnots();
nbs*= C->Degree();
nbs*= C->LastParameter()- C->FirstParameter();
nbs/= U1-U0;
if(nbs < 2.0) nbs = 2.;
break;
default:
break;
case GeomAbs_Line:
nbs = 2.;
break;
case GeomAbs_BezierCurve:
nbs = 3. + C->NbPoles();
break;
case GeomAbs_BSplineCurve:
nbs = C->NbKnots();
nbs*= C->Degree();
nbs*= C->LastParameter()- C->FirstParameter();
nbs/= U1-U0;
if(nbs < 2.0) nbs = 2.;
break;
default:
break;
}
if (nbs>50.)
nbs = 50.;

View File

@ -14,7 +14,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include CurveGen_hxx
#include <Adaptor2d_HCurve2d.hxx>
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
@ -33,59 +33,59 @@
#include <TColStd_Array1OfReal.hxx>
//============================================================
inline Standard_Real Contap_HCurve2dToolGen::FirstParameter (const CurveGen& C) {
inline Standard_Real Contap_HCurve2dTool::FirstParameter (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->FirstParameter());
}
//============================================================
inline Standard_Real Contap_HCurve2dToolGen::LastParameter (const CurveGen& C) {
inline Standard_Real Contap_HCurve2dTool::LastParameter (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->LastParameter());
}
//============================================================
inline GeomAbs_Shape Contap_HCurve2dToolGen::Continuity (const CurveGen& C) {
inline GeomAbs_Shape Contap_HCurve2dTool::Continuity (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->Continuity());
}
//============================================================
inline Standard_Integer Contap_HCurve2dToolGen::NbIntervals(const CurveGen& C,const GeomAbs_Shape Sh) {
inline Standard_Integer Contap_HCurve2dTool::NbIntervals(const Handle(Adaptor2d_HCurve2d)& C,const GeomAbs_Shape Sh) {
return(C->NbIntervals(Sh));
}
//============================================================
inline void Contap_HCurve2dToolGen::Intervals(const CurveGen& C,
inline void Contap_HCurve2dTool::Intervals(const Handle(Adaptor2d_HCurve2d)& C,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape Sh) {
C->Intervals(Tab,Sh);
}
//============================================================
inline Standard_Boolean Contap_HCurve2dToolGen::IsClosed(const CurveGen& C) {
inline Standard_Boolean Contap_HCurve2dTool::IsClosed(const Handle(Adaptor2d_HCurve2d)& C) {
return(C->IsClosed());
}
//============================================================
inline Standard_Boolean Contap_HCurve2dToolGen::IsPeriodic(const CurveGen& C) {
inline Standard_Boolean Contap_HCurve2dTool::IsPeriodic(const Handle(Adaptor2d_HCurve2d)& C) {
return(C->IsPeriodic());
}
//============================================================
inline Standard_Real Contap_HCurve2dToolGen::Period(const CurveGen& C) {
inline Standard_Real Contap_HCurve2dTool::Period(const Handle(Adaptor2d_HCurve2d)& C) {
return(C->Period());
}
//============================================================
inline gp_Pnt2d Contap_HCurve2dToolGen::Value (const CurveGen& C,
inline gp_Pnt2d Contap_HCurve2dTool::Value (const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real U) {
return(C->Value(U));
}
//============================================================
inline void Contap_HCurve2dToolGen::D0(const CurveGen& C,
inline void Contap_HCurve2dTool::D0(const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real U,
gp_Pnt2d& P) {
C->D0(U,P);
}
//============================================================
inline void Contap_HCurve2dToolGen::D1 (const CurveGen& C,
inline void Contap_HCurve2dTool::D1 (const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T) {
C->D1(U,P,T);
}
//============================================================
inline void Contap_HCurve2dToolGen::D2 (const CurveGen& C,
inline void Contap_HCurve2dTool::D2 (const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T,
@ -94,7 +94,7 @@ inline void Contap_HCurve2dToolGen::D2 (const CurveGen& C,
C->D2(U,P,T,N);
}
//============================================================
inline void Contap_HCurve2dToolGen::D3 (const CurveGen& C,
inline void Contap_HCurve2dTool::D3 (const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& V1,
@ -104,47 +104,47 @@ inline void Contap_HCurve2dToolGen::D3 (const CurveGen& C,
C->D3(U,P,V1,V2,V3);
}
//============================================================
inline gp_Vec2d Contap_HCurve2dToolGen::DN (const CurveGen& C,
inline gp_Vec2d Contap_HCurve2dTool::DN (const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real U,
const Standard_Integer N) {
return(C->DN(U,N));
}
//============================================================
inline Standard_Real Contap_HCurve2dToolGen::Resolution(const CurveGen& C,
inline Standard_Real Contap_HCurve2dTool::Resolution(const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real R3d) {
return(C->Resolution(R3d));
}
//============================================================
inline GeomAbs_CurveType Contap_HCurve2dToolGen::GetType(const CurveGen& C) {
inline GeomAbs_CurveType Contap_HCurve2dTool::GetType(const Handle(Adaptor2d_HCurve2d)& C) {
return(C->GetType());
}
//============================================================
inline gp_Lin2d Contap_HCurve2dToolGen::Line (const CurveGen& C) {
inline gp_Lin2d Contap_HCurve2dTool::Line (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->Line());
}
//============================================================
inline gp_Circ2d Contap_HCurve2dToolGen::Circle (const CurveGen& C) {
inline gp_Circ2d Contap_HCurve2dTool::Circle (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->Circle());
}
//============================================================
inline gp_Elips2d Contap_HCurve2dToolGen::Ellipse (const CurveGen& C) {
inline gp_Elips2d Contap_HCurve2dTool::Ellipse (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->Ellipse());
}
//============================================================
inline gp_Parab2d Contap_HCurve2dToolGen::Parabola (const CurveGen& C) {
inline gp_Parab2d Contap_HCurve2dTool::Parabola (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->Parabola());
}
//============================================================
inline gp_Hypr2d Contap_HCurve2dToolGen::Hyperbola (const CurveGen& C) {
inline gp_Hypr2d Contap_HCurve2dTool::Hyperbola (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->Hyperbola());
}
//============================================================
inline Handle(Geom2d_BezierCurve) Contap_HCurve2dToolGen::Bezier (const CurveGen& C) {
inline Handle(Geom2d_BezierCurve) Contap_HCurve2dTool::Bezier (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->Bezier());
}
//============================================================
inline Handle(Geom2d_BSplineCurve) Contap_HCurve2dToolGen::BSpline (const CurveGen& C) {
inline Handle(Geom2d_BSplineCurve) Contap_HCurve2dTool::BSpline (const Handle(Adaptor2d_HCurve2d)& C) {
return(C->BSpline());
}
//============================================================

View File

@ -14,12 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Line from Contap
(TheVertex as any;
TheArc as any;
ThePoint as any; --as Point from Contap(TheVertex,TheArc)
TheHSequenceOfPoint as Transient) --as HSequence from TCollection
-- (ThePoint)
class Line from Contap
---Purpose:
@ -30,7 +25,11 @@ uses Pnt from gp,
Lin from gp,
Circ from gp,
Dir from gp,
IType from Contap -- duplique IntPatch_IType. Mettre ds IntSurf
IType from Contap, -- duplique IntPatch_IType. Mettre ds IntSurf
HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
Point from Contap,
TheHSequenceOfPoint from Contap
raises DomainError from Standard,
OutOfRange from Standard
@ -76,12 +75,12 @@ is
is static;
SetValue(me: in out; A: TheArc)
SetValue(me: in out; A: HCurve2d from Adaptor2d)
is static;
Add(me: in out; P: ThePoint)
Add(me: in out; P: Point from Contap)
is static;
@ -96,7 +95,7 @@ is
Vertex(me; Index: Integer from Standard)
returns ThePoint
returns Point from Contap
---C++: return &
---C++: inline
@ -171,7 +170,7 @@ is
Arc(me)
returns any TheArc
returns any HCurve2d from Adaptor2d
---C++: return const&
raises DomainError from Standard
@ -203,8 +202,8 @@ fields
Trans : TypeTrans from IntSurf;
curv : LineOn2S from IntSurf;
svtx : TheHSequenceOfPoint;
thearc : TheArc;
svtx : TheHSequenceOfPoint from Contap;
thearc : HCurve2d from Adaptor2d;
typL : IType from Contap;
pt : Pnt from gp;
dir1 : Dir from gp;

View File

@ -14,16 +14,18 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_Line.ixx>
Contap_Line::Contap_Line () {
svtx = new TheHSequenceOfPoint ();
svtx = new Contap_TheHSequenceOfPoint ();
Trans = IntSurf_Undecided;
}
void Contap_Line::ResetSeqOfVertex() {
svtx = new TheHSequenceOfPoint ();
svtx = new Contap_TheHSequenceOfPoint ();
}
void Contap_Line::Add(const ThePoint& P) {
void Contap_Line::Add(const Contap_Point& P) {
Standard_Integer n = svtx->Length();
if(n==0) {
svtx->Append(P);
@ -35,10 +37,10 @@ void Contap_Line::Add(const ThePoint& P) {
}
else {
for(Standard_Integer i=n-1;i>0;i--) {
if(prm> svtx->Value(i).ParameterOnLine()) {
svtx->InsertBefore(i+1,P);
return;
}
if(prm> svtx->Value(i).ParameterOnLine()) {
svtx->InsertBefore(i+1,P);
return;
}
}
svtx->Prepend(P);
}
@ -48,7 +50,7 @@ void Contap_Line::Add(const ThePoint& P) {
void Contap_Line::Clear () {
if(!curv.IsNull())
curv->Clear();
svtx = new TheHSequenceOfPoint ();
svtx = new Contap_TheHSequenceOfPoint ();
typL = Contap_Walking;
}
@ -68,7 +70,7 @@ void Contap_Line::SetValue(const gp_Circ& C)
typL = Contap_Circle;
}
void Contap_Line::SetValue(const TheArc& A)
void Contap_Line::SetValue(const Handle(Adaptor2d_HCurve2d)& A)
{
thearc = A;
typL = Contap_Restriction;
@ -87,7 +89,7 @@ IntSurf_TypeTrans Contap_Line::TransitionOnS() const {
return(Trans);
}
const TheArc& Contap_Line::Arc () const
const Handle(Adaptor2d_HCurve2d)& Contap_Line::Arc () const
{
if (typL != Contap_Restriction) {Standard_DomainError::Raise();}
return thearc;

View File

@ -21,7 +21,8 @@
#include <IntSurf_PntOn2S.hxx>
#include <IntSurf_LineOn2S.hxx>
#include TheHSequenceOfPoint_hxx
#include <Contap_Point.hxx>
#include <Contap_TheHSequenceOfPoint.hxx>
inline const Handle(IntSurf_LineOn2S)& Contap_Line::LineOn2S () const
{
@ -38,7 +39,7 @@ inline Standard_Integer Contap_Line::NbVertex () const
return svtx->Length();
}
inline ThePoint& Contap_Line::Vertex (const Standard_Integer Index) const
inline Contap_Point& Contap_Line::Vertex (const Standard_Integer Index) const
{
return svtx->ChangeSequence()(Index);
}

View File

@ -14,9 +14,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Point from Contap
(TheVertex as any;
TheArc as any)
class Point from Contap
---Purpose: Definition of a vertex on the contour line.
@ -28,7 +26,9 @@ generic class Point from Contap
uses Pnt from gp,
Transition from IntSurf
Transition from IntSurf,
HVertex from Adaptor3d,
HCurve2d from Adaptor2d
raises DomainError from Standard
@ -68,7 +68,7 @@ is
is static;
SetVertex(me: in out; V: TheVertex)
SetVertex(me: in out; V: HVertex from Adaptor3d)
---Purpose: Sets the values of a point which is a vertex on
-- the initial facet of restriction of one
@ -79,7 +79,7 @@ is
is static;
SetArc(me: in out; A: TheArc; Param: Real from Standard;
SetArc(me: in out; A: HCurve2d from Adaptor2d; Param: Real from Standard;
TLine,TArc: Transition from IntSurf)
---Purpose: Sets the value of the arc and of the parameter on
@ -151,7 +151,7 @@ is
---Purpose: Returns the arc of restriction containing the
-- vertex.
returns any TheArc
returns any HCurve2d from Adaptor2d
---C++: return const&
---C++: inline
@ -221,7 +221,7 @@ is
-- IsVertex returns True.
-- Otherwise, an exception is raised.
returns any TheVertex
returns any HVertex from Adaptor3d
---C++: return const&
---C++: inline
@ -259,12 +259,12 @@ fields
vparam : Real from Standard;
paraline : Real from Standard;
onarc : Boolean from Standard;
arc : TheArc;
arc : HCurve2d from Adaptor2d;
traline : Transition from IntSurf;
traarc : Transition from IntSurf;
prmarc : Real from Standard;
isvtx : Boolean from Standard;
vtx : TheVertex;
vtx : HVertex from Adaptor3d;
ismult : Boolean from Standard;
myInternal : Boolean from Standard;

View File

@ -14,14 +14,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_Point.ixx>
Contap_Point::Contap_Point ():
onarc(Standard_False),isvtx(Standard_False),ismult(Standard_False),
myInternal(Standard_False)
onarc(Standard_False),isvtx(Standard_False),ismult(Standard_False),
myInternal(Standard_False)
{}
Contap_Point::Contap_Point (const gp_Pnt& Pt,
const Standard_Real U,
const Standard_Real V):
pt(Pt),uparam(U),vparam(V),onarc(Standard_False),isvtx(Standard_False),
ismult(Standard_False),myInternal(Standard_False)
const Standard_Real U,
const Standard_Real V):
pt(Pt),uparam(U),vparam(V),onarc(Standard_False),isvtx(Standard_False),
ismult(Standard_False),myInternal(Standard_False)
{}

View File

@ -34,13 +34,13 @@ inline void Contap_Point::SetParameter (const Standard_Real Para) {
paraline = Para;
}
inline void Contap_Point::SetVertex(const TheVertex& V) {
inline void Contap_Point::SetVertex(const Handle(Adaptor3d_HVertex)& V) {
isvtx = Standard_True;
vtx = V;
}
inline void Contap_Point::SetArc (const TheArc& A,
inline void Contap_Point::SetArc (const Handle(Adaptor2d_HCurve2d)& A,
const Standard_Real Param,
const IntSurf_Transition& TLine,
const IntSurf_Transition& TArc) {
@ -94,7 +94,7 @@ inline Standard_Boolean Contap_Point::IsOnArc () const{
return onarc;
}
inline const TheArc& Contap_Point::Arc () const {
inline const Handle_Adaptor2d_HCurve2d& Contap_Point::Arc () const {
if (!onarc) {Standard_DomainError::Raise();}
return arc;
@ -122,7 +122,7 @@ inline Standard_Boolean Contap_Point::IsVertex () const {
return isvtx;
}
inline const TheVertex& Contap_Point::Vertex () const {
inline const Handle_Adaptor3d_HVertex& Contap_Point::Vertex () const {
if (!isvtx) {Standard_DomainError::Raise();}
return vtx;

View File

@ -14,27 +14,23 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class SurfFunction from Contap
(TheSurface as any;
TheSurfaceTool as any;
TheSurfProps as any; -- as SurfProps from Contap(TheSurface,
-- TheSurfaceTool)
TheContTool as any)
inherits FunctionSetWithDerivatives from math
class SurfFunction from Contap inherits FunctionSetWithDerivatives from math
---Purpose: This class describes the function on a parametric surface.
-- the form of the function is F(u,v) = 0 where u and v are
-- the parameteric coordinates of a point on the surface,
-- to compute the contours of the surface.
uses Vector from math,
Matrix from math,
Pnt from gp,
Vec from gp,
Dir from gp,
Dir2d from gp,
TFunction from Contap
uses Vector from math,
Matrix from math,
Pnt from gp,
Vec from gp,
Dir from gp,
Dir2d from gp,
TFunction from Contap,
HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d,
HContTool from Contap
raises UndefinedDerivative from StdFail
@ -46,7 +42,7 @@ is
returns SurfFunction from Contap;
Set(me: in out; S: TheSurface)
Set(me: in out; S: HSurface from Adaptor3d)
is static;
@ -203,7 +199,7 @@ is
Surface(me)
returns any TheSurface
returns any HSurface from Adaptor3d
---C++: return const&
---C++: inline
is static;
@ -212,7 +208,7 @@ is
fields
mySurf : TheSurface;
mySurf : HSurface from Adaptor3d;
myMean : Real from Standard;
myType : TFunction from Contap;
myDir : Dir from gp;

View File

@ -16,34 +16,36 @@
// jag 940616 #define Tolpetit 1.e-16
#include <Contap_SurfFunction.ixx>
#include <gp.hxx>
#include <Contap_SurfProps.hxx>
#include <Contap_HContTool.hxx>
#include <Adaptor3d_HSurfaceTool.hxx>
Contap_SurfFunction::Contap_SurfFunction ():
myMean(1.),
myType(Contap_ContourStd),
myDir(0.,0.,1.),
myCosAng(0.), // PI/2 - Angle de depouille
tol(1.e-6),
computed(Standard_False),
derived(Standard_False)
myMean(1.),
myType(Contap_ContourStd),
myDir(0.,0.,1.),
myCosAng(0.), // PI/2 - Angle de depouille
tol(1.e-6),
computed(Standard_False),
derived(Standard_False)
{}
void Contap_SurfFunction::Set(const TheSurface& S)
void Contap_SurfFunction::Set(const Handle(Adaptor3d_HSurface)& S)
{
mySurf = S;
Standard_Integer i;
Standard_Integer nbs = TheContTool::NbSamplePoints(S);
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
Standard_Real U,V;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
TheContTool::SamplePoint(S,i,U,V);
// TheSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
TheSurfProps::Normale(S,U,V,solpt,norm);
Contap_HContTool::SamplePoint(S,i,U,V);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);
myMean = myMean + norm.Magnitude();
}
myMean = myMean / ((Standard_Real)nbs);
@ -65,13 +67,13 @@ Standard_Integer Contap_SurfFunction::NbEquations () const
Standard_Boolean Contap_SurfFunction::Value(const math_Vector& X,
math_Vector& F)
math_Vector& F)
{
Usol = X(1); Vsol = X(2);
// TheSurfaceTool::D1(mySurf,Usol,Vsol,solpt,d1u,d1v);
// gp_Vec norm(d1u.Crossed(d1v));
// Adaptor3d_HSurfaceTool::D1(mySurf,Usol,Vsol,solpt,d1u,d1v);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Vec norm;
TheSurfProps::Normale(mySurf,Usol,Vsol,solpt,norm);
Contap_SurfProps::Normale(mySurf,Usol,Vsol,solpt,norm);
switch (myType) {
case Contap_ContourStd:
{
@ -99,20 +101,20 @@ Standard_Boolean Contap_SurfFunction::Value(const math_Vector& X,
Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
math_Matrix& Grad)
math_Matrix& Grad)
{
// gp_Vec d2u,d2v,d2uv;
// gp_Vec d2u,d2v,d2uv;
Usol = X(1); Vsol = X(2);
// TheSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
// Adaptor3d_HSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
gp_Vec norm,dnu,dnv;
TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
Grad(1,1) = (dnu.Dot(myDir))/myMean;
Grad(1,2) = (dnv.Dot(myDir))/myMean;
}
@ -126,11 +128,11 @@ Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
break;
case Contap_DraftStd:
{
// gp_Vec norm(d1u.Crossed(d1v).Normalized());
// gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
// Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
// dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
// Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
// gp_Vec norm(d1u.Crossed(d1v).Normalized());
// gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
// Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
// dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
// Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
norm.Normalize();
Grad(1,1) = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
Grad(1,2) = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
@ -149,24 +151,24 @@ Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
math_Vector& F,
math_Matrix& Grad)
math_Vector& F,
math_Matrix& Grad)
{
// gp_Vec d2u,d2v,d2uv;
// gp_Vec d2u,d2v,d2uv;
Usol = X(1); Vsol = X(2);
// TheSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec norm(d1u.Crossed(d1v));
// Adaptor3d_HSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Vec norm,dnu,dnv;
TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
F(1) = (norm.Dot(myDir))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
Grad(1,1) = (dnu.Dot(myDir))/myMean;
Grad(1,2) = (dnv.Dot(myDir))/myMean;
}
@ -175,8 +177,8 @@ Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
{
gp_Vec Ep(myEye,solpt);
F(1) = (norm.Dot(Ep))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
Grad(1,1) = (dnu.Dot(Ep))/myMean;
Grad(1,2) = (dnv.Dot(Ep))/myMean;
}
@ -185,12 +187,12 @@ Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
{
F(1) = (norm.Dot(myDir)-myCosAng*norm.Magnitude())/myMean;
norm.Normalize();
/*
/*
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
*/
Grad(1,1) = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
Grad(1,2) = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}
@ -213,47 +215,47 @@ Standard_Boolean Contap_SurfFunction::IsTangent ()
if (!computed) {
computed = Standard_True;
if(!derived) {
// gp_Vec d2u,d2v,d2uv;
// TheSurfaceTool::D2(mySurf, Usol, Vsol, solpt, d1u, d1v, d2u, d2v, d2uv);
// gp_Vec d2u,d2v,d2uv;
// Adaptor3d_HSurfaceTool::D2(mySurf, Usol, Vsol, solpt, d1u, d1v, d2u, d2v, d2uv);
gp_Vec norm,dnu,dnv;
TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
// Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
Fpu = (dnu.Dot(myDir))/myMean;
Fpv = (dnv.Dot(myDir))/myMean;
}
break;
{
// Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
Fpu = (dnu.Dot(myDir))/myMean;
Fpv = (dnv.Dot(myDir))/myMean;
}
break;
case Contap_ContourPrs:
{
gp_Vec Ep(myEye,solpt);
// Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
Fpu = (dnu.Dot(Ep))/myMean;
Fpv = (dnv.Dot(Ep))/myMean;
}
break;
{
gp_Vec Ep(myEye,solpt);
// Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
Fpu = (dnu.Dot(Ep))/myMean;
Fpv = (dnv.Dot(Ep))/myMean;
}
break;
case Contap_DraftStd:
{
/*
gp_Vec norm(d1u.Crossed(d1v).Normalized());
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
Fpu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
Fpv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
norm.Normalize();
Fpu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
Fpv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}
break;
{
/*
gp_Vec norm(d1u.Crossed(d1v).Normalized());
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
Fpu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
Fpv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
norm.Normalize();
Fpu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
Fpv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}
break;
case Contap_DraftPrs:
default:
{
}
{
}
}
derived = Standard_True;
}
@ -266,7 +268,7 @@ Standard_Boolean Contap_SurfFunction::IsTangent ()
else {
d2d = gp_Dir2d(-Fpv,Fpu);
gp_Vec d1u,d1v;
TheSurfaceTool::D1(mySurf, Usol, Vsol, solpt, d1u, d1v); // ajout jag 02.95
Adaptor3d_HSurfaceTool::D1(mySurf, Usol, Vsol, solpt, d1u, d1v); // ajout jag 02.95
gp_XYZ d3dxyz(-Fpv*d1u.XYZ());
d3dxyz.Add(Fpu*d1v.XYZ());
@ -274,7 +276,7 @@ Standard_Boolean Contap_SurfFunction::IsTangent ()
//jag 940616 if (d3d.Magnitude() <= Tolpetit) {
if (d3d.Magnitude() <= tol) {
tangent = Standard_True;
tangent = Standard_True;
}
}
}

View File

@ -80,7 +80,7 @@ inline const gp_Dir2d& Contap_SurfFunction::Direction2d()
return d2d;
}
inline const TheSurface& Contap_SurfFunction::Surface() const
inline const Handle_Adaptor3d_HSurface& Contap_SurfFunction::Surface() const
{
return mySurf;
}

View File

@ -14,19 +14,19 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class SurfProps from Contap
(TheSurface as any;
TheSurfaceTool as any)
class SurfProps from Contap
---Purpose: Internal tool used to compute the normal and its
-- derivatives.
uses Pnt from gp,
Vec from gp
uses Pnt from gp,
Vec from gp,
HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d
is
Normale(myclass; S: TheSurface; U,V: Real from Standard;
Normale(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
P: out Pnt from gp;
N: out Vec from gp);
@ -35,7 +35,7 @@ is
DerivAndNorm(myclass; S: TheSurface; U,V: Real from Standard;
DerivAndNorm(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
P : out Pnt from gp;
d1u,d1v: out Vec from gp;
N : out Vec from gp);
@ -45,7 +45,7 @@ is
NormAndDn(myclass; S: TheSurface; U,V: Real from Standard;
NormAndDn(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
P : out Pnt from gp;
N,Dnu,Dnv: out Vec from gp);

View File

@ -14,29 +14,32 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_SurfProps.ixx>
#include <ElSLib.hxx>
#include <Adaptor3d_HSurfaceTool.hxx>
//=======================================================================
//function : Normale
//purpose :
//=======================================================================
void Contap_SurfProps::Normale(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& Norm)
void Contap_SurfProps::Normale(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& Norm)
{
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
switch (typS) {
case GeomAbs_Plane:
{
gp_Pln pl(TheSurfaceTool::Plane(S));
gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
Norm = pl.Axis().Direction();
P = ElSLib::Value(U,V,pl);
if (!pl.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
@ -44,26 +47,26 @@ void Contap_SurfProps::Normale(const TheSurface& S,
case GeomAbs_Sphere:
{
gp_Sphere sp(TheSurfaceTool::Sphere(S));
gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
P = ElSLib::Value(U,V,sp);
Norm = gp_Vec(sp.Location(),P);
if (sp.Direct()) {
Norm.Divide(sp.Radius());
Norm.Divide(sp.Radius());
}
else {
Norm.Divide(-sp.Radius());
Norm.Divide(-sp.Radius());
}
}
break;
case GeomAbs_Cylinder:
{
gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
P = ElSLib::Value(U,V,cy);
Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
Sin(U),cy.YAxis().Direction());
Sin(U),cy.YAxis().Direction());
if (!cy.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
@ -71,7 +74,7 @@ void Contap_SurfProps::Normale(const TheSurface& S,
case GeomAbs_Cone:
{
gp_Cone co(TheSurfaceTool::Cone(S));
gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
P = ElSLib::Value(U,V,co);
Standard_Real Angle = co.SemiAngle();
Standard_Real Sina = sin(Angle);
@ -80,38 +83,38 @@ void Contap_SurfProps::Normale(const TheSurface& S,
Standard_Real Vcalc = V;
if (Abs(V*Sina + Rad) <= 1e-12) { // on est a l`apex
/*
Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
*/
Norm.SetCoord(0,0,0);
return;
/*
Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
*/
Norm.SetCoord(0,0,0);
return;
}
if (Rad + Vcalc*Sina < 0.) {
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*cos(U),co.XAxis().Direction(),
Cosa*sin(U),co.YAxis().Direction());
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*cos(U),co.XAxis().Direction(),
Cosa*sin(U),co.YAxis().Direction());
}
else {
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*cos(U),co.XAxis().Direction(),
Cosa*sin(U),co.YAxis().Direction());
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*cos(U),co.XAxis().Direction(),
Cosa*sin(U),co.YAxis().Direction());
}
if (!co.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
default:
{
gp_Vec d1u,d1v;
TheSurfaceTool::D1(S,U,V,P,d1u,d1v);
Adaptor3d_HSurfaceTool::D1(S,U,V,P,d1u,d1v);
Norm = d1u.Crossed(d1v);
}
break;
@ -126,24 +129,24 @@ void Contap_SurfProps::Normale(const TheSurface& S,
//purpose :
//=======================================================================
void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& d1u,
gp_Vec& d1v,
gp_Vec& Norm)
void Contap_SurfProps::DerivAndNorm(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& d1u,
gp_Vec& d1v,
gp_Vec& Norm)
{
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
switch (typS) {
case GeomAbs_Plane:
{
gp_Pln pl(TheSurfaceTool::Plane(S));
gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
Norm = pl.Axis().Direction();
ElSLib::D1(U,V,pl,P,d1u,d1v);
if (!pl.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
@ -151,26 +154,26 @@ void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
case GeomAbs_Sphere:
{
gp_Sphere sp(TheSurfaceTool::Sphere(S));
gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
ElSLib::D1(U,V,sp,P,d1u,d1v);
Norm = gp_Vec(sp.Location(),P);
if (sp.Direct()) {
Norm.Divide(sp.Radius());
Norm.Divide(sp.Radius());
}
else {
Norm.Divide(-sp.Radius());
Norm.Divide(-sp.Radius());
}
}
break;
case GeomAbs_Cylinder:
{
gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
ElSLib::D1(U,V,cy,P,d1u,d1v);
Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
Sin(U),cy.YAxis().Direction());
Sin(U),cy.YAxis().Direction());
if (!cy.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
@ -178,7 +181,7 @@ void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
case GeomAbs_Cone:
{
gp_Cone co(TheSurfaceTool::Cone(S));
gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
ElSLib::D1(U,V,co,P,d1u,d1v);
Standard_Real Angle = co.SemiAngle();
Standard_Real Sina = Sin(Angle);
@ -187,33 +190,33 @@ void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
Standard_Real Vcalc = V;
if (Abs(V*Sina + Rad) <= RealEpsilon()) { // on est a l`apex
Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
}
if (Rad + Vcalc*Sina < 0.) {
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
}
else {
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
}
if (!co.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
default:
{
TheSurfaceTool::D1(S,U,V,P,d1u,d1v);
Adaptor3d_HSurfaceTool::D1(S,U,V,P,d1u,d1v);
Norm = d1u.Crossed(d1v);
}
break;
@ -226,24 +229,24 @@ void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
//purpose :
//=======================================================================
void Contap_SurfProps::NormAndDn(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& Norm,
gp_Vec& Dnu,
gp_Vec& Dnv)
void Contap_SurfProps::NormAndDn(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& Norm,
gp_Vec& Dnu,
gp_Vec& Dnv)
{
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
switch (typS) {
case GeomAbs_Plane:
{
gp_Pln pl(TheSurfaceTool::Plane(S));
gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
P = ElSLib::Value(U,V,pl);
Norm = pl.Axis().Direction();
if (!pl.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
Dnu = Dnv = gp_Vec(0.,0.,0.);
}
@ -251,12 +254,12 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
case GeomAbs_Sphere:
{
gp_Sphere sp(TheSurfaceTool::Sphere(S));
gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
ElSLib::D1(U,V,sp,P,Dnu,Dnv);
Norm = gp_Vec(sp.Location(),P);
Standard_Real Rad = sp.Radius();
if (!sp.Direct()) {
Rad = -Rad;
Rad = -Rad;
}
Norm.Divide(Rad);
Dnu.Divide(Rad);
@ -266,15 +269,15 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
case GeomAbs_Cylinder:
{
gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
P = ElSLib::Value(U,V,cy);
Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
Sin(U),cy.YAxis().Direction());
Sin(U),cy.YAxis().Direction());
Dnu.SetLinearForm(-Sin(U),cy.XAxis().Direction(),
Cos(U),cy.YAxis().Direction());
Cos(U),cy.YAxis().Direction());
if (!cy.Direct()) {
Norm.Reverse();
Dnu.Reverse();
Norm.Reverse();
Dnu.Reverse();
}
Dnv = gp_Vec(0.,0.,0.);
}
@ -283,7 +286,7 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
case GeomAbs_Cone:
{
gp_Cone co(TheSurfaceTool::Cone(S));
gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
P = ElSLib::Value(U,V,co);
Standard_Real Angle = co.SemiAngle();
Standard_Real Sina = Sin(Angle);
@ -291,30 +294,30 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
Standard_Real Rad = co.RefRadius();
Standard_Real Vcalc = V;
if (Abs(V*Sina + Rad) <= RealEpsilon()) { // on est a l`apex
Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
}
if (Rad + Vcalc*Sina < 0.) {
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
}
else {
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
}
Dnu.SetLinearForm(-Cosa*Sin(U),co.XAxis().Direction(),
Cosa*Cos(U),co.YAxis().Direction());
Cosa*Cos(U),co.YAxis().Direction());
if (!co.Direct()) {
Norm.Reverse();
Dnu.Reverse();
Norm.Reverse();
Dnu.Reverse();
}
Dnv = gp_Vec(0.,0.,0.);
}
@ -323,7 +326,7 @@ void Contap_SurfProps::NormAndDn(const TheSurface& S,
default:
{
gp_Vec d1u,d1v,d2u,d2v,d2uv;
TheSurfaceTool::D2(S,U,V,P,d1u,d1v,d2u,d2v,d2uv);
Adaptor3d_HSurfaceTool::D2(S,U,V,P,d1u,d1v,d2u,d2v,d2uv);
Norm = d1u.Crossed(d1v);
Dnu = d2u.Crossed(d1v) + d1u.Crossed(d2uv);
Dnv = d2uv.Crossed(d1v) + d1u.Crossed(d2v);

View File

@ -1,3 +0,0 @@
Contap_ContourGen_1.gxx
Contap_ContourGen_2.gxx
Contap_ContourGen_3.gxx

View File

@ -26,7 +26,7 @@ uses
Face from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
ThePointOfContour from Contap,
Point from Contap,
Contour from Contap,
Data from HLRTopoBRep,
MapOfShapeTool from BRepTopAdaptor
@ -52,7 +52,7 @@ is
is private;
MakeVertex(myclass;
P : ThePointOfContour from Contap;
P : Point from Contap;
tol : Real from Standard;
DS : in out Data from HLRTopoBRep)
returns Vertex from TopoDS
@ -61,7 +61,7 @@ is
is private;
InsertVertex(myclass;
P : ThePointOfContour from Contap;
P : Point from Contap;
tol : Real from Standard;
E : Edge from TopoDS;
DS : in out Data from HLRTopoBRep)

View File

@ -44,7 +44,7 @@
#include <BRepTopAdaptor_HVertex.hxx>
#include <BRepTopAdaptor_TopolTool.hxx>
#include <BRepTopAdaptor_Tool.hxx>
#include <Contap_TheLineOfContour.hxx>
#include <Contap_Line.hxx>
#include <Extrema_LocateExtPC.hxx>
#include <Standard_ProgramError.hxx>
#include <Precision.hxx>
@ -197,7 +197,7 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
Standard_Integer CurLine;
for (CurLine = 1; CurLine <= NbLines; CurLine++)
{
const Contap_TheLineOfContour& Line = FO.Line(CurLine);
const Contap_Line& Line = FO.Line(CurLine);
const Standard_Integer NbPoints = Line.NbVertex();
Standard_Integer CurPoint;
if (Line.TypeContour() == Contap_Restriction)
@ -209,7 +209,7 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
// insert the Internal points.
for (CurPoint = 1; CurPoint <= NbPoints; CurPoint++) {
Contap_ThePointOfContour P = Line.Vertex(CurPoint);
Contap_Point P = Line.Vertex(CurPoint);
if (P.IsInternal()) {
if (P.Value().IsEqual(BRep_Tool::Pnt(VF),BRep_Tool::Tolerance(VF))) {
if (P.Value().IsEqual(BRep_Tool::Pnt(VL),BRep_Tool::Tolerance(VL))) {
@ -223,7 +223,7 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
{
for (CurPoint = 1; CurPoint <= NbPoints; CurPoint++) {
const Contap_ThePointOfContour PF = Line.Vertex(CurPoint);
const Contap_Point PF = Line.Vertex(CurPoint);
if (PF.IsInternal() && CurPoint != 1)
VF = VL;
else
@ -231,7 +231,7 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
const Standard_Real parF = PF.ParameterOnLine();
if (CurPoint < NbPoints) {
const Contap_ThePointOfContour PL = Line.Vertex(CurPoint+1);
const Contap_Point PL = Line.Vertex(CurPoint+1);
VL = MakeVertex(PL,tol,DS);
const Standard_Real parL = PL.ParameterOnLine();
@ -284,7 +284,7 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
/*
else if(ipL-ipF < 6) {
// compute the tangents
Contap_TheSurfFunctionOfContour& SFunc =
Contap_SurfFunction& SFunc =
FO.SurfaceFunction();
Standard_Boolean isTg1,isTg2;
@ -553,7 +553,7 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
//=======================================================================
TopoDS_Vertex
HLRTopoBRep_DSFiller::MakeVertex (const Contap_ThePointOfContour& P,
HLRTopoBRep_DSFiller::MakeVertex (const Contap_Point& P,
const Standard_Real tol,
HLRTopoBRep_Data& DS)
{
@ -611,7 +611,7 @@ HLRTopoBRep_DSFiller::MakeVertex (const Contap_ThePointOfContour& P,
//=======================================================================
void
HLRTopoBRep_DSFiller::InsertVertex (const Contap_ThePointOfContour& P,
HLRTopoBRep_DSFiller::InsertVertex (const Contap_Point& P,
const Standard_Real tol,
const TopoDS_Edge& E,
HLRTopoBRep_Data& DS)