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

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

73
src/BRepPrim/BRepPrim.cdl Executable file
View File

@@ -0,0 +1,73 @@
-- File: BRepPrim.cdl
-- Created: Wed Jul 24 16:40:38 1991
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1991
package BRepPrim
---Purpose: this package implements the primitives of the
-- Primitives package with the BRep Topology
--
-- Contains :
-- a Builder implementing the Template from Primitives
--
-- The instantiations of the algorithms :
-- OneAxis
-- Wedge
--
-- The rotational primitives inherited from OneAxis
--
-- Revolution
-- Cylinder
-- Cone
-- Sphere
-- Torus
--
-- The class FaceBuilder is a tool to build a face
-- from a Geom surface.
uses
gp,
Geom2d,
Geom,
Primitives,
TopoDS,
BRep
is
class Builder;
deferred class OneAxis instantiates OneAxis from Primitives(
Shell from TopoDS,
Face from TopoDS,
Wire from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
Builder from BRepPrim);
class Revolution;
class Cylinder;
class Cone;
class Sphere;
class Torus;
class GWedge instantiates Wedge from Primitives(
Shell from TopoDS,
Face from TopoDS,
Wire from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
Builder from BRepPrim);
class Wedge;
class FaceBuilder;
end BRepPrim;

167
src/BRepPrim/BRepPrim_Builder.cdl Executable file
View File

@@ -0,0 +1,167 @@
-- File: Builder.cdl
-- Created: Thu Mar 12 11:04:50 1992
-- Author: Philippe DAUTRY
-- <fid@sdsun1>
---Copyright: Matra Datavision 1992
class Builder from BRepPrim
---Purpose: implements the abstract Builder with the BRep Builder
uses
Builder from BRep,
Shell from TopoDS,
Face from TopoDS,
Wire from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
Pnt from gp,
Lin from gp,
Circ from gp,
Pln from gp,
Lin2d from gp,
Circ2d from gp
is
Create returns Builder from BRepPrim;
---Purpose: Creates an empty, useless Builder. Necesseray for
-- compilation.
Create(B : Builder from BRep) returns Builder from BRepPrim;
---Purpose: Creates from a Builder.
Builder(me) returns Builder from BRep
---C++: inline
---C++: return const &
is static;
-- implements the Builder methods
MakeShell (me; S : out Shell from TopoDS)
---Purpose: Make a empty Shell.
is static;
MakeFace (me; F : out Face from TopoDS; P : Pln from gp)
---Purpose: Returns in <F> a Face built with the plane
-- equation <P>. Used by all primitives.
is static;
MakeWire (me; W : out Wire from TopoDS)
---Purpose: Returns in <W> an empty Wire.
is static;
MakeDegeneratedEdge(me; E : out Edge from TopoDS)
---Purpose: Returns in <E> a degenerated edge.
is static;
MakeEdge (me; E : out Edge from TopoDS; L : Lin from gp)
---Purpose: Returns in <E> an Edge built with the line
-- equation <L>.
is static;
MakeEdge (me; E : out Edge from TopoDS; C : Circ from gp)
---Purpose: Returns in <E> an Edge built with the circle
-- equation <C>.
is static;
SetPCurve(me; E : in out Edge from TopoDS; F : in Face from TopoDS;
L : Lin2d from gp)
---Purpose: Sets the line <L> to be the curve representing the
-- edge <E> in the parametric space of the surface of
-- <F>.
is static;
SetPCurve(me; E : in out Edge from TopoDS; F : in Face from TopoDS;
L1,L2 : Lin2d from gp)
---Purpose: Sets the lines <L1,L2> to be the curves
-- representing the edge <E> in the parametric space
-- of the closed surface of <F>.
is static;
SetPCurve(me; E : in out Edge from TopoDS; F : in Face from TopoDS;
C : Circ2d from gp)
---Purpose: Sets the circle <C> to be the curve representing
-- the edge <E> in the parametric space of the
-- surface of <F>.
is static;
MakeVertex (me; V : out Vertex from TopoDS; P : Pnt from gp)
---Purpose: Returns in <V> a Vertex built with the point <P>.
is static;
ReverseFace(me; F : in out Face from TopoDS)
---Purpose: Reverses the Face <F>.
is static;
AddEdgeVertex(me; E : in out Edge from TopoDS;
V : in Vertex from TopoDS;
P : in Real;
direct : Boolean)
---Purpose: Adds the Vertex <V> in the Edge <E>. <P> is the
-- parameter of the vertex on the edge. If direct
-- is False the Vertex is reversed.
is static;
AddEdgeVertex(me; E : in out Edge from TopoDS;
V : in Vertex from TopoDS;
P1,P2 : in Real)
---Purpose: Adds the Vertex <V> in the Edge <E>. <P1,P2>
-- are the parameters of the vertex on the closed
-- edge.
is static;
SetParameters(me;
E : in out Edge from TopoDS;
V : in Vertex from TopoDS;
P1,P2 : in Real)
---Purpose: <P1,P2> are the parameters of the vertex on the
-- edge. The edge is a closed curve.
is static;
AddWireEdge(me; W : in out Wire from TopoDS;
E : in Edge from TopoDS;
direct : Boolean)
---Purpose: Adds the Edge <E> in the Wire <W>, if direct is
-- False the Edge is reversed.
is static;
AddFaceWire(me; F : in out Face from TopoDS;
W : in Wire from TopoDS)
---Purpose: Adds the Wire <W> in the Face <F>.
is static;
AddShellFace(me; Sh : in out Shell from TopoDS;
F : in Face from TopoDS)
---Purpose: Adds the Face <F> in the Shell <Sh>.
is static;
CompleteEdge(me; E : in out Edge from TopoDS)
---Purpose: This is called once an edge is completed. It gives
-- the opportunity to perform any post treatment.
is static;
CompleteWire(me; W : in out Wire from TopoDS)
---Purpose: This is called once a wire is completed. It gives
-- the opportunity to perform any post treatment.
is static;
CompleteFace(me; F : in out Face from TopoDS)
---Purpose: This is called once a face is completed. It gives
-- the opportunity to perform any post treatment.
is static;
CompleteShell(me; S : in out Shell from TopoDS)
---Purpose: This is called once a shell is completed. It gives
-- the opportunity to perform any post treatment.
is static;
fields
myBuilder : Builder from BRep;
end Builder;

297
src/BRepPrim/BRepPrim_Builder.cxx Executable file
View File

@@ -0,0 +1,297 @@
// File: BRepPrim_Builder.cxx
// Created: Thu Jul 25 10:33:44 1991
// Author: Christophe MARION
// <cma@sdsun1>
#include <BRepPrim_Builder.ixx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_Circle.hxx>
#include <BRepTools.hxx>
//=======================================================================
//function : BRepPrim_Builder
//purpose : constructor
//=======================================================================
BRepPrim_Builder::BRepPrim_Builder ()
{
}
//=======================================================================
//function : BRepPrim_Builder
//purpose : constructor
//=======================================================================
BRepPrim_Builder::BRepPrim_Builder (const BRep_Builder& B) :
myBuilder(B)
{
}
//=======================================================================
//function : MakeShell
//purpose : Make a Shell
//=======================================================================
void BRepPrim_Builder::MakeShell (TopoDS_Shell& S) const
{
myBuilder.MakeShell(S);
S.Closed(Standard_True);
}
//=======================================================================
//function : MakeFace
//purpose : Make a Planar Face
//=======================================================================
void BRepPrim_Builder::MakeFace (TopoDS_Face& F, const gp_Pln& P) const
{
myBuilder.MakeFace(F,new Geom_Plane(P),Precision::Confusion());
}
//=======================================================================
//function : MakeWire
//purpose : Make an empty Wire
//=======================================================================
void BRepPrim_Builder::MakeWire (TopoDS_Wire& W) const
{
myBuilder.MakeWire(W);
}
//=======================================================================
//function : MakeDegeneratedEdge
//purpose :
//=======================================================================
void BRepPrim_Builder::MakeDegeneratedEdge (TopoDS_Edge& E) const
{
myBuilder.MakeEdge(E);
myBuilder.Degenerated(E,Standard_True);
}
//=======================================================================
//function : MakeEdge
//purpose : Make a linear Edge
//=======================================================================
void BRepPrim_Builder::MakeEdge (TopoDS_Edge& E, const gp_Lin& L) const
{
myBuilder.MakeEdge(E,new Geom_Line(L),Precision::Confusion());
}
//=======================================================================
//function : MakeEdge
//purpose : Make a Circular Edge
//=======================================================================
void BRepPrim_Builder::MakeEdge (TopoDS_Edge& E, const gp_Circ& C) const
{
myBuilder.MakeEdge(E,new Geom_Circle(C),Precision::Confusion());
}
//=======================================================================
//function : SetPCurve
//purpose :
//=======================================================================
void BRepPrim_Builder::SetPCurve(TopoDS_Edge& E,
const TopoDS_Face& F,
const gp_Lin2d& L) const
{
myBuilder.UpdateEdge(E,new Geom2d_Line(L),F,Precision::Confusion());
}
//=======================================================================
//function : SetPCurve
//purpose :
//=======================================================================
void BRepPrim_Builder::SetPCurve(TopoDS_Edge& E,
const TopoDS_Face& F,
const gp_Lin2d& L1,
const gp_Lin2d& L2) const
{
TopoDS_Shape aLocalShape = E.Oriented(TopAbs_FORWARD);
myBuilder.UpdateEdge(TopoDS::Edge(aLocalShape),
new Geom2d_Line(L1),
new Geom2d_Line(L2),
F,Precision::Confusion());
// myBuilder.UpdateEdge(TopoDS::Edge(E.Oriented(TopAbs_FORWARD)),
// new Geom2d_Line(L1),
// new Geom2d_Line(L2),
// F,Precision::Confusion());
myBuilder.Continuity(E,F,F,GeomAbs_CN);
}
//=======================================================================
//function : SetPCurve
//purpose :
//=======================================================================
void BRepPrim_Builder::SetPCurve(TopoDS_Edge& E,
const TopoDS_Face& F,
const gp_Circ2d& C) const
{
myBuilder.UpdateEdge(E,new Geom2d_Circle(C),F,Precision::Confusion());
}
//=======================================================================
//function : MakeVertex
//purpose : Make a Vertex
//=======================================================================
void BRepPrim_Builder::MakeVertex (TopoDS_Vertex& V, const gp_Pnt& P) const
{
myBuilder.MakeVertex(V,P,Precision::Confusion());
}
//=======================================================================
//function : ReverseFace
//purpose : Reverse a Face
//=======================================================================
void BRepPrim_Builder::ReverseFace (TopoDS_Face& F) const
{
F.Reverse();
}
//=======================================================================
//function : AddEdgeVertex
//purpose : Add a Vertex to an Edge
//=======================================================================
void BRepPrim_Builder::AddEdgeVertex (TopoDS_Edge& E,
const TopoDS_Vertex& V,
const Standard_Real P,
const Standard_Boolean direct) const
{
TopoDS_Vertex VV = V;
if (!direct)
VV.Reverse();
myBuilder.Add(E,VV);
myBuilder.UpdateVertex(VV,P,E,Precision::Confusion());
}
//=======================================================================
//function : AddEdgeVertex
//purpose : Add a Vertex to an Edge
//=======================================================================
void BRepPrim_Builder::AddEdgeVertex (TopoDS_Edge& E,
const TopoDS_Vertex& V,
const Standard_Real P1,
const Standard_Real P2) const
{
TopoDS_Vertex VV = V;
VV.Orientation(TopAbs_FORWARD);
myBuilder.Add(E,VV);
VV.Orientation(TopAbs_REVERSED);
myBuilder.Add(E,VV);
myBuilder.Range(E,P1,P2);
E.Closed(Standard_True);
}
//=======================================================================
//function : SetParameters
//purpose :
//=======================================================================
void BRepPrim_Builder::SetParameters (TopoDS_Edge& E,
const TopoDS_Vertex& ,
const Standard_Real P1,
const Standard_Real P2) const
{
myBuilder.Range(E,P1,P2);
}
//=======================================================================
//function : AddWireEdge
//purpose : Add an Edge to a Wire
//=======================================================================
void BRepPrim_Builder::AddWireEdge (TopoDS_Wire& W,
const TopoDS_Edge& E,
const Standard_Boolean direct) const
{
TopoDS_Edge EE = E;
if (!direct)
EE.Reverse();
myBuilder.Add(W,EE);
}
//=======================================================================
//function : AddFaceWire
//purpose : Add a Wire to a Face
//=======================================================================
void BRepPrim_Builder::AddFaceWire (TopoDS_Face& F,
const TopoDS_Wire& W) const
{
myBuilder.Add(F,W);
}
//=======================================================================
//function : AddShellFace
//purpose : Add a Face to a Shell
//=======================================================================
void BRepPrim_Builder::AddShellFace(TopoDS_Shell& S,
const TopoDS_Face& F) const
{
myBuilder.Add(S,F);
}
//=======================================================================
//function : Complete
//purpose :
//=======================================================================
void BRepPrim_Builder::CompleteEdge(TopoDS_Edge& E)const
{
BRepTools::Update(E);
}
//=======================================================================
//function : Complete
//purpose :
//=======================================================================
void BRepPrim_Builder::CompleteWire(TopoDS_Wire& W)const
{
BRepTools::Update(W);
}
//=======================================================================
//function : Complete
//purpose :
//=======================================================================
void BRepPrim_Builder::CompleteFace(TopoDS_Face& F)const
{
BRepTools::Update(F);
}
//=======================================================================
//function : Complete
//purpose :
//=======================================================================
void BRepPrim_Builder::CompleteShell(TopoDS_Shell& S)const
{
BRepTools::Update(S);
}

View File

@@ -0,0 +1,15 @@
// File: BRepPrim_Builder.lxx
// Created: Fri Nov 6 10:29:44 1992
// Author: Remi LEQUETTE
// <rle@phylox>
//=======================================================================
//function : Builder
//purpose :
//=======================================================================
inline const BRep_Builder& BRepPrim_Builder::Builder() const
{
return myBuilder;
}

93
src/BRepPrim/BRepPrim_Cone.cdl Executable file
View File

@@ -0,0 +1,93 @@
-- File: Cone.cdl
-- Created: Thu Nov 5 18:41:49 1992
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1992
class Cone from BRepPrim inherits Revolution from BRepPrim
---Purpose: Implement the cone primitive.
uses
Face from TopoDS,
Pnt from gp,
Ax2 from gp
raises
DomainError
is
Create(Angle : Real; Position : Ax2 from gp; Height : Real;
Radius : Real = 0)
returns Cone from BRepPrim
---Purpose: the STEP definition
-- Angle = semi-angle of the cone
-- Position : the coordinate system
-- Height : height of the cone.
-- Radius : radius of truncated face at z = 0
--
-- The apex is on z < 0
--
-- Errors : Height < Resolution
-- Angle < Resolution / Height
-- Angle > PI/2 - Resolution / Height
raises DomainError;
Create(Angle : Real)
returns Cone from BRepPrim
---Purpose: infinite cone at origin on Z negative
raises DomainError;
Create(Angle : Real; Apex : Pnt from gp)
returns Cone from BRepPrim
---Purpose: infinite cone at Apex on Z negative
raises DomainError;
Create(Angle : Real; Axes : Ax2 from gp)
returns Cone from BRepPrim
---Purpose: infinite cone with Axes
raises DomainError;
Create(R1,R2,H : Real)
returns Cone from BRepPrim
---Purpose: create a Cone at origin on Z axis, of height H,
-- radius R1 at Z = 0, R2 at Z = H, X is the origin
-- of angles. If R1 or R2 is 0 there is an apex.
-- Otherwise, it is a truncated cone.
--
-- Error : R1 and R2 < Resolution
-- R1 or R2 negative
-- Abs(R1-R2) < Resolution
-- H < Resolution
-- H negative
raises DomainError;
Create(Center : Pnt from gp; R1,R2,H : Real)
returns Cone from BRepPrim
---Purpose: same as above but at a given point
raises DomainError;
Create(Axes : Ax2 from gp; R1,R2,H : Real)
returns Cone from BRepPrim
---Purpose: same as above with given axes system.
raises DomainError;
MakeEmptyLateralFace(me) returns Face from TopoDS
---Purpose: The surface normal should be directed towards the
-- outside.
is redefined;
SetMeridian(me : in out)
is static private;
SetParameters(me : in out; R1, R2, H : Real)
is static private;
fields
myHalfAngle : Real;
myRadius : Real;
end Cone;

195
src/BRepPrim/BRepPrim_Cone.cxx Executable file
View File

@@ -0,0 +1,195 @@
// File: BRepPrim_Cone.cxx
// Created: Fri Nov 6 11:33:55 1992
// Author: Remi LEQUETTE
// <rle@phylox>
#include <BRepPrim_Cone.ixx>
#include <gp.hxx>
#include <gp_Vec.hxx>
#include <Precision.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_Line.hxx>
#include <Geom2d_Line.hxx>
#include <Standard_DomainError.hxx>
//=======================================================================
//function : BRepPrim_Cone
//purpose :
//=======================================================================
BRepPrim_Cone::BRepPrim_Cone(const Standard_Real Angle,
const gp_Ax2& Position,
const Standard_Real Height,
const Standard_Real Radius) :
BRepPrim_Revolution(Position,0,0),
myHalfAngle(Angle),
myRadius(Radius)
{
if (Height < Precision::Confusion())
Standard_DomainError::Raise("cone with null height");
if (myHalfAngle*Height < Precision::Confusion())
Standard_DomainError::Raise("cone with null angle");
if ((PI/2 - myHalfAngle)*Height < Precision::Confusion())
Standard_DomainError::Raise("cone with angle > PI/2");
// cut at top
VMax(Height / Cos(myHalfAngle));
VMin(0.);
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cone
//purpose :
//=======================================================================
BRepPrim_Cone::BRepPrim_Cone(const Standard_Real Angle) :
BRepPrim_Revolution(gp::XOY(),0,RealLast()),
myHalfAngle(Angle),
myRadius(0.)
{
if ((Angle < 0) || (Angle > PI/2))
Standard_DomainError::Raise("cone with angle <0 or > PI/2");
VMin(0.);
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cone
//purpose :
//=======================================================================
BRepPrim_Cone::BRepPrim_Cone(const Standard_Real Angle,
const gp_Pnt& Apex) :
BRepPrim_Revolution(gp_Ax2(Apex,gp_Dir(0,0,1),gp_Dir(1,0,0)),
0,RealLast()),
myHalfAngle(Angle),
myRadius(0.)
{
if ((Angle < 0) || (Angle > PI/2))
Standard_DomainError::Raise("cone with angle <0 or > PI/2");
VMin(0.);
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cone
//purpose :
//=======================================================================
BRepPrim_Cone::BRepPrim_Cone(const Standard_Real Angle,
const gp_Ax2& Axes) :
BRepPrim_Revolution( Axes, 0,RealLast()),
myHalfAngle(Angle)
{
if ((Angle < 0) || (Angle > PI/2))
Standard_DomainError::Raise("cone with angle <0 or > PI/2");
VMin(0.);
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cone
//purpose :
//=======================================================================
BRepPrim_Cone::BRepPrim_Cone(const Standard_Real R1,
const Standard_Real R2,
const Standard_Real H) :
BRepPrim_Revolution(gp::XOY(),0,0)
{
SetParameters(R1,R2,H);
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cone
//purpose :
//=======================================================================
BRepPrim_Cone::BRepPrim_Cone(const gp_Pnt& Center,
const Standard_Real R1,
const Standard_Real R2,
const Standard_Real H) :
BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
0,0)
{
SetParameters(R1,R2,H);
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cone
//purpose :
//=======================================================================
BRepPrim_Cone::BRepPrim_Cone(const gp_Ax2& Axes,
const Standard_Real R1,
const Standard_Real R2,
const Standard_Real H) :
BRepPrim_Revolution(Axes,0,0)
{
SetParameters(R1,R2,H);
SetMeridian();
}
//=======================================================================
//function : MakeEmptyLateralFace
//purpose :
//=======================================================================
TopoDS_Face BRepPrim_Cone::MakeEmptyLateralFace()const
{
Handle(Geom_ConicalSurface) C =
new Geom_ConicalSurface(Axes(),myHalfAngle,myRadius);
TopoDS_Face F;
myBuilder.Builder().MakeFace(F,C,Precision::Confusion());
return F;
}
//=======================================================================
//function : SetMeridian
//purpose :
//=======================================================================
void BRepPrim_Cone::SetMeridian ()
{
gp_Ax1 A = Axes().Axis();
A.Rotate(gp_Ax1(Axes().Location(),Axes().YDirection()),myHalfAngle);
gp_Vec V(Axes().XDirection());
V *= myRadius;
A.Translate(V);
Handle(Geom_Line) L = new Geom_Line(A);
Handle(Geom2d_Line) L2d =
new Geom2d_Line(gp_Pnt2d(myRadius,0),gp_Dir2d(Sin(myHalfAngle),Cos(myHalfAngle)));
Meridian(L,L2d);
}
//=======================================================================
//function : SetParameters
//purpose :
//=======================================================================
void BRepPrim_Cone::SetParameters(const Standard_Real R1,
const Standard_Real R2,
const Standard_Real H)
{
if (((R1 != 0) && (R1 < Precision::Confusion())) ||
((R2 != 0) && (R2 < Precision::Confusion())))
Standard_DomainError::Raise("cone with negative or too small radius");
if (Abs(R1-R2) < Precision::Confusion())
Standard_DomainError::Raise("cone with two identic radii");
if (H < Precision::Confusion())
Standard_DomainError::Raise("cone with negative or null height");
myRadius = R1;
myHalfAngle = ATan((R2 - R1) / H);
// cut top and bottom
VMin(0.);
VMax(Sqrt(H*H + (R2-R1)*(R2-R1)));
}

View File

@@ -0,0 +1,76 @@
-- File: Cylinder.cdl
-- Created: Thu Nov 5 18:37:18 1992
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1992
class Cylinder from BRepPrim inherits Revolution from BRepPrim
---Purpose: Cylinder primitive.
uses
Face from TopoDS,
Pnt from gp,
Ax2 from gp
raises
DomainError
is
Create(Position : Ax2 from gp; Radius : Real; Height : Real)
returns Cylinder from BRepPrim
---Purpose: the STEP definition
-- Position : center of a Face and Axis
-- Radius : radius of cylinder
-- Height : distance between faces
-- on positive side
--
-- Errors : Height < Resolution
-- Radius < Resolution
raises DomainError;
Create(Radius : Real)
returns Cylinder from BRepPrim
---Purpose: infinite Cylinder at origin on Z negative
raises DomainError;
Create(Center : Pnt from gp; Radius : Real)
returns Cylinder from BRepPrim
---Purpose: infinite Cylinder at Center on Z negative
raises DomainError;
Create(Axes : Ax2 from gp; Radius : Real)
returns Cylinder from BRepPrim
---Purpose: infinite Cylinder at Axes on Z negative
raises DomainError;
Create(R,H : Real)
returns Cylinder from BRepPrim
---Purpose: create a Cylinder at origin on Z axis, of
-- height H and radius R
-- Error : Radius < Resolution
-- H < Resolution
-- H negative
raises DomainError;
Create(Center : Pnt from gp; R,H : Real)
returns Cylinder from BRepPrim
---Purpose: same as above but at a given point
raises DomainError;
MakeEmptyLateralFace(me) returns Face from TopoDS
---Purpose: The surface normal should be directed towards the
-- outside.
is redefined;
SetMeridian(me : in out)
is static private;
fields
myRadius : Real;
end Cylinder;

View File

@@ -0,0 +1,125 @@
// File: BRepPrim_Cylinder.cxx
// Created: Fri Nov 6 10:46:02 1992
// Author: Remi LEQUETTE
// <rle@phylox>
#include <BRepPrim_Cylinder.ixx>
#include <gp.hxx>
#include <gp_Vec.hxx>
#include <Precision.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_Line.hxx>
#include <Geom2d_Line.hxx>
//=======================================================================
//function : BRepPrim_Cylinder
//purpose :
//=======================================================================
BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Ax2& Position,
const Standard_Real Radius,
const Standard_Real Height) :
BRepPrim_Revolution(Position,0,Height),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cylinder
//purpose :
//=======================================================================
BRepPrim_Cylinder::BRepPrim_Cylinder(const Standard_Real Radius) :
BRepPrim_Revolution(gp::XOY(),RealFirst(),RealLast()),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cylinder
//purpose :
//=======================================================================
BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Pnt& Center,
const Standard_Real Radius) :
BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
RealFirst(),RealLast()),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cylinder
//purpose :
//=======================================================================
BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Ax2& Axes,
const Standard_Real Radius) :
BRepPrim_Revolution(Axes, RealFirst(),RealLast()),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cylinder
//purpose :
//=======================================================================
BRepPrim_Cylinder::BRepPrim_Cylinder(const Standard_Real R,
const Standard_Real H) :
BRepPrim_Revolution(gp::XOY(), 0, H),
myRadius(R)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Cylinder
//purpose :
//=======================================================================
BRepPrim_Cylinder::BRepPrim_Cylinder(const gp_Pnt& Center,
const Standard_Real R,
const Standard_Real H) :
BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
0,H),
myRadius(R)
{
SetMeridian();
}
//=======================================================================
//function : MakeEmptyLateralFace
//purpose :
//=======================================================================
TopoDS_Face BRepPrim_Cylinder::MakeEmptyLateralFace() const
{
Handle(Geom_CylindricalSurface) C =
new Geom_CylindricalSurface(Axes(),myRadius);
TopoDS_Face F;
myBuilder.Builder().MakeFace(F,C,Precision::Confusion());
return F;
}
//=======================================================================
//function : SetMeridian
//purpose :
//=======================================================================
void BRepPrim_Cylinder::SetMeridian()
{
gp_Vec V = Axes().XDirection();
V.Multiply(myRadius);
gp_Ax1 A = Axes().Axis();
A.Translate(V);
Handle(Geom_Line) L = new Geom_Line(A);
Handle(Geom2d_Line) L2d = new Geom2d_Line(gp_Pnt2d(myRadius,0),gp_Dir2d(0,1));
Meridian(L,L2d);
}

View File

@@ -0,0 +1,85 @@
-- File: BRepPrim_FaceBuilder.cdl
-- Created: Wed Jun 23 13:31:47 1993
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1993
class FaceBuilder from BRepPrim
---Purpose: The FaceBuilder is an algorithm to build a BRep
-- Face from a Geom Surface.
--
-- The face covers the whole surface or the area
-- delimited by UMin, UMax, VMin, VMax
uses
Surface from Geom,
Face from TopoDS,
Edge from TopoDS,
Vertex from TopoDS,
Builder from BRep
raises
ConstructionError from Standard,
OutOfRange from Standard
is
Create returns FaceBuilder from BRepPrim;
Create(B : Builder from BRep;
S : Surface from Geom) returns FaceBuilder from BRepPrim;
Create(B : Builder from BRep;
S : Surface from Geom;
UMin, UMax, VMin, VMax : Real) returns FaceBuilder from BRepPrim
raises ConstructionError from Standard; -- if UV are outside the surface
Init(me : in out;
B : Builder from BRep;
S : Surface from Geom)
is static;
Init(me : in out;
B : Builder from BRep;
S : Surface from Geom;
UMin, UMax, VMin, VMax : Real)
raises ConstructionError from Standard -- if UV are outside the surface
is static;
Face(me) returns Face from TopoDS
---C++: return const &
--
---C++: alias "Standard_EXPORT operator TopoDS_Face();"
is static;
Edge(me; I : Integer) returns Edge from TopoDS
---Purpose: Returns the edge of index <I>
-- 1 - Edge VMin
-- 2 - Edge UMax
-- 3 - Edge VMax
-- 4 - Edge UMin
--
---C++: return const &
raises OutOfRange from Standard -- if I < 1 or I > 4
is static;
Vertex(me; I : Integer) returns Vertex from TopoDS
---Purpose: Returns the vertex of index <I>
-- 1 - Vertex UMin,VMin
-- 2 - Vertex UMax,VMin
-- 3 - Vertex UMax,VMax
-- 4 - Vertex UMin,VMax
--
---C++: return const &
raises OutOfRange from Standard -- if I < 1 or I > 4
is static;
fields
myVertex : Vertex from TopoDS [4];
myEdges : Edge from TopoDS [4];
myFace : Face from TopoDS;
end FaceBuilder;

View File

@@ -0,0 +1,202 @@
// File: BRepPrim_FaceBuilder.cxx
// Created: Wed Jun 23 15:26:39 1993
// Author: Remi LEQUETTE
// <rle@phylox>
#include <BRepPrim_FaceBuilder.ixx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <Geom2d_Line.hxx>
#include <TopoDS_Wire.hxx>
#include <Standard_OutOfRange.hxx>
//=======================================================================
//function : BRepPrim_FaceBuilder
//purpose :
//=======================================================================
BRepPrim_FaceBuilder::BRepPrim_FaceBuilder()
{
}
//=======================================================================
//function : BRepPrim_FaceBuilder
//purpose :
//=======================================================================
BRepPrim_FaceBuilder::BRepPrim_FaceBuilder(const BRep_Builder& B,
const Handle(Geom_Surface)& S)
{
Init(B,S);
}
//=======================================================================
//function : BRepPrim_FaceBuilder
//purpose :
//=======================================================================
BRepPrim_FaceBuilder::BRepPrim_FaceBuilder(const BRep_Builder& B,
const Handle(Geom_Surface)& S,
const Standard_Real UMin,
const Standard_Real UMax,
const Standard_Real VMin,
const Standard_Real VMax)
{
Init(B,S,UMin,UMax,VMin,VMax);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepPrim_FaceBuilder::Init(const BRep_Builder& B,
const Handle(Geom_Surface)& S)
{
Standard_Real UMin,UMax,VMin,VMax;
S->Bounds(UMin,UMax,VMin,VMax);
Init(B,S,UMin,UMax,VMin,VMax);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepPrim_FaceBuilder::Init(const BRep_Builder& B,
const Handle(Geom_Surface)& S,
const Standard_Real UMin,
const Standard_Real UMax,
const Standard_Real VMin,
const Standard_Real VMax)
{
// Check the values
Standard_Real USMin,USMax,VSMin,VSMax;
S->Bounds(USMin,USMax,VSMin,VSMax);
if (UMin >= UMax) Standard_ConstructionError::Raise("BRepPrim_FaceBuilder");
if (VMin >= VMax) Standard_ConstructionError::Raise("BRepPrim_FaceBuilder");
if (UMin < USMin) Standard_ConstructionError::Raise("BRepPrim_FaceBuilder");
if (UMax > USMax) Standard_ConstructionError::Raise("BRepPrim_FaceBuilder");
if (VMin < VSMin) Standard_ConstructionError::Raise("BRepPrim_FaceBuilder");
if (VMax > VSMax) Standard_ConstructionError::Raise("BRepPrim_FaceBuilder");
// Make the vertices
B.MakeVertex(myVertex[0],S->Value(UMin,VMin),Precision::Confusion());
B.MakeVertex(myVertex[1],S->Value(UMax,VMin),Precision::Confusion());
B.MakeVertex(myVertex[2],S->Value(UMax,VMax),Precision::Confusion());
B.MakeVertex(myVertex[3],S->Value(UMin,VMax),Precision::Confusion());
// Make the edges
B.MakeEdge(myEdges[0]);
B.MakeEdge(myEdges[1]);
B.MakeEdge(myEdges[2]);
B.MakeEdge(myEdges[3]);
// Make the face
B.MakeFace(myFace,S,Precision::Confusion());
// set the pcurves
Handle(Geom2d_Line) L;
L = new Geom2d_Line(gp_Pnt2d(UMin,VMin),gp_Dir2d(1,0));
B.UpdateEdge(myEdges[0],L,myFace,Precision::Confusion());
L = new Geom2d_Line(gp_Pnt2d(UMax,VMin),gp_Dir2d(0,1));
B.UpdateEdge(myEdges[1],L,myFace,Precision::Confusion());
L = new Geom2d_Line(gp_Pnt2d(UMax,VMax),gp_Dir2d(-1,0));
B.UpdateEdge(myEdges[2],L,myFace,Precision::Confusion());
L = new Geom2d_Line(gp_Pnt2d(UMin,VMax),gp_Dir2d(0,-1));
B.UpdateEdge(myEdges[3],L,myFace,Precision::Confusion());
// set the parameters
B.UpdateVertex(myVertex[0],0,myEdges[0],0);
B.UpdateVertex(myVertex[1],UMax-UMin,myEdges[0],0);
B.UpdateVertex(myVertex[1],0,myEdges[1],0);
B.UpdateVertex(myVertex[2],VMax-VMin,myEdges[1],0);
B.UpdateVertex(myVertex[2],0,myEdges[2],0);
B.UpdateVertex(myVertex[3],UMax-UMin,myEdges[2],0);
B.UpdateVertex(myVertex[3],0,myEdges[3],0);
B.UpdateVertex(myVertex[0],VMax-VMin,myEdges[3],0);
// insert vertices in edges
myVertex[0].Orientation(TopAbs_REVERSED);
B.Add(myEdges[3],myVertex[0]);
myVertex[0].Orientation(TopAbs_FORWARD);
B.Add(myEdges[0],myVertex[0]);
myVertex[1].Orientation(TopAbs_REVERSED);
B.Add(myEdges[0],myVertex[1]);
myVertex[1].Orientation(TopAbs_FORWARD);
B.Add(myEdges[1],myVertex[1]);
myVertex[2].Orientation(TopAbs_REVERSED);
B.Add(myEdges[1],myVertex[2]);
myVertex[2].Orientation(TopAbs_FORWARD);
B.Add(myEdges[2],myVertex[2]);
myVertex[3].Orientation(TopAbs_REVERSED);
B.Add(myEdges[2],myVertex[3]);
myVertex[3].Orientation(TopAbs_FORWARD);
B.Add(myEdges[3],myVertex[3]);
// insert edges in a wire and in the face
TopoDS_Wire W;
B.MakeWire(W);
B.Add(W,myEdges[0]);
B.Add(W,myEdges[1]);
B.Add(W,myEdges[2]);
B.Add(W,myEdges[3]);
B.Add(myFace,W);
// set the natural restriction flag
if ( UMin == USMin && UMax == USMax && VMin == VSMin && VMax == VSMax)
B.NaturalRestriction(myFace,Standard_True);
}
//=======================================================================
//function : Face
//purpose :
//=======================================================================
const TopoDS_Face& BRepPrim_FaceBuilder::Face()const
{
return myFace;
}
//=======================================================================
//function : Edge
//purpose :
//=======================================================================
const TopoDS_Edge& BRepPrim_FaceBuilder::Edge(const Standard_Integer I)const
{
Standard_OutOfRange_Raise_if(I<1 || I >4,"BRepPrim_FaceBuilder::Edge");
return myEdges[I-1];
}
//=======================================================================
//function : Vertex
//purpose :
//=======================================================================
const TopoDS_Vertex& BRepPrim_FaceBuilder::Vertex(const Standard_Integer I)const
{
Standard_OutOfRange_Raise_if(I<1 || I >4,"BRepPrim_FaceBuilder::Vertex");
return myVertex[I-1];
}
//=======================================================================
//function : operator TopoDS_Face
//purpose :
//=======================================================================
BRepPrim_FaceBuilder::operator TopoDS_Face()
{
return Face();
}

191
src/BRepPrim/BRepPrim_OneAxis.hxx Executable file
View File

@@ -0,0 +1,191 @@
// File generated by CPPExt (Value)
// Copyright (C) 1991,1995 by
//
// MATRA DATAVISION, FRANCE
//
// This software is furnished in accordance with the terms and conditions
// of the contract and with the inclusion of the above copyright notice.
// This software or any other copy thereof may not be provided or otherwise
// be made available to any other person. No title to an ownership of the
// software is hereby transferred.
//
// At the termination of the contract, the software and all copies of this
// software must be deleted.
#ifndef _BRepPrim_OneAxis_HeaderFile
#define _BRepPrim_OneAxis_HeaderFile
#ifndef _BRepPrim_Builder_HeaderFile
#include <BRepPrim_Builder.hxx>
#endif
#ifndef _gp_Ax2_HeaderFile
#include <gp_Ax2.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _TopoDS_Shell_HeaderFile
#include <TopoDS_Shell.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _TopoDS_Vertex_HeaderFile
#include <TopoDS_Vertex.hxx>
#endif
#ifndef _TopoDS_Edge_HeaderFile
#include <TopoDS_Edge.hxx>
#endif
#ifndef _TopoDS_Wire_HeaderFile
#include <TopoDS_Wire.hxx>
#endif
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
class Standard_DomainError;
class Standard_OutOfRange;
class TopoDS_Shell;
class TopoDS_Face;
class TopoDS_Wire;
class TopoDS_Edge;
class TopoDS_Vertex;
class BRepPrim_Builder;
class gp_Ax2;
class gp_Pnt2d;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class BRepPrim_OneAxis {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT virtual void Delete() ;
Standard_EXPORT virtual ~BRepPrim_OneAxis()
//Standard_EXPORT virtual ~()
{
Delete();
}
Standard_EXPORT void SetMeridianOffset(const Standard_Real MeridianOffset = 0) ;
Standard_EXPORT const gp_Ax2& Axes() const;
Standard_EXPORT void Axes(const gp_Ax2& A) ;
Standard_EXPORT Standard_Real Angle() const;
Standard_EXPORT void Angle(const Standard_Real A) ;
Standard_EXPORT Standard_Real VMin() const;
Standard_EXPORT void VMin(const Standard_Real V) ;
Standard_EXPORT Standard_Real VMax() const;
Standard_EXPORT void VMax(const Standard_Real V) ;
Standard_EXPORT virtual TopoDS_Face MakeEmptyLateralFace() const = 0;
Standard_EXPORT virtual TopoDS_Edge MakeEmptyMeridianEdge(const Standard_Real Ang) const = 0;
Standard_EXPORT virtual void SetMeridianPCurve(TopoDS_Edge& E,const TopoDS_Face& F) const = 0;
Standard_EXPORT virtual gp_Pnt2d MeridianValue(const Standard_Real V) const = 0;
Standard_EXPORT virtual Standard_Boolean MeridianOnAxis(const Standard_Real V) const;
Standard_EXPORT virtual Standard_Boolean MeridianClosed() const;
Standard_EXPORT virtual Standard_Boolean VMaxInfinite() const;
Standard_EXPORT virtual Standard_Boolean VMinInfinite() const;
Standard_EXPORT virtual Standard_Boolean HasTop() const;
Standard_EXPORT virtual Standard_Boolean HasBottom() const;
Standard_EXPORT virtual Standard_Boolean HasSides() const;
Standard_EXPORT const TopoDS_Shell& Shell() ;
Standard_EXPORT const TopoDS_Face& LateralFace() ;
Standard_EXPORT const TopoDS_Face& TopFace() ;
Standard_EXPORT const TopoDS_Face& BottomFace() ;
Standard_EXPORT const TopoDS_Face& StartFace() ;
Standard_EXPORT const TopoDS_Face& EndFace() ;
Standard_EXPORT const TopoDS_Wire& LateralWire() ;
Standard_EXPORT const TopoDS_Wire& LateralStartWire() ;
Standard_EXPORT const TopoDS_Wire& LateralEndWire() ;
Standard_EXPORT const TopoDS_Wire& TopWire() ;
Standard_EXPORT const TopoDS_Wire& BottomWire() ;
Standard_EXPORT const TopoDS_Wire& StartWire() ;
Standard_EXPORT const TopoDS_Wire& AxisStartWire() ;
Standard_EXPORT const TopoDS_Wire& EndWire() ;
Standard_EXPORT const TopoDS_Wire& AxisEndWire() ;
Standard_EXPORT const TopoDS_Edge& AxisEdge() ;
Standard_EXPORT const TopoDS_Edge& StartEdge() ;
Standard_EXPORT const TopoDS_Edge& EndEdge() ;
Standard_EXPORT const TopoDS_Edge& StartTopEdge() ;
Standard_EXPORT const TopoDS_Edge& StartBottomEdge() ;
Standard_EXPORT const TopoDS_Edge& EndTopEdge() ;
Standard_EXPORT const TopoDS_Edge& EndBottomEdge() ;
Standard_EXPORT const TopoDS_Edge& TopEdge() ;
Standard_EXPORT const TopoDS_Edge& BottomEdge() ;
Standard_EXPORT const TopoDS_Vertex& AxisTopVertex() ;
Standard_EXPORT const TopoDS_Vertex& AxisBottomVertex() ;
Standard_EXPORT const TopoDS_Vertex& TopStartVertex() ;
Standard_EXPORT const TopoDS_Vertex& TopEndVertex() ;
Standard_EXPORT const TopoDS_Vertex& BottomStartVertex() ;
Standard_EXPORT const TopoDS_Vertex& BottomEndVertex() ;
protected:
// Methods PROTECTED
//
Standard_EXPORT BRepPrim_OneAxis(const BRepPrim_Builder& B,const gp_Ax2& A,const Standard_Real VMin,const Standard_Real VMax);
// Fields PROTECTED
//
BRepPrim_Builder myBuilder;
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
gp_Ax2 myAxes;
Standard_Real myAngle;
Standard_Real myVMin;
Standard_Real myVMax;
Standard_Real myMeridianOffset;
TopoDS_Shell myShell;
Standard_Boolean ShellBuilt;
TopoDS_Vertex myVertices[6];
Standard_Boolean VerticesBuilt[6];
TopoDS_Edge myEdges[9];
Standard_Boolean EdgesBuilt[9];
TopoDS_Wire myWires[9];
Standard_Boolean WiresBuilt[9];
TopoDS_Face myFaces[5];
Standard_Boolean FacesBuilt[5];
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -0,0 +1,60 @@
proc BRepPrim_Replace:AdmFileType {} {
return "dbadmfile";
}
proc BRepPrim_Replace:OutputDirTypeName {} {
return "dbtmpfile";
}
proc BRepPrim_Replace:HandleInputFile { ID } {
scan $ID "%\[^:\]:%\[^:\]:%\[^:\]" unit type name
switch $name {
BRepPrim_OneAxis.hxx {return 1;}
default {
return 0;
}
}
}
proc BRepPrim_Replace:Execute { unit args } {
global tcl_interactive
set tcl_interactive 1
package require Wokutils
msgprint -i -c "BRepPrim_Replace:Execute" "Copying of BRepPrim includes"
if { [wokparam -e %Station $unit] != "wnt" } {
set copycmd "cp -p "
set replstr "/"
} {
set copycmd "cmd /c copy"
set replstr "\\\\\\\\"
}
foreach file $args {
scan $file "%\[^:\]:%\[^:\]:%\[^:\]" Unit type name
regsub ".hxx" $name ".hxx" sourcename
set source [woklocate -p BRepPrim:source:$sourcename [wokinfo -N $unit]]
set vistarget [woklocate -p BRepPrim:pubinclude:$name [wokinfo -N $unit]]
set target [wokinfo -p pubinclude:$name $unit]
regsub -all "/" " $source $target" $replstr TheArgs
msgprint -i -c "BRepPrim_Replace:Execute" "Copy $source to $target"
if { [file exist $target] && [wokparam -e %Station] != "wnt" } {
eval exec "chmod u+w $target"
}
eval exec "$copycmd $TheArgs"
}
return 0;
}

View File

@@ -0,0 +1,68 @@
-- File: BRepPrim_Revolution.cdl
-- Created: Thu Nov 5 18:17:00 1992
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1992
class Revolution from BRepPrim inherits OneAxis from BRepPrim
---Purpose: Implement the OneAxis algoritm for a revolution
-- surface.
uses
Face from TopoDS,
Edge from TopoDS,
Curve from Geom,
Curve from Geom2d,
Ax2 from gp,
Pnt2d from gp
is
Create(A : Ax2 from gp;
VMin, VMax : Real from Standard;
M : Curve from Geom;
PM : Curve from Geom2d) returns Revolution from BRepPrim;
---Purpose: Create a revolution body <M> is the meridian nd
-- must be in the XZ plane of <A>. <PM> is the
-- meridian in the XZ plane.
Create(A : Ax2 from gp;
VMin, VMax : Real from Standard) returns Revolution from BRepPrim
---Purpose: Create a revolution body. The meridian is set
-- later. Reserved for derivated classes.
is protected;
Meridian(me : in out; M : Curve from Geom; PM : Curve from Geom2d)
is protected;
MakeEmptyLateralFace(me) returns Face from TopoDS
---Purpose: The surface normal should be directed towards the
-- outside.
is virtual;
MakeEmptyMeridianEdge(me; Ang : Real) returns Edge from TopoDS
---Purpose: Returns an edge with a 3D curve made from the
-- meridian in the XZ plane rotated by <Ang> around
-- the Z-axis. Ang may be 0 or myAngle.
is virtual;
MeridianValue(me; V : Real) returns Pnt2d from gp
---Purpose: Returns the meridian point at parameter <V> in the
-- plane XZ.
is virtual;
SetMeridianPCurve(me; E : in out Edge from TopoDS; F : Face from TopoDS)
---Purpose: Sets the parametric urve of the edge <E> in the
-- face <F> to be the 2d representation of the
-- meridian.
is virtual;
fields
myMeridian : Curve from Geom;
myPMeridian : Curve from Geom2d;
end Revolution;

View File

@@ -0,0 +1,104 @@
// File: BRepPrim_Revolution.cxx
// Created: Fri Nov 6 10:02:39 1992
// Author: Remi LEQUETTE
// <rle@phylox>
#include <BRepPrim_Revolution.ixx>
#include <Precision.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
//=======================================================================
//function : BRepPrim_Revolution
//purpose :
//=======================================================================
BRepPrim_Revolution::BRepPrim_Revolution(const gp_Ax2& A,
const Standard_Real VMin,
const Standard_Real VMax,
const Handle(Geom_Curve)& M,
const Handle(Geom2d_Curve)& PM) :
BRepPrim_OneAxis(BRepPrim_Builder(),A,VMin,VMax),
myMeridian(M),
myPMeridian(PM)
{
}
//=======================================================================
//function : BRepPrim_Revolution
//purpose :
//=======================================================================
BRepPrim_Revolution::BRepPrim_Revolution(const gp_Ax2& A,
const Standard_Real VMin,
const Standard_Real VMax) :
BRepPrim_OneAxis(BRepPrim_Builder(),A,VMin,VMax)
{
}
//=======================================================================
//function : Meridian
//purpose :
//=======================================================================
void BRepPrim_Revolution::Meridian(const Handle(Geom_Curve)& M,
const Handle(Geom2d_Curve)& PM)
{
myMeridian = M;
myPMeridian = PM;
}
//=======================================================================
//function : MakeEmptyLateralFace
//purpose :
//=======================================================================
TopoDS_Face BRepPrim_Revolution::MakeEmptyLateralFace() const
{
Handle(Geom_SurfaceOfRevolution) S =
new Geom_SurfaceOfRevolution(myMeridian,Axes().Axis());
TopoDS_Face F;
myBuilder.Builder().MakeFace(F,S,Precision::Confusion());
return F;
}
//=======================================================================
//function : MakeEmptyMeridianEdge
//purpose :
//=======================================================================
TopoDS_Edge BRepPrim_Revolution::MakeEmptyMeridianEdge(const Standard_Real Ang) const
{
TopoDS_Edge E;
Handle(Geom_Curve) C = Handle(Geom_Curve)::DownCast(myMeridian->Copy());
gp_Trsf T;
T.SetRotation(Axes().Axis(),Ang);
C->Transform(T);
myBuilder.Builder().MakeEdge(E,C,Precision::Confusion());
return E;
}
//=======================================================================
//function : MeridianValue
//purpose :
//=======================================================================
gp_Pnt2d BRepPrim_Revolution::MeridianValue(const Standard_Real V) const
{
return myPMeridian->Value(V);
}
//=======================================================================
//function : SetMeridianPCurve
//purpose :
//=======================================================================
void BRepPrim_Revolution::SetMeridianPCurve(TopoDS_Edge& E,
const TopoDS_Face& F) const
{
myBuilder.Builder().UpdateEdge(E,myPMeridian,F,Precision::Confusion());
}

View File

@@ -0,0 +1,54 @@
-- File: Sphere.cdl
-- Created: Thu Nov 5 18:45:38 1992
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1992
class Sphere from BRepPrim inherits Revolution from BRepPrim
---Purpose: Implements the sphere primitive
uses
Face from TopoDS,
Pnt from gp,
Ax2 from gp
raises
DomainError
is
Create(Radius : Real)
returns Sphere from BRepPrim
---Purpose: Creates a Sphere at origin with Radius. The axes
-- of the sphere are the reference axes. An error is
-- raised if the radius is < Resolution.
raises DomainError;
Create(Center : Pnt from gp; Radius : Real)
returns Sphere from BRepPrim
---Purpose: Creates a Sphere with Center and Radius. Axes are
-- the referrence axes. This is the STEP
-- constructor.
raises DomainError;
Create(Axes : Ax2 from gp; Radius : Real)
returns Sphere from BRepPrim
---Purpose: Creates a sphere with given axes system.
raises DomainError;
MakeEmptyLateralFace(me) returns Face from TopoDS
---Purpose: The surface normal should be directed towards the
-- outside.
is redefined;
SetMeridian(me : in out)
is static private;
fields
myRadius : Real;
end Sphere;

View File

@@ -0,0 +1,97 @@
// File: BRepPrim_Sphere.cxx
// Created: Fri Nov 6 13:28:47 1992
// Author: Remi LEQUETTE
// <rle@phylox>
#include <BRepPrim_Sphere.ixx>
#include <gp.hxx>
#include <gp_Ax2d.hxx>
#include <Precision.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Circle.hxx>
#include <Geom2d_Circle.hxx>
// parametres sur le meridien
#define PMIN (-0.5*PI)
#define PMAX (0.5*PI)
//=======================================================================
//function : BRepPrim_Sphere
//purpose :
//=======================================================================
BRepPrim_Sphere::BRepPrim_Sphere(const Standard_Real Radius) :
BRepPrim_Revolution(gp::XOY(),PMIN,PMAX),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Sphere
//purpose :
//=======================================================================
BRepPrim_Sphere::BRepPrim_Sphere(const gp_Pnt& Center,
const Standard_Real Radius) :
BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
PMIN,PMAX),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Sphere
//purpose :
//=======================================================================
BRepPrim_Sphere::BRepPrim_Sphere(const gp_Ax2& Axes,
const Standard_Real Radius) :
BRepPrim_Revolution(Axes,PMIN,PMAX),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : MakeEmptyLateralFace
//purpose :
//=======================================================================
TopoDS_Face BRepPrim_Sphere::MakeEmptyLateralFace()const
{
Handle(Geom_SphericalSurface) S =
new Geom_SphericalSurface(Axes(),myRadius);
TopoDS_Face F;
myBuilder.Builder().MakeFace(F,S,Precision::Confusion());
return F;
}
//=======================================================================
//function : SetMeridian
//purpose :
//=======================================================================
void BRepPrim_Sphere::SetMeridian()
{
// Offset the parameters on the meridian
// to trim the edge in 3pi/2, 5pi/2
SetMeridianOffset(2*PI);
gp_Dir D = Axes().YDirection();
D.Reverse();
gp_Ax2 A(Axes().Location(),D,Axes().XDirection());
Handle(Geom_Circle) C = new Geom_Circle(A,myRadius);
Handle(Geom2d_Circle) C2d =
new Geom2d_Circle(gp_Ax2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)),
myRadius);
Meridian(C,C2d);
}

55
src/BRepPrim/BRepPrim_Torus.cdl Executable file
View File

@@ -0,0 +1,55 @@
-- File: Torus.cdl
-- Created: Thu Nov 5 18:50:02 1992
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1992
class Torus from BRepPrim inherits Revolution from BRepPrim
---Purpose: Implements the torus primitive
uses
Face from TopoDS,
Pnt from gp,
Ax2 from gp
raises
DomainError
is
Create(Position : Ax2 from gp; Major : Real; Minor : Real)
returns Torus from BRepPrim
---Purpose: the STEP definition
-- Position : center and axes
-- Major, Minor : Radii
--
-- Errors : Major < Resolution
-- Minor < Resolution
raises DomainError;
Create(Major,Minor : Real)
returns Torus from BRepPrim
---Purpose: Torus centered at origin
raises DomainError;
Create(Center : Pnt from gp; Major, Minor : Real)
returns Torus from BRepPrim
---Purpose: Torus at Center
raises DomainError;
MakeEmptyLateralFace(me) returns Face from TopoDS
---Purpose: The surface normal should be directed towards the
-- outside.
is redefined;
SetMeridian(me : in out)
is static private;
fields
myMajor : Real;
myMinor : Real;
end Torus;

97
src/BRepPrim/BRepPrim_Torus.cxx Executable file
View File

@@ -0,0 +1,97 @@
// File: BRepPrim_Torus.cxx
// Created: Fri Nov 6 14:27:00 1992
// Author: Remi LEQUETTE
// <rle@phylox>
#include <BRepPrim_Torus.ixx>
#include <gp.hxx>
#include <gp_Vec.hxx>
#include <gp_Ax2d.hxx>
#include <Precision.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_Circle.hxx>
#include <Geom2d_Circle.hxx>
//=======================================================================
//function : BRepPrim_Torus
//purpose :
//=======================================================================
BRepPrim_Torus::BRepPrim_Torus(const gp_Ax2& Position,
const Standard_Real Major,
const Standard_Real Minor) :
BRepPrim_Revolution(Position,0,2*PI),
myMajor(Major),
myMinor(Minor)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Torus
//purpose :
//=======================================================================
BRepPrim_Torus::BRepPrim_Torus(const Standard_Real Major,
const Standard_Real Minor) :
BRepPrim_Revolution(gp::XOY(),0,2*PI),
myMajor(Major),
myMinor(Minor)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Torus
//purpose :
//=======================================================================
BRepPrim_Torus::BRepPrim_Torus(const gp_Pnt& Center,
const Standard_Real Major,
const Standard_Real Minor) :
BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
0,2*PI),
myMajor(Major),
myMinor(Minor)
{
SetMeridian();
}
//=======================================================================
//function : MakeEmptyLateralFace
//purpose :
//=======================================================================
TopoDS_Face BRepPrim_Torus::MakeEmptyLateralFace()const
{
Handle(Geom_ToroidalSurface) T =
new Geom_ToroidalSurface(Axes(),myMajor,myMinor);
TopoDS_Face F;
myBuilder.Builder().MakeFace(F,T,Precision::Confusion());
return F;
}
//=======================================================================
//function : SetMeridian
//purpose :
//=======================================================================
void BRepPrim_Torus::SetMeridian()
{
gp_Dir D = Axes().YDirection();
D.Reverse();
gp_Ax2 A(Axes().Location(),D,Axes().XDirection());
gp_Vec V = Axes().XDirection();
V.Multiply(myMajor);
A.Translate(V);
Handle(Geom_Circle) C = new Geom_Circle(A,myMinor);
Handle(Geom2d_Circle) C2d = new Geom2d_Circle(gp_Ax2d(gp_Pnt2d(myMajor,0),
gp_Dir2d(1,0)),
myMinor);
Meridian(C,C2d);
}

View File

@@ -0,0 +1,19 @@
--
-- File: BRepPrim_WOKSteps.edl
-- Author: JR
-- History: 19-11-99
-- Copyright: Matra Datavision 1999
--
@ifnotdefined ( %BRepPrim_WOKSteps_EDL) then
@set %BRepPrim_WOKSteps_EDL = "";
@string %WOKSteps_XcppGroup += " xcpp.repl ";
@set %WOKSteps_xcpp_repl = "*BRepPrim_Replace(xcpp.header)";
@set %BRepPrim_UseSourceInclude = "";
@endif;

63
src/BRepPrim/BRepPrim_Wedge.cdl Executable file
View File

@@ -0,0 +1,63 @@
-- File: BRepPrim_Wedge.cdl
-- Created: Mon Jan 9 14:10:54 1995
-- Author: Modelistation
-- <model@mastox>
---Copyright: Matra Datavision 1995
class Wedge from BRepPrim inherits GWedge from BRepPrim
---Purpose: Provides constructors without Builders.
uses
Ax2 from gp,
Pnt from gp
raises
DomainError
is
Create(Axes : Ax2 from gp; dx, dy, dz : Real)
returns Wedge from BRepPrim
---Purpose: Creates a Wedge algorithm. <Axes> is the axis
-- system for the primitive.
--
-- XMin, YMin, ZMin are set to 0
-- XMax, YMax, ZMax are set to dx, dy, dz
-- Z2Min = ZMin
-- Z2Max = ZMax
-- X2Min = XMin
-- X2Max = XMax
-- The result is a box
-- dx,dy,dz should be positive
raises DomainError;
Create(Axes : Ax2 from gp; dx, dy, dz, ltx : Real)
returns Wedge from BRepPrim
---Purpose: Creates a Wedge primitive. <Axes> is the axis
-- system for the primitive.
--
-- XMin, YMin, ZMin are set to 0
-- XMax, YMax, ZMax are set to dx, dy, dz
-- Z2Min = ZMin
-- Z2Max = ZMax
-- X2Min = ltx
-- X2Max = ltx
-- The result is a STEP right angular wedge
-- dx,dy,dz should be positive
-- ltx should not be negative
raises DomainError;
Create(Axes : Ax2 from gp; xmin, ymin, zmin, z2min, x2min,
xmax, ymax, zmax, z2max, x2max : Real)
returns Wedge from BRepPrim
---Purpose: Create a Wedge primitive. <Axes> is the axis
-- system for the primitive.
--
-- all the fields are set to the corresponding value
-- XYZMax - XYZMin should be positive
-- ZX2Max - ZX2Min should not be negative
raises DomainError;
end Wedge;

44
src/BRepPrim/BRepPrim_Wedge.cxx Executable file
View File

@@ -0,0 +1,44 @@
// File: BRepPrim_Wedge.cxx
// Created: Mon Jan 9 14:18:58 1995
// Author: Modelistation
// <model@mastox>
#include <BRepPrim_Wedge.ixx>
//=======================================================================
//function : BRepPrim_Wedge
//purpose :
//=======================================================================
BRepPrim_Wedge::BRepPrim_Wedge(const gp_Ax2& Axes, const Standard_Real dx, const Standard_Real dy, const Standard_Real dz) :
BRepPrim_GWedge(BRepPrim_Builder(),Axes,dx,dy,dz)
{
}
//=======================================================================
//function : BRepPrim_Wedge
//purpose :
//=======================================================================
BRepPrim_Wedge::BRepPrim_Wedge(const gp_Ax2& Axes, const Standard_Real dx, const Standard_Real dy, const Standard_Real dz, const Standard_Real ltx) :
BRepPrim_GWedge(BRepPrim_Builder(),Axes,dx,dy,dz,ltx)
{
}
//=======================================================================
//function : BRepPrim_Wedge
//purpose :
//=======================================================================
BRepPrim_Wedge::BRepPrim_Wedge(const gp_Ax2& Axes,
const Standard_Real xmin, const Standard_Real ymin, const Standard_Real zmin,
const Standard_Real z2min, const Standard_Real x2min,
const Standard_Real xmax, const Standard_Real ymax, const Standard_Real zmax,
const Standard_Real z2max, const Standard_Real x2max) :
BRepPrim_GWedge(BRepPrim_Builder(),Axes,xmin,ymin,zmin,z2min,x2min,xmax,ymax,zmax,z2max,x2max)
{
}

3
src/BRepPrim/FILES Executable file
View File

@@ -0,0 +1,3 @@
BRepPrim_OneAxis.hxx
BRepPrim_Replace.tcl
BRepPrim_WOKSteps.edl