Generic classes "LProp_FuncCurExt", "LProp_FuncCurNul" and "LProp_NumericCurInf" from "LProp" package converted to the non-generic classes and moved to the "Geom2dLProp" package. Therefore names of this classes were changed to "Geom2dLProp_FuncCurExt", "Geom2dLProp_FuncCurNul" and "Geom2dLProp_NumericCurInf".
Generic class "Sweep_LinearRegularSweep" from "Sweep" package converted to the non-generic classes and moved to the "BRepSweep" package. Therefore name of this class was changed to "BRepSweep_NumLinearRegularSweep". Also 2 internal classes of "BRepSweep_NumLinearRegularSweep" moved to "BRepSweep.cdl".
Generic classes "Primitives_Wedge" and "Primitives_OneAxis" from "Primitives" package converted to the non-generic classes and moved to the "BRepPrim" package. Therefore names of this classes were changed to "BRepPrim_GWedge" and "BRepPrim_OneAxis". Also enum "Direction" moved to BRepPrim. Therefore all "Primitives" package was deleted.
And some other minor changes were done.
Internal classes Array2OfShapes and SequenceOfShapes from BRepSweep_NumLinearRegularSweep replaced to Array2OfShape and SequenceOfShape from TopTools.
p MAT2d
p NLPlate
p Plate
-p Primitives
p ShapeAlgo
p ShapeAnalysis
p ShapeBuild
gp,
Geom2d,
Geom,
- Primitives,
TopoDS,
BRep
is
+ enumeration Direction is
+ ---Purpose:
+ XMin, XMax, YMin, YMax, ZMin, ZMax
+ end Direction;
+
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);
+
+ deferred class OneAxis;
class Revolution;
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 GWedge;
class Wedge;
--- /dev/null
+-- Created on: 1991-09-18
+-- Created by: Christophe MARION
+-- Copyright (c) 1991-1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class GWedge from BRepPrim
+
+
+ ---Purpose: A wedge is defined by :
+ --
+ -- Axes : an Axis2 (coordinate system)
+ --
+ -- YMin, YMax the coordinates of the ymin and ymax
+ -- rectangular faces parallel to the ZX plane (of the
+ -- coordinate systems)
+ --
+ -- ZMin,ZMax,XMin,XMax the rectangular
+ -- left (YMin) face parallel to the Z and X axes.
+ --
+ -- Z2Min,Z2Max,X2Min,X2Max the rectangular
+ -- right (YMax) face parallel to the Z and X axes.
+ --
+ -- For a box Z2Min = ZMin, Z2Max = ZMax,
+ -- X2Min = XMin, X2Max = XMax
+ --
+ -- The wedge can be open in the corresponding direction
+ -- of its Boolean myInfinite
+
+
+uses
+
+ Direction from BRepPrim,
+
+ Ax2 from gp,
+ Pln from gp,
+ Lin from gp,
+ Pnt from gp,
+ Shell from TopoDS,
+ Face from TopoDS,
+ Wire from TopoDS,
+ Edge from TopoDS,
+ Vertex from TopoDS,
+ Builder from BRepPrim
+
+raises
+ DomainError,
+ OutOfRange
+
+is
+ Create(B : Builder from BRepPrim; Axes : Ax2 from gp; dx, dy, dz : Real)
+ returns GWedge from BRepPrim
+ ---Purpose: Creates a GWedge 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(B : Builder from BRepPrim; Axes : Ax2 from gp; dx, dy, dz, ltx : Real)
+ returns GWedge from BRepPrim
+ ---Purpose: Creates a GWedge 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(B : Builder from BRepPrim; Axes : Ax2 from gp; xmin, ymin, zmin, z2min, x2min,
+ xmax, ymax, zmax, z2max, x2max : Real)
+ returns GWedge from BRepPrim
+ ---Purpose: Create a GWedge 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;
+
+ Axes(me) returns Ax2 from gp
+ ---Purpose: Returns the coordinates system from <me>.
+ is static;
+
+ GetXMin(me) returns Real
+ ---Purpose: Returns Xmin value from <me>.
+ is static;
+
+ GetYMin(me) returns Real
+ ---Purpose: Returns YMin value from <me>.
+ is static;
+
+ GetZMin(me) returns Real
+ ---Purpose: Returns ZMin value from <me>.
+ is static;
+
+ GetZ2Min(me) returns Real
+ ---Purpose: Returns Z2Min value from <me>.
+ is static;
+
+ GetX2Min(me) returns Real
+ ---Purpose: Returns X2Min value from <me>.
+ is static;
+
+ GetXMax(me) returns Real
+ ---Purpose: Returns XMax value from <me>.
+ is static;
+
+ GetYMax(me) returns Real
+ ---Purpose: Returns YMax value from <me>.
+ is static;
+
+ GetZMax(me) returns Real
+ ---Purpose: Returns ZMax value from <me>.
+ is static;
+
+ GetZ2Max(me) returns Real
+ ---Purpose: Returns Z2Max value from <me>.
+ is static;
+
+ GetX2Max(me) returns Real
+ ---Purpose: Returns X2Max value from <me>.
+ is static;
+
+ Open(me : in out; d1 : Direction from BRepPrim)
+ ---Purpose: Opens <me> in <d1> direction. A face and its edges
+ -- or vertices are said nonexistant.
+ raises DomainError
+ is static;
+
+ Close(me : in out; d1 : Direction from BRepPrim)
+ ---Purpose: Closes <me> in <d1> direction. A face and its
+ -- edges or vertices are said existant.
+ raises DomainError
+ is static;
+
+ IsInfinite(me; d1 : Direction from BRepPrim)
+ ---Purpose: Returns True if <me> is open in <d1> direction.
+ returns Boolean;
+
+ Shell(me : in out) returns Shell from TopoDS
+ ---Purpose: Returns the Shell containing the Faces of <me>.
+ --
+ ---C++: return const &
+ is static;
+
+ HasFace(me; d1 : Direction from BRepPrim)
+ ---Purpose: Returns True if <me> has a Face in <d1> direction.
+ returns Boolean;
+
+ Face(me : in out; d1 : Direction from BRepPrim) returns Face from TopoDS
+ ---Purpose: Returns the Face of <me> located in <d1> direction.
+ --
+ ---C++: return const &
+ raises DomainError
+ is static;
+
+ Plane(me : in out; d1 : Direction from BRepPrim) returns Pln from gp
+ ---Purpose: Returns the plane of the Face of <me> located in
+ -- <d1> direction.
+ raises DomainError
+ is static;
+
+ HasWire(me; d1 : Direction from BRepPrim)
+ ---Purpose: Returns True if <me> has a Wire in <d1> direction.
+ returns Boolean;
+
+ Wire(me : in out; d1 : Direction from BRepPrim) returns Wire from TopoDS
+ ---Purpose: Returns the Wire of <me> located in <d1> direction.
+ --
+ ---C++: return const &
+ raises DomainError
+ is static;
+
+ HasEdge(me; d1, d2 : Direction from BRepPrim)
+ ---Purpose: Returns True if <me> has an Edge in <d1><d2> direction.
+ returns Boolean;
+
+ Edge(me : in out; d1, d2 : Direction from BRepPrim) returns Edge from TopoDS
+ ---Purpose: Returns the Edge of <me> located in <d1><d2> direction.
+ --
+ ---C++: return const &
+ raises DomainError
+ is static;
+
+ Line(me : in out; d1, d2 : Direction from BRepPrim) returns Lin from gp
+ ---Purpose: Returns the line of the Edge of <me> located in
+ -- <d1><d2> direction.
+ raises DomainError
+ is static;
+
+ HasVertex(me; d1, d2, d3 : Direction from BRepPrim)
+ ---Purpose: Returns True if <me> has a Vertex in <d1><d2><d3>
+ -- direction.
+ returns Boolean;
+
+ Vertex(me : in out; d1, d2, d3 : Direction from BRepPrim)
+ returns Vertex from TopoDS
+ ---Purpose: Returns the Vertex of <me> located in <d1><d2><d3>
+ -- direction.
+ --
+ ---C++: return const &
+ raises DomainError
+ is static;
+
+ Point(me : in out; d1, d2, d3 : Direction from BRepPrim)
+ returns Pnt from gp
+ ---Purpose: Returns the point of the Vertex of <me> located in
+ -- <d1><d2><d3> direction.
+ raises DomainError
+ is static;
+
+fields
+ myBuilder : Builder from BRepPrim;
+
+ myAxes : Ax2 from gp;
+ XMin : Real;
+ XMax : Real;
+ YMin : Real;
+ YMax : Real;
+ ZMin : Real;
+ ZMax : Real;
+ Z2Min : Real;
+ Z2Max : Real;
+ X2Min : Real;
+ X2Max : Real;
+
+ -- the Topology
+
+ myShell : Shell from TopoDS;
+ ShellBuilt : Boolean;
+
+ myVertices : Vertex from TopoDS [8];
+ -- 0 : xmin ymin zmin
+ -- 1 : xmax ymin zmin
+ -- 2 : xmin ymax zmin
+ -- 3 : xmax ymax zmin
+ -- 4 : xmin ymin zmax
+ -- 5 : xmax ymin zmax
+ -- 6 : xmin ymax zmax
+ -- 7 : xmax ymax zmax
+ VerticesBuilt : Boolean [8];
+
+ myEdges : Edge from TopoDS [12];
+ -- 0 : xmin ymin
+ -- 1 : xmax ymin
+ -- 2 : xmin ymax
+ -- 3 : xmax ymax
+ -- 4 : ymin zmin
+ -- 5 : ymax zmin
+ -- 6 : ymin zmax
+ -- 7 : ymax zmax
+ -- 8 : zmin xmin
+ -- 9 : zmax xmin
+ -- 10 : zmin xmax
+ -- 11 : zmax xmax
+ EdgesBuilt : Boolean [12];
+
+ myWires : Wire from TopoDS [6];
+ -- 0 : xmin
+ -- 1 : xmax
+ -- 2 : ymin
+ -- 3 : ymax
+ -- 4 : zmin
+ -- 5 : zmax
+ WiresBuilt : Boolean [6];
+
+ myFaces : Face from TopoDS [6];
+ -- 0 : xmin
+ -- 1 : xmax
+ -- 2 : ymin
+ -- 3 : ymax
+ -- 4 : zmin
+ -- 5 : zmax
+ FacesBuilt : Boolean [6];
+
+ myInfinite : Boolean[6];
+ -- 0 : xmin
+ -- 1 : xmax
+ -- 2 : ymin
+ -- 3 : ymax
+ -- 4 : zmin
+ -- 5 : zmax
+
+end GWedge;
--- /dev/null
+// Created on: 1991-09-27
+// Created by: Christophe MARION
+// Copyright (c) 1991-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BRepPrim_GWedge.ixx>
+
+#include <Precision.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Lin.hxx>
+#include <ElSLib.hxx>
+#include <ElCLib.hxx>
+
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <BRepPrim_Builder.hxx>
+#include <BRepPrim_Direction.hxx>
+
+#include <Standard_DomainError.hxx>
+#include <Standard_OutOfRange.hxx>
+
+#undef Standard_True
+#undef Standard_False
+
+#define Standard_True ((Standard_Boolean) 1)
+#define Standard_False ((Standard_Boolean) 0)
+
+#define NBFACES 6
+#define NBWIRES 6
+#define NBEDGES 12
+#define NBVERTICES 8
+
+static const Standard_Integer num[6] = {0,1,2,3,4,5};
+static const Standard_Integer val[6] = {0,4,0,2,0,1};
+static const Standard_Integer tab[6][6] = {{-1,-1, 0, 1, 8, 9},
+ {-1,-1, 2, 3,10,11},
+ { 0, 2,-1,-1, 4, 5},
+ { 1, 3,-1,-1, 6, 7},
+ { 8,10, 4, 6,-1,-1},
+ { 9,11, 5, 7,-1,-1}};
+
+//=======================================================================
+//function : BRepPrim_Wedge_NumDir1
+//purpose : when giving a direction return the range of the face
+//=======================================================================
+
+static Standard_Integer BRepPrim_Wedge_NumDir1
+ (const BRepPrim_Direction d1) { return num[d1]; }
+
+//=======================================================================
+//function : BRepPrim_Wedge_NumDir2
+//purpose : when giving two directions return the range of the edge
+//=======================================================================
+
+static Standard_Integer BRepPrim_Wedge_NumDir2
+ (const BRepPrim_Direction d1,
+ const BRepPrim_Direction d2)
+{
+ Standard_Integer i1 = BRepPrim_Wedge_NumDir1(d1);
+ Standard_Integer i2 = BRepPrim_Wedge_NumDir1(d2);
+ if ( i1/2 == i2/2 ) Standard_DomainError::Raise();
+ return tab[i1][i2];
+}
+
+//=======================================================================
+//function : BRepPrim_Wedge_NumDir3
+//purpose : when giving three directions return the range of the vertex
+//=======================================================================
+
+static Standard_Integer BRepPrim_Wedge_NumDir3
+ (const BRepPrim_Direction d1,
+ const BRepPrim_Direction d2,
+ const BRepPrim_Direction d3)
+{
+ Standard_Integer i1 = BRepPrim_Wedge_NumDir1(d1);
+ Standard_Integer i2 = BRepPrim_Wedge_NumDir1(d2);
+ Standard_Integer i3 = BRepPrim_Wedge_NumDir1(d3);
+ if (( i1/2 == i2/2 ) ||
+ ( i2/2 == i3/2 ) ||
+ ( i3/2 == i1/2 )) Standard_DomainError::Raise();
+ return val[i1]+val[i2]+val[i3];
+}
+
+//=======================================================================
+//function : BRepPrim_Wedge_Check
+//purpose : raise Standard_DomainError if something was built
+//=======================================================================
+
+static void BRepPrim_Wedge_Check(const Standard_Boolean V[],
+ const Standard_Boolean E[],
+ const Standard_Boolean W[],
+ const Standard_Boolean F[])
+{
+ Standard_Integer i;
+ for (i = 0; i < NBVERTICES; i++)
+ if (V[i]) Standard_DomainError::Raise();
+ for (i = 0; i < NBEDGES; i++)
+ if (E[i]) Standard_DomainError::Raise();
+ for (i = 0; i < NBWIRES; i++)
+ if (W[i]) Standard_DomainError::Raise();
+ for (i = 0; i < NBFACES; i++)
+ if (F[i]) Standard_DomainError::Raise();
+}
+
+//=======================================================================
+//function : BRepPrim_Wedge_Init
+//purpose : Set arrays to Standard_False
+//=======================================================================
+
+static void BRepPrim_Wedge_Init(Standard_Boolean& S,
+ Standard_Boolean V[],
+ Standard_Boolean E[],
+ Standard_Boolean W[],
+ Standard_Boolean F[])
+{
+ Standard_Integer i;
+ S = Standard_False;
+ for (i = 0; i < NBVERTICES; i++)
+ V[i] = Standard_False;
+ for (i = 0; i < NBEDGES; i++)
+ E[i] = Standard_False;
+ for (i = 0; i < NBWIRES; i++)
+ W[i] = Standard_False;
+ for (i = 0; i < NBFACES; i++)
+ F[i] = Standard_False;
+}
+
+//=======================================================================
+//function : BRepPrim_GWedge
+//purpose : build a box
+//=======================================================================
+
+BRepPrim_GWedge::BRepPrim_GWedge (const BRepPrim_Builder& B,
+ const gp_Ax2& Axes,
+ const Standard_Real dx,
+ const Standard_Real dy,
+ const Standard_Real dz) :
+ myBuilder(B),
+ myAxes(Axes),
+ XMin(0),
+ XMax(dx),
+ YMin(0),
+ YMax(dy),
+ ZMin(0),
+ ZMax(dz),
+ Z2Min(0),
+ Z2Max(dz),
+ X2Min(0),
+ X2Max(dx)
+{
+ for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
+ if ( ( dx <= Precision::Confusion() ) ||
+ ( dy <= Precision::Confusion() ) ||
+ ( dz <= Precision::Confusion() ) )
+ Standard_DomainError::Raise();
+ BRepPrim_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
+ WiresBuilt,FacesBuilt);
+}
+
+//=======================================================================
+//function : BRepPrim_GWedge
+//purpose : build a STEP wedge
+//=======================================================================
+
+BRepPrim_GWedge::BRepPrim_GWedge (const BRepPrim_Builder& B,
+ const gp_Ax2& Axes,
+ const Standard_Real dx,
+ const Standard_Real dy,
+ const Standard_Real dz,
+ const Standard_Real ltx) :
+ myBuilder(B),
+ myAxes(Axes),
+ XMin(0),
+ XMax(dx),
+ YMin(0),
+ YMax(dy),
+ ZMin(0),
+ ZMax(dz),
+ Z2Min(0),
+ Z2Max(dz),
+ X2Min(0),
+ X2Max(ltx)
+{
+ for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
+ if ( ( dx <= Precision::Confusion() ) ||
+ ( dy <= Precision::Confusion() ) ||
+ ( dz <= Precision::Confusion() ) ||
+ ( ltx < 0 ) )
+ Standard_DomainError::Raise();
+ BRepPrim_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
+ WiresBuilt,FacesBuilt);
+}
+
+//=======================================================================
+//function : BRepPrim_GWedge
+//purpose : build a wedge by giving all the fields
+//=======================================================================
+
+BRepPrim_GWedge::BRepPrim_GWedge (const BRepPrim_Builder& B,
+ 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) :
+ myBuilder(B),
+ myAxes(Axes),
+ XMin(xmin),
+ XMax(xmax),
+ YMin(ymin),
+ YMax(ymax),
+ ZMin(zmin),
+ ZMax(zmax),
+ Z2Min(z2min),
+ Z2Max(z2max),
+ X2Min(x2min),
+ X2Max(x2max)
+{
+ for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
+ if ( ( XMax-XMin <= Precision::Confusion() ) ||
+ ( YMax-YMin <= Precision::Confusion() ) ||
+ ( ZMax-ZMin <= Precision::Confusion() ) ||
+ ( Z2Max-Z2Min < 0 ) ||
+ ( X2Max-X2Min < 0 ) )
+ Standard_DomainError::Raise();
+ BRepPrim_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
+ WiresBuilt,FacesBuilt);
+}
+
+//=======================================================================
+//function : Axes,
+// GetXMin, GetYMin, GetZMin, GetZ2Min, GetX2Min
+// GetXMax, GetYMax, GetZMax, GetZ2Max, GetX2Max
+//purpose : trivial
+//=======================================================================
+
+gp_Ax2 BRepPrim_GWedge::Axes () const { return myAxes; }
+Standard_Real BRepPrim_GWedge::GetXMin () const { return XMin; }
+Standard_Real BRepPrim_GWedge::GetYMin () const { return YMin; }
+Standard_Real BRepPrim_GWedge::GetZMin () const { return ZMin; }
+Standard_Real BRepPrim_GWedge::GetZ2Min () const { return Z2Min; }
+Standard_Real BRepPrim_GWedge::GetX2Min () const { return X2Min; }
+Standard_Real BRepPrim_GWedge::GetXMax () const { return XMax; }
+Standard_Real BRepPrim_GWedge::GetYMax () const { return YMax; }
+Standard_Real BRepPrim_GWedge::GetZMax () const { return ZMax; }
+Standard_Real BRepPrim_GWedge::GetZ2Max () const { return Z2Max; }
+Standard_Real BRepPrim_GWedge::GetX2Max () const { return X2Max; }
+
+//=======================================================================
+//function : Open
+//purpose : trivial
+//=======================================================================
+
+void BRepPrim_GWedge::Open (const BRepPrim_Direction d1)
+{
+ BRepPrim_Wedge_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
+ myInfinite[BRepPrim_Wedge_NumDir1(d1)] = Standard_True;
+}
+
+//=======================================================================
+//function : Close
+//purpose : trivial
+//=======================================================================
+
+void BRepPrim_GWedge::Close (const BRepPrim_Direction d1)
+{
+ BRepPrim_Wedge_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
+ myInfinite[BRepPrim_Wedge_NumDir1(d1)] = Standard_False;
+}
+
+//=======================================================================
+//function : IsInfinite
+//purpose : true if it is open in the given direction
+//=======================================================================
+
+Standard_Boolean BRepPrim_GWedge::IsInfinite (const BRepPrim_Direction d1) const
+{ return myInfinite[BRepPrim_Wedge_NumDir1(d1)]; }
+
+//=======================================================================
+//function : Shell
+//purpose :
+//=======================================================================
+
+const TopoDS_Shell& BRepPrim_GWedge::Shell() {
+ if (!ShellBuilt) {
+ myBuilder.MakeShell(myShell);
+
+ if (HasFace(BRepPrim_XMin))
+ myBuilder.AddShellFace(myShell,Face(BRepPrim_XMin));
+ if (HasFace(BRepPrim_XMax))
+ myBuilder.AddShellFace(myShell,Face(BRepPrim_XMax));
+ if (HasFace(BRepPrim_YMin))
+ myBuilder.AddShellFace(myShell,Face(BRepPrim_YMin));
+ if (HasFace(BRepPrim_YMax))
+ myBuilder.AddShellFace(myShell,Face(BRepPrim_YMax));
+ if (HasFace(BRepPrim_ZMin))
+ myBuilder.AddShellFace(myShell,Face(BRepPrim_ZMin));
+ if (HasFace(BRepPrim_ZMax))
+ myBuilder.AddShellFace(myShell,Face(BRepPrim_ZMax));
+
+ myBuilder.CompleteShell(myShell);
+ ShellBuilt = Standard_True;
+ }
+ return myShell;
+}
+
+//=======================================================================
+//function : HasFace
+//purpose : true if the face exist in one direction
+//=======================================================================
+
+Standard_Boolean BRepPrim_GWedge::HasFace (const BRepPrim_Direction d1) const
+{
+ Standard_Boolean state = !myInfinite[BRepPrim_Wedge_NumDir1(d1)];
+ if ( d1 == BRepPrim_YMax ) state = state && ( Z2Max != Z2Min )
+ && ( X2Max != X2Min );
+ return state;
+}
+
+//=======================================================================
+//function : Plane
+//purpose :
+//=======================================================================
+
+gp_Pln BRepPrim_GWedge::Plane(const BRepPrim_Direction d1)
+{
+
+ Standard_Integer i = BRepPrim_Wedge_NumDir1(d1);
+
+ gp_Dir D;
+ gp_Vec VX = myAxes.XDirection();
+ gp_Vec VY = myAxes.YDirection();
+ gp_Vec VZ = myAxes.Direction();
+
+ switch (i/2) {
+
+ case 0 :
+ D = myAxes.XDirection();
+ break;
+
+ case 1 :
+ D = myAxes.YDirection();
+ break;
+
+ case 2 :
+ D = myAxes.Direction();
+ break;
+
+ };
+ Standard_Real X = 0., Y = 0., Z = 0.;
+
+ switch (i) {
+
+ case 0 :
+ // XMin
+ X = XMin;
+ Y = YMin;
+ Z = ZMin;
+ if ( X2Min != XMin ) D = gp_Dir((YMax-YMin)*VX+(XMin-X2Min)*VY);
+ break;
+
+ case 1 :
+ // XMax
+ X = XMax;
+ Y = YMin;
+ Z = ZMin;
+ if ( X2Max != XMax ) D = gp_Dir((YMax-YMin)*VX+(XMax-X2Max)*VY);
+ break;
+
+ case 2 :
+ // YMin
+ X = XMin;
+ Y = YMin;
+ Z = ZMin;
+ break;
+
+ case 3 :
+ // YMax
+ X = XMin;
+ Y = YMax;
+ Z = ZMin;
+ break;
+
+ case 4 :
+ // ZMin
+ X = XMin;
+ Y = YMin;
+ Z = ZMin;
+ if ( Z2Min != ZMin ) D = gp_Dir((YMax-YMin)*VZ+(ZMin-Z2Min)*VY);
+ break;
+
+ case 5 :
+ // ZMax
+ X = XMin;
+ Y = YMin;
+ Z = ZMax;
+ if ( Z2Max != ZMax ) D = gp_Dir((YMax-YMin)*VZ+(ZMax-Z2Max)*VY);
+ break;
+
+ };
+
+ gp_Pnt P = myAxes.Location();
+ P.Translate(X*gp_Vec(myAxes.XDirection()));
+ P.Translate(Y*gp_Vec(myAxes.YDirection()));
+ P.Translate(Z*gp_Vec(myAxes.Direction ()));
+ gp_Pln plane(P,D);
+ return plane;
+}
+
+//=======================================================================
+//function : Face
+//purpose : the face in one direction
+//=======================================================================
+
+const TopoDS_Face& BRepPrim_GWedge::Face
+ (const BRepPrim_Direction d1)
+{
+
+ Standard_Integer i = BRepPrim_Wedge_NumDir1(d1);
+
+ if (!FacesBuilt[i]) {
+ gp_Pln P = Plane(d1);
+ myBuilder.MakeFace(myFaces[i],P);
+ if (HasWire(d1)) myBuilder.AddFaceWire(myFaces[i],Wire(d1));
+ if ( i%2 == 0 ) myBuilder.ReverseFace(myFaces[i]);
+
+ // pcurves
+
+ BRepPrim_Direction dd1 = BRepPrim_ZMin, dd2 = BRepPrim_YMax,
+ dd3 = BRepPrim_ZMax,dd4 = BRepPrim_YMin;
+
+ switch (i/2) {
+
+ case 0 :
+ // XMin XMax
+ dd1 = BRepPrim_ZMin;
+ dd2 = BRepPrim_YMax;
+ dd3 = BRepPrim_ZMax;
+ dd4 = BRepPrim_YMin;
+ break;
+
+ case 1 :
+ // YMin YMax
+ dd1 = BRepPrim_XMin;
+ dd2 = BRepPrim_ZMax;
+ dd3 = BRepPrim_XMax;
+ dd4 = BRepPrim_ZMin;
+ break;
+
+ case 2 :
+ // ZMin ZMax
+ dd1 = BRepPrim_YMin;
+ dd2 = BRepPrim_XMax;
+ dd3 = BRepPrim_YMax;
+ dd4 = BRepPrim_XMin;
+ break;
+
+ };
+
+ gp_Lin L;
+ gp_Dir DX = P.XAxis().Direction();
+ gp_Dir DY = P.YAxis().Direction();
+ Standard_Real U,V,DU,DV;
+ if (HasEdge(d1,dd4)) {
+ L = Line(d1,dd4);
+ ElSLib::Parameters(P,L.Location(),U,V);
+ DU = L.Direction() * DX;
+ DV = L.Direction() * DY;
+ myBuilder.SetPCurve(myEdges[BRepPrim_Wedge_NumDir2(d1,dd4)],
+ myFaces[i],
+ gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV)));
+ }
+ if (HasEdge(d1,dd3)) {
+ L = Line(d1,dd3);
+ ElSLib::Parameters(P,L.Location(),U,V);
+ DU = L.Direction() * DX;
+ DV = L.Direction() * DY;
+ myBuilder.SetPCurve(myEdges[BRepPrim_Wedge_NumDir2(d1,dd3)],
+ myFaces[i],
+ gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV)));
+ }
+
+ if (HasEdge(d1,dd2)) {
+ L = Line(d1,dd2);
+ ElSLib::Parameters(P,L.Location(),U,V);
+ DU = L.Direction() * DX;
+ DV = L.Direction() * DY;
+ myBuilder.SetPCurve(myEdges[BRepPrim_Wedge_NumDir2(d1,dd2)],
+ myFaces[i],
+ gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV)));
+ }
+
+ if (HasEdge(d1,dd1)) {
+ L = Line(d1,dd1);
+ ElSLib::Parameters(P,L.Location(),U,V);
+ DU = L.Direction() * DX;
+ DV = L.Direction() * DY;
+ myBuilder.SetPCurve(myEdges[BRepPrim_Wedge_NumDir2(d1,dd1)],
+ myFaces[i],
+ gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV)));
+ }
+
+
+ myBuilder.CompleteFace(myFaces[i]);
+ FacesBuilt[i] = Standard_True;
+ }
+
+ return myFaces[i];
+
+}
+
+//=======================================================================
+//function : HasWire
+//purpose : trivial
+//=======================================================================
+
+Standard_Boolean BRepPrim_GWedge::HasWire (const BRepPrim_Direction d1) const
+{
+ Standard_Integer i = BRepPrim_Wedge_NumDir1(d1);
+
+ if (myInfinite[i]) return Standard_False;
+ BRepPrim_Direction dd1 = BRepPrim_XMin,dd2 = BRepPrim_YMax,dd3 = BRepPrim_XMax ,dd4 = BRepPrim_ZMin;
+
+ switch (i/2) {
+
+ case 0 :
+ // XMin XMax
+ dd1 = BRepPrim_ZMin;
+ dd2 = BRepPrim_YMax;
+ dd3 = BRepPrim_ZMax;
+ dd4 = BRepPrim_YMin;
+ break;
+
+ case 1 :
+ // YMin YMax
+ dd1 = BRepPrim_XMin;
+ dd2 = BRepPrim_ZMax;
+ dd3 = BRepPrim_XMax;
+ dd4 = BRepPrim_ZMin;
+ break;
+
+ case 2 :
+ // ZMin ZMax
+ dd1 = BRepPrim_YMin;
+ dd2 = BRepPrim_XMax;
+ dd3 = BRepPrim_YMax;
+ dd4 = BRepPrim_XMin;
+ break;
+#ifndef DEB
+ default:
+ break;
+#endif
+ };
+
+ return HasEdge(d1,dd1)||HasEdge(d1,dd2)||HasEdge(d1,dd3)||HasEdge(d1,dd4);
+
+}
+
+//=======================================================================
+//function : Wire
+//purpose : trivial
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_GWedge::Wire
+ (const BRepPrim_Direction d1)
+{
+ Standard_Integer i = BRepPrim_Wedge_NumDir1(d1);
+
+ BRepPrim_Direction dd1 = BRepPrim_XMin,dd2 = BRepPrim_YMax,dd3 = BRepPrim_XMax ,dd4 = BRepPrim_ZMin;
+
+ if (!WiresBuilt[i]) {
+
+ switch (i/2) {
+
+ case 0 :
+ // XMin XMax
+ dd1 = BRepPrim_ZMin;
+ dd2 = BRepPrim_YMax;
+ dd3 = BRepPrim_ZMax;
+ dd4 = BRepPrim_YMin;
+ break;
+
+ case 1 :
+ // YMin YMax
+ dd1 = BRepPrim_XMin;
+ dd2 = BRepPrim_ZMax;
+ dd3 = BRepPrim_XMax;
+ dd4 = BRepPrim_ZMin;
+ break;
+
+ case 2 :
+ // ZMin ZMax
+ dd1 = BRepPrim_YMin;
+ dd2 = BRepPrim_XMax;
+ dd3 = BRepPrim_YMax;
+ dd4 = BRepPrim_XMin;
+ break;
+ default:
+ break;
+ };
+
+ myBuilder.MakeWire(myWires[i]);
+
+ if (HasEdge(d1,dd4))
+ myBuilder.AddWireEdge(myWires[i],Edge(d1,dd4),Standard_False);
+ if (HasEdge(d1,dd3))
+ myBuilder.AddWireEdge(myWires[i],Edge(d1,dd3),Standard_False);
+ if (HasEdge(d1,dd2))
+ myBuilder.AddWireEdge(myWires[i],Edge(d1,dd2),Standard_True );
+ if (HasEdge(d1,dd1))
+ myBuilder.AddWireEdge(myWires[i],Edge(d1,dd1),Standard_True );
+
+ myBuilder.CompleteWire(myWires[i]);
+ WiresBuilt[i] = Standard_True;
+ }
+
+ return myWires[i];
+
+}
+
+//=======================================================================
+//function : HasEdge
+//purpose : trivial
+//=======================================================================
+
+Standard_Boolean BRepPrim_GWedge::HasEdge (const BRepPrim_Direction d1,
+ const BRepPrim_Direction d2) const
+{
+ Standard_Boolean state = !(myInfinite[BRepPrim_Wedge_NumDir1(d1)] ||
+ myInfinite[BRepPrim_Wedge_NumDir1(d2)]);
+ Standard_Integer i = BRepPrim_Wedge_NumDir2(d1,d2);
+ if ( i == 6 || i == 7 ) state = state && ( X2Max != X2Min );
+ else if ( i == 1 || i == 3 ) state = state && ( Z2Max != Z2Min );
+ return state;
+}
+
+//=======================================================================
+//function : Line
+//purpose : trivial
+//=======================================================================
+
+gp_Lin BRepPrim_GWedge::Line
+ (const BRepPrim_Direction d1,
+ const BRepPrim_Direction d2)
+{
+ if (!HasEdge(d1,d2)) Standard_DomainError::Raise();
+
+ Standard_Integer i = BRepPrim_Wedge_NumDir2(d1,d2);
+
+ Standard_Real X =0., Y =0., Z =0.;
+
+ gp_Dir D;
+ gp_Vec VX = myAxes.XDirection();
+ gp_Vec VY = myAxes.YDirection();
+ gp_Vec VZ = myAxes.Direction();
+
+ switch (i/4) {
+
+ case 0 :
+ D = myAxes.Direction();
+ break;
+
+ case 1 :
+ D = myAxes.XDirection();
+ break;
+
+ case 2 :
+ D = myAxes.YDirection();
+ break;
+
+ };
+
+ switch (i) {
+
+ case 0 :
+ // XMin YMin
+ X = XMin;
+ Y = YMin;
+ Z = ZMin;
+ break;
+
+ case 1 :
+ // XMin YMax
+ X = X2Min;
+ Y = YMax;
+ Z = Z2Min;
+ break;
+
+ case 2 :
+ // XMax YMin
+ X = XMax;
+ Y = YMin;
+ Z = ZMin;
+ break;
+
+ case 3 :
+ // XMax YMax
+ X = X2Max;
+ Y = YMax;
+ Z = Z2Min;
+ break;
+
+ case 4 :
+ // YMin ZMin
+ X = XMin;
+ Y = YMin;
+ Z = ZMin;
+ break;
+
+ case 5 :
+ // YMin ZMax
+ X = XMin;
+ Y = YMin;
+ Z = ZMax;
+ break;
+
+ case 6 :
+ // YMax ZMin
+ X = X2Min;
+ Y = YMax;
+ Z = Z2Min;
+ break;
+
+ case 7 :
+ // YMax ZMax
+ X = X2Min;
+ Y = YMax;
+ Z = Z2Max;
+ break;
+
+ case 8 :
+ // ZMin XMin
+ X = XMin;
+ Y = YMin;
+ Z = ZMin;
+ if ( (XMin != X2Min) || (ZMin != Z2Min) )
+ D = gp_Vec( (X2Min-XMin)*VX + (YMax-YMin)*VY + (Z2Min-ZMin)*VZ);
+ break;
+
+ case 9 :
+ // ZMax XMin
+ X = XMin;
+ Y = YMin;
+ Z = ZMax;
+ if ( (XMin != X2Min) || (ZMax != Z2Max) )
+ D = gp_Vec( (X2Min-XMin)*VX + (YMax-YMin)*VY + (Z2Max-ZMax)*VZ);
+ break;
+
+ case 10 :
+ // ZMin XMax
+ X = XMax;
+ Y = YMin;
+ Z = ZMin;
+ if ( (XMax != X2Max) || (ZMin != Z2Min) )
+ D = gp_Vec( (X2Max-XMax)*VX + (YMax-YMin)*VY + (Z2Min-ZMin)*VZ);
+ break;
+
+ case 11 :
+ // ZMax XMax
+ X = XMax;
+ Y = YMin;
+ Z = ZMax;
+ if ( (XMax != X2Max) || (ZMax != Z2Max) )
+ D = gp_Vec(gp_Pnt(XMax,YMin,ZMax),gp_Pnt(X2Max,YMax,Z2Max));
+ D = gp_Vec( (X2Max-XMax)*VX + (YMax-YMin)*VY + (Z2Max-ZMax)*VZ);
+ break;
+
+ }
+
+ gp_Pnt P = myAxes.Location();
+ P.Translate(X*gp_Vec(myAxes.XDirection()));
+ P.Translate(Y*gp_Vec(myAxes.YDirection()));
+ P.Translate(Z*gp_Vec(myAxes.Direction ()));
+ return gp_Lin(gp_Ax1(P,D));
+
+}
+
+//=======================================================================
+//function : Edge
+//purpose : trivial
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_GWedge::Edge
+ (const BRepPrim_Direction d1,
+ const BRepPrim_Direction d2)
+{
+ if (!HasEdge(d1,d2)) Standard_DomainError::Raise();
+
+ Standard_Integer i = BRepPrim_Wedge_NumDir2(d1,d2);
+
+ if (!EdgesBuilt[i]) {
+
+ BRepPrim_Direction dd1 = BRepPrim_XMin ,dd2 = BRepPrim_XMax;
+
+ switch (i/4) {
+
+ case 0 :
+ dd1 = BRepPrim_ZMin;
+ dd2 = BRepPrim_ZMax;
+ break;
+
+ case 1 :
+ dd1 = BRepPrim_XMin;
+ dd2 = BRepPrim_XMax;
+ break;
+
+ case 2 :
+ dd1 = BRepPrim_YMin;
+ dd2 = BRepPrim_YMax;
+ break;
+
+ default:
+ break;
+ };
+
+ gp_Lin L = Line(d1,d2);
+ myBuilder.MakeEdge(myEdges[i],L);
+
+ if (HasVertex(d1,d2,dd2)) {
+ myBuilder.AddEdgeVertex(myEdges[i],Vertex(d1,d2,dd2),
+ ElCLib::Parameter(L,Point(d1,d2,dd2)),
+ Standard_False);
+ }
+ if (HasVertex(d1,d2,dd1)) {
+ myBuilder.AddEdgeVertex(myEdges[i],Vertex(d1,d2,dd1),
+ ElCLib::Parameter(L,Point(d1,d2,dd1)),
+ Standard_True );
+ }
+
+ if ( Z2Max == Z2Min ) {
+ if ( i == 6 ) {
+ myEdges[7] = myEdges[6];
+ EdgesBuilt[7] = Standard_True;
+ }
+ else if ( i == 7 ) {
+ myEdges[6] = myEdges[7];
+ EdgesBuilt[6] = Standard_True;
+ }
+ }
+ if ( X2Max == X2Min ) {
+ if ( i == 1 ) {
+ myEdges[3] = myEdges[1];
+ EdgesBuilt[3] = Standard_True;
+ }
+ else if ( i == 3 ) {
+ myEdges[1] = myEdges[3];
+ EdgesBuilt[1] = Standard_True;
+ }
+ }
+
+ myBuilder.CompleteEdge(myEdges[i]);
+ EdgesBuilt[i] = Standard_True;
+ }
+
+ return myEdges[i];
+
+}
+
+//=======================================================================
+//function : HasVertex
+//purpose : trivial
+//=======================================================================
+
+Standard_Boolean BRepPrim_GWedge::HasVertex
+ (const BRepPrim_Direction d1,
+ const BRepPrim_Direction d2,
+ const BRepPrim_Direction d3) const
+{ return !(myInfinite[BRepPrim_Wedge_NumDir1(d1)] ||
+ myInfinite[BRepPrim_Wedge_NumDir1(d2)] ||
+ myInfinite[BRepPrim_Wedge_NumDir1(d3)]); }
+
+//=======================================================================
+//function : Point
+//purpose : trivial
+//=======================================================================
+
+gp_Pnt BRepPrim_GWedge::Point
+ (const BRepPrim_Direction d1,
+ const BRepPrim_Direction d2,
+ const BRepPrim_Direction d3)
+{
+ if (!HasVertex(d1,d2,d3)) Standard_DomainError::Raise();
+
+ Standard_Integer i = BRepPrim_Wedge_NumDir3(d1,d2,d3);
+
+ Standard_Real X =0., Y =0., Z =0.;
+
+ switch (i) {
+
+ case 0 :
+ X = XMin;
+ Y = YMin;
+ Z = ZMin;
+ break;
+
+ case 1 :
+ X = XMin;
+ Y = YMin;
+ Z = ZMax;
+ break;
+
+ case 2 :
+ X = X2Min;
+ Y = YMax;
+ Z = Z2Min;
+ break;
+
+ case 3 :
+ X = X2Min;
+ Y = YMax;
+ Z = Z2Max;
+ break;
+
+ case 4 :
+ X = XMax;
+ Y = YMin;
+ Z = ZMin;
+ break;
+
+ case 5 :
+ X = XMax;
+ Y = YMin;
+ Z = ZMax;
+ break;
+
+ case 6 :
+ X = X2Max;
+ Y = YMax;
+ Z = Z2Min;
+ break;
+
+ case 7 :
+ X = X2Max;
+ Y = YMax;
+ Z = Z2Max;
+ break;
+
+ };
+
+ gp_Pnt P = myAxes.Location();
+ P.Translate(X*gp_Vec(myAxes.XDirection()));
+ P.Translate(Y*gp_Vec(myAxes.YDirection()));
+ P.Translate(Z*gp_Vec(myAxes.Direction ()));
+ return P;
+}
+
+//=======================================================================
+//function : Vertex
+//purpose : trivial
+//=======================================================================
+
+const TopoDS_Vertex& BRepPrim_GWedge::Vertex
+ (const BRepPrim_Direction d1,
+ const BRepPrim_Direction d2,
+ const BRepPrim_Direction d3)
+{
+ if (!HasVertex(d1,d2,d3)) Standard_DomainError::Raise();
+
+ Standard_Integer i = BRepPrim_Wedge_NumDir3(d1,d2,d3);
+
+ if (!VerticesBuilt[i]) {
+
+ myBuilder.MakeVertex(myVertices[i],Point(d1,d2,d3));
+
+ if ( Z2Max == Z2Min ) {
+ if ( i == 2 || i == 6 ) {
+ myVertices[3] = myVertices[2];
+ myVertices[7] = myVertices[6];
+ VerticesBuilt[3] = Standard_True;
+ VerticesBuilt[7] = Standard_True;
+ }
+ else if ( i == 3 || i == 7 ) {
+ myVertices[2] = myVertices[3];
+ myVertices[6] = myVertices[7];
+ VerticesBuilt[2] = Standard_True;
+ VerticesBuilt[6] = Standard_True;
+ }
+ }
+ if ( X2Max == X2Min ) {
+ if ( i == 2 || i == 3 ) {
+ myVertices[6] = myVertices[2];
+ myVertices[7] = myVertices[3];
+ VerticesBuilt[6] = Standard_True;
+ VerticesBuilt[7] = Standard_True;
+ }
+ else if ( i == 6 || i == 7 ) {
+ myVertices[2] = myVertices[6];
+ myVertices[3] = myVertices[7];
+ VerticesBuilt[2] = Standard_True;
+ VerticesBuilt[3] = Standard_True;
+ }
+ }
+
+ VerticesBuilt[i] = Standard_True;
+ }
+
+ return myVertices[i];
+
+}
+
--- /dev/null
+-- Created on: 1991-07-23
+-- Created by: Christophe MARION
+-- Copyright (c) 1991-1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+deferred class OneAxis from BRepPrim
+
+ ---Purpose: Algorithm to build primitives with one axis of
+ -- revolution.
+ --
+ -- The revolution body is described by :
+ --
+ -- A coordinate system (Ax2 from gp). The Z axis is
+ -- the rotational axis.
+ --
+ -- An Angle around the Axis, When the Angle is 2*PI
+ -- the primitive is not limited by planar faces. The
+ -- U parameter range from 0 to Angle.
+ --
+ -- A parameter range VMin, VMax on the meridian.
+ --
+ -- A meridian : The meridian is a curve described by
+ -- a set of deferred methods.
+ --
+ --
+ -- The topology consists of A shell, Faces, Wires,
+ -- Edges and Vertices. Methods are provided to build
+ -- all the elements. Building an element implies the
+ -- automatic building of all its sub-elements.
+ --
+ -- So building the shell builds everything.
+ --
+ -- There are at most 5 faces :
+ --
+ -- - The LateralFace.
+ --
+ -- - The TopFace and the BottomFace.
+ --
+ -- - The StartFace and the EndFace.
+ --
+
+
+
+uses
+ Ax2 from gp,
+ Pnt2d from gp,
+ Shell from TopoDS,
+ Face from TopoDS,
+ Wire from TopoDS,
+ Edge from TopoDS,
+ Vertex from TopoDS,
+ Builder from BRepPrim
+
+raises
+ DomainError,
+ OutOfRange
+
+is
+ Delete(me:out) is virtual ;
+ ---C++: alias ~
+
+ Initialize(B : Builder from BRepPrim;
+ A : Ax2 from gp;
+ VMin, VMax : Real from Standard);
+ ---Purpose: Creates a OneAxis algorithm. <B> is used to build
+ -- the Topology. The angle defaults to 2*PI.
+
+
+ SetMeridianOffset(me: in out;MeridianOffset : Real from Standard = 0)
+ ---Purpose: The MeridianOffset is added to the parameters on
+ -- the meridian curve and to the V values of the
+ -- pcurves. This is used for the sphere for example,
+ -- to give a range on the meridian edge which is not
+ -- VMin, VMax.
+ is static;
+
+ Axes(me) returns Ax2 from gp
+ ---Purpose: Returns the Ax2 from <me>.
+ ---C++: return const &
+ is static;
+
+ Axes(me : in out; A : Ax2 from gp)
+ raises DomainError -- when some topology has been built or A > 2*PI
+ is static;
+
+ Angle(me) returns Real
+ is static;
+
+ Angle(me : in out; A : Real)
+ raises DomainError -- when some topology has been built or A > 2*PI
+ is static;
+
+ VMin(me) returns Real
+ is static;
+
+ VMin(me : in out; V : Real)
+ raises DomainError -- when some topology has been built
+ is static;
+
+ VMax(me) returns Real
+ is static;
+
+ VMax(me : in out; V : Real)
+ raises DomainError -- when some topology has been built
+ is static;
+
+ --
+ -- Methods to describe the meridian
+ -- They should be redefined in inherited classes
+ --
+
+ MakeEmptyLateralFace(me) returns Face from TopoDS
+ ---Purpose: Returns a face with no edges. The surface is the
+ -- lateral surface with normals pointing outward. The
+ -- U parameter is the angle with the origin on the X
+ -- axis. The V parameter is the parameter of the
+ -- meridian.
+ is deferred;
+
+ 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 deferred;
+
+ SetMeridianPCurve(me; E : in out Edge from TopoDS; F : Face from TopoDS)
+ ---Purpose: Sets the parametric curve of the edge <E> in the
+ -- face <F> to be the 2d representation of the
+ -- meridian.
+ is deferred;
+
+ MeridianValue(me; V : Real) returns Pnt2d from gp
+ ---Purpose: Returns the meridian point at parameter <V> in the
+ -- plane XZ.
+ is deferred;
+
+ MeridianOnAxis(me; V : Real) returns Boolean
+ ---Purpose: Returns True if the point of parameter <V> on the
+ -- meridian is on the Axis. Default implementation is
+ -- Abs(MeridianValue(V).X()) < Precision::Confusion()
+ is virtual;
+
+ MeridianClosed(me) returns Boolean
+ ---Purpose: Returns True if the meridian is closed. Default
+ -- implementation is
+ -- MeridianValue(VMin).IsEqual(MeridianValue(VMax),
+ -- Precision::Confusion())
+ is virtual;
+
+ VMaxInfinite(me) returns Boolean
+ ---Purpose: Returns True if VMax is infinite. Default
+ -- Precision::IsPositiveInfinite(VMax);
+ is virtual;
+
+ VMinInfinite(me) returns Boolean
+ ---Purpose: Returns True if VMin is infinite. Default
+ -- Precision::IsNegativeInfinite(VMax);
+ is virtual;
+
+
+ -- Usefull booleans
+
+ HasTop(me) returns Boolean
+ ---Purpose: Returns True if there is a top face.
+ --
+ -- That is neither : VMaxInfinite()
+ -- MeridianClosed()
+ -- MeridianOnAxis(VMax)
+ is virtual;
+
+ HasBottom(me) returns Boolean
+ ---Purpose: Returns True if there is a bottom face.
+ --
+ -- That is neither : VMinInfinite()
+ -- MeridianClosed()
+ -- MeridianOnAxis(VMin)
+ is virtual;
+
+ HasSides(me) returns Boolean
+ ---Purpose: Returns True if there are Start and End faces.
+ --
+ -- That is : 2*PI - Angle > Precision::Angular()
+ is virtual;
+
+
+ --
+ -- Methods to get the Topology of:
+ --
+
+ -- the shell
+ Shell(me : in out) returns Shell from TopoDS
+ ---Purpose: Returns the Shell containing all the Faces of the
+ -- primitive.
+ --
+ ---C++: return const &
+ is static;
+
+ -- the Faces
+
+ LateralFace(me : in out) returns Face from TopoDS
+ ---Purpose: Returns the lateral Face. It is oriented toward
+ -- the outside of the primitive.
+ --
+ ---C++: return const &
+ is static;
+
+ TopFace(me : in out) returns Face from TopoDS
+ ---Purpose: Returns the top planar Face. It is Oriented
+ -- toward the +Z axis (outside).
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasTop()
+ is static;
+
+ BottomFace(me : in out) returns Face from TopoDS
+ ---Purpose: Returns the Bottom planar Face. It is Oriented
+ -- toward the -Z axis (outside).
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasBottom()
+ is static;
+
+ StartFace(me : in out) returns Face from TopoDS
+ ---Purpose: Returns the Face starting the slice, it is
+ -- oriented toward the exterior of the primitive.
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasSides()
+ is static;
+
+ EndFace(me : in out) returns Face from TopoDS
+ ---Purpose: Returns the Face ending the slice, it is oriented
+ -- toward the exterior of the primitive.
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasSides()
+ is static;
+
+ -- Wires
+
+ LateralWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the wire in the lateral face.
+ --
+ ---C++: return const &
+ raises DomainError -- if VMinInfinite() && VMaxInfinite()
+ is static;
+
+ LateralStartWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the wire in the lateral face with the
+ -- start edge.
+ --
+ ---C++: return const &
+ raises DomainError -- if ! (VMinInfinite() && VMaxInfinite())
+ is static;
+
+ LateralEndWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the wire with in lateral face with the end
+ -- edge.
+ --
+ ---C++: return const &
+ raises DomainError -- if ! (VMinInfinite() && VMaxInfinite())
+ is static;
+
+ TopWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the wire in the top face.
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasTop()
+ is static;
+
+ BottomWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the wire in the bottom face.
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasBottom()
+ is static;
+
+ StartWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the wire in the start face.
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasSides()
+ is static;
+
+ AxisStartWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the wire in the start face with the
+ -- AxisEdge.
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasSides() ! (VMinInfinite() && VMaxInfinite())
+ is static;
+
+ EndWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the Wire in the end face.
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasSides()
+ is static;
+
+ AxisEndWire(me : in out) returns Wire from TopoDS
+ ---Purpose: Returns the Wire in the end face with the
+ -- AxisEdge.
+ --
+ ---C++: return const &
+ raises DomainError -- if !HasSides() ! (VMinInfinite() && VMaxInfinite())
+ is static;
+
+
+ -- Edges
+
+ AxisEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the Edge built along the Axis and oriented
+ -- on +Z of the Axis.
+ --
+ ---C++: return const &
+ raises DomainError -- if ! (MeridianOnAxis(VMin) || MeridianOnAxis(VMax))
+ is static;
+
+ StartEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the Edge at angle 0.
+ --
+ ---C++: return const &
+ is static;
+
+ EndEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the Edge at angle Angle. If !HasSides()
+ -- the StartEdge and the EndEdge are the same edge.
+ --
+ ---C++: return const &
+ is static;
+
+ StartTopEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the linear Edge between start Face and top
+ -- Face.
+ --
+ ---C++: return const &
+ raises DomainError -- if ! (HasTop() && HasSides())
+ is static;
+
+ StartBottomEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the linear Edge between start Face and
+ -- bottom Face.
+ --
+ ---C++: return const &
+ raises DomainError -- if ! (HasBottom() && HasSides())
+ is static;
+
+ EndTopEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the linear Edge between end Face and top
+ -- Face.
+ --
+ ---C++: return const &
+ raises DomainError -- if ! (HasTop() && HasSides())
+ is static;
+
+ EndBottomEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the linear Edge between end Face and
+ -- bottom Face.
+ --
+ ---C++: return const &
+ raises DomainError -- if ! (HasBottom() && HasSides())
+ is static;
+
+ TopEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the edge at VMax. If MeridianClosed() the
+ -- TopEdge and the BottomEdge are the same edge.
+ --
+ ---C++: return const &
+ raises DomainError -- if VMaxInfinite()
+ is static;
+
+ BottomEdge(me : in out) returns Edge from TopoDS
+ ---Purpose: Returns the edge at VMin. If MeridianClosed() the
+ -- TopEdge and the BottomEdge are the same edge.
+ --
+ ---C++: return const &
+ raises DomainError -- if VMinInfinite()
+ is static;
+
+ -- Vertices
+
+ AxisTopVertex(me : in out) returns Vertex from TopoDS
+ ---Purpose: Returns the Vertex at the Top altitude on the axis.
+ --
+ ---C++: return const &
+ raises DomainError -- if !MeridianOnAxis(VMax)
+ is static;
+
+ AxisBottomVertex(me : in out) returns Vertex from TopoDS
+ ---Purpose: Returns the Vertex at the Bottom altitude on the
+ -- axis.
+ --
+ ---C++: return const &
+ raises DomainError -- if !MeridianOnAxis(VMin)
+ is static;
+
+ TopStartVertex(me : in out) returns Vertex from TopoDS
+ ---Purpose: Returns the vertex (0,VMax)
+ --
+ ---C++: return const &
+ raises DomainError -- if VMaxInfinite()
+ is static;
+
+ TopEndVertex(me : in out) returns Vertex from TopoDS
+ ---Purpose: Returns the vertex (angle,VMax)
+ --
+ ---C++: return const &
+ raises DomainError -- if VMaxInfinite()
+ is static;
+
+ BottomStartVertex(me : in out) returns Vertex from TopoDS
+ ---Purpose: Returns the vertex (0,VMin)
+ --
+ ---C++: return const &
+ raises DomainError -- if VMinInfinite()
+ is static;
+
+ BottomEndVertex(me : in out) returns Vertex from TopoDS
+ ---Purpose: Returns the vertex (angle,VMax)
+ --
+ ---C++: return const &
+ raises DomainError -- if VMinInfinite()
+ is static;
+
+fields
+ myBuilder : Builder from BRepPrim is protected;
+ myAxes : Ax2 from gp;
+
+ myAngle : Real from Standard;
+ myVMin : Real from Standard;
+ myVMax : Real from Standard;
+ myMeridianOffset : Real from Standard;
+
+ -- the Topology
+
+ myShell : Shell from TopoDS;
+ ShellBuilt : Boolean;
+
+ myVertices : Vertex from TopoDS [6];
+ -- 0 : Vertex on top of the axis
+ -- 1 : on bottom of the axis
+ -- 2 : top, start
+ -- 3 : top, end
+ -- 4 : bottom, start
+ -- 5 : bottom, end
+ VerticesBuilt : Boolean [6];
+
+ myEdges : Edge from TopoDS [9];
+ -- 0 : Edge on the Axis
+ -- 1 : Start Edge
+ -- 2 : End Edge
+ -- 3 : Start Top
+ -- 4 : Start Bottom
+ -- 5 : End Top
+ -- 6 : End Bottom
+ -- 7 : Top
+ -- 8 : Bottom
+ EdgesBuilt : Boolean [9];
+
+ myWires : Wire from TopoDS [9];
+ -- 0 : wire Lateral
+ -- 1 : Lateral Start
+ -- 2 : Lateral End
+ -- 3 : Top
+ -- 4 : Bottom
+ -- 5 : Start
+ -- 6 : Axis Start
+ -- 7 : End
+ -- 8 : Axis End
+ WiresBuilt : Boolean [9];
+
+ myFaces : Face from TopoDS [5];
+ -- 0 : Lateral Face
+ -- 1 : Top
+ -- 2 : Bottom
+ -- 3 : Start
+ -- 4 : End
+ FacesBuilt : Boolean [5];
+
+
+end OneAxis;
--- /dev/null
+// Created on: 1991-07-24
+// Created by: Christophe MARION
+// Copyright (c) 1991-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BRepPrim_OneAxis.ixx>
+
+#include <Precision.hxx>
+
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <BRepPrim_Builder.hxx>
+#include <BRepPrim_Direction.hxx>
+
+#include <gp_Pln.hxx>
+#include <gp_Lin2d.hxx>
+#include <gp_Circ2d.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Circ.hxx>
+#include <gp_Vec.hxx>
+
+#include <Standard_DomainError.hxx>
+#include <Standard_OutOfRange.hxx>
+
+#undef Standard_True
+#undef Standard_False
+
+#define Standard_True ((Standard_Boolean) 1)
+#define Standard_False ((Standard_Boolean) 0)
+
+
+#define NBVERTICES 6
+#define VAXISTOP 0
+#define VAXISBOT 1
+#define VTOPSTART 2
+#define VTOPEND 3
+#define VBOTSTART 4
+#define VBOTEND 5
+#define NBEDGES 9
+#define EAXIS 0
+#define ESTART 1
+#define EEND 2
+#define ETOPSTART 3
+#define ETOPEND 4
+#define EBOTSTART 5
+#define EBOTEND 6
+#define ETOP 7
+#define EBOTTOM 8
+#define NBWIRES 9
+#define WLATERAL 0
+#define WLATERALSTART 0
+#define WLATERALEND 1
+#define WTOP 2
+#define WBOTTOM 3
+#define WSTART 5
+#define WAXISSTART 6
+#define WEND 7
+#define WAXISEND 8
+#define NBFACES 5
+#define FLATERAL 0
+#define FTOP 1
+#define FBOTTOM 2
+#define FSTART 3
+#define FEND 4
+
+//=======================================================================
+//function : BRepPrim_OneAxis_Check
+//purpose : raise Standard_DomainError if something was built
+//=======================================================================
+
+static void BRepPrim_OneAxis_Check(const Standard_Boolean V[],
+ const Standard_Boolean E[],
+ const Standard_Boolean W[],
+ const Standard_Boolean F[])
+{
+ Standard_Integer i;
+ for (i = 0; i < NBVERTICES; i++)
+ if (V[i]) Standard_DomainError::Raise();
+ for (i = 0; i < NBEDGES; i++)
+ if (E[i]) Standard_DomainError::Raise();
+ for (i = 0; i < NBWIRES; i++)
+ if (W[i]) Standard_DomainError::Raise();
+ for (i = 0; i < NBFACES; i++)
+ if (F[i]) Standard_DomainError::Raise();
+}
+
+//=======================================================================
+//function : BRepPrim_OneAxis
+//purpose :
+//=======================================================================
+
+BRepPrim_OneAxis::BRepPrim_OneAxis(const BRepPrim_Builder& B,
+ const gp_Ax2& A,
+ const Standard_Real VMin,
+ const Standard_Real VMax) :
+ myBuilder(B),
+ myAxes(A),
+ myAngle(2*M_PI),
+ myVMin(VMin),
+ myVMax(VMax),
+ myMeridianOffset(0)
+
+{
+ // init Built flags
+ Standard_Integer i;
+ ShellBuilt = Standard_False;
+ for (i = 0; i < NBVERTICES; i++)
+ VerticesBuilt[i] = Standard_False;
+ for (i = 0; i < NBEDGES; i++)
+ EdgesBuilt[i] = Standard_False;
+ for (i = 0; i < NBWIRES; i++)
+ WiresBuilt[i] = Standard_False;
+ for (i = 0; i < NBFACES; i++)
+ FacesBuilt[i] = Standard_False;
+
+}
+
+void BRepPrim_OneAxis::Delete()
+{}
+
+//=======================================================================
+//function : SetMeridianOffset
+//purpose :
+//=======================================================================
+
+void BRepPrim_OneAxis::SetMeridianOffset(const Standard_Real O)
+{
+ myMeridianOffset = O;
+}
+
+//=======================================================================
+//function : Axes, Angle, VMin, VMax
+//purpose :
+//=======================================================================
+
+const gp_Ax2& BRepPrim_OneAxis::Axes () const
+{
+ return myAxes;
+}
+
+void BRepPrim_OneAxis::Axes (const gp_Ax2& A)
+{
+ BRepPrim_OneAxis_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
+ myAxes = A;
+}
+
+Standard_Real BRepPrim_OneAxis::Angle () const
+{
+ return myAngle;
+}
+
+void BRepPrim_OneAxis::Angle (const Standard_Real A)
+{
+ BRepPrim_OneAxis_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
+ myAngle = A;
+}
+
+Standard_Real BRepPrim_OneAxis::VMin () const
+{
+ return myVMin;
+}
+
+void BRepPrim_OneAxis::VMin (const Standard_Real V)
+{
+ BRepPrim_OneAxis_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
+ myVMin = V;
+}
+
+Standard_Real BRepPrim_OneAxis::VMax () const
+{
+ return myVMax;
+}
+
+void BRepPrim_OneAxis::VMax (const Standard_Real V)
+{
+ BRepPrim_OneAxis_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
+ myVMax = V;
+}
+
+//=======================================================================
+//function : MeridianOnAxis
+//purpose :
+//=======================================================================
+
+Standard_Boolean BRepPrim_OneAxis::MeridianOnAxis
+ (const Standard_Real V) const
+{
+ return Abs(MeridianValue(V).X()) < Precision::Confusion();
+}
+
+//=======================================================================
+//function : MeridianClosed
+//purpose :
+//=======================================================================
+
+Standard_Boolean BRepPrim_OneAxis::MeridianClosed() const
+{
+ if (VMaxInfinite()) return Standard_False;
+ if (VMinInfinite()) return Standard_False;
+ return MeridianValue(myVMin).IsEqual(MeridianValue(myVMax),
+ Precision::Confusion());
+}
+
+//=======================================================================
+//function : VMaxInfinite
+//purpose :
+//=======================================================================
+
+Standard_Boolean BRepPrim_OneAxis::VMaxInfinite() const
+{
+ return Precision::IsPositiveInfinite(myVMax);
+}
+
+//=======================================================================
+//function : VMinInfinite
+//purpose :
+//=======================================================================
+
+Standard_Boolean BRepPrim_OneAxis::VMinInfinite() const
+{
+ return Precision::IsNegativeInfinite(myVMin);
+}
+
+//=======================================================================
+//function : HasTop
+//purpose :
+//=======================================================================
+
+Standard_Boolean BRepPrim_OneAxis::HasTop() const
+{
+ if (VMaxInfinite()) return Standard_False;
+ if (MeridianClosed()) return Standard_False;
+ if (MeridianOnAxis(myVMax)) return Standard_False;
+ return Standard_True;
+}
+
+//=======================================================================
+//function : HasBottom
+//purpose :
+//=======================================================================
+
+Standard_Boolean BRepPrim_OneAxis::HasBottom() const
+{
+ if (VMinInfinite()) return Standard_False;
+ if (MeridianClosed()) return Standard_False;
+ if (MeridianOnAxis(myVMin)) return Standard_False;
+ return Standard_True;
+}
+
+//=======================================================================
+//function : HasSides
+//purpose :
+//=======================================================================
+
+Standard_Boolean BRepPrim_OneAxis::HasSides() const
+{
+ return 2*M_PI - myAngle > Precision::Angular();
+}
+
+//=======================================================================
+//function : Shell
+//purpose :
+//=======================================================================
+
+const TopoDS_Shell& BRepPrim_OneAxis::Shell()
+{
+ if (!ShellBuilt) {
+ myBuilder.MakeShell(myShell);
+
+ myBuilder.AddShellFace(myShell,LateralFace());
+ if (HasTop())
+ myBuilder.AddShellFace(myShell,TopFace());
+ if (HasBottom())
+ myBuilder.AddShellFace(myShell,BottomFace());
+ if (HasSides()) {
+ myBuilder.AddShellFace(myShell,StartFace());
+ myBuilder.AddShellFace(myShell,EndFace());
+ }
+
+ myBuilder.CompleteShell(myShell);
+ ShellBuilt = Standard_True;
+ }
+ return myShell;
+}
+
+//=======================================================================
+//function : LateralFace
+//purpose : build the lateral face
+//=======================================================================
+
+const TopoDS_Face& BRepPrim_OneAxis::LateralFace ()
+{
+ // do it if not done
+ if (!FacesBuilt[FLATERAL]) {
+
+ // build an empty lateral face
+ myFaces[FLATERAL] = MakeEmptyLateralFace();
+
+ // add the wires
+ if (VMaxInfinite() && VMinInfinite()) {
+ myBuilder.AddFaceWire(myFaces[FLATERAL],LateralStartWire());
+ myBuilder.AddFaceWire(myFaces[FLATERAL],LateralEndWire());
+ }
+ else
+ myBuilder.AddFaceWire(myFaces[FLATERAL],LateralWire());
+
+ // put the parametric curves
+ if (MeridianClosed()) {
+ // closed edge
+ myBuilder.SetPCurve(myEdges[ETOP],myFaces[FLATERAL],
+ gp_Lin2d(gp_Pnt2d(0,myVMin),gp_Dir2d(1,0)),
+ gp_Lin2d(gp_Pnt2d(0,myVMax),gp_Dir2d(1,0)));
+ }
+ else {
+ if (!VMaxInfinite()) {
+ myBuilder.SetPCurve(myEdges[ETOP],myFaces[FLATERAL],
+ gp_Lin2d(gp_Pnt2d(0,myVMax),gp_Dir2d(1,0)));
+ if (!HasSides() || MeridianOnAxis(myVMax)) {
+ // closed edge set parameters
+ myBuilder.SetParameters(myEdges[ETOP],
+ TopEndVertex(),
+ 0.,myAngle);
+ }
+ }
+ if (!VMinInfinite()) {
+ myBuilder.SetPCurve(myEdges[EBOTTOM],myFaces[FLATERAL],
+ gp_Lin2d(gp_Pnt2d(0,myVMin),gp_Dir2d(1,0)));
+ if (!HasSides() || MeridianOnAxis(myVMin)) {
+ // closed edge set parameters
+ myBuilder.SetParameters(myEdges[EBOTTOM],
+ BottomEndVertex(),
+ 0.,myAngle);
+ }
+ }
+ }
+ if (HasSides()) {
+ myBuilder.SetPCurve(myEdges[ESTART],myFaces[FLATERAL],
+ gp_Lin2d(gp_Pnt2d(0,-myMeridianOffset),
+ gp_Dir2d(0,1)));
+
+ myBuilder.SetPCurve(myEdges[EEND],myFaces[FLATERAL],
+ gp_Lin2d(gp_Pnt2d(myAngle,-myMeridianOffset),
+ gp_Dir2d(0,1)));
+ }
+ else {
+ // closed edge
+ myBuilder.SetPCurve(myEdges[ESTART],myFaces[FLATERAL],
+ gp_Lin2d(gp_Pnt2d(myAngle,-myMeridianOffset),
+ gp_Dir2d(0,1)),
+ gp_Lin2d(gp_Pnt2d(0,-myMeridianOffset),
+ gp_Dir2d(0,1)));
+ }
+ myBuilder.CompleteFace(myFaces[FLATERAL]);
+ FacesBuilt[FLATERAL] = Standard_True;
+ }
+ return myFaces[FLATERAL];
+}
+
+//=======================================================================
+//function : TopFace
+//purpose : build and return the TopFace
+//=======================================================================
+
+const TopoDS_Face& BRepPrim_OneAxis::TopFace ()
+{
+ // do it if not done
+ if (!FacesBuilt[FTOP]) {
+
+ Standard_DomainError_Raise_if(!HasTop(),
+ "BRepPrim_OneAxis::TopFace:No top face");
+
+ // make the empty face by translating the axes
+ Standard_Real z = MeridianValue(myVMax).Y();
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(z);
+ myBuilder.MakeFace(myFaces[FTOP],gp_Pln(myAxes.Translated(V)));
+
+ myBuilder.AddFaceWire(myFaces[FTOP],TopWire());
+
+ // put the parametric curves
+ myBuilder.SetPCurve(myEdges[ETOP],myFaces[FTOP],
+ gp_Circ2d(gp_Ax2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)),
+ MeridianValue(myVMax).X()));
+ if (HasSides()) {
+ myBuilder.SetPCurve(myEdges[ETOPSTART],myFaces[FTOP],
+ gp_Lin2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)));
+ myBuilder.SetPCurve(myEdges[ETOPEND],myFaces[FTOP],
+ gp_Lin2d(gp_Pnt2d(0,0),
+ gp_Dir2d(Cos(myAngle),Sin(myAngle))));
+ }
+
+ myBuilder.CompleteFace(myFaces[FTOP]);
+ FacesBuilt[FTOP] = Standard_True;
+ }
+
+ return myFaces[FTOP];
+}
+
+//=======================================================================
+//function : BottomFace
+//purpose :
+//=======================================================================
+
+const TopoDS_Face& BRepPrim_OneAxis::BottomFace ()
+{
+ // do it if not done
+ if (!FacesBuilt[FBOTTOM]) {
+
+ Standard_DomainError_Raise_if(!HasBottom(),
+ "BRepPrim_OneAxis::BottomFace:No bottom face");
+
+ // make the empty face by translating the axes
+ Standard_Real z = MeridianValue(myVMin).Y();
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(z);
+ gp_Ax2 axes = myAxes.Translated(V);
+ myBuilder.MakeFace(myFaces[FBOTTOM],gp_Pln(axes));
+ myBuilder.ReverseFace(myFaces[FBOTTOM]);
+ myBuilder.AddFaceWire(myFaces[FBOTTOM],BottomWire());
+
+ // put the parametric curves
+ myBuilder.SetPCurve(myEdges[EBOTTOM],myFaces[FBOTTOM],
+ gp_Circ2d(gp_Ax2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)),
+ MeridianValue(myVMin).X()));
+ if (HasSides()) {
+ myBuilder.SetPCurve(myEdges[EBOTSTART],myFaces[FBOTTOM],
+ gp_Lin2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)));
+ myBuilder.SetPCurve(myEdges[EBOTEND],myFaces[FBOTTOM],
+ gp_Lin2d(gp_Pnt2d(0,0),
+ gp_Dir2d(Cos(myAngle),Sin(myAngle))));
+ }
+
+ myBuilder.CompleteFace(myFaces[FBOTTOM]);
+ FacesBuilt[FBOTTOM] = Standard_True;
+ }
+
+ return myFaces[FBOTTOM];
+}
+
+//=======================================================================
+//function : StartFace
+//purpose :
+//=======================================================================
+
+const TopoDS_Face& BRepPrim_OneAxis::StartFace ()
+{
+ // do it if not done
+ if (!FacesBuilt[FSTART]) {
+
+ Standard_DomainError_Raise_if(!HasSides(),
+ "BRepPrim_OneAxes::StartFace:No side faces");
+
+ // build the empty face, perpendicular to myTool.Axes()
+ gp_Ax2 axes(myAxes.Location(),myAxes.YDirection().Reversed(),myAxes.XDirection());
+ myBuilder.MakeFace(myFaces[FSTART],gp_Pln(axes));
+
+
+ if (VMaxInfinite() && VMinInfinite())
+ myBuilder.AddFaceWire(myFaces[FSTART],AxisStartWire());
+
+ myBuilder.AddFaceWire(myFaces[FSTART],StartWire());
+
+ // parametric curves
+ SetMeridianPCurve(myEdges[ESTART],myFaces[FSTART]);
+ if (EdgesBuilt[EAXIS])
+ myBuilder.SetPCurve(myEdges[EAXIS],myFaces[FSTART],
+ gp_Lin2d(gp_Pnt2d(0,0),gp_Dir2d(0,1)));
+ if (EdgesBuilt[ETOPSTART])
+ myBuilder.SetPCurve(myEdges[ETOPSTART],myFaces[FSTART],
+ gp_Lin2d(gp_Pnt2d(0,MeridianValue(myVMax).Y()),gp_Dir2d(1,0)));
+ if (EdgesBuilt[EBOTSTART])
+ myBuilder.SetPCurve(myEdges[EBOTSTART],myFaces[FSTART],
+ gp_Lin2d(gp_Pnt2d(0,MeridianValue(myVMin).Y()),gp_Dir2d(1,0)));
+
+
+ myBuilder.CompleteFace(myFaces[FSTART]);
+ FacesBuilt[FSTART] = Standard_True;
+ }
+
+ return myFaces[FSTART];
+}
+
+//=======================================================================
+//function : EndFace
+//purpose :
+//=======================================================================
+
+const TopoDS_Face& BRepPrim_OneAxis::EndFace ()
+{
+ // do it if not done
+ if (!FacesBuilt[FEND]) {
+
+ Standard_DomainError_Raise_if(!HasSides(),
+ "BRepPrim_OneAxes::EndFace:No side faces");
+
+ // build the empty face, perpendicular to myTool.Axes()
+ gp_Ax2 axes(myAxes.Location(),myAxes.YDirection().Reversed(),myAxes.XDirection());
+ axes.Rotate(myAxes.Axis(),myAngle);
+ myBuilder.MakeFace(myFaces[FEND],gp_Pln(axes));
+ myBuilder.ReverseFace(myFaces[FEND]);
+
+ if (VMaxInfinite() && VMinInfinite())
+ myBuilder.AddFaceWire(myFaces[FEND],AxisEndWire());
+ myBuilder.AddFaceWire(myFaces[FEND],EndWire());
+
+ // parametric curves
+ SetMeridianPCurve(myEdges[EEND],myFaces[FEND]);
+ if (EdgesBuilt[EAXIS])
+ myBuilder.SetPCurve(myEdges[EAXIS],myFaces[FEND],
+ gp_Lin2d(gp_Pnt2d(0,0),gp_Dir2d(0,1)));
+ if (EdgesBuilt[ETOPEND])
+ myBuilder.SetPCurve(myEdges[ETOPEND],myFaces[FEND],
+ gp_Lin2d(gp_Pnt2d(0,MeridianValue(myVMax).Y()),
+ gp_Dir2d(1,0)));
+ if (EdgesBuilt[EBOTEND])
+ myBuilder.SetPCurve(myEdges[EBOTEND],myFaces[FEND],
+ gp_Lin2d(gp_Pnt2d(0,MeridianValue(myVMin).Y()),
+ gp_Dir2d(1,0)));
+
+ myBuilder.CompleteFace(myFaces[FEND]);
+ FacesBuilt[FEND] = Standard_True;
+ }
+
+ return myFaces[FEND];
+}
+
+//=======================================================================
+//function : LateralWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::LateralWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WLATERAL]) {
+
+ myBuilder.MakeWire(myWires[WLATERAL]);
+
+ if (!VMaxInfinite())
+ myBuilder.AddWireEdge(myWires[WLATERAL],TopEdge() ,Standard_False);
+ myBuilder.AddWireEdge( myWires[WLATERAL],EndEdge() ,Standard_True);
+ if (!VMinInfinite())
+ myBuilder.AddWireEdge(myWires[WLATERAL],BottomEdge() ,Standard_True);
+ myBuilder.AddWireEdge( myWires[WLATERAL],StartEdge() ,Standard_False);
+
+ myBuilder.CompleteWire(myWires[WLATERAL]);
+ WiresBuilt[WLATERAL] = Standard_True;
+ }
+
+ return myWires[WLATERAL];
+}
+
+
+//=======================================================================
+//function : LateralStartWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::LateralStartWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WLATERALSTART]) {
+
+ myBuilder.MakeWire(myWires[WLATERALSTART]);
+
+ myBuilder.AddWireEdge(myWires[WLATERALSTART],StartEdge(),Standard_False);
+
+ myBuilder.CompleteWire(myWires[WLATERALSTART]);
+ WiresBuilt[WLATERALSTART] = Standard_True;
+ }
+
+ return myWires[WLATERALSTART];
+}
+
+
+//=======================================================================
+//function : LateralEndWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::LateralEndWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WLATERALEND]) {
+
+ myBuilder.MakeWire(myWires[WLATERALEND]);
+
+ myBuilder.AddWireEdge(myWires[WLATERALEND],EndEdge(),Standard_True);
+
+ myBuilder.CompleteWire(myWires[WLATERALEND]);
+ WiresBuilt[WLATERALEND] = Standard_True;
+ }
+
+ return myWires[WLATERALEND];
+}
+
+//=======================================================================
+//function : TopWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::TopWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WTOP]) {
+
+ Standard_DomainError_Raise_if(!HasTop(),
+ "BRepPrim_OneAxis::TopWire: no top");
+
+ myBuilder.MakeWire(myWires[WTOP]);
+
+ myBuilder.AddWireEdge(myWires[WTOP],TopEdge() ,Standard_True);
+ if (HasSides()) {
+ myBuilder.AddWireEdge(myWires[WTOP],StartTopEdge() ,Standard_True);
+ myBuilder.AddWireEdge(myWires[WTOP],EndTopEdge() ,Standard_False);
+ }
+ myBuilder.CompleteWire(myWires[WTOP]);
+ WiresBuilt[WTOP] = Standard_True;
+ }
+
+ return myWires[WTOP];
+}
+
+//=======================================================================
+//function : BottomWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::BottomWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WBOTTOM]) {
+
+ Standard_DomainError_Raise_if(!HasBottom(),
+ "BRepPrim_OneAxis::BottomWire: no bottom");
+
+ myBuilder.MakeWire(myWires[WBOTTOM]);
+
+ myBuilder.AddWireEdge(myWires[WBOTTOM],BottomEdge() ,Standard_False);
+ if (HasSides()) {
+ myBuilder.AddWireEdge(myWires[WBOTTOM],EndBottomEdge() ,Standard_True);
+ myBuilder.AddWireEdge(myWires[WBOTTOM],StartBottomEdge(),Standard_False);
+ }
+
+ myBuilder.CompleteWire(myWires[WBOTTOM]);
+ WiresBuilt[WBOTTOM] = Standard_True;
+ }
+
+ return myWires[WBOTTOM];
+}
+
+//=======================================================================
+//function : StartWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::StartWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WSTART]) {
+
+ Standard_DomainError_Raise_if(!HasSides(),
+ "BRepPrim_OneAxes::StartWire:no sides");
+
+ myBuilder.MakeWire(myWires[WSTART]);
+
+ if (HasBottom())
+ myBuilder.AddWireEdge(myWires[WSTART],StartBottomEdge() ,Standard_True);
+
+ if (!MeridianClosed()) {
+ if (!VMaxInfinite() || !VMinInfinite())
+ myBuilder.AddWireEdge( myWires[WSTART],AxisEdge() ,Standard_False);
+ }
+
+ if (HasTop())
+ myBuilder.AddWireEdge(myWires[WSTART],StartTopEdge() ,Standard_False);
+ myBuilder.AddWireEdge( myWires[WSTART],StartEdge() ,Standard_True);
+
+ myBuilder.CompleteWire(myWires[WSTART]);
+ WiresBuilt[WSTART] = Standard_True;
+ }
+
+ return myWires[WSTART];
+}
+
+//=======================================================================
+//function : AxisStartWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::AxisStartWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WAXISSTART]) {
+
+ Standard_DomainError_Raise_if
+ (!HasSides(),
+ "BRepPrim_OneAxes::AxisStartWire:no sides");
+
+ Standard_DomainError_Raise_if
+ (!VMaxInfinite() || !VMinInfinite(),
+ "BRepPrim_OneAxes::AxisStartWire:not infinite");
+
+ Standard_DomainError_Raise_if
+ (MeridianClosed(),
+ "BRepPrim_OneAxes::AxisStartWire:meridian closed");
+
+ myBuilder.MakeWire(myWires[WAXISSTART]);
+
+ myBuilder.AddWireEdge( myWires[WAXISSTART],AxisEdge() ,Standard_False);
+
+ myBuilder.CompleteWire(myWires[WAXISSTART]);
+ WiresBuilt[WAXISSTART] = Standard_True;
+ }
+
+ return myWires[WAXISSTART];
+}
+
+//=======================================================================
+//function : EndWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::EndWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WEND]) {
+
+ Standard_DomainError_Raise_if(!HasSides(),
+ "BRepPrim_OneAxes::EndWire:no sides");
+
+ myBuilder.MakeWire(myWires[WEND]);
+
+ if (HasTop())
+ myBuilder.AddWireEdge(myWires[WEND],EndTopEdge(), Standard_True);
+ if (!MeridianClosed()) {
+ if (!VMaxInfinite() || !VMinInfinite()) {
+ myBuilder.AddWireEdge( myWires[WEND],AxisEdge(), Standard_True);
+ }
+ }
+ if (HasBottom())
+ myBuilder.AddWireEdge(myWires[WEND],EndBottomEdge(), Standard_False);
+ myBuilder.AddWireEdge( myWires[WEND],EndEdge(), Standard_False);
+
+ myBuilder.CompleteWire(myWires[WEND]);
+ WiresBuilt[WEND] = Standard_True;
+ }
+ return myWires[WEND];
+}
+
+//=======================================================================
+//function : AxisEndWire
+//purpose :
+//=======================================================================
+
+const TopoDS_Wire& BRepPrim_OneAxis::AxisEndWire ()
+{
+ // do it if not done
+ if (!WiresBuilt[WAXISEND]) {
+
+ Standard_DomainError_Raise_if
+ (!HasSides(),
+ "BRepPrim_OneAxes::AxisEndWire:no sides");
+
+ Standard_DomainError_Raise_if
+ (!VMaxInfinite() || !VMinInfinite(),
+ "BRepPrim_OneAxes::AxisEndWire:not infinite");
+
+ Standard_DomainError_Raise_if
+ (MeridianClosed(),
+ "BRepPrim_OneAxes::AxisEndWire:meridian closed");
+
+ myBuilder.MakeWire(myWires[WAXISEND]);
+
+ myBuilder.AddWireEdge( myWires[WAXISEND],AxisEdge(), Standard_True);
+
+ myBuilder.CompleteWire(myWires[WAXISEND]);
+ WiresBuilt[WAXISEND] = Standard_True;
+ }
+ return myWires[WAXISEND];
+}
+
+//=======================================================================
+//function : AxisEdge
+//purpose : make the edge on the axis, oriented +Z
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::AxisEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[EAXIS]) {
+
+ Standard_DomainError_Raise_if(!HasSides(),
+ "BRepPrim_OneAxis::AxisEdge:no sides");
+ Standard_DomainError_Raise_if(MeridianClosed(),
+ "BRepPrim_OneAxis::AxisEdge:closed");
+
+ // build the empty edge.
+ myBuilder.MakeEdge(myEdges[EAXIS],gp_Lin(myAxes.Axis()));
+
+ if (!VMaxInfinite())
+ myBuilder.AddEdgeVertex(myEdges[EAXIS],AxisTopVertex(),
+ MeridianValue(myVMax).Y(),Standard_False);
+ if (!VMinInfinite())
+ myBuilder.AddEdgeVertex(myEdges[EAXIS],AxisBottomVertex(),
+ MeridianValue(myVMin).Y(),Standard_True);
+
+ myBuilder.CompleteEdge(myEdges[EAXIS]);
+ EdgesBuilt[EAXIS] = Standard_True;
+ }
+
+ return myEdges[EAXIS];
+}
+
+//=======================================================================
+//function : StartEdge
+//purpose :
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::StartEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[ESTART]) {
+
+ // is it shared with the EndEdge
+
+ if (!HasSides() && EdgesBuilt[EEND])
+ myEdges[ESTART] = myEdges[EEND];
+
+ else {
+ // build the empty Edge
+ myEdges[ESTART] = MakeEmptyMeridianEdge(0.);
+
+ if (MeridianClosed()) {
+ // Closed edge
+ myBuilder.AddEdgeVertex(myEdges[ESTART],
+ TopStartVertex(),
+ myVMin+myMeridianOffset,
+ myVMax+myMeridianOffset);
+ }
+ else {
+ if (!VMaxInfinite()) {
+ myBuilder.AddEdgeVertex(myEdges[ESTART],
+ TopStartVertex(),
+ myVMax+myMeridianOffset,
+ Standard_False);
+ }
+ if (!VMinInfinite()) {
+ myBuilder.AddEdgeVertex(myEdges[ESTART],
+ BottomStartVertex(),
+ myVMin+myMeridianOffset,
+ Standard_True);
+ }
+ }
+ }
+
+ myBuilder.CompleteEdge(myEdges[ESTART]);
+ EdgesBuilt[ESTART] = Standard_True;
+
+ }
+
+ return myEdges[ESTART];
+}
+
+//=======================================================================
+//function : EndEdge
+//purpose :
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::EndEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[EEND]) {
+
+ // is it shared with the start edge
+ if (!HasSides() && EdgesBuilt[ESTART])
+ myEdges[EEND] = myEdges[ESTART];
+
+ else {
+ // build the empty Edge
+ myEdges[EEND] = MakeEmptyMeridianEdge(myAngle);
+
+
+ if (MeridianClosed()) {
+ // Closed edge
+ myBuilder.AddEdgeVertex(myEdges[EEND],
+ TopEndVertex(),
+ myVMin+myMeridianOffset,
+ myVMax+myMeridianOffset);
+ }
+ else {
+ if (!VMaxInfinite()) {
+ myBuilder.AddEdgeVertex(myEdges[EEND],
+ TopEndVertex(),
+ myVMax+myMeridianOffset,
+ Standard_False);
+ }
+ if (!VMinInfinite()) {
+ myBuilder.AddEdgeVertex(myEdges[EEND],
+ BottomEndVertex(),
+ myVMin+myMeridianOffset,
+ Standard_True);
+ }
+ }
+ }
+
+ myBuilder.CompleteEdge(myEdges[EEND]);
+ EdgesBuilt[EEND] = Standard_True;
+
+ }
+
+ return myEdges[EEND];
+}
+
+//=======================================================================
+//function : StartTopEdge
+//purpose :
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::StartTopEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[ETOPSTART]) {
+
+ Standard_DomainError_Raise_if
+ (!HasTop() || !HasSides(),
+ "BRepPrim_OneAxis::StartTopEdge:no sides or no top");
+
+ // build the empty Edge
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(MeridianValue(myVMax).Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ myBuilder.MakeEdge(myEdges[ETOPSTART],gp_Lin(P,myAxes.XDirection()));
+
+ myBuilder.AddEdgeVertex(myEdges[ETOPSTART],AxisTopVertex(),
+ 0.,Standard_True);
+ myBuilder.AddEdgeVertex(myEdges[ETOPSTART],TopStartVertex(),
+ MeridianValue(myVMax).X(),Standard_False);
+
+ myBuilder.CompleteEdge(myEdges[ETOPSTART]);
+ EdgesBuilt[ETOPSTART] = Standard_True;
+ }
+
+ return myEdges[ETOPSTART];
+}
+
+//=======================================================================
+//function : StartBottomEdge
+//purpose :
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::StartBottomEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[EBOTSTART]) {
+
+ Standard_DomainError_Raise_if
+ (!HasBottom() || !HasSides(),
+ "BRepPrim_OneAxis::StartBottomEdge:no sides or no top");
+
+ // build the empty Edge
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(MeridianValue(myVMin).Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ myBuilder.MakeEdge(myEdges[EBOTSTART],gp_Lin(P,myAxes.XDirection()));
+
+ myBuilder.AddEdgeVertex(myEdges[EBOTSTART],BottomStartVertex(),
+ MeridianValue(myVMin).X(),Standard_False);
+ myBuilder.AddEdgeVertex(myEdges[EBOTSTART],AxisBottomVertex(),
+ 0.,Standard_True);
+
+ myBuilder.CompleteEdge(myEdges[EBOTSTART]);
+ EdgesBuilt[EBOTSTART] = Standard_True;
+ }
+
+ return myEdges[EBOTSTART];
+}
+
+//=======================================================================
+//function : EndTopEdge
+//purpose :
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::EndTopEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[ETOPEND]) {
+
+ Standard_DomainError_Raise_if
+ (!HasTop() || !HasSides(),
+ "BRepPrim_OneAxis::EndTopEdge:no sides or no top");
+
+ // build the empty Edge
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(MeridianValue(myVMax).Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ gp_Lin L(P,myAxes.XDirection());
+ L.Rotate(myAxes.Axis(),myAngle);
+ myBuilder.MakeEdge(myEdges[ETOPEND],L);
+
+ myBuilder.AddEdgeVertex(myEdges[ETOPEND],AxisTopVertex(),
+ 0.,Standard_True);
+ myBuilder.AddEdgeVertex(myEdges[ETOPEND],TopEndVertex(),
+ MeridianValue(myVMax).X(),Standard_False);
+
+ myBuilder.CompleteEdge(myEdges[ETOPEND]);
+ EdgesBuilt[ETOPEND] = Standard_True;
+ }
+
+ return myEdges[ETOPEND];
+}
+
+//=======================================================================
+//function : EndBottomEdge
+//purpose :
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::EndBottomEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[EBOTEND]) {
+
+
+ Standard_DomainError_Raise_if
+ (!HasBottom() || !HasSides(),
+ "BRepPrim_OneAxis::EndBottomEdge:no sides or no bottom");
+
+ // build the empty Edge
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(MeridianValue(myVMin).Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ gp_Lin L(P,myAxes.XDirection());
+ L.Rotate(myAxes.Axis(),myAngle);
+ myBuilder.MakeEdge(myEdges[EBOTEND],L);
+
+ myBuilder.AddEdgeVertex(myEdges[EBOTEND],AxisBottomVertex(),
+ 0.,Standard_True);
+ myBuilder.AddEdgeVertex(myEdges[EBOTEND],BottomEndVertex(),
+ MeridianValue(myVMin).X(),Standard_False);
+
+ myBuilder.CompleteEdge(myEdges[EBOTEND]);
+ EdgesBuilt[EBOTEND] = Standard_True;
+ }
+
+ return myEdges[EBOTEND];
+}
+
+//=======================================================================
+//function : TopEdge
+//purpose :
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::TopEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[ETOP]) {
+
+ // Test if shared with bottom edge
+ if (MeridianClosed() && EdgesBuilt[EBOTTOM]) {
+ myEdges[ETOP] = myEdges[EBOTTOM];
+ }
+
+ else {
+
+ // build the empty Edge
+ if (!MeridianOnAxis(myVMax)) {
+ gp_Pnt2d mp = MeridianValue(myVMax);
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(mp.Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ gp_Circ C(gp_Ax2(P,myAxes.Direction(),myAxes.XDirection()),mp.X());
+ myBuilder.MakeEdge(myEdges[ETOP],C);
+ }
+ else
+ myBuilder.MakeDegeneratedEdge(myEdges[ETOP]);
+
+ if (!HasSides()) {
+ // closed edge
+ myBuilder.AddEdgeVertex(myEdges[ETOP],
+ TopEndVertex(),
+ 0.,myAngle);
+ }
+ else {
+ myBuilder.AddEdgeVertex(myEdges[ETOP],
+ TopEndVertex(),
+ myAngle,
+ Standard_False);
+ myBuilder.AddEdgeVertex(myEdges[ETOP],
+ TopStartVertex(),
+ 0.,
+ Standard_True);
+ }
+ }
+
+ myBuilder.CompleteEdge(myEdges[ETOP]);
+ EdgesBuilt[ETOP] = Standard_True;
+ }
+
+ return myEdges[ETOP];
+}
+
+//=======================================================================
+//function : BottomEdge
+//purpose :
+//=======================================================================
+
+const TopoDS_Edge& BRepPrim_OneAxis::BottomEdge ()
+{
+ // do it if not done
+ if (!EdgesBuilt[EBOTTOM]) {
+
+ // Test if shared with top edge
+ if (MeridianClosed() && EdgesBuilt[ETOP]) {
+ myEdges[EBOTTOM] = myEdges[ETOP];
+ }
+
+ else {
+
+ // build the empty Edge
+
+ if (!MeridianOnAxis(myVMin)) {
+ gp_Pnt2d mp = MeridianValue(myVMin);
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(mp.Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ gp_Circ C(gp_Ax2(P,myAxes.Direction(),myAxes.XDirection()),mp.X());
+ myBuilder.MakeEdge(myEdges[EBOTTOM],C);
+ }
+ else
+ myBuilder.MakeDegeneratedEdge(myEdges[EBOTTOM]);
+
+ if (!HasSides()) {
+ // closed edge
+ myBuilder.AddEdgeVertex(myEdges[EBOTTOM],
+ BottomEndVertex(),
+ 0.,myAngle);
+ }
+ else {
+ myBuilder.AddEdgeVertex(myEdges[EBOTTOM],
+ BottomEndVertex(),
+ myAngle,
+ Standard_False);
+ myBuilder.AddEdgeVertex(myEdges[EBOTTOM],
+ BottomStartVertex(),
+ 0.,
+ Standard_True);
+ }
+ }
+
+ myBuilder.CompleteEdge(myEdges[EBOTTOM]);
+ EdgesBuilt[EBOTTOM] = Standard_True;
+ }
+
+ return myEdges[EBOTTOM];
+}
+
+//=======================================================================
+//function : AxisTopVertex
+//purpose :
+//=======================================================================
+
+const TopoDS_Vertex& BRepPrim_OneAxis::AxisTopVertex ()
+{
+ // do it if not done
+ if (!VerticesBuilt[VAXISTOP]) {
+
+ // deduct from others
+ if (MeridianOnAxis(myVMax) && VerticesBuilt[VTOPSTART])
+ myVertices[VAXISTOP] = myVertices[VTOPSTART];
+
+ else if (MeridianOnAxis(myVMax) && VerticesBuilt[VTOPEND])
+ myVertices[VAXISTOP] = myVertices[VTOPEND];
+
+ else {
+ Standard_DomainError_Raise_if(MeridianClosed(),
+ "BRepPrim_OneAxis::AxisTopVertex");
+ Standard_DomainError_Raise_if(VMaxInfinite(),
+ "BRepPrim_OneAxis::AxisTopVertex");
+
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(MeridianValue(myVMax).Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ myBuilder.MakeVertex(myVertices[VAXISTOP],P);
+ }
+
+ VerticesBuilt[VAXISTOP] = Standard_True;
+ }
+
+ return myVertices[VAXISTOP];
+}
+
+//=======================================================================
+//function : AxisBottomVertex
+//purpose :
+//=======================================================================
+
+const TopoDS_Vertex& BRepPrim_OneAxis::AxisBottomVertex ()
+{
+ // do it if not done
+ if (!VerticesBuilt[VAXISBOT]) {
+
+ // deduct from others
+ if (MeridianOnAxis(myVMin) && VerticesBuilt[VBOTSTART])
+ myVertices[VAXISBOT] = myVertices[VBOTSTART];
+
+ else if (MeridianOnAxis(myVMin) && VerticesBuilt[VBOTEND])
+ myVertices[VAXISBOT] = myVertices[VBOTEND];
+
+ else {
+ Standard_DomainError_Raise_if(MeridianClosed(),
+ "BRepPrim_OneAxis::AxisBottomVertex");
+ Standard_DomainError_Raise_if(VMinInfinite(),
+ "BRepPrim_OneAxis::AxisBottomVertex");
+
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(MeridianValue(myVMin).Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ myBuilder.MakeVertex(myVertices[VAXISBOT],P);
+ }
+
+ VerticesBuilt[VAXISBOT] = Standard_True;
+ }
+
+ return myVertices[VAXISBOT];
+}
+
+//=======================================================================
+//function : TopStartVertex
+//purpose :
+//=======================================================================
+
+const TopoDS_Vertex& BRepPrim_OneAxis::TopStartVertex ()
+{
+ // do it if not done
+ if (!VerticesBuilt[VTOPSTART]) {
+
+ // deduct from others
+ if (MeridianOnAxis(myVMax) && VerticesBuilt[VAXISTOP])
+ myVertices[VTOPSTART] = myVertices[VAXISTOP];
+ else if ((MeridianOnAxis(myVMax) || !HasSides()) && VerticesBuilt[VTOPEND])
+ myVertices[VTOPSTART] = myVertices[VTOPEND];
+ else if (MeridianClosed() && VerticesBuilt[VBOTSTART])
+ myVertices[VTOPSTART] = myVertices[VBOTSTART];
+ else if ((MeridianClosed() && !HasSides()) && VerticesBuilt[VBOTEND])
+ myVertices[VTOPSTART] = myVertices[VBOTEND];
+
+ else{
+ gp_Pnt2d mp = MeridianValue(myVMax);
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(mp.Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ V = myAxes.XDirection();
+ V.Multiply(mp.X());
+ P.Translate(V);
+ myBuilder.MakeVertex(myVertices[VTOPSTART],P);
+ }
+
+ VerticesBuilt[VTOPSTART] = Standard_True;
+ }
+
+ return myVertices[VTOPSTART];
+}
+
+//=======================================================================
+//function : TopEndVertex
+//purpose :
+//=======================================================================
+
+const TopoDS_Vertex& BRepPrim_OneAxis::TopEndVertex ()
+{
+ // do it if not done
+ if (!VerticesBuilt[VTOPEND]) {
+
+
+ // deduct from others
+ if (MeridianOnAxis(myVMax) && VerticesBuilt[VAXISTOP])
+ myVertices[VTOPEND] = myVertices[VAXISTOP];
+ else if ((MeridianOnAxis(myVMax) || !HasSides()) && VerticesBuilt[VTOPSTART])
+ myVertices[VTOPEND] = myVertices[VTOPSTART];
+ else if (MeridianClosed() && VerticesBuilt[VBOTEND])
+ myVertices[VTOPEND] = myVertices[VBOTEND];
+ else if ((MeridianClosed() && !HasSides()) && VerticesBuilt[VBOTSTART])
+ myVertices[VTOPEND] = myVertices[VBOTSTART];
+
+ else {
+ gp_Pnt2d mp = MeridianValue(myVMax);
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(mp.Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ V = myAxes.XDirection();
+ V.Multiply(mp.X());
+ P.Translate(V);
+ P.Rotate(myAxes.Axis(),myAngle);
+ myBuilder.MakeVertex(myVertices[VTOPEND],P);
+ }
+
+ VerticesBuilt[VTOPEND] = Standard_True;
+ }
+
+ return myVertices[VTOPEND];
+}
+
+//=======================================================================
+//function : BottomStartVertex
+//purpose :
+//=======================================================================
+
+const TopoDS_Vertex& BRepPrim_OneAxis::BottomStartVertex ()
+{
+ // do it if not done
+ if (!VerticesBuilt[VBOTSTART]) {
+
+ // deduct from others
+ if (MeridianOnAxis(myVMin) && VerticesBuilt[VAXISBOT])
+ myVertices[VBOTSTART] = myVertices[VAXISBOT];
+ else if ((MeridianOnAxis(myVMin) || !HasSides()) && VerticesBuilt[VBOTEND])
+ myVertices[VBOTSTART] = myVertices[VBOTEND];
+ else if (MeridianClosed() && VerticesBuilt[VTOPSTART])
+ myVertices[VBOTSTART] = myVertices[VTOPSTART];
+ else if ((MeridianClosed() && !HasSides()) && VerticesBuilt[VTOPEND])
+ myVertices[VBOTSTART] = myVertices[VTOPEND];
+
+ else {
+ gp_Pnt2d mp = MeridianValue(myVMin);
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(mp.Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ V = myAxes.XDirection();
+ V.Multiply(mp.X());
+ P.Translate(V);
+ myBuilder.MakeVertex(myVertices[VBOTSTART],P);
+ }
+
+ VerticesBuilt[VBOTSTART] = Standard_True;
+ }
+
+ return myVertices[VBOTSTART];
+}
+
+//=======================================================================
+//function : BottomEndVertex
+//purpose :
+//=======================================================================
+
+const TopoDS_Vertex& BRepPrim_OneAxis::BottomEndVertex ()
+{
+ // do it if not done
+ if (!VerticesBuilt[VBOTEND]) {
+
+ // deduct from others
+ if (MeridianOnAxis(myVMin) && VerticesBuilt[VAXISBOT])
+ myVertices[VBOTEND] = myVertices[VAXISBOT];
+ else if ((MeridianOnAxis(myVMin) || !HasSides()) && VerticesBuilt[VBOTSTART])
+ myVertices[VBOTEND] = myVertices[VBOTSTART];
+ else if (MeridianClosed() && VerticesBuilt[VTOPEND])
+ myVertices[VBOTEND] = myVertices[VTOPEND];
+ else if (MeridianClosed() && !HasSides() && VerticesBuilt[VTOPSTART])
+ myVertices[VBOTEND] = myVertices[VTOPSTART];
+
+ else {
+ gp_Pnt2d mp = MeridianValue(myVMin);
+ gp_Vec V = myAxes.Direction();
+ V.Multiply(mp.Y());
+ gp_Pnt P = myAxes.Location().Translated(V);
+ V = myAxes.XDirection();
+ V.Multiply(mp.X());
+ P.Translate(V);
+ P.Rotate(myAxes.Axis(),myAngle);
+ myBuilder.MakeVertex(myVertices[VBOTEND],P);
+ }
+
+ VerticesBuilt[VBOTEND] = Standard_True;
+ }
+
+ return myVertices[VBOTEND];
+}
+++ /dev/null
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _BRepPrim_OneAxis_HeaderFile
-#define _BRepPrim_OneAxis_HeaderFile
-
-#include <BRepPrim_Builder.hxx>
-#include <gp_Ax2.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Face.hxx>
-
-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_DefineAlloc_HeaderFile
-#include <Standard_DefineAlloc.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class BRepPrim_OneAxis {
-
-public:
-
- DEFINE_STANDARD_ALLOC
-
- // 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
+++ /dev/null
-# 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.
-
-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;
-}
+++ /dev/null
--- Created by: JR
--- Copyright (c) 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.
-
-@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;
-
+++ /dev/null
-BRepPrim_OneAxis.hxx
-BRepPrim_Replace.tcl
-BRepPrim_WOKSteps.edl
#include <BRepPrimAPI_MakeBox.ixx>
#include <BRepBuilderAPI.hxx>
#include <TopoDS.hxx>
-#include <Primitives_Direction.hxx>
+#include <BRepPrim_Direction.hxx>
inline gp_Pnt pmin(const gp_Pnt& p,
const TopoDS_Face& BRepPrimAPI_MakeBox::BottomFace () {
- return myWedge.Face (Primitives_ZMin);
+ return myWedge.Face (BRepPrim_ZMin);
}
const TopoDS_Face& BRepPrimAPI_MakeBox::BackFace () {
- return myWedge.Face (Primitives_XMin);
+ return myWedge.Face (BRepPrim_XMin);
}
const TopoDS_Face& BRepPrimAPI_MakeBox::FrontFace () {
- return myWedge.Face (Primitives_XMax);
+ return myWedge.Face (BRepPrim_XMax);
}
const TopoDS_Face& BRepPrimAPI_MakeBox::LeftFace () {
- return myWedge.Face (Primitives_YMin);
+ return myWedge.Face (BRepPrim_YMin);
}
const TopoDS_Face& BRepPrimAPI_MakeBox::RightFace () {
- return myWedge.Face (Primitives_YMax);
+ return myWedge.Face (BRepPrim_YMax);
}
const TopoDS_Face& BRepPrimAPI_MakeBox::TopFace () {
- return myWedge.Face (Primitives_ZMax);
+ return myWedge.Face (BRepPrim_ZMax);
}
class Iterator;
---Purpose: Iterator on the subShapes of a shape.
-
- deferred class NumLinearRegularSweep
- instantiates LinearRegularSweep from Sweep(
- Shape from TopoDS, -- Resulting topological objects.
- Shape from TopoDS, -- Generating Shape.
- NumShape from Sweep, -- Directing Wire.
- Builder from BRepSweep,
- Tool from BRepSweep, -- GenTool
- NumShapeTool from Sweep, -- DirTool
- Iterator from BRepSweep, -- Resulting objects Iterator
- Iterator from BRepSweep, -- GenIterator
- NumShapeIterator from Sweep); -- DirSubEdgeIterator
+ deferred class NumLinearRegularSweep;
deferred class Trsf;
--- This class is inherited from LinearRegularSweep to implement
--- /dev/null
+-- Created on: 1993-01-27
+-- Created by: Philippe DAUTRY
+-- 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.
+
+deferred class NumLinearRegularSweep from BRepSweep
+
+ ---Purpose: This a generic class is used to build Sweept
+ -- primitives with a generating "shape" and a
+ -- directing "line".
+ --
+ -- The indexation and type analysis services required
+ -- for the generatrix are given by <Tool from BRepSweep>.
+ --
+ -- The indexation and type analysis services required
+ -- for the directrix are given by <NumShapeTool from Sweep>.
+ --
+ -- The iteration services required for the generatrix
+ -- are given by <Iterator from BRepSweep>.
+ --
+ -- The iteration services required for the directrix
+ -- are given by <NumShapeIterator from Sweep>.
+ --
+ -- The topology is like a grid of shapes. Each shape
+ -- of the grid must be addressable without confusion
+ -- by one or two objects from the generating or
+ -- directing shapes. Here are exemples of correct
+ -- associations to address:
+ --
+ -- - a vertex : GenVertex - DirVertex
+ -- - an edge : GenVertex - DirEdge
+ -- - : GenEdge - DirVertex
+ -- - a face : GenEdge - DirEdge
+ -- GenFace - DirVertex
+ -- ...
+ --
+ -- "GenObject" is used to identify an object from the
+ -- Generating Shape, and "DirObject" from the
+ -- Directing Shape. So may they be from different
+ -- types.
+ --
+ -- The method Has... is given because in some special
+ -- cases, a vertex, an edge or a face may be
+ -- geometricaly nonexistant or not usefull.
+
+uses
+
+ Orientation from TopAbs,
+ Array2OfBoolean from TColStd,
+ Shape from TopoDS,
+ NumShape from Sweep,
+ Builder from BRepSweep,
+ Tool from BRepSweep,
+ NumShapeTool from Sweep,
+ Iterator from BRepSweep,
+ NumShapeIterator from Sweep,
+ Array2OfShape from TopTools,
+ SequenceOfShape from TopTools
+
+raises
+
+ NoMoreObject from Standard,
+ NoSuchObject from Standard,
+ RangeError from Standard,
+ DomainError from Standard
+
+
+is
+
+
+ -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+ Delete(me:out) is virtual ;
+ ---C++: alias ~
+
+ Initialize(aBuilder : Builder from BRepSweep;
+ aGenShape : Shape from TopoDS;
+ aDirWire : NumShape from Sweep);
+ ---Purpose: Creates a NumLinearRegularSweep. <aBuilder> gives
+ -- basic topological services.
+
+
+ -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+ -- Deferred Methods supporting the creation of the geometric part.
+
+ -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+ MakeEmptyVertex(me : in out; aGenV: Shape from TopoDS; aDirV: NumShape from Sweep)
+ returns Shape from TopoDS
+ ---Purpose: Builds the vertex addressed by [aGenV,aDirV], with its
+ -- geometric part, but without subcomponents.
+ is deferred;
+
+ MakeEmptyDirectingEdge(me: in out; aGenV: Shape from TopoDS; aDirE: NumShape from Sweep)
+ returns Shape from TopoDS
+ ---Purpose: Builds the edge addressed by [aGenV,aDirE], with its
+ -- geometric part, but without subcomponents.
+ is deferred;
+
+ MakeEmptyGeneratingEdge(me: in out; aGenE: Shape from TopoDS; aDirV: NumShape from Sweep)
+ returns Shape from TopoDS
+ ---Purpose: Builds the edge addressed by [aGenE,aDirV], with its
+ -- geometric part, but without subcomponents.
+ is deferred;
+
+ SetParameters(me : in out;
+ aNewFace : Shape from TopoDS;
+ aNewVertex : in out Shape from TopoDS;
+ aGenF : Shape from TopoDS;
+ aGenV : Shape from TopoDS;
+ aDirV : NumShape from Sweep)
+ ---Purpose: Sets the parameters of the new vertex on the new
+ -- face. The new face and new vertex where generated
+ -- from aGenF, aGenV and aDirV .
+ is deferred;
+
+ SetDirectingParameter(me : in out;
+ aNewEdge : Shape from TopoDS;
+ aNewVertex : in out Shape from TopoDS;
+ aGenV : Shape from TopoDS;
+ aDirE : NumShape from Sweep;
+ aDirV : NumShape from Sweep)
+ ---Purpose: Sets the parameter of the new vertex on the new
+ -- edge. The new edge and new vertex where generated
+ -- from aGenV aDirE, and aDirV.
+ is deferred;
+
+ SetGeneratingParameter(me : in out;
+ aNewEdge : Shape from TopoDS;
+ aNewVertex : in out Shape from TopoDS;
+ aGenE : Shape from TopoDS;
+ aGenV : Shape from TopoDS;
+ aDirV : NumShape from Sweep)
+ ---Purpose: Sets the parameter of the new vertex on the new
+ -- edge. The new edge and new vertex where generated
+ -- from aGenE, aGenV and aDirV .
+ is deferred;
+
+ MakeEmptyFace(me : in out;
+ aGenS : Shape from TopoDS;
+ aDirS : NumShape from Sweep)
+ returns Shape from TopoDS
+ ---Purpose: Builds the face addressed by [aGenS,aDirS], with
+ -- its geometric part, but without subcomponents. The
+ -- couple aGenS, aDirS can be a "generating face and
+ -- a directing vertex" or "a generating edge and a
+ -- directing edge".
+ is deferred;
+
+ SetPCurve(me : in out;
+ aNewFace : Shape from TopoDS;
+ aNewEdge : in out Shape from TopoDS;
+ aGenF : Shape from TopoDS;
+ aGenE : Shape from TopoDS;
+ aDirV : NumShape from Sweep;
+ orien : Orientation from TopAbs)
+ ---Purpose: Sets the PCurve for a new edge on a new face. The
+ -- new edge and the new face were generated using
+ -- aGenF, aGenE and aDirV.
+ is deferred;
+
+ SetGeneratingPCurve(me : in out;
+ aNewFace : Shape from TopoDS;
+ aNewEdge : in out Shape from TopoDS;
+ aGenE : Shape from TopoDS;
+ aDirE : NumShape from Sweep;
+ aDirV : NumShape from Sweep;
+ orien : Orientation from TopAbs)
+
+ ---Purpose: Sets the PCurve for a new edge on a new face. The
+ -- new edge and the new face were generated using
+ -- aGenE, aDirE and aDirV.
+ is deferred;
+
+ SetDirectingPCurve(me : in out;
+ aNewFace : Shape from TopoDS;
+ aNewEdge : in out Shape from TopoDS;
+ aGenE : Shape from TopoDS;
+ aGenV : Shape from TopoDS;
+ aDirE : NumShape from Sweep;
+ orien : Orientation from TopAbs)
+
+ ---Purpose: Sets the PCurve for a new edge on a new face. The
+ -- new edge and the new face were generated using
+ -- aGenE, aDirE and aGenV.
+ is deferred;
+
+ DirectSolid(me : in out;
+ aGenS : Shape from TopoDS;
+ aDirS : NumShape from Sweep)
+ returns Orientation from TopAbs
+ ---Purpose: Returns the Orientation of the shell in the solid
+ -- generated by the face aGenS with the edge aDirS.
+ -- It is REVERSED if the surface is swept in the
+ -- direction of the normal.
+ is deferred;
+
+ GGDShapeIsToAdd (me;
+ aNewShape : Shape from TopoDS;
+ aNewSubShape : Shape from TopoDS;
+ aGenS : Shape from TopoDS;
+ aSubGenS : Shape from TopoDS;
+ aDirS : NumShape from Sweep)
+ returns Boolean from Standard
+ ---Purpose: Returns true if aNewSubShape (addressed by
+ -- aSubGenS and aDirS) must be added in aNewShape
+ -- (addressed by aGenS and aDirS).
+ is deferred;
+
+ GDDShapeIsToAdd (me;
+ aNewShape : Shape from TopoDS;
+ aNewSubShape : Shape from TopoDS;
+ aGenS : Shape from TopoDS;
+ aDirS : NumShape from Sweep;
+ aSubDirS : NumShape from Sweep)
+ returns Boolean from Standard
+ ---Purpose: Returns true if aNewSubShape (addressed by
+ -- aGenS and aSubDirS) must be added in aNewShape
+ -- (addressed by aGenS and aDirS).
+ is deferred;
+
+
+ SeparatedWires (me;
+ aNewShape : Shape from TopoDS;
+ aNewSubShape : Shape from TopoDS;
+ aGenS : Shape from TopoDS;
+ aSubGenS : Shape from TopoDS;
+ aDirS : NumShape from Sweep)
+ returns Boolean from Standard
+ ---Purpose: In some particular cases the topology of a
+ -- generated face must be composed of independant
+ -- closed wires, in this case this function returns
+ -- true.
+ is deferred;
+
+
+ SplitShell (me; aNewShape : Shape from TopoDS)
+ returns Shape from TopoDS
+ ---Purpose: In some particular cases the topology of a
+ -- generated Shell must be composed of independant
+ -- closed Shells, in this case this function returns
+ -- a Compound of independant Shells.
+ is virtual;
+
+
+ -- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+ -- Method coding the continuities on the edges between 2 faces
+ -- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+ SetContinuity(me : in out; aGenS : Shape from TopoDS; aDirS : NumShape from Sweep)
+ ---Purpose: Called to propagate the continuity of every vertex
+ -- between two edges of the generating wire aGenS on
+ -- the generated edge and faces.
+ is deferred;
+
+
+ -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+ -- User end methods.
+ --
+ -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+ -- Shapes
+ -- """"""
+
+ HasShape(me; aGenS : Shape from TopoDS; aDirS : NumShape from Sweep)
+ returns Boolean from Standard
+ ---Purpose: Returns true if aDirS and aGenS addresses a
+ -- resulting Shape. In some specific cases the shape
+ -- can be geometrically inexsistant, then this
+ -- function returns false.
+ is deferred;
+
+ Shape(me: in out; aGenS : Shape from TopoDS; aDirS : NumShape from Sweep)
+ returns Shape from TopoDS
+ ---Purpose: Returns the resulting Shape indexed by aDirS and
+ -- aGenS.
+ is static;
+
+
+ Shape(me: in out; aGenS : Shape from TopoDS)
+ returns Shape from TopoDS
+ ---Purpose: Returns the resulting Shape indexed by myDirWire
+ -- and aGenS.
+ is static;
+
+ Shape(me: in out)
+ returns Shape from TopoDS
+ ---Purpose: Returns the resulting Shape indexed by myDirWire
+ -- and myGenShape.
+ is static;
+
+ FirstShape(me: in out)
+ returns Shape from TopoDS
+ ---Purpose: Returns the resulting Shape indexed by the first
+ -- Vertex of myDirWire and myGenShape.
+ is static;
+
+ LastShape(me: in out)
+ returns Shape from TopoDS
+ ---Purpose: Returns the resulting Shape indexed by the last
+ -- Vertex of myDirWire and myGenShape.
+ is static;
+
+
+ FirstShape(me: in out; aGenS : Shape from TopoDS)
+ returns Shape from TopoDS
+ ---Purpose: Returns the resulting Shape indexed by the first
+ -- Vertex of myDirWire and aGenS.
+ is static;
+
+ LastShape(me: in out; aGenS : Shape from TopoDS)
+ returns Shape from TopoDS
+ ---Purpose: Returns the resulting Shape indexed by the last
+ -- Vertex of myDirWire and aGenS.
+ is static;
+
+
+ Closed(me) returns Boolean from Standard is static;
+
+
+fields
+
+ -- Topology builder.
+
+ myBuilder : Builder from BRepSweep is protected;
+
+ -- Generating shape
+
+ myGenShape : Shape from TopoDS is protected;
+
+ -- Directing line
+
+ myDirWire : NumShape from Sweep is protected;
+
+ -- shape tools.
+
+ myGenShapeTool : Tool from BRepSweep is protected;
+ myDirShapeTool : NumShapeTool from Sweep is protected;
+
+ -- Array of built objects (NbGShapes,NbDShapes).
+ myShapes : Array2OfShape from TopTools is protected;
+
+ -- Array of built objects flags (NbGShapes,NbDShapes).
+ myBuiltShapes : Array2OfBoolean from TColStd is protected;
+
+end NumLinearRegularSweep;
--- /dev/null
+// Created on: 1992-07-02
+// Created by: Philippe DAUTRY
+// Copyright (c) 1992-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 <BRepSweep_NumLinearRegularSweep.ixx>
+
+#include <Standard_RangeError.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_NoMoreObject.hxx>
+#include <Standard_DomainError.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <Sweep_NumShape.hxx>
+#include <BRepSweep_Builder.hxx>
+#include <BRepSweep_Tool.hxx>
+#include <Sweep_NumShapeTool.hxx>
+#include <BRepSweep_Iterator.hxx>
+#include <Sweep_NumShapeIterator.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+
+#include <TopAbs_Orientation.hxx>
+#include <TopAbs.hxx>
+
+//=======================================================================
+//function : BRepSweep_NumLinearRegularSweep
+//purpose : Create a Regular Sweep.
+//=======================================================================
+
+BRepSweep_NumLinearRegularSweep::BRepSweep_NumLinearRegularSweep
+ (const BRepSweep_Builder& aBuilder,
+ const TopoDS_Shape& aGenShape,
+ const Sweep_NumShape& aDirShape):
+
+ myBuilder(aBuilder),
+ myGenShape(aGenShape),
+ myDirWire(aDirShape),
+
+ myGenShapeTool(aGenShape),
+ myDirShapeTool(aDirShape),
+
+ // *****************************************************************
+ // Les Tableaux
+ // *****************************************************************
+
+ myShapes(1,myGenShapeTool.NbShapes(),
+ 1,myDirShapeTool.NbShapes()),
+ myBuiltShapes(1,myGenShapeTool.NbShapes(),
+ 1,myDirShapeTool.NbShapes())
+{
+ myBuiltShapes.Init(Standard_False);
+}
+
+void BRepSweep_NumLinearRegularSweep::Delete()
+{}
+
+//=======================================================================
+//function : Shape
+//purpose : Returns the global Shape.
+//=======================================================================
+
+TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape ()
+{
+ if (HasShape(myGenShape,myDirWire)) return Shape(myGenShape,myDirWire);
+ else {
+ TopoDS_Shape bidon;
+ return bidon;
+ }
+}
+
+
+//=======================================================================
+//function : Shape
+//purpose : Returns the Shape generated with aGenS.
+//=======================================================================
+
+TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS)
+{
+ if (myGenShapeTool.Index(aGenS) != 0 &&
+ HasShape(aGenS,myDirWire)) return Shape(aGenS,myDirWire);
+ else {
+ TopoDS_Shape bidon;
+ return bidon;
+ }
+}
+
+
+//=======================================================================
+//function : Shape
+//purpose : Returns the Shape indexed by the arguments.
+//=======================================================================
+
+TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS,
+ const Sweep_NumShape& aDirS)
+{
+ Standard_Integer iGenS = myGenShapeTool.Index(aGenS);
+ Standard_Integer iDirS = myDirShapeTool.Index(aDirS);
+ if (!myBuiltShapes(iGenS,iDirS)){
+ TopoDS_Shape newShape;
+ TopoDS_Shape bGenS,cGenS,subGenS,subsubGenS;
+ Sweep_NumShape bDirS,subDirS;
+ BRepSweep_Iterator It;
+ Sweep_NumShapeIterator Kt;
+ BRepSweep_Iterator Lt;
+ TopAbs_Orientation Or,Pr;
+ if (myDirShapeTool.Type(aDirS)==TopAbs_VERTEX){
+ //Ici on construit les "planchers" du Shape.
+ TopAbs_ShapeEnum aGenSType = myGenShapeTool.Type(aGenS);
+ switch (aGenSType){
+ case TopAbs_VERTEX :
+ myShapes(iGenS,iDirS)=MakeEmptyVertex(aGenS,aDirS);
+ break;
+ case TopAbs_EDGE :
+ myShapes(iGenS,iDirS)=MakeEmptyGeneratingEdge(aGenS,aDirS);
+ break;
+ case TopAbs_WIRE :
+ myBuilder.MakeWire(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_FACE :
+ myShapes(iGenS,iDirS)=MakeEmptyFace(aGenS,aDirS);
+ break;
+ case TopAbs_SHELL :
+ myBuilder.MakeShell(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_SOLID :
+ Standard_NoSuchObject::Raise("Solids are not Processed");
+ break;
+ case TopAbs_COMPSOLID :
+ Standard_NoSuchObject::Raise("Solids are not Processed");
+ break;
+ case TopAbs_COMPOUND :
+ myBuilder.MakeCompound(myShapes(iGenS,iDirS));
+ break;
+ default:
+ Standard_NoSuchObject::Raise("Unknown Shape");
+ break;
+ }
+ bGenS = aGenS;
+ myGenShapeTool.SetOrientation(bGenS,TopAbs_FORWARD);
+ for (It.Init(bGenS);It.More();It.Next()){
+ subGenS = It.Value();
+ Or = It.Orientation();
+ if(HasShape(subGenS,aDirS)){
+ newShape = Shape(subGenS,aDirS);
+ if (GGDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
+ aGenS,subGenS,aDirS)){
+ //Les "planchers" doivent etre construits par les
+ //fonctions de construcion geometrique identiquement
+ //au shape generateur.
+ //On leur recolle juste une orientation pour etre bien
+ //sur.
+
+ myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+ TopAbs_ShapeEnum subGenSType = myGenShapeTool.Type(subGenS);
+ if (aGenSType==TopAbs_FACE){
+ if(subGenSType==TopAbs_VERTEX){
+ SetParameters(myShapes(iGenS,iDirS),
+ newShape,aGenS,subGenS,aDirS);
+ }
+ else if(subGenSType==TopAbs_EDGE){
+ SetPCurve(myShapes(iGenS,iDirS),newShape,
+ aGenS,subGenS,aDirS,Or);
+ }
+ else if(subGenSType==TopAbs_WIRE){
+ BRepSweep_Iterator Jt;
+ cGenS = subGenS;
+ myGenShapeTool.SetOrientation(cGenS,TopAbs_FORWARD);
+ for (Jt.Init(cGenS);Jt.More();Jt.Next()){
+ subsubGenS = Jt.Value();
+ Pr = Jt.Orientation();
+ if(HasShape(subsubGenS,aDirS)){
+ TopoDS_Shape newsubEdge = Shape(subsubGenS,aDirS);
+ SetPCurve(myShapes(iGenS,iDirS),newsubEdge,
+ aGenS,subsubGenS,aDirS,Pr);
+ }
+ }
+ }
+ }
+ else if(aGenSType==TopAbs_EDGE){
+ SetGeneratingParameter(myShapes(iGenS,iDirS),
+ newShape,bGenS,subGenS,aDirS);
+ }
+ }
+ }
+ }
+ }
+ else if (myDirShapeTool.Type(aDirS)==TopAbs_EDGE){
+ //Ici on construit les murs du Shape.
+ TopAbs_ShapeEnum aGenSType = myGenShapeTool.Type(aGenS);
+ TopoDS_Shape newWire,newShell;
+ TopTools_SequenceOfShape WireSeq;
+ Standard_Boolean sepwires = Standard_False;
+ switch (aGenSType){
+ case TopAbs_VERTEX :
+ myShapes(iGenS,iDirS)=MakeEmptyDirectingEdge(aGenS,aDirS);
+ break;
+ case TopAbs_EDGE :
+ //On cree un wire intermediaire qui contient tous les edges
+ //du montant (face) du Shape pour le cas standard, et une
+ //sequence de wires pour les cas merdiques necessitant des
+ //wires independants.
+ myBuilder.MakeWire(newWire);
+ myShapes(iGenS,iDirS)=MakeEmptyFace(aGenS,aDirS);
+ break;
+ case TopAbs_WIRE :
+ myBuilder.MakeShell(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_FACE :
+ //On cree un shell intermediaire dans lequel on jette toutes
+ //les faces en direct, pour eviter les empilages compliques
+ //de shells et sous shells dans la structure du solide.
+ myBuilder.MakeShell(newShell);
+ myBuilder.MakeSolid(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_SHELL :
+ myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_SOLID :
+ Standard_NoSuchObject::Raise("Solids are not Processed");
+ break;
+ case TopAbs_COMPSOLID :
+ Standard_NoSuchObject::Raise("Solids are not Processed");
+ break;
+ case TopAbs_COMPOUND :
+ myBuilder.MakeCompound(myShapes(iGenS,iDirS));
+ break;
+ default:
+ Standard_NoSuchObject::Raise("Unknown Shape");
+ break;
+ }
+ bGenS = aGenS;
+ myGenShapeTool.SetOrientation(bGenS,TopAbs_FORWARD);
+ for (It.Init(bGenS);It.More();It.Next()){
+ subGenS = It.Value();
+ if(HasShape(subGenS,aDirS)){
+ newShape = Shape(subGenS,aDirS);
+ if (GGDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
+ aGenS,subGenS,aDirS)){
+ TopAbs_ShapeEnum subGenSType = myGenShapeTool.Type(subGenS);
+ if (aGenSType==TopAbs_EDGE){
+ Or = It.Orientation();
+ if (SeparatedWires(myShapes(iGenS,iDirS),newShape,
+ aGenS,subGenS,aDirS)){
+ sepwires = Standard_True;
+ TopoDS_Shape wi;
+ myBuilder.MakeWire(wi);
+ myBuilder.Add(wi,newShape,Or);
+ WireSeq.Append(wi);
+ }
+ else{
+ myBuilder.Add(newWire,newShape,Or);
+ }
+ SetDirectingPCurve (myShapes(iGenS,iDirS),
+ newShape,bGenS,subGenS,aDirS,Or);
+ }
+ else if (aGenSType==TopAbs_WIRE){
+ Or = It.Orientation();
+ myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+ }
+ else if (aGenSType==TopAbs_FACE){
+ Or = It.Orientation();
+ if(subGenSType == TopAbs_WIRE) {
+ for (Lt.Init(newShape);Lt.More();Lt.Next()){
+ myBuilder.Add(newShell,Lt.Value(),
+ TopAbs::Compose(Lt.Orientation(),Or));
+ }
+ }
+ else if(subGenSType == TopAbs_EDGE) {
+ myBuilder.Add(newShell,newShape,Or);
+ }
+ }
+ else if(aGenSType == TopAbs_SHELL){
+ Or = TopAbs_FORWARD;
+ myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+ }
+ else if(aGenSType == TopAbs_COMPOUND){
+ Or = TopAbs_FORWARD;
+ myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+ }
+ else{
+ Or = It.Orientation();
+ myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+ }
+ }
+ }
+ }
+ bDirS = aDirS;
+ for (Kt.Init(bDirS);Kt.More();Kt.Next()){
+ subDirS = Kt.Value();
+ if(HasShape(aGenS,subDirS)){
+ newShape = Shape(aGenS,subDirS);
+ if (GDDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
+ aGenS,aDirS,subDirS)){
+ if (aGenSType==TopAbs_EDGE){
+ Or = TopAbs::Reverse(Kt.Orientation());
+ myBuilder.Add(newWire,newShape,Or);
+ SetGeneratingPCurve
+ (myShapes(iGenS,iDirS),newShape,aGenS,aDirS,subDirS,Or);
+ }
+ else if(aGenSType==TopAbs_VERTEX){
+ Or = Kt.Orientation();
+ myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+ SetDirectingParameter
+ (myShapes(iGenS,iDirS),newShape,aGenS,aDirS,subDirS);
+ }
+ else if(aGenSType==TopAbs_FACE){
+ Or = Kt.Orientation();
+ myBuilder.Add(newShell,newShape,Or);
+ }
+ }
+ }
+ }
+ if (aGenSType==TopAbs_EDGE){
+ if (sepwires){
+ for(Standard_Integer ij = 1;ij <= WireSeq.Length();ij++){
+ myBuilder.Add(myShapes(iGenS,iDirS),WireSeq.Value(ij));
+ }
+ }
+ else{
+ myBuilder.Add(myShapes(iGenS,iDirS),newWire);
+ }
+ myBuiltShapes(iGenS,iDirS) = Standard_True;
+ SetContinuity(aGenS,aDirS);
+ }
+ if (aGenSType==TopAbs_WIRE){
+ SetContinuity(aGenS,aDirS);
+ }
+ if (aGenSType==TopAbs_FACE){
+ TopoDS_Shape temp = SplitShell(newShell);
+ TopAbs_Orientation Or = DirectSolid(aGenS,aDirS);
+ Lt.Init(temp);
+ if(Lt.More()) Lt.Next();
+ if(Lt.More()){
+ for (Lt.Init(temp);Lt.More();Lt.Next()){
+ myBuilder.Add(myShapes(iGenS,iDirS),Lt.Value(),Or);
+ }
+ }
+ else myBuilder.Add(myShapes(iGenS,iDirS),newShell,Or);
+ }
+ }
+ else if (myDirShapeTool.Type(aDirS)==TopAbs_WIRE){
+ TopAbs_ShapeEnum aGenSType = myGenShapeTool.Type(aGenS);
+ switch (aGenSType){
+ case TopAbs_VERTEX :
+ myBuilder.MakeWire(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_EDGE :
+ myBuilder.MakeShell(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_WIRE :
+ myBuilder.MakeShell(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_FACE :
+ myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_SHELL :
+ myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
+ break;
+ case TopAbs_SOLID :
+ Standard_NoSuchObject::Raise("Solids are not Processed");
+ break;
+ case TopAbs_COMPSOLID :
+ Standard_NoSuchObject::Raise("Solids are not Processed");
+ break;
+ case TopAbs_COMPOUND :
+ myBuilder.MakeCompound(myShapes(iGenS,iDirS));
+ break;
+ default:
+ Standard_NoSuchObject::Raise("Unknown Shape");
+ break;
+ }
+ bDirS = aDirS;
+ for (Kt.Init(aDirS);Kt.More();Kt.Next()){
+ subDirS = Kt.Value();
+ if(HasShape(aGenS,subDirS)){
+ Or = Kt.Orientation();
+ newShape = Shape(aGenS,subDirS);
+ myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+ }
+ }
+ }
+ myBuiltShapes(iGenS,iDirS) = Standard_True;
+ }
+ return myShapes(iGenS,iDirS);
+}
+
+
+//=======================================================================
+//function : FirstShape
+//purpose : Returns the Shape indexed by the arguments.
+//=======================================================================
+
+TopoDS_Shape BRepSweep_NumLinearRegularSweep::FirstShape ()
+{
+ TopoDS_Shape result;
+ if (myDirShapeTool.HasFirstVertex()){
+ if(HasShape(myGenShape,myDirShapeTool.FirstVertex()))
+ result = Shape(myGenShape,myDirShapeTool.FirstVertex());
+ }
+ return result;
+}
+
+
+//=======================================================================
+//function : LastShape
+//purpose : Returns the Shape indexed by the arguments.
+//=======================================================================
+
+TopoDS_Shape BRepSweep_NumLinearRegularSweep::LastShape ()
+{
+ TopoDS_Shape result;
+ if (myDirShapeTool.HasLastVertex()){
+ if(HasShape(myGenShape,myDirShapeTool.LastVertex()))
+ result = Shape(myGenShape,myDirShapeTool.LastVertex());
+ }
+ return result;
+}
+
+
+//=======================================================================
+//function : FirstShape
+//purpose : Returns the Shape indexed by the arguments.
+//=======================================================================
+
+TopoDS_Shape BRepSweep_NumLinearRegularSweep::FirstShape (const TopoDS_Shape& aGenS)
+{
+ TopoDS_Shape result;
+ if (myDirShapeTool.HasFirstVertex()){
+ if(HasShape(aGenS,myDirShapeTool.FirstVertex()))
+ result = Shape(aGenS,myDirShapeTool.FirstVertex());
+ }
+ return result;
+}
+
+
+//=======================================================================
+//function : LastShape
+//purpose : Returns the Shape indexed by the arguments.
+//=======================================================================
+
+TopoDS_Shape BRepSweep_NumLinearRegularSweep::LastShape (const TopoDS_Shape& aGenS)
+{
+ TopoDS_Shape result;
+ if (myDirShapeTool.HasLastVertex()){
+ if(HasShape(aGenS,myDirShapeTool.LastVertex()))
+ result = Shape(aGenS,myDirShapeTool.LastVertex());
+ }
+ return result;
+}
+
+//=======================================================================
+//function : Closed
+//purpose :
+//=======================================================================
+
+Standard_Boolean BRepSweep_NumLinearRegularSweep::Closed()const
+{
+ return myDirWire.Closed();
+}
+
+//=======================================================================
+//function : SplitShell
+//purpose :
+//=======================================================================
+
+TopoDS_Shape BRepSweep_NumLinearRegularSweep::SplitShell(const TopoDS_Shape& aNewShape)const
+{
+ TopoDS_Shape comp;
+ myBuilder.MakeCompound(comp);
+ myBuilder.Add(comp,aNewShape);
+ return comp;
+}
+
+++ /dev/null
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _BRepSweep_NumLinearRegularSweep_HeaderFile
-#define _BRepSweep_NumLinearRegularSweep_HeaderFile
-
-#include <BRepSweep_Builder.hxx>
-#include <TopoDS_Shape.hxx>
-#include <Sweep_NumShape.hxx>
-#include <BRepSweep_Tool.hxx>
-#include <Sweep_NumShapeTool.hxx>
-#include <BRepSweep_Array2OfShapesOfNumLinearRegularSweep.hxx>
-#include <TColStd_Array2OfBoolean.hxx>
-#include <BRepSweep_SequenceNodeOfSequenceOfShapesOfNumLinearRegularSweep.hxx>
-#include <TopAbs_Orientation.hxx>
-
-class Standard_NoMoreObject;
-class Standard_NoSuchObject;
-class Standard_RangeError;
-class Standard_DomainError;
-class TopoDS_Shape;
-class Sweep_NumShape;
-class BRepSweep_Builder;
-class BRepSweep_Tool;
-class Sweep_NumShapeTool;
-class BRepSweep_Iterator;
-class Sweep_NumShapeIterator;
-class BRepSweep_Array2OfShapesOfNumLinearRegularSweep;
-class BRepSweep_SequenceOfShapesOfNumLinearRegularSweep;
-class BRepSweep_SequenceNodeOfSequenceOfShapesOfNumLinearRegularSweep;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_DefineAlloc_HeaderFile
-#include <Standard_DefineAlloc.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class BRepSweep_NumLinearRegularSweep {
-
-public:
-
- DEFINE_STANDARD_ALLOC
-
- // Methods PUBLIC
- //
-Standard_EXPORT virtual void Delete() ;
-Standard_EXPORT virtual ~BRepSweep_NumLinearRegularSweep()
-{
- Delete();
-}
-
-Standard_EXPORT virtual TopoDS_Shape MakeEmptyVertex(const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirV) = 0;
-Standard_EXPORT virtual TopoDS_Shape MakeEmptyDirectingEdge(const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirE) = 0;
-Standard_EXPORT virtual TopoDS_Shape MakeEmptyGeneratingEdge(const TopoDS_Shape& aGenE,const Sweep_NumShape& aDirV) = 0;
-Standard_EXPORT virtual void SetParameters(const TopoDS_Shape& aNewFace,TopoDS_Shape& aNewVertex,const TopoDS_Shape& aGenF,const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirV) = 0;
-Standard_EXPORT virtual void SetDirectingParameter(const TopoDS_Shape& aNewEdge,TopoDS_Shape& aNewVertex,const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirE,const Sweep_NumShape& aDirV) = 0;
-Standard_EXPORT virtual void SetGeneratingParameter(const TopoDS_Shape& aNewEdge,TopoDS_Shape& aNewVertex,const TopoDS_Shape& aGenE,const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirV) = 0;
-Standard_EXPORT virtual TopoDS_Shape MakeEmptyFace(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) = 0;
-Standard_EXPORT virtual void SetPCurve(const TopoDS_Shape& aNewFace,TopoDS_Shape& aNewEdge,const TopoDS_Shape& aGenF,const TopoDS_Shape& aGenE,const Sweep_NumShape& aDirV,const TopAbs_Orientation orien) = 0;
-Standard_EXPORT virtual void SetGeneratingPCurve(const TopoDS_Shape& aNewFace,TopoDS_Shape& aNewEdge,const TopoDS_Shape& aGenE,const Sweep_NumShape& aDirE,const Sweep_NumShape& aDirV,const TopAbs_Orientation orien) = 0;
-Standard_EXPORT virtual void SetDirectingPCurve(const TopoDS_Shape& aNewFace,TopoDS_Shape& aNewEdge,const TopoDS_Shape& aGenE,const TopoDS_Shape& aGenV,const Sweep_NumShape& aDirE,const TopAbs_Orientation orien) = 0;
-Standard_EXPORT virtual TopAbs_Orientation DirectSolid(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) = 0;
-Standard_EXPORT virtual Standard_Boolean GGDShapeIsToAdd(const TopoDS_Shape& aNewShape,const TopoDS_Shape& aNewSubShape,const TopoDS_Shape& aGenS,const TopoDS_Shape& aSubGenS,const Sweep_NumShape& aDirS) const = 0;
-Standard_EXPORT virtual Standard_Boolean GDDShapeIsToAdd(const TopoDS_Shape& aNewShape,const TopoDS_Shape& aNewSubShape,const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS,const Sweep_NumShape& aSubDirS) const = 0;
-Standard_EXPORT virtual Standard_Boolean SeparatedWires(const TopoDS_Shape& aNewShape,const TopoDS_Shape& aNewSubShape,const TopoDS_Shape& aGenS,const TopoDS_Shape& aSubGenS,const Sweep_NumShape& aDirS) const = 0;
-Standard_EXPORT virtual TopoDS_Shape SplitShell(const TopoDS_Shape& aNewShape) const;
-Standard_EXPORT virtual void SetContinuity(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) = 0;
-Standard_EXPORT virtual Standard_Boolean HasShape(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) const = 0;
-Standard_EXPORT TopoDS_Shape Shape(const TopoDS_Shape& aGenS,const Sweep_NumShape& aDirS) ;
-Standard_EXPORT TopoDS_Shape Shape(const TopoDS_Shape& aGenS) ;
-Standard_EXPORT TopoDS_Shape Shape() ;
-Standard_EXPORT TopoDS_Shape FirstShape() ;
-Standard_EXPORT TopoDS_Shape LastShape() ;
-Standard_EXPORT TopoDS_Shape FirstShape(const TopoDS_Shape& aGenS) ;
-Standard_EXPORT TopoDS_Shape LastShape(const TopoDS_Shape& aGenS) ;
-Standard_EXPORT Standard_Boolean Closed() const;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-Standard_EXPORT BRepSweep_NumLinearRegularSweep(const BRepSweep_Builder& aBuilder,const TopoDS_Shape& aGenShape,const Sweep_NumShape& aDirWire);
-
-
- // Fields PROTECTED
- //
-BRepSweep_Builder myBuilder;
-TopoDS_Shape myGenShape;
-Sweep_NumShape myDirWire;
-BRepSweep_Tool myGenShapeTool;
-Sweep_NumShapeTool myDirShapeTool;
-BRepSweep_Array2OfShapesOfNumLinearRegularSweep myShapes;
-TColStd_Array2OfBoolean myBuiltShapes;
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-# 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.
-
-proc BRepSweep_Replace:AdmFileType {} {
- return "dbadmfile";
-}
-
-proc BRepSweep_Replace:OutputDirTypeName {} {
- return "dbtmpfile";
-}
-
-
-proc BRepSweep_Replace:HandleInputFile { ID } {
-
- scan $ID "%\[^:\]:%\[^:\]:%\[^:\]" unit type name
-
- switch $name {
- BRepSweep_NumLinearRegularSweep.hxx {return 1;}
- default {
- return 0;
- }
- }
-}
-
-proc BRepSweep_Replace:Execute { unit args } {
-
- global tcl_interactive
-
- set tcl_interactive 1
- package require Wokutils
-
- msgprint -i -c "BRepSweep_Replace:Execute" "Copying of BRepSweep 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 BRepSweep:source:$sourcename [wokinfo -N $unit]]
- set vistarget [woklocate -p BRepSweep:pubinclude:$name [wokinfo -N $unit]]
- set target [wokinfo -p pubinclude:$name $unit]
-
- regsub -all "/" " $source $target" $replstr TheArgs
-
- msgprint -i -c "BRepSweep_Replace:Execute" "Copy $source to $target"
- if { [file exist $target] && [wokparam -e %Station $unit] != "wnt" } {
- eval exec "chmod u+w $target"
- }
- eval exec "$copycmd $TheArgs"
-
- }
- return 0;
-}
+++ /dev/null
--- Created by: JR
--- Copyright (c) 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.
-
-@ifnotdefined ( %BRepSweep_WOKSteps_EDL) then
-
- @set %BRepSweep_WOKSteps_EDL = "";
-
- @string %WOKSteps_XcppGroup += " xcpp.repl ";
- @set %WOKSteps_xcpp_repl = "*BRepSweep_Replace(xcpp.header)";
-
-@endif;
-
+++ /dev/null
-BRepSweep_NumLinearRegularSweep.hxx
-BRepSweep_WOKSteps.edl
-BRepSweep_Replace.tcl
class Curve2dTool;
- class CLProps2d from Geom2dLProp
- instantiates CLProps from LProp(Curve from Geom2d,
- Vec2d from gp,
- Pnt2d from gp,
- Dir2d from gp,
- Curve2dTool from Geom2dLProp);
+ class CLProps2d from Geom2dLProp instantiates
+ CLProps from LProp(Curve from Geom2d,
+ Vec2d from gp,
+ Pnt2d from gp,
+ Dir2d from gp,
+ Curve2dTool from Geom2dLProp);
class CurAndInf2d;
-
- private class NumericCurInf2d instantiates NumericCurInf from LProp(
- Curve from Geom2d,
- Vec2d from gp,
- Pnt2d from gp,
- Dir2d from gp,
- Curve2dTool from Geom2dLProp);
-
-end Geom2dLProp;
+
+ private class FuncCurExt;
+ private class FuncCurNul;
+ class NumericCurInf2d;
+ ---Purpose: Computes the locals extremas of curvature and the
+ -- inflections of a bounded curve in 2d.
+
+end Geom2dLProp;
--- /dev/null
+-- Created on: 1994-09-02
+-- Created by: Yves FRICAUD
+-- Copyright (c) 1994-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.
+
+private class FuncCurExt from Geom2dLProp inherits FunctionWithDerivative from math
+ ---Purpose: Function used to find the extremas of curvature in 2d.
+
+uses Curve from Geom2d,
+ Vec2d from gp,
+ Pnt2d from gp,
+ Dir2d from gp,
+ Curve2dTool from Geom2dLProp
+
+is
+ Create ( C : Curve from Geom2d ; Tol : Real) returns FuncCurExt from Geom2dLProp;
+
+ Value (me : in out; X : Real; F : out Real)
+ ---Purpose: Returns the value for the variable <X>.
+ returns Boolean;
+
+ Derivative (me : in out; X : Real; D : out Real)
+ ---Purpose: Returns the derivative for the variable <X>.
+ returns Boolean;
+
+ Values (me : in out ; X : Real; F : out Real; D : out Real)
+ ---Purpose: Returns the value of the function and the derivative
+ -- for the variable <X>.
+ returns Boolean;
+
+ IsMinKC (me ; Param : Real)
+ ---Purpose: True if Param corresponds to a minus
+ -- of the radius of curvature.
+ returns Boolean;
+
+fields
+ theCurve : Curve from Geom2d;
+ epsX : Real from Standard;
+
+end FuncCurExt;
+
--- /dev/null
+// Created on: 1994-09-06
+// Created by: Yves FRICAUD
+// Copyright (c) 1994-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 <Geom2dLProp_FuncCurExt.ixx>
+
+#include <gp_Pnt2d.hxx>
+#include <Geom2dLProp_Curve2dTool.hxx>
+
+#include <gp.hxx>
+#include <Precision.hxx>
+
+//=============================================================================
+//function :
+// purpose :
+//=============================================================================
+Geom2dLProp_FuncCurExt::Geom2dLProp_FuncCurExt(const Handle(Geom2d_Curve)& C,
+ const Standard_Real Tol)
+ :theCurve(C)
+{
+ epsX = Tol;
+}
+
+//=============================================================================
+//function : Value
+// purpose : KC = (V1^V2.Z) / ||V1||^3 avec V1 tangente etV2 derivee seconde.
+// F = d KC/ dU.
+//=============================================================================
+Standard_Boolean Geom2dLProp_FuncCurExt::Value (const Standard_Real X,
+ Standard_Real& F)
+{
+ gp_Pnt2d P1;
+ gp_Vec2d V1,V2,V3;
+
+ Geom2dLProp_Curve2dTool::D3(theCurve,X,P1,V1,V2,V3);
+ Standard_Real CPV1V2 = V1.Crossed(V2);
+ Standard_Real CPV1V3 = V1.Crossed(V3);
+ Standard_Real V1V2 = V1.Dot(V2);
+ Standard_Real V1V1 = V1.SquareMagnitude();
+ Standard_Real NV1 = Sqrt(V1V1);
+ Standard_Real V13 = V1V1*NV1;
+ Standard_Real V15 = V13*V1V1;
+
+ if (V15 < gp::Resolution()) {
+ return Standard_False;
+ }
+ F = CPV1V3/V13 - 3*CPV1V2*V1V2/V15;
+
+ return Standard_True;
+}
+
+//=============================================================================
+//function : Derivative
+// purpose :
+//=============================================================================
+Standard_Boolean Geom2dLProp_FuncCurExt::Derivative(const Standard_Real X,
+ Standard_Real& D)
+{
+ Standard_Real F;
+ return Values (X,F,D) ;
+}
+
+//=============================================================================
+//function : Values
+// purpose :
+//=============================================================================
+Standard_Boolean Geom2dLProp_FuncCurExt::Values (const Standard_Real X,
+ Standard_Real& F,
+ Standard_Real& D)
+{
+ Standard_Real F2;
+ Standard_Real Dx= epsX/100.;
+
+ if (X+Dx > Geom2dLProp_Curve2dTool::LastParameter(theCurve)) {Dx = - Dx;}
+
+ Value (X,F);
+ Value (X+Dx,F2);
+ D = (F2 - F)/Dx;
+
+ return Standard_True;
+}
+
+
+//=============================================================================
+//function : IsMinKC
+// purpose : Teste si le parametere coorespond a un minimum du rayon de courbure
+// par comparaison avec un point voisin.
+//=============================================================================
+Standard_Boolean Geom2dLProp_FuncCurExt::IsMinKC (const Standard_Real X) const
+{
+ gp_Pnt2d P1;
+ gp_Vec2d V1,V2,V3;
+ Standard_Real Dx= epsX;
+ Standard_Real KC,KP;
+
+ Geom2dLProp_Curve2dTool::D3(theCurve,X,P1,V1,V2,V3);
+ Standard_Real CPV1V2 = V1.Crossed(V2);
+ Standard_Real V1V1 = V1.SquareMagnitude();
+ Standard_Real NV1 = Sqrt(V1V1);
+ Standard_Real V13 = V1V1*NV1;
+
+ if (V13 < gp::Resolution()) {return Standard_False;}
+
+ KC = CPV1V2/V13;
+
+ if (X+Dx > Geom2dLProp_Curve2dTool::LastParameter(theCurve)) {Dx = - Dx;}
+
+ Geom2dLProp_Curve2dTool::D3(theCurve,X+Dx,P1,V1,V2,V3);
+ CPV1V2 = V1.Crossed(V2);
+ V1V1 = V1.SquareMagnitude();
+ NV1 = Sqrt(V1V1);
+ V13 = V1V1*NV1;
+
+ if (V13 < gp::Resolution()) { return Standard_False;}
+ KP = CPV1V2/V13;
+
+ if (Abs(KC) > Abs(KP)) {return Standard_True ;}
+ else {return Standard_False;}
+
+}
--- /dev/null
+-- Created on: 1994-09-02
+-- Created by: Yves FRICAUD
+-- Copyright (c) 1994-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.
+
+private class FuncCurNul from Geom2dLProp inherits FunctionWithDerivative from math
+ ---Purpose: Function used to find the inflections in 2d.
+
+uses
+ Curve from Geom2d,
+ Vec2d from gp,
+ Pnt2d from gp,
+ Dir2d from gp,
+ Curve2dTool from Geom2dLProp
+
+is
+ Create ( C : Curve from Geom2d) returns FuncCurNul from Geom2dLProp;
+
+ Value (me : in out; X : Real; F : out Real)
+ ---Purpose: Returns the value for the variable <X>.
+ returns Boolean;
+
+ Derivative(me : in out; X : Real; D : out Real)
+ ---Purpose: Returns the derivative for the variable <X>
+ returns Boolean;
+
+ Values(me : in out ; X : Real; F : out Real; D : out Real)
+ ---Purpose: Returns the value of the function and the derivative
+ -- for the variable <X>.
+ returns Boolean;
+
+fields
+ theCurve : Curve from Geom2d;
+
+end FuncCurNul;
+
--- /dev/null
+// Created on: 1994-09-05
+// Created by: Yves FRICAUD
+// Copyright (c) 1994-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 <Geom2dLProp_FuncCurNul.ixx>
+
+#include <gp_Pnt2d.hxx>
+#include <Geom2dLProp_Curve2dTool.hxx>
+
+#include <gp.hxx>
+#include <Precision.hxx>
+
+//=============================================================================
+//function :
+// purpose :
+//=============================================================================
+Geom2dLProp_FuncCurNul::Geom2dLProp_FuncCurNul(const Handle(Geom2d_Curve)& C)
+:theCurve(C)
+{
+}
+
+//=============================================================================
+//function : Value
+// purpose : F = (V1^V2.Z)/||V1||*||V2||
+//=============================================================================
+Standard_Boolean Geom2dLProp_FuncCurNul::Value (const Standard_Real X,
+ Standard_Real& F)
+{
+ Standard_Real D;
+ return Values(X,F,D);
+}
+
+//=============================================================================
+//function : Derivative
+// purpose :
+//=============================================================================
+Standard_Boolean Geom2dLProp_FuncCurNul::Derivative(const Standard_Real X,
+ Standard_Real& D)
+{
+ Standard_Real F;
+ return Values(X,F,D);
+}
+
+//=============================================================================
+//function : Values
+// purpose : F = (V1^V2.Z)/||V1||*||V2||
+//=============================================================================
+Standard_Boolean Geom2dLProp_FuncCurNul::Values (const Standard_Real X,
+ Standard_Real& F,
+ Standard_Real& D)
+{
+ gp_Pnt2d P1;
+ gp_Vec2d V1,V2,V3;
+ Geom2dLProp_Curve2dTool::D3(theCurve,X,P1,V1,V2,V3);
+ Standard_Real CP1 = V1.Crossed(V2);
+ Standard_Real CP2 = V1.Crossed(V3);
+ Standard_Real V1V2 = V1.Dot(V2);
+ Standard_Real V2V3 = V2.Dot(V3);
+ Standard_Real NV1 = V1.Magnitude();
+ Standard_Real NV2 = V2.Magnitude();
+
+ F = 0. ;
+ D = 0. ;
+
+/*
+ if (Abs(CP1) < 1.e-4) {
+ return Standard_True;
+ } else */
+
+ if (NV2 < 1.e-4) {
+ return Standard_True;
+ } else if (NV1*NV2 < gp::Resolution()) {
+ return Standard_False;
+ } else {
+ F = CP1/(NV1*NV2);
+ D = (CP2 - CP1*V1V2/(NV1*NV1) - CP1*V2V3/(NV2*NV2))/(NV1*NV2);
+ }
+ return Standard_True;
+
+}
+
+
+
--- /dev/null
+-- Created on: 1994-09-02
+-- Created by: Yves FRICAUD
+-- Copyright (c) 1994-1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class NumericCurInf2d from Geom2dLProp
+
+ ---Purpose: Computes the locals extremas of curvature and the
+ -- inflections of a bounded curve in 2d.
+
+uses
+ CurAndInf from LProp,
+ Curve from Geom2d,
+ Vec2d from gp,
+ Pnt2d from gp,
+ Dir2d from gp,
+ Curve2dTool from Geom2dLProp
+
+is
+
+ Create;
+
+ PerformCurExt (me : in out; C : Curve from Geom2d; Result : in out CurAndInf)
+ ---Purpose: Computes the locals extremas of curvature.
+ is static;
+
+ PerformInf (me : in out; C : Curve from Geom2d; Result : in out CurAndInf)
+ ---Purpose: Computes the inflections.
+ is static;
+
+ PerformCurExt (me : in out;
+ C : Curve from Geom2d ;
+ UMin : Real;
+ UMax : Real;
+ Result : in out CurAndInf)
+ ---Purpose: Computes the locals extremas of curvature.
+ -- in the interval of parmeters [UMin,UMax].
+ is static;
+
+ PerformInf (me : in out;
+ C : Curve from Geom2d ;
+ UMin : Real;
+ UMax : Real;
+ Result : in out CurAndInf)
+ ---Purpose: Computes the inflections in the interval of
+ -- parmeters [UMin,UMax].
+ is static;
+
+ IsDone (me) returns Boolean
+ ---Purpose: True if the solutions are found.
+ is static;
+
+fields
+ isDone : Boolean from Standard;
+
+end NumericCurInf2d;
--- /dev/null
+// Created on: 1994-09-05
+// Created by: Yves FRICAUD
+// Copyright (c) 1994-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 <Geom2dLProp_NumericCurInf2d.ixx>
+
+#include <Geom2dLProp_FuncCurExt.hxx>
+#include <Geom2dLProp_FuncCurNul.hxx>
+
+#include <Geom2dLProp_Curve2dTool.hxx>
+#include <math_FunctionRoots.hxx>
+#include <math_BracketedRoot.hxx>
+#include <Precision.hxx>
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+Geom2dLProp_NumericCurInf2d::Geom2dLProp_NumericCurInf2d()
+{
+}
+//=======================================================================
+//function : PerformCurExt
+//purpose :
+//=======================================================================
+void Geom2dLProp_NumericCurInf2d::PerformCurExt (const Handle(Geom2d_Curve)& C,LProp_CurAndInf& Result)
+{
+ PerformCurExt(C,Geom2dLProp_Curve2dTool::FirstParameter(C),Geom2dLProp_Curve2dTool::LastParameter(C),Result);
+}
+
+//=======================================================================
+//function : PerformCurExt
+//purpose :
+//=======================================================================
+void Geom2dLProp_NumericCurInf2d::PerformCurExt (const Handle(Geom2d_Curve)& C,
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ LProp_CurAndInf& Result)
+{
+ isDone = Standard_True;
+
+ Standard_Real EpsH = 1.e-4*(UMax - UMin);
+ Standard_Real Tol = Precision::PConfusion();
+
+ // la premiere recherce se fait avec une tolerance assez grande
+ // car la derivee de la fonction est estimee assez grossierement.
+
+ Geom2dLProp_FuncCurExt F(C,EpsH);
+ Standard_Integer NbSamples = 100;
+ Standard_Boolean SolType;
+
+ math_FunctionRoots SolRoot (F,UMin,UMax,NbSamples,EpsH,EpsH,EpsH);
+
+ if (SolRoot.IsDone()) {
+ for (Standard_Integer j = 1; j <= SolRoot.NbSolutions(); j++) {
+ Standard_Real Param = SolRoot.Value(j);
+ // la solution est affinee.
+ math_BracketedRoot BS (F,
+ Param - EpsH,
+ Param + EpsH,
+ Tol);
+ if (BS.IsDone()) {Param = BS.Root();}
+ SolType = F.IsMinKC(Param);
+ Result.AddExtCur(Param,SolType);
+ }
+ }
+ else {
+ isDone = Standard_False;
+ }
+}
+
+//=======================================================================
+//function : PerformInf
+//purpose :
+//=======================================================================
+void Geom2dLProp_NumericCurInf2d::PerformInf(const Handle(Geom2d_Curve)& C,LProp_CurAndInf& Result)
+{
+ PerformInf(C,Geom2dLProp_Curve2dTool::FirstParameter(C),Geom2dLProp_Curve2dTool::LastParameter(C),Result);
+}
+
+//=======================================================================
+//function : PerformInf
+//purpose :
+//=======================================================================
+void Geom2dLProp_NumericCurInf2d::PerformInf(const Handle(Geom2d_Curve)& C,
+ const Standard_Real UMin,
+ const Standard_Real UMax,
+ LProp_CurAndInf& Result)
+{
+ isDone = Standard_True;
+ Geom2dLProp_FuncCurNul F(C);
+ Standard_Real EpsX = 1.e-6;
+ Standard_Real EpsF = 1.e-6;
+ Standard_Integer NbSamples = 30;
+
+ math_FunctionRoots SolRoot (F,UMin,UMax,NbSamples,EpsX,EpsF,EpsX);
+
+ if (SolRoot.IsDone()) {
+ for (Standard_Integer j = 1; j <= SolRoot.NbSolutions(); j++) {
+ Result.AddInflection(SolRoot.Value(j));
+ }
+ }
+ else {
+ isDone = Standard_False;
+ }
+}
+
+//=======================================================================
+//function : IsDone
+//purpose :
+//=======================================================================
+Standard_Boolean Geom2dLProp_NumericCurInf2d::IsDone() const
+{
+ return isDone;
+}
+
class AnalyticCurInf;
---Purpose: Computes the locals extremas of curvature of a gp curve.
- private generic class FuncCurExt;
- private generic class FuncCurNul;
- generic class NumericCurInf, FCurExt, FCurNul;
- ---Purpose: Computes the locals extremas of curvature and the
- -- inflections of a bounded curve in 2d.
-
private class SequenceOfCIType instantiates Sequence from TCollection
(CIType from LProp);
+++ /dev/null
--- Created on: 1994-09-02
--- Created by: Yves FRICAUD
--- Copyright (c) 1994-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.
-
-private generic class FuncCurExt from LProp (Curve as any;
- Vec as any; -- as Vec or Vec2d
- Pnt as any; -- as Pnt or Pnt2d
- Dir as any; -- as Dir or Dir2d Vec
- Tool as any) -- as Tool(Curve, Pnt, Vec)
-inherits FunctionWithDerivative from math
- ---Purpose: Function used to find the extremas of curvature in 2d.
-
-is
- Create ( C : Curve ; Tol : Real) returns FuncCurExt from LProp;
-
- Value (me : in out; X : Real; F : out Real)
- ---Purpose: Returns the value for the variable <X>.
- returns Boolean;
-
- Derivative (me : in out; X : Real; D : out Real)
- ---Purpose: Returns the derivative for the variable <X>.
- returns Boolean;
-
- Values (me : in out ; X : Real; F : out Real; D : out Real)
- ---Purpose: Returns the value of the function and the derivative
- -- for the variable <X>.
- returns Boolean;
-
- IsMinKC (me ; Param : Real)
- ---Purpose: True if Param corresponds to a minus
- -- of the radius of curvature.
- returns Boolean;
-
-fields
- theCurve : Curve;
- epsX : Real from Standard;
-
-end FuncCurExt;
-
+++ /dev/null
-// Created on: 1994-09-06
-// Created by: Yves FRICAUD
-// Copyright (c) 1994-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 <gp.hxx>
-#include <Precision.hxx>
-
-//=============================================================================
-//function :
-// purpose :
-//=============================================================================
-LProp_FuncCurExt::LProp_FuncCurExt(const Curve& C,
- const Standard_Real Tol)
-:theCurve(C)
-{
- epsX = Tol;
-}
-
-//=============================================================================
-//function : Value
-// purpose : KC = (V1^V2.Z) / ||V1||^3 avec V1 tangente etV2 derivee seconde.
-// F = d KC/ dU.
-//=============================================================================
-Standard_Boolean LProp_FuncCurExt::Value (const Standard_Real X,
- Standard_Real& F)
-{
- Pnt P1;
- Vec V1,V2,V3;
-
- Tool::D3(theCurve,X,P1,V1,V2,V3);
- Standard_Real CPV1V2 = V1.Crossed(V2);
- Standard_Real CPV1V3 = V1.Crossed(V3);
- Standard_Real V1V2 = V1.Dot(V2);
- Standard_Real V1V1 = V1.SquareMagnitude();
- Standard_Real NV1 = Sqrt(V1V1);
- Standard_Real V13 = V1V1*NV1;
- Standard_Real V15 = V13*V1V1;
-
- if (V15 < gp::Resolution()) {
- return Standard_False;
- }
- F = CPV1V3/V13 - 3*CPV1V2*V1V2/V15;
-
- return Standard_True;
-}
-
-//=============================================================================
-//function : Derivative
-// purpose :
-//=============================================================================
-Standard_Boolean LProp_FuncCurExt::Derivative(const Standard_Real X,
- Standard_Real& D)
-{
- Standard_Real F;
- return Values (X,F,D) ;
-}
-
-//=============================================================================
-//function : Values
-// purpose :
-//=============================================================================
-Standard_Boolean LProp_FuncCurExt::Values (const Standard_Real X,
- Standard_Real& F,
- Standard_Real& D)
-{
- Standard_Real F2;
- Standard_Real Dx= epsX/100.;
-
- if (X+Dx > Tool::LastParameter(theCurve)) {Dx = - Dx;}
-
- Value (X,F);
- Value (X+Dx,F2);
- D = (F2 - F)/Dx;
-
- return Standard_True;
-}
-
-
-//=============================================================================
-//function : IsMinKC
-// purpose : Teste si le parametere coorespond a un minimum du rayon de courbure
-// par comparaison avec un point voisin.
-//=============================================================================
-Standard_Boolean LProp_FuncCurExt::IsMinKC (const Standard_Real X) const
-{
- Pnt P1;
- Vec V1,V2,V3;
- Standard_Real Dx= epsX;
- Standard_Real KC,KP;
-
- Tool::D3(theCurve,X,P1,V1,V2,V3);
- Standard_Real CPV1V2 = V1.Crossed(V2);
- Standard_Real V1V1 = V1.SquareMagnitude();
- Standard_Real NV1 = Sqrt(V1V1);
- Standard_Real V13 = V1V1*NV1;
-
- if (V13 < gp::Resolution()) {return Standard_False;}
-
- KC = CPV1V2/V13;
-
- if (X+Dx > Tool::LastParameter(theCurve)) {Dx = - Dx;}
-
- Tool::D3(theCurve,X+Dx,P1,V1,V2,V3);
- CPV1V2 = V1.Crossed(V2);
- V1V1 = V1.SquareMagnitude();
- NV1 = Sqrt(V1V1);
- V13 = V1V1*NV1;
-
- if (V13 < gp::Resolution()) { return Standard_False;}
- KP = CPV1V2/V13;
-
- if (Abs(KC) > Abs(KP)) {return Standard_True ;}
- else {return Standard_False;}
-
-}
+++ /dev/null
--- Created on: 1994-09-02
--- Created by: Yves FRICAUD
--- Copyright (c) 1994-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.
-
-private generic class FuncCurNul from LProp (Curve as any;
- Vec as any; -- as Vec or Vec2d
- Pnt as any; -- as Pnt or Pnt2d
- Dir as any; -- as Dir or Dir2d Vec
- Tool as any) -- as Tool(Curve, Pnt, Vec)
-inherits FunctionWithDerivative from math
- ---Purpose: Function used to find the inflections in 2d.
-
-is
- Create ( C : Curve) returns FuncCurNul from LProp;
-
- Value (me : in out; X : Real; F : out Real)
- ---Purpose: Returns the value for the variable <X>.
- returns Boolean;
-
- Derivative(me : in out; X : Real; D : out Real)
- ---Purpose: Returns the derivative for the variable <X>
- returns Boolean;
-
- Values(me : in out ; X : Real; F : out Real; D : out Real)
- ---Purpose: Returns the value of the function and the derivative
- -- for the variable <X>.
- returns Boolean;
-
-fields
- theCurve : Curve;
-
-end FuncCurNul;
-
+++ /dev/null
-// Created on: 1994-09-05
-// Created by: Yves FRICAUD
-// Copyright (c) 1994-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 <gp.hxx>
-#include <Precision.hxx>
-
-//=============================================================================
-//function :
-// purpose :
-//=============================================================================
-LProp_FuncCurNul::LProp_FuncCurNul(const Curve& C)
-:theCurve(C)
-{
-}
-
-//=============================================================================
-//function : Value
-// purpose : F = (V1^V2.Z)/||V1||*||V2||
-//=============================================================================
-Standard_Boolean LProp_FuncCurNul::Value (const Standard_Real X,
- Standard_Real& F)
-{
- Standard_Real D;
- return Values(X,F,D);
-}
-
-//=============================================================================
-//function : Derivative
-// purpose :
-//=============================================================================
-Standard_Boolean LProp_FuncCurNul::Derivative(const Standard_Real X,
- Standard_Real& D)
-{
- Standard_Real F;
- return Values(X,F,D);
-}
-
-//=============================================================================
-//function : Values
-// purpose : F = (V1^V2.Z)/||V1||*||V2||
-//=============================================================================
-Standard_Boolean LProp_FuncCurNul::Values (const Standard_Real X,
- Standard_Real& F,
- Standard_Real& D)
-{
- Pnt P1;
- Vec V1,V2,V3;
- Tool::D3(theCurve,X,P1,V1,V2,V3);
- Standard_Real CP1 = V1.Crossed(V2);
- Standard_Real CP2 = V1.Crossed(V3);
- Standard_Real V1V2 = V1.Dot(V2);
- Standard_Real V2V3 = V2.Dot(V3);
- Standard_Real NV1 = V1.Magnitude();
- Standard_Real NV2 = V2.Magnitude();
-
- F = 0. ;
- D = 0. ;
-
-/*
- if (Abs(CP1) < 1.e-4) {
- return Standard_True;
- } else */
-
- if (NV2 < 1.e-4) {
- return Standard_True;
- } else if (NV1*NV2 < gp::Resolution()) {
- return Standard_False;
- } else {
- F = CP1/(NV1*NV2);
- D = (CP2 - CP1*V1V2/(NV1*NV1) - CP1*V2V3/(NV2*NV2))/(NV1*NV2);
- }
- return Standard_True;
-
-}
-
-
-
+++ /dev/null
--- Created on: 1994-09-02
--- Created by: Yves FRICAUD
--- Copyright (c) 1994-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class NumericCurInf from LProp (Curve as any;
- Vec as any; -- as Vec or Vec2d
- Pnt as any; -- as Pnt or Pnt2d
- Dir as any; -- as Dir or Dir2d Vec
- Tool as any) -- as Tool(Curve, Pnt, Vec)
-
- ---Purpose: Computes the locals extremas of curvature and the
- -- inflections of a bounded curve in 2d.
-
-uses
- CurAndInf from LProp
-
-private class FCurExt instantiates FuncCurExt from LProp (Curve,Vec,Pnt,Dir,Tool);
-private class FCurNul instantiates FuncCurNul from LProp (Curve,Vec,Pnt,Dir,Tool);
-
-is
- Create;
-
- PerformCurExt (me : in out; C : Curve; Result : in out CurAndInf)
- ---Purpose: Computes the locals extremas of curvature.
- is static;
-
- PerformInf (me : in out; C : Curve; Result : in out CurAndInf)
- ---Purpose: Computes the inflections.
- is static;
-
- PerformCurExt (me : in out;
- C : Curve ;
- UMin : Real;
- UMax : Real;
- Result : in out CurAndInf)
- ---Purpose: Computes the locals extremas of curvature.
- -- in the interval of parmeters [UMin,UMax].
- is static;
-
- PerformInf (me : in out;
- C : Curve ;
- UMin : Real;
- UMax : Real;
- Result : in out CurAndInf)
- ---Purpose: Computes the inflections in the interval of
- -- parmeters [UMin,UMax].
- is static;
-
- IsDone (me) returns Boolean
- ---Purpose: True if the solutions are found.
- is static;
-
-fields
- isDone : Boolean from Standard;
-
-end NumericCurInf;
+++ /dev/null
-// Created on: 1994-09-05
-// Created by: Yves FRICAUD
-// Copyright (c) 1994-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 <math_FunctionRoots.hxx>
-#include <math_BracketedRoot.hxx>
-#include <Precision.hxx>
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-LProp_NumericCurInf::LProp_NumericCurInf()
-{
-}
-//=======================================================================
-//function : PerformCurExt
-//purpose :
-//=======================================================================
-void LProp_NumericCurInf::PerformCurExt (const Curve& C,LProp_CurAndInf& Result)
-{
- PerformCurExt(C,Tool::FirstParameter(C),Tool::LastParameter(C),Result);
-}
-
-//=======================================================================
-//function : PerformCurExt
-//purpose :
-//=======================================================================
-void LProp_NumericCurInf::PerformCurExt (const Curve& C,
- const Standard_Real UMin,
- const Standard_Real UMax,
- LProp_CurAndInf& Result)
-{
- isDone = Standard_True;
-
- Standard_Real EpsH = 1.e-4*(UMax - UMin);
- Standard_Real Tol = Precision::PConfusion();
-
- // la premiere recherce se fait avec une tolerance assez grande
- // car la derivee de la fonction est estimee assez grossierement.
-
- LProp_FCurExt F(C,EpsH);
- Standard_Integer NbSamples = 100;
- Standard_Boolean SolType;
-
- math_FunctionRoots SolRoot (F,UMin,UMax,NbSamples,EpsH,EpsH,EpsH);
-
- if (SolRoot.IsDone()) {
- for (Standard_Integer j = 1; j <= SolRoot.NbSolutions(); j++) {
- Standard_Real Param = SolRoot.Value(j);
- // la solution est affinee.
- math_BracketedRoot BS (F,
- Param - EpsH,
- Param + EpsH,
- Tol);
- if (BS.IsDone()) {Param = BS.Root();}
- SolType = F.IsMinKC(Param);
- Result.AddExtCur(Param,SolType);
- }
- }
- else {
- isDone = Standard_False;
- }
-}
-
-//=======================================================================
-//function : PerformInf
-//purpose :
-//=======================================================================
-void LProp_NumericCurInf::PerformInf(const Curve& C,LProp_CurAndInf& Result)
-{
- PerformInf(C,Tool::FirstParameter(C),Tool::LastParameter(C),Result);
-}
-
-//=======================================================================
-//function : PerformInf
-//purpose :
-//=======================================================================
-void LProp_NumericCurInf::PerformInf(const Curve& C,
- const Standard_Real UMin,
- const Standard_Real UMax,
- LProp_CurAndInf& Result)
-{
- isDone = Standard_True;
- LProp_FCurNul F(C);
- Standard_Real EpsX = 1.e-6;
- Standard_Real EpsF = 1.e-6;
- Standard_Integer NbSamples = 30;
-
- math_FunctionRoots SolRoot (F,UMin,UMax,NbSamples,EpsX,EpsF,EpsX);
-
- if (SolRoot.IsDone()) {
- for (Standard_Integer j = 1; j <= SolRoot.NbSolutions(); j++) {
- Result.AddInflection(SolRoot.Value(j));
- }
- }
- else {
- isDone = Standard_False;
- }
-}
-
-//=======================================================================
-//function : IsDone
-//purpose :
-//=======================================================================
-Standard_Boolean LProp_NumericCurInf::IsDone() const
-{
- return isDone;
-}
-
+++ /dev/null
--- Created on: 1991-07-23
--- Created by: Christophe MARION
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-package Primitives
-
- ---Purpose: This package describes algorithms to build
- -- topological primitives.
- --
- -- The algorithms in this package are generic. It
- -- contains :
- --
- -- * The Builder signature class. Describes the
- -- services required from the Topology Data
- -- Structure to build the following primitives.
- --
- -- * The OneAxis generic class. Algorithm used to
- -- build rotational primitives.
- --
- -- * The Wedge generic class. Algorithm to build
- -- boxes and wedges.
-
-uses
- gp -- gp provides all geometrical information
-
-is
-
-
- enumeration Direction is
- ---Purpose:
- XMin, XMax, YMin, YMax, ZMin, ZMax
- end Direction;
-
- deferred generic class OneAxis;
-
- generic class Wedge;
-
-end Primitives;
+++ /dev/null
--- Created on: 1991-07-23
--- Created by: Christophe MARION
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-deferred generic class OneAxis from Primitives(
- TheShell as any;
- TheFace as any;
- TheWire as any;
- TheEdge as any;
- TheVertex as any;
- TheBuilder as any)
-
- ---Purpose: Algorithm to build primitives with one axis of
- -- revolution.
- --
- -- The revolution body is described by :
- --
- -- A coordinate system (Ax2 from gp). The Z axis is
- -- the rotational axis.
- --
- -- An Angle around the Axis, When the Angle is 2*PI
- -- the primitive is not limited by planar faces. The
- -- U parameter range from 0 to Angle.
- --
- -- A parameter range VMin, VMax on the meridian.
- --
- -- A meridian : The meridian is a curve described by
- -- a set of deferred methods.
- --
- --
- -- The topology consists of A shell, Faces, Wires,
- -- Edges and Vertices. Methods are provided to build
- -- all the elements. Building an element implies the
- -- automatic building of all its sub-elements.
- --
- -- So building the shell builds everything.
- --
- -- There are at most 5 faces :
- --
- -- - The LateralFace.
- --
- -- - The TopFace and the BottomFace.
- --
- -- - The StartFace and the EndFace.
- --
-
-
-
-uses
- Ax2 from gp,
- Pnt2d from gp
-
-raises
- DomainError,
- OutOfRange
-
-is
- Delete(me:out) is virtual ;
- ---C++: alias ~
-
- Initialize(B : TheBuilder;
- A : Ax2 from gp;
- VMin, VMax : Real from Standard);
- ---Purpose: Creates a OneAxis algorithm. <B> is used to build
- -- the Topology. The angle defaults to 2*PI.
-
-
- SetMeridianOffset(me: in out;MeridianOffset : Real from Standard = 0)
- ---Purpose: The MeridianOffset is added to the parameters on
- -- the meridian curve and to the V values of the
- -- pcurves. This is used for the sphere for example,
- -- to give a range on the meridian edge which is not
- -- VMin, VMax.
- is static;
-
- Axes(me) returns Ax2 from gp
- ---Purpose: Returns the Ax2 from <me>.
- ---C++: return const &
- is static;
-
- Axes(me : in out; A : Ax2 from gp)
- raises DomainError -- when some topology has been built or A > 2*PI
- is static;
-
- Angle(me) returns Real
- is static;
-
- Angle(me : in out; A : Real)
- raises DomainError -- when some topology has been built or A > 2*PI
- is static;
-
- VMin(me) returns Real
- is static;
-
- VMin(me : in out; V : Real)
- raises DomainError -- when some topology has been built
- is static;
-
- VMax(me) returns Real
- is static;
-
- VMax(me : in out; V : Real)
- raises DomainError -- when some topology has been built
- is static;
-
- --
- -- Methods to describe the meridian
- -- They should be redefined in inherited classes
- --
-
- MakeEmptyLateralFace(me) returns TheFace
- ---Purpose: Returns a face with no edges. The surface is the
- -- lateral surface with normals pointing outward. The
- -- U parameter is the angle with the origin on the X
- -- axis. The V parameter is the parameter of the
- -- meridian.
- is deferred;
-
- MakeEmptyMeridianEdge(me; Ang : Real) returns TheEdge
- ---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 deferred;
-
- SetMeridianPCurve(me; E : in out TheEdge; F : TheFace)
- ---Purpose: Sets the parametric curve of the edge <E> in the
- -- face <F> to be the 2d representation of the
- -- meridian.
- is deferred;
-
- MeridianValue(me; V : Real) returns Pnt2d from gp
- ---Purpose: Returns the meridian point at parameter <V> in the
- -- plane XZ.
- is deferred;
-
- MeridianOnAxis(me; V : Real) returns Boolean
- ---Purpose: Returns True if the point of parameter <V> on the
- -- meridian is on the Axis. Default implementation is
- -- Abs(MeridianValue(V).X()) < Precision::Confusion()
- is virtual;
-
- MeridianClosed(me) returns Boolean
- ---Purpose: Returns True if the meridian is closed. Default
- -- implementation is
- -- MeridianValue(VMin).IsEqual(MeridianValue(VMax),
- -- Precision::Confusion())
- is virtual;
-
- VMaxInfinite(me) returns Boolean
- ---Purpose: Returns True if VMax is infinite. Default
- -- Precision::IsPositiveInfinite(VMax);
- is virtual;
-
- VMinInfinite(me) returns Boolean
- ---Purpose: Returns True if VMin is infinite. Default
- -- Precision::IsNegativeInfinite(VMax);
- is virtual;
-
-
- -- Usefull booleans
-
- HasTop(me) returns Boolean
- ---Purpose: Returns True if there is a top face.
- --
- -- That is neither : VMaxInfinite()
- -- MeridianClosed()
- -- MeridianOnAxis(VMax)
- is virtual;
-
- HasBottom(me) returns Boolean
- ---Purpose: Returns True if there is a bottom face.
- --
- -- That is neither : VMinInfinite()
- -- MeridianClosed()
- -- MeridianOnAxis(VMin)
- is virtual;
-
- HasSides(me) returns Boolean
- ---Purpose: Returns True if there are Start and End faces.
- --
- -- That is : 2*PI - Angle > Precision::Angular()
- is virtual;
-
-
- --
- -- Methods to get the Topology of:
- --
-
- -- the shell
- Shell(me : in out) returns TheShell
- ---Purpose: Returns the Shell containing all the Faces of the
- -- primitive.
- --
- ---C++: return const &
- is static;
-
- -- the Faces
-
- LateralFace(me : in out) returns TheFace
- ---Purpose: Returns the lateral Face. It is oriented toward
- -- the outside of the primitive.
- --
- ---C++: return const &
- is static;
-
- TopFace(me : in out) returns TheFace
- ---Purpose: Returns the top planar Face. It is Oriented
- -- toward the +Z axis (outside).
- --
- ---C++: return const &
- raises DomainError -- if !HasTop()
- is static;
-
- BottomFace(me : in out) returns TheFace
- ---Purpose: Returns the Bottom planar Face. It is Oriented
- -- toward the -Z axis (outside).
- --
- ---C++: return const &
- raises DomainError -- if !HasBottom()
- is static;
-
- StartFace(me : in out) returns TheFace
- ---Purpose: Returns the Face starting the slice, it is
- -- oriented toward the exterior of the primitive.
- --
- ---C++: return const &
- raises DomainError -- if !HasSides()
- is static;
-
- EndFace(me : in out) returns TheFace
- ---Purpose: Returns the Face ending the slice, it is oriented
- -- toward the exterior of the primitive.
- --
- ---C++: return const &
- raises DomainError -- if !HasSides()
- is static;
-
- -- Wires
-
- LateralWire(me : in out) returns TheWire
- ---Purpose: Returns the wire in the lateral face.
- --
- ---C++: return const &
- raises DomainError -- if VMinInfinite() && VMaxInfinite()
- is static;
-
- LateralStartWire(me : in out) returns TheWire
- ---Purpose: Returns the wire in the lateral face with the
- -- start edge.
- --
- ---C++: return const &
- raises DomainError -- if ! (VMinInfinite() && VMaxInfinite())
- is static;
-
- LateralEndWire(me : in out) returns TheWire
- ---Purpose: Returns the wire with in lateral face with the end
- -- edge.
- --
- ---C++: return const &
- raises DomainError -- if ! (VMinInfinite() && VMaxInfinite())
- is static;
-
- TopWire(me : in out) returns TheWire
- ---Purpose: Returns the wire in the top face.
- --
- ---C++: return const &
- raises DomainError -- if !HasTop()
- is static;
-
- BottomWire(me : in out) returns TheWire
- ---Purpose: Returns the wire in the bottom face.
- --
- ---C++: return const &
- raises DomainError -- if !HasBottom()
- is static;
-
- StartWire(me : in out) returns TheWire
- ---Purpose: Returns the wire in the start face.
- --
- ---C++: return const &
- raises DomainError -- if !HasSides()
- is static;
-
- AxisStartWire(me : in out) returns TheWire
- ---Purpose: Returns the wire in the start face with the
- -- AxisEdge.
- --
- ---C++: return const &
- raises DomainError -- if !HasSides() ! (VMinInfinite() && VMaxInfinite())
- is static;
-
- EndWire(me : in out) returns TheWire
- ---Purpose: Returns the Wire in the end face.
- --
- ---C++: return const &
- raises DomainError -- if !HasSides()
- is static;
-
- AxisEndWire(me : in out) returns TheWire
- ---Purpose: Returns the Wire in the end face with the
- -- AxisEdge.
- --
- ---C++: return const &
- raises DomainError -- if !HasSides() ! (VMinInfinite() && VMaxInfinite())
- is static;
-
-
- -- Edges
-
- AxisEdge(me : in out) returns TheEdge
- ---Purpose: Returns the Edge built along the Axis and oriented
- -- on +Z of the Axis.
- --
- ---C++: return const &
- raises DomainError -- if ! (MeridianOnAxis(VMin) || MeridianOnAxis(VMax))
- is static;
-
- StartEdge(me : in out) returns TheEdge
- ---Purpose: Returns the Edge at angle 0.
- --
- ---C++: return const &
- is static;
-
- EndEdge(me : in out) returns TheEdge
- ---Purpose: Returns the Edge at angle Angle. If !HasSides()
- -- the StartEdge and the EndEdge are the same edge.
- --
- ---C++: return const &
- is static;
-
- StartTopEdge(me : in out) returns TheEdge
- ---Purpose: Returns the linear Edge between start Face and top
- -- Face.
- --
- ---C++: return const &
- raises DomainError -- if ! (HasTop() && HasSides())
- is static;
-
- StartBottomEdge(me : in out) returns TheEdge
- ---Purpose: Returns the linear Edge between start Face and
- -- bottom Face.
- --
- ---C++: return const &
- raises DomainError -- if ! (HasBottom() && HasSides())
- is static;
-
- EndTopEdge(me : in out) returns TheEdge
- ---Purpose: Returns the linear Edge between end Face and top
- -- Face.
- --
- ---C++: return const &
- raises DomainError -- if ! (HasTop() && HasSides())
- is static;
-
- EndBottomEdge(me : in out) returns TheEdge
- ---Purpose: Returns the linear Edge between end Face and
- -- bottom Face.
- --
- ---C++: return const &
- raises DomainError -- if ! (HasBottom() && HasSides())
- is static;
-
- TopEdge(me : in out) returns TheEdge
- ---Purpose: Returns the edge at VMax. If MeridianClosed() the
- -- TopEdge and the BottomEdge are the same edge.
- --
- ---C++: return const &
- raises DomainError -- if VMaxInfinite()
- is static;
-
- BottomEdge(me : in out) returns TheEdge
- ---Purpose: Returns the edge at VMin. If MeridianClosed() the
- -- TopEdge and the BottomEdge are the same edge.
- --
- ---C++: return const &
- raises DomainError -- if VMinInfinite()
- is static;
-
- -- Vertices
-
- AxisTopVertex(me : in out) returns TheVertex
- ---Purpose: Returns the Vertex at the Top altitude on the axis.
- --
- ---C++: return const &
- raises DomainError -- if !MeridianOnAxis(VMax)
- is static;
-
- AxisBottomVertex(me : in out) returns TheVertex
- ---Purpose: Returns the Vertex at the Bottom altitude on the
- -- axis.
- --
- ---C++: return const &
- raises DomainError -- if !MeridianOnAxis(VMin)
- is static;
-
- TopStartVertex(me : in out) returns TheVertex
- ---Purpose: Returns the vertex (0,VMax)
- --
- ---C++: return const &
- raises DomainError -- if VMaxInfinite()
- is static;
-
- TopEndVertex(me : in out) returns TheVertex
- ---Purpose: Returns the vertex (angle,VMax)
- --
- ---C++: return const &
- raises DomainError -- if VMaxInfinite()
- is static;
-
- BottomStartVertex(me : in out) returns TheVertex
- ---Purpose: Returns the vertex (0,VMin)
- --
- ---C++: return const &
- raises DomainError -- if VMinInfinite()
- is static;
-
- BottomEndVertex(me : in out) returns TheVertex
- ---Purpose: Returns the vertex (angle,VMax)
- --
- ---C++: return const &
- raises DomainError -- if VMinInfinite()
- is static;
-
-fields
- myBuilder : TheBuilder is protected;
- myAxes : Ax2 from gp;
-
- myAngle : Real from Standard;
- myVMin : Real from Standard;
- myVMax : Real from Standard;
- myMeridianOffset : Real from Standard;
-
- -- the Topology
-
- myShell : TheShell;
- ShellBuilt : Boolean;
-
- myVertices : TheVertex [6];
- -- 0 : Vertex on top of the axis
- -- 1 : on bottom of the axis
- -- 2 : top, start
- -- 3 : top, end
- -- 4 : bottom, start
- -- 5 : bottom, end
- VerticesBuilt : Boolean [6];
-
- myEdges : TheEdge [9];
- -- 0 : Edge on the Axis
- -- 1 : Start Edge
- -- 2 : End Edge
- -- 3 : Start Top
- -- 4 : Start Bottom
- -- 5 : End Top
- -- 6 : End Bottom
- -- 7 : Top
- -- 8 : Bottom
- EdgesBuilt : Boolean [9];
-
- myWires : TheWire [9];
- -- 0 : wire Lateral
- -- 1 : Lateral Start
- -- 2 : Lateral End
- -- 3 : Top
- -- 4 : Bottom
- -- 5 : Start
- -- 6 : Axis Start
- -- 7 : End
- -- 8 : Axis End
- WiresBuilt : Boolean [9];
-
- myFaces : TheFace [5];
- -- 0 : Lateral Face
- -- 1 : Top
- -- 2 : Bottom
- -- 3 : Start
- -- 4 : End
- FacesBuilt : Boolean [5];
-
-
-end OneAxis;
+++ /dev/null
-// Created on: 1991-07-24
-// Created by: Christophe MARION
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Precision.hxx>
-
-#include <gp_Pln.hxx>
-#include <gp_Lin2d.hxx>
-#include <gp_Circ2d.hxx>
-#include <gp_Lin.hxx>
-#include <gp_Circ.hxx>
-#include <gp_Vec.hxx>
-
-#include <Standard_DomainError.hxx>
-#include <Standard_OutOfRange.hxx>
-
-#undef Standard_True
-#undef Standard_False
-
-#define Standard_True ((Standard_Boolean) 1)
-#define Standard_False ((Standard_Boolean) 0)
-
-
-#define NBVERTICES 6
-#define VAXISTOP 0
-#define VAXISBOT 1
-#define VTOPSTART 2
-#define VTOPEND 3
-#define VBOTSTART 4
-#define VBOTEND 5
-#define NBEDGES 9
-#define EAXIS 0
-#define ESTART 1
-#define EEND 2
-#define ETOPSTART 3
-#define ETOPEND 4
-#define EBOTSTART 5
-#define EBOTEND 6
-#define ETOP 7
-#define EBOTTOM 8
-#define NBWIRES 9
-#define WLATERAL 0
-#define WLATERALSTART 0
-#define WLATERALEND 1
-#define WTOP 2
-#define WBOTTOM 3
-#define WSTART 5
-#define WAXISSTART 6
-#define WEND 7
-#define WAXISEND 8
-#define NBFACES 5
-#define FLATERAL 0
-#define FTOP 1
-#define FBOTTOM 2
-#define FSTART 3
-#define FEND 4
-
-//=======================================================================
-//function : Primitives_OneAxis_Check
-//purpose : raise Standard_DomainError if something was built
-//=======================================================================
-
-static void Primitives_OneAxis_Check(const Standard_Boolean V[],
- const Standard_Boolean E[],
- const Standard_Boolean W[],
- const Standard_Boolean F[])
-{
- Standard_Integer i;
- for (i = 0; i < NBVERTICES; i++)
- if (V[i]) Standard_DomainError::Raise();
- for (i = 0; i < NBEDGES; i++)
- if (E[i]) Standard_DomainError::Raise();
- for (i = 0; i < NBWIRES; i++)
- if (W[i]) Standard_DomainError::Raise();
- for (i = 0; i < NBFACES; i++)
- if (F[i]) Standard_DomainError::Raise();
-}
-
-//=======================================================================
-//function : Primitives_OneAxis
-//purpose :
-//=======================================================================
-
-Primitives_OneAxis::Primitives_OneAxis(const TheBuilder& B,
- const gp_Ax2& A,
- const Standard_Real VMin,
- const Standard_Real VMax) :
- myBuilder(B),
- myAxes(A),
- myAngle(2*M_PI),
- myVMin(VMin),
- myVMax(VMax),
- myMeridianOffset(0)
-
-{
- // init Built flags
- Standard_Integer i;
- ShellBuilt = Standard_False;
- for (i = 0; i < NBVERTICES; i++)
- VerticesBuilt[i] = Standard_False;
- for (i = 0; i < NBEDGES; i++)
- EdgesBuilt[i] = Standard_False;
- for (i = 0; i < NBWIRES; i++)
- WiresBuilt[i] = Standard_False;
- for (i = 0; i < NBFACES; i++)
- FacesBuilt[i] = Standard_False;
-
-}
-
-void Primitives_OneAxis::Delete()
-{}
-
-//=======================================================================
-//function : SetMeridianOffset
-//purpose :
-//=======================================================================
-
-void Primitives_OneAxis::SetMeridianOffset(const Standard_Real O)
-{
- myMeridianOffset = O;
-}
-
-//=======================================================================
-//function : Axes, Angle, VMin, VMax
-//purpose :
-//=======================================================================
-
-const gp_Ax2& Primitives_OneAxis::Axes () const
-{
- return myAxes;
-}
-
-void Primitives_OneAxis::Axes (const gp_Ax2& A)
-{
- Primitives_OneAxis_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
- myAxes = A;
-}
-
-Standard_Real Primitives_OneAxis::Angle () const
-{
- return myAngle;
-}
-
-void Primitives_OneAxis::Angle (const Standard_Real A)
-{
- Primitives_OneAxis_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
- myAngle = A;
-}
-
-Standard_Real Primitives_OneAxis::VMin () const
-{
- return myVMin;
-}
-
-void Primitives_OneAxis::VMin (const Standard_Real V)
-{
- Primitives_OneAxis_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
- myVMin = V;
-}
-
-Standard_Real Primitives_OneAxis::VMax () const
-{
- return myVMax;
-}
-
-void Primitives_OneAxis::VMax (const Standard_Real V)
-{
- Primitives_OneAxis_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
- myVMax = V;
-}
-
-//=======================================================================
-//function : MeridianOnAxis
-//purpose :
-//=======================================================================
-
-Standard_Boolean Primitives_OneAxis::MeridianOnAxis
- (const Standard_Real V) const
-{
- return Abs(MeridianValue(V).X()) < Precision::Confusion();
-}
-
-//=======================================================================
-//function : MeridianClosed
-//purpose :
-//=======================================================================
-
-Standard_Boolean Primitives_OneAxis::MeridianClosed() const
-{
- if (VMaxInfinite()) return Standard_False;
- if (VMinInfinite()) return Standard_False;
- return MeridianValue(myVMin).IsEqual(MeridianValue(myVMax),
- Precision::Confusion());
-}
-
-//=======================================================================
-//function : VMaxInfinite
-//purpose :
-//=======================================================================
-
-Standard_Boolean Primitives_OneAxis::VMaxInfinite() const
-{
- return Precision::IsPositiveInfinite(myVMax);
-}
-
-//=======================================================================
-//function : VMinInfinite
-//purpose :
-//=======================================================================
-
-Standard_Boolean Primitives_OneAxis::VMinInfinite() const
-{
- return Precision::IsNegativeInfinite(myVMin);
-}
-
-//=======================================================================
-//function : HasTop
-//purpose :
-//=======================================================================
-
-Standard_Boolean Primitives_OneAxis::HasTop() const
-{
- if (VMaxInfinite()) return Standard_False;
- if (MeridianClosed()) return Standard_False;
- if (MeridianOnAxis(myVMax)) return Standard_False;
- return Standard_True;
-}
-
-//=======================================================================
-//function : HasBottom
-//purpose :
-//=======================================================================
-
-Standard_Boolean Primitives_OneAxis::HasBottom() const
-{
- if (VMinInfinite()) return Standard_False;
- if (MeridianClosed()) return Standard_False;
- if (MeridianOnAxis(myVMin)) return Standard_False;
- return Standard_True;
-}
-
-//=======================================================================
-//function : HasSides
-//purpose :
-//=======================================================================
-
-Standard_Boolean Primitives_OneAxis::HasSides() const
-{
- return 2*M_PI - myAngle > Precision::Angular();
-}
-
-//=======================================================================
-//function : Shell
-//purpose :
-//=======================================================================
-
-const TheShell& Primitives_OneAxis::Shell()
-{
- if (!ShellBuilt) {
- myBuilder.MakeShell(myShell);
-
- myBuilder.AddShellFace(myShell,LateralFace());
- if (HasTop())
- myBuilder.AddShellFace(myShell,TopFace());
- if (HasBottom())
- myBuilder.AddShellFace(myShell,BottomFace());
- if (HasSides()) {
- myBuilder.AddShellFace(myShell,StartFace());
- myBuilder.AddShellFace(myShell,EndFace());
- }
-
- myBuilder.CompleteShell(myShell);
- ShellBuilt = Standard_True;
- }
- return myShell;
-}
-
-//=======================================================================
-//function : LateralFace
-//purpose : build the lateral face
-//=======================================================================
-
-const TheFace& Primitives_OneAxis::LateralFace ()
-{
- // do it if not done
- if (!FacesBuilt[FLATERAL]) {
-
- // build an empty lateral face
- myFaces[FLATERAL] = MakeEmptyLateralFace();
-
- // add the wires
- if (VMaxInfinite() && VMinInfinite()) {
- myBuilder.AddFaceWire(myFaces[FLATERAL],LateralStartWire());
- myBuilder.AddFaceWire(myFaces[FLATERAL],LateralEndWire());
- }
- else
- myBuilder.AddFaceWire(myFaces[FLATERAL],LateralWire());
-
- // put the parametric curves
- if (MeridianClosed()) {
- // closed edge
- myBuilder.SetPCurve(myEdges[ETOP],myFaces[FLATERAL],
- gp_Lin2d(gp_Pnt2d(0,myVMin),gp_Dir2d(1,0)),
- gp_Lin2d(gp_Pnt2d(0,myVMax),gp_Dir2d(1,0)));
- }
- else {
- if (!VMaxInfinite()) {
- myBuilder.SetPCurve(myEdges[ETOP],myFaces[FLATERAL],
- gp_Lin2d(gp_Pnt2d(0,myVMax),gp_Dir2d(1,0)));
- if (!HasSides() || MeridianOnAxis(myVMax)) {
- // closed edge set parameters
- myBuilder.SetParameters(myEdges[ETOP],
- TopEndVertex(),
- 0.,myAngle);
- }
- }
- if (!VMinInfinite()) {
- myBuilder.SetPCurve(myEdges[EBOTTOM],myFaces[FLATERAL],
- gp_Lin2d(gp_Pnt2d(0,myVMin),gp_Dir2d(1,0)));
- if (!HasSides() || MeridianOnAxis(myVMin)) {
- // closed edge set parameters
- myBuilder.SetParameters(myEdges[EBOTTOM],
- BottomEndVertex(),
- 0.,myAngle);
- }
- }
- }
- if (HasSides()) {
- myBuilder.SetPCurve(myEdges[ESTART],myFaces[FLATERAL],
- gp_Lin2d(gp_Pnt2d(0,-myMeridianOffset),
- gp_Dir2d(0,1)));
-
- myBuilder.SetPCurve(myEdges[EEND],myFaces[FLATERAL],
- gp_Lin2d(gp_Pnt2d(myAngle,-myMeridianOffset),
- gp_Dir2d(0,1)));
- }
- else {
- // closed edge
- myBuilder.SetPCurve(myEdges[ESTART],myFaces[FLATERAL],
- gp_Lin2d(gp_Pnt2d(myAngle,-myMeridianOffset),
- gp_Dir2d(0,1)),
- gp_Lin2d(gp_Pnt2d(0,-myMeridianOffset),
- gp_Dir2d(0,1)));
- }
- myBuilder.CompleteFace(myFaces[FLATERAL]);
- FacesBuilt[FLATERAL] = Standard_True;
- }
- return myFaces[FLATERAL];
-}
-
-//=======================================================================
-//function : TopFace
-//purpose : build and return the TopFace
-//=======================================================================
-
-const TheFace& Primitives_OneAxis::TopFace ()
-{
- // do it if not done
- if (!FacesBuilt[FTOP]) {
-
- Standard_DomainError_Raise_if(!HasTop(),
- "Primitives_OneAxis::TopFace:No top face");
-
- // make the empty face by translating the axes
- Standard_Real z = MeridianValue(myVMax).Y();
- gp_Vec V = myAxes.Direction();
- V.Multiply(z);
- myBuilder.MakeFace(myFaces[FTOP],gp_Pln(myAxes.Translated(V)));
-
- myBuilder.AddFaceWire(myFaces[FTOP],TopWire());
-
- // put the parametric curves
- myBuilder.SetPCurve(myEdges[ETOP],myFaces[FTOP],
- gp_Circ2d(gp_Ax2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)),
- MeridianValue(myVMax).X()));
- if (HasSides()) {
- myBuilder.SetPCurve(myEdges[ETOPSTART],myFaces[FTOP],
- gp_Lin2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)));
- myBuilder.SetPCurve(myEdges[ETOPEND],myFaces[FTOP],
- gp_Lin2d(gp_Pnt2d(0,0),
- gp_Dir2d(Cos(myAngle),Sin(myAngle))));
- }
-
- myBuilder.CompleteFace(myFaces[FTOP]);
- FacesBuilt[FTOP] = Standard_True;
- }
-
- return myFaces[FTOP];
-}
-
-//=======================================================================
-//function : BottomFace
-//purpose :
-//=======================================================================
-
-const TheFace& Primitives_OneAxis::BottomFace ()
-{
- // do it if not done
- if (!FacesBuilt[FBOTTOM]) {
-
- Standard_DomainError_Raise_if(!HasBottom(),
- "Primitives_OneAxis::BottomFace:No bottom face");
-
- // make the empty face by translating the axes
- Standard_Real z = MeridianValue(myVMin).Y();
- gp_Vec V = myAxes.Direction();
- V.Multiply(z);
- gp_Ax2 axes = myAxes.Translated(V);
- myBuilder.MakeFace(myFaces[FBOTTOM],gp_Pln(axes));
- myBuilder.ReverseFace(myFaces[FBOTTOM]);
- myBuilder.AddFaceWire(myFaces[FBOTTOM],BottomWire());
-
- // put the parametric curves
- myBuilder.SetPCurve(myEdges[EBOTTOM],myFaces[FBOTTOM],
- gp_Circ2d(gp_Ax2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)),
- MeridianValue(myVMin).X()));
- if (HasSides()) {
- myBuilder.SetPCurve(myEdges[EBOTSTART],myFaces[FBOTTOM],
- gp_Lin2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)));
- myBuilder.SetPCurve(myEdges[EBOTEND],myFaces[FBOTTOM],
- gp_Lin2d(gp_Pnt2d(0,0),
- gp_Dir2d(Cos(myAngle),Sin(myAngle))));
- }
-
- myBuilder.CompleteFace(myFaces[FBOTTOM]);
- FacesBuilt[FBOTTOM] = Standard_True;
- }
-
- return myFaces[FBOTTOM];
-}
-
-//=======================================================================
-//function : StartFace
-//purpose :
-//=======================================================================
-
-const TheFace& Primitives_OneAxis::StartFace ()
-{
- // do it if not done
- if (!FacesBuilt[FSTART]) {
-
- Standard_DomainError_Raise_if(!HasSides(),
- "Primitives_OneAxes::StartFace:No side faces");
-
- // build the empty face, perpendicular to myTool.Axes()
- gp_Ax2 axes(myAxes.Location(),myAxes.YDirection().Reversed(),myAxes.XDirection());
- myBuilder.MakeFace(myFaces[FSTART],gp_Pln(axes));
-
-
- if (VMaxInfinite() && VMinInfinite())
- myBuilder.AddFaceWire(myFaces[FSTART],AxisStartWire());
-
- myBuilder.AddFaceWire(myFaces[FSTART],StartWire());
-
- // parametric curves
- SetMeridianPCurve(myEdges[ESTART],myFaces[FSTART]);
- if (EdgesBuilt[EAXIS])
- myBuilder.SetPCurve(myEdges[EAXIS],myFaces[FSTART],
- gp_Lin2d(gp_Pnt2d(0,0),gp_Dir2d(0,1)));
- if (EdgesBuilt[ETOPSTART])
- myBuilder.SetPCurve(myEdges[ETOPSTART],myFaces[FSTART],
- gp_Lin2d(gp_Pnt2d(0,MeridianValue(myVMax).Y()),gp_Dir2d(1,0)));
- if (EdgesBuilt[EBOTSTART])
- myBuilder.SetPCurve(myEdges[EBOTSTART],myFaces[FSTART],
- gp_Lin2d(gp_Pnt2d(0,MeridianValue(myVMin).Y()),gp_Dir2d(1,0)));
-
-
- myBuilder.CompleteFace(myFaces[FSTART]);
- FacesBuilt[FSTART] = Standard_True;
- }
-
- return myFaces[FSTART];
-}
-
-//=======================================================================
-//function : EndFace
-//purpose :
-//=======================================================================
-
-const TheFace& Primitives_OneAxis::EndFace ()
-{
- // do it if not done
- if (!FacesBuilt[FEND]) {
-
- Standard_DomainError_Raise_if(!HasSides(),
- "Primitives_OneAxes::EndFace:No side faces");
-
- // build the empty face, perpendicular to myTool.Axes()
- gp_Ax2 axes(myAxes.Location(),myAxes.YDirection().Reversed(),myAxes.XDirection());
- axes.Rotate(myAxes.Axis(),myAngle);
- myBuilder.MakeFace(myFaces[FEND],gp_Pln(axes));
- myBuilder.ReverseFace(myFaces[FEND]);
-
- if (VMaxInfinite() && VMinInfinite())
- myBuilder.AddFaceWire(myFaces[FEND],AxisEndWire());
- myBuilder.AddFaceWire(myFaces[FEND],EndWire());
-
- // parametric curves
- SetMeridianPCurve(myEdges[EEND],myFaces[FEND]);
- if (EdgesBuilt[EAXIS])
- myBuilder.SetPCurve(myEdges[EAXIS],myFaces[FEND],
- gp_Lin2d(gp_Pnt2d(0,0),gp_Dir2d(0,1)));
- if (EdgesBuilt[ETOPEND])
- myBuilder.SetPCurve(myEdges[ETOPEND],myFaces[FEND],
- gp_Lin2d(gp_Pnt2d(0,MeridianValue(myVMax).Y()),
- gp_Dir2d(1,0)));
- if (EdgesBuilt[EBOTEND])
- myBuilder.SetPCurve(myEdges[EBOTEND],myFaces[FEND],
- gp_Lin2d(gp_Pnt2d(0,MeridianValue(myVMin).Y()),
- gp_Dir2d(1,0)));
-
- myBuilder.CompleteFace(myFaces[FEND]);
- FacesBuilt[FEND] = Standard_True;
- }
-
- return myFaces[FEND];
-}
-
-//=======================================================================
-//function : LateralWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::LateralWire ()
-{
- // do it if not done
- if (!WiresBuilt[WLATERAL]) {
-
- myBuilder.MakeWire(myWires[WLATERAL]);
-
- if (!VMaxInfinite())
- myBuilder.AddWireEdge(myWires[WLATERAL],TopEdge() ,Standard_False);
- myBuilder.AddWireEdge( myWires[WLATERAL],EndEdge() ,Standard_True);
- if (!VMinInfinite())
- myBuilder.AddWireEdge(myWires[WLATERAL],BottomEdge() ,Standard_True);
- myBuilder.AddWireEdge( myWires[WLATERAL],StartEdge() ,Standard_False);
-
- myBuilder.CompleteWire(myWires[WLATERAL]);
- WiresBuilt[WLATERAL] = Standard_True;
- }
-
- return myWires[WLATERAL];
-}
-
-
-//=======================================================================
-//function : LateralStartWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::LateralStartWire ()
-{
- // do it if not done
- if (!WiresBuilt[WLATERALSTART]) {
-
- myBuilder.MakeWire(myWires[WLATERALSTART]);
-
- myBuilder.AddWireEdge(myWires[WLATERALSTART],StartEdge(),Standard_False);
-
- myBuilder.CompleteWire(myWires[WLATERALSTART]);
- WiresBuilt[WLATERALSTART] = Standard_True;
- }
-
- return myWires[WLATERALSTART];
-}
-
-
-//=======================================================================
-//function : LateralEndWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::LateralEndWire ()
-{
- // do it if not done
- if (!WiresBuilt[WLATERALEND]) {
-
- myBuilder.MakeWire(myWires[WLATERALEND]);
-
- myBuilder.AddWireEdge(myWires[WLATERALEND],EndEdge(),Standard_True);
-
- myBuilder.CompleteWire(myWires[WLATERALEND]);
- WiresBuilt[WLATERALEND] = Standard_True;
- }
-
- return myWires[WLATERALEND];
-}
-
-//=======================================================================
-//function : TopWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::TopWire ()
-{
- // do it if not done
- if (!WiresBuilt[WTOP]) {
-
- Standard_DomainError_Raise_if(!HasTop(),
- "Primitives_OneAxis::TopWire: no top");
-
- myBuilder.MakeWire(myWires[WTOP]);
-
- myBuilder.AddWireEdge(myWires[WTOP],TopEdge() ,Standard_True);
- if (HasSides()) {
- myBuilder.AddWireEdge(myWires[WTOP],StartTopEdge() ,Standard_True);
- myBuilder.AddWireEdge(myWires[WTOP],EndTopEdge() ,Standard_False);
- }
- myBuilder.CompleteWire(myWires[WTOP]);
- WiresBuilt[WTOP] = Standard_True;
- }
-
- return myWires[WTOP];
-}
-
-//=======================================================================
-//function : BottomWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::BottomWire ()
-{
- // do it if not done
- if (!WiresBuilt[WBOTTOM]) {
-
- Standard_DomainError_Raise_if(!HasBottom(),
- "Primitives_OneAxis::BottomWire: no bottom");
-
- myBuilder.MakeWire(myWires[WBOTTOM]);
-
- myBuilder.AddWireEdge(myWires[WBOTTOM],BottomEdge() ,Standard_False);
- if (HasSides()) {
- myBuilder.AddWireEdge(myWires[WBOTTOM],EndBottomEdge() ,Standard_True);
- myBuilder.AddWireEdge(myWires[WBOTTOM],StartBottomEdge(),Standard_False);
- }
-
- myBuilder.CompleteWire(myWires[WBOTTOM]);
- WiresBuilt[WBOTTOM] = Standard_True;
- }
-
- return myWires[WBOTTOM];
-}
-
-//=======================================================================
-//function : StartWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::StartWire ()
-{
- // do it if not done
- if (!WiresBuilt[WSTART]) {
-
- Standard_DomainError_Raise_if(!HasSides(),
- "Primitives_OneAxes::StartWire:no sides");
-
- myBuilder.MakeWire(myWires[WSTART]);
-
- if (HasBottom())
- myBuilder.AddWireEdge(myWires[WSTART],StartBottomEdge() ,Standard_True);
-
- if (!MeridianClosed()) {
- if (!VMaxInfinite() || !VMinInfinite())
- myBuilder.AddWireEdge( myWires[WSTART],AxisEdge() ,Standard_False);
- }
-
- if (HasTop())
- myBuilder.AddWireEdge(myWires[WSTART],StartTopEdge() ,Standard_False);
- myBuilder.AddWireEdge( myWires[WSTART],StartEdge() ,Standard_True);
-
- myBuilder.CompleteWire(myWires[WSTART]);
- WiresBuilt[WSTART] = Standard_True;
- }
-
- return myWires[WSTART];
-}
-
-//=======================================================================
-//function : AxisStartWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::AxisStartWire ()
-{
- // do it if not done
- if (!WiresBuilt[WAXISSTART]) {
-
- Standard_DomainError_Raise_if
- (!HasSides(),
- "Primitives_OneAxes::AxisStartWire:no sides");
-
- Standard_DomainError_Raise_if
- (!VMaxInfinite() || !VMinInfinite(),
- "Primitives_OneAxes::AxisStartWire:not infinite");
-
- Standard_DomainError_Raise_if
- (MeridianClosed(),
- "Primitives_OneAxes::AxisStartWire:meridian closed");
-
- myBuilder.MakeWire(myWires[WAXISSTART]);
-
- myBuilder.AddWireEdge( myWires[WAXISSTART],AxisEdge() ,Standard_False);
-
- myBuilder.CompleteWire(myWires[WAXISSTART]);
- WiresBuilt[WAXISSTART] = Standard_True;
- }
-
- return myWires[WAXISSTART];
-}
-
-//=======================================================================
-//function : EndWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::EndWire ()
-{
- // do it if not done
- if (!WiresBuilt[WEND]) {
-
- Standard_DomainError_Raise_if(!HasSides(),
- "Primitives_OneAxes::EndWire:no sides");
-
- myBuilder.MakeWire(myWires[WEND]);
-
- if (HasTop())
- myBuilder.AddWireEdge(myWires[WEND],EndTopEdge(), Standard_True);
- if (!MeridianClosed()) {
- if (!VMaxInfinite() || !VMinInfinite()) {
- myBuilder.AddWireEdge( myWires[WEND],AxisEdge(), Standard_True);
- }
- }
- if (HasBottom())
- myBuilder.AddWireEdge(myWires[WEND],EndBottomEdge(), Standard_False);
- myBuilder.AddWireEdge( myWires[WEND],EndEdge(), Standard_False);
-
- myBuilder.CompleteWire(myWires[WEND]);
- WiresBuilt[WEND] = Standard_True;
- }
- return myWires[WEND];
-}
-
-//=======================================================================
-//function : AxisEndWire
-//purpose :
-//=======================================================================
-
-const TheWire& Primitives_OneAxis::AxisEndWire ()
-{
- // do it if not done
- if (!WiresBuilt[WAXISEND]) {
-
- Standard_DomainError_Raise_if
- (!HasSides(),
- "Primitives_OneAxes::AxisEndWire:no sides");
-
- Standard_DomainError_Raise_if
- (!VMaxInfinite() || !VMinInfinite(),
- "Primitives_OneAxes::AxisEndWire:not infinite");
-
- Standard_DomainError_Raise_if
- (MeridianClosed(),
- "Primitives_OneAxes::AxisEndWire:meridian closed");
-
- myBuilder.MakeWire(myWires[WAXISEND]);
-
- myBuilder.AddWireEdge( myWires[WAXISEND],AxisEdge(), Standard_True);
-
- myBuilder.CompleteWire(myWires[WAXISEND]);
- WiresBuilt[WAXISEND] = Standard_True;
- }
- return myWires[WAXISEND];
-}
-
-//=======================================================================
-//function : AxisEdge
-//purpose : make the edge on the axis, oriented +Z
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::AxisEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[EAXIS]) {
-
- Standard_DomainError_Raise_if(!HasSides(),
- "Primitives_OneAxis::AxisEdge:no sides");
- Standard_DomainError_Raise_if(MeridianClosed(),
- "Primitives_OneAxis::AxisEdge:closed");
-
- // build the empty edge.
- myBuilder.MakeEdge(myEdges[EAXIS],gp_Lin(myAxes.Axis()));
-
- if (!VMaxInfinite())
- myBuilder.AddEdgeVertex(myEdges[EAXIS],AxisTopVertex(),
- MeridianValue(myVMax).Y(),Standard_False);
- if (!VMinInfinite())
- myBuilder.AddEdgeVertex(myEdges[EAXIS],AxisBottomVertex(),
- MeridianValue(myVMin).Y(),Standard_True);
-
- myBuilder.CompleteEdge(myEdges[EAXIS]);
- EdgesBuilt[EAXIS] = Standard_True;
- }
-
- return myEdges[EAXIS];
-}
-
-//=======================================================================
-//function : StartEdge
-//purpose :
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::StartEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[ESTART]) {
-
- // is it shared with the EndEdge
-
- if (!HasSides() && EdgesBuilt[EEND])
- myEdges[ESTART] = myEdges[EEND];
-
- else {
- // build the empty Edge
- myEdges[ESTART] = MakeEmptyMeridianEdge(0.);
-
- if (MeridianClosed()) {
- // Closed edge
- myBuilder.AddEdgeVertex(myEdges[ESTART],
- TopStartVertex(),
- myVMin+myMeridianOffset,
- myVMax+myMeridianOffset);
- }
- else {
- if (!VMaxInfinite()) {
- myBuilder.AddEdgeVertex(myEdges[ESTART],
- TopStartVertex(),
- myVMax+myMeridianOffset,
- Standard_False);
- }
- if (!VMinInfinite()) {
- myBuilder.AddEdgeVertex(myEdges[ESTART],
- BottomStartVertex(),
- myVMin+myMeridianOffset,
- Standard_True);
- }
- }
- }
-
- myBuilder.CompleteEdge(myEdges[ESTART]);
- EdgesBuilt[ESTART] = Standard_True;
-
- }
-
- return myEdges[ESTART];
-}
-
-//=======================================================================
-//function : EndEdge
-//purpose :
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::EndEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[EEND]) {
-
- // is it shared with the start edge
- if (!HasSides() && EdgesBuilt[ESTART])
- myEdges[EEND] = myEdges[ESTART];
-
- else {
- // build the empty Edge
- myEdges[EEND] = MakeEmptyMeridianEdge(myAngle);
-
-
- if (MeridianClosed()) {
- // Closed edge
- myBuilder.AddEdgeVertex(myEdges[EEND],
- TopEndVertex(),
- myVMin+myMeridianOffset,
- myVMax+myMeridianOffset);
- }
- else {
- if (!VMaxInfinite()) {
- myBuilder.AddEdgeVertex(myEdges[EEND],
- TopEndVertex(),
- myVMax+myMeridianOffset,
- Standard_False);
- }
- if (!VMinInfinite()) {
- myBuilder.AddEdgeVertex(myEdges[EEND],
- BottomEndVertex(),
- myVMin+myMeridianOffset,
- Standard_True);
- }
- }
- }
-
- myBuilder.CompleteEdge(myEdges[EEND]);
- EdgesBuilt[EEND] = Standard_True;
-
- }
-
- return myEdges[EEND];
-}
-
-//=======================================================================
-//function : StartTopEdge
-//purpose :
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::StartTopEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[ETOPSTART]) {
-
- Standard_DomainError_Raise_if
- (!HasTop() || !HasSides(),
- "Primitives_OneAxis::StartTopEdge:no sides or no top");
-
- // build the empty Edge
- gp_Vec V = myAxes.Direction();
- V.Multiply(MeridianValue(myVMax).Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- myBuilder.MakeEdge(myEdges[ETOPSTART],gp_Lin(P,myAxes.XDirection()));
-
- myBuilder.AddEdgeVertex(myEdges[ETOPSTART],AxisTopVertex(),
- 0.,Standard_True);
- myBuilder.AddEdgeVertex(myEdges[ETOPSTART],TopStartVertex(),
- MeridianValue(myVMax).X(),Standard_False);
-
- myBuilder.CompleteEdge(myEdges[ETOPSTART]);
- EdgesBuilt[ETOPSTART] = Standard_True;
- }
-
- return myEdges[ETOPSTART];
-}
-
-//=======================================================================
-//function : StartBottomEdge
-//purpose :
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::StartBottomEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[EBOTSTART]) {
-
- Standard_DomainError_Raise_if
- (!HasBottom() || !HasSides(),
- "Primitives_OneAxis::StartBottomEdge:no sides or no top");
-
- // build the empty Edge
- gp_Vec V = myAxes.Direction();
- V.Multiply(MeridianValue(myVMin).Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- myBuilder.MakeEdge(myEdges[EBOTSTART],gp_Lin(P,myAxes.XDirection()));
-
- myBuilder.AddEdgeVertex(myEdges[EBOTSTART],BottomStartVertex(),
- MeridianValue(myVMin).X(),Standard_False);
- myBuilder.AddEdgeVertex(myEdges[EBOTSTART],AxisBottomVertex(),
- 0.,Standard_True);
-
- myBuilder.CompleteEdge(myEdges[EBOTSTART]);
- EdgesBuilt[EBOTSTART] = Standard_True;
- }
-
- return myEdges[EBOTSTART];
-}
-
-//=======================================================================
-//function : EndTopEdge
-//purpose :
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::EndTopEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[ETOPEND]) {
-
- Standard_DomainError_Raise_if
- (!HasTop() || !HasSides(),
- "Primitives_OneAxis::EndTopEdge:no sides or no top");
-
- // build the empty Edge
- gp_Vec V = myAxes.Direction();
- V.Multiply(MeridianValue(myVMax).Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- gp_Lin L(P,myAxes.XDirection());
- L.Rotate(myAxes.Axis(),myAngle);
- myBuilder.MakeEdge(myEdges[ETOPEND],L);
-
- myBuilder.AddEdgeVertex(myEdges[ETOPEND],AxisTopVertex(),
- 0.,Standard_True);
- myBuilder.AddEdgeVertex(myEdges[ETOPEND],TopEndVertex(),
- MeridianValue(myVMax).X(),Standard_False);
-
- myBuilder.CompleteEdge(myEdges[ETOPEND]);
- EdgesBuilt[ETOPEND] = Standard_True;
- }
-
- return myEdges[ETOPEND];
-}
-
-//=======================================================================
-//function : EndBottomEdge
-//purpose :
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::EndBottomEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[EBOTEND]) {
-
-
- Standard_DomainError_Raise_if
- (!HasBottom() || !HasSides(),
- "Primitives_OneAxis::EndBottomEdge:no sides or no bottom");
-
- // build the empty Edge
- gp_Vec V = myAxes.Direction();
- V.Multiply(MeridianValue(myVMin).Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- gp_Lin L(P,myAxes.XDirection());
- L.Rotate(myAxes.Axis(),myAngle);
- myBuilder.MakeEdge(myEdges[EBOTEND],L);
-
- myBuilder.AddEdgeVertex(myEdges[EBOTEND],AxisBottomVertex(),
- 0.,Standard_True);
- myBuilder.AddEdgeVertex(myEdges[EBOTEND],BottomEndVertex(),
- MeridianValue(myVMin).X(),Standard_False);
-
- myBuilder.CompleteEdge(myEdges[EBOTEND]);
- EdgesBuilt[EBOTEND] = Standard_True;
- }
-
- return myEdges[EBOTEND];
-}
-
-//=======================================================================
-//function : TopEdge
-//purpose :
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::TopEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[ETOP]) {
-
- // Test if shared with bottom edge
- if (MeridianClosed() && EdgesBuilt[EBOTTOM]) {
- myEdges[ETOP] = myEdges[EBOTTOM];
- }
-
- else {
-
- // build the empty Edge
- if (!MeridianOnAxis(myVMax)) {
- gp_Pnt2d mp = MeridianValue(myVMax);
- gp_Vec V = myAxes.Direction();
- V.Multiply(mp.Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- gp_Circ C(gp_Ax2(P,myAxes.Direction(),myAxes.XDirection()),mp.X());
- myBuilder.MakeEdge(myEdges[ETOP],C);
- }
- else
- myBuilder.MakeDegeneratedEdge(myEdges[ETOP]);
-
- if (!HasSides()) {
- // closed edge
- myBuilder.AddEdgeVertex(myEdges[ETOP],
- TopEndVertex(),
- 0.,myAngle);
- }
- else {
- myBuilder.AddEdgeVertex(myEdges[ETOP],
- TopEndVertex(),
- myAngle,
- Standard_False);
- myBuilder.AddEdgeVertex(myEdges[ETOP],
- TopStartVertex(),
- 0.,
- Standard_True);
- }
- }
-
- myBuilder.CompleteEdge(myEdges[ETOP]);
- EdgesBuilt[ETOP] = Standard_True;
- }
-
- return myEdges[ETOP];
-}
-
-//=======================================================================
-//function : BottomEdge
-//purpose :
-//=======================================================================
-
-const TheEdge& Primitives_OneAxis::BottomEdge ()
-{
- // do it if not done
- if (!EdgesBuilt[EBOTTOM]) {
-
- // Test if shared with top edge
- if (MeridianClosed() && EdgesBuilt[ETOP]) {
- myEdges[EBOTTOM] = myEdges[ETOP];
- }
-
- else {
-
- // build the empty Edge
-
- if (!MeridianOnAxis(myVMin)) {
- gp_Pnt2d mp = MeridianValue(myVMin);
- gp_Vec V = myAxes.Direction();
- V.Multiply(mp.Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- gp_Circ C(gp_Ax2(P,myAxes.Direction(),myAxes.XDirection()),mp.X());
- myBuilder.MakeEdge(myEdges[EBOTTOM],C);
- }
- else
- myBuilder.MakeDegeneratedEdge(myEdges[EBOTTOM]);
-
- if (!HasSides()) {
- // closed edge
- myBuilder.AddEdgeVertex(myEdges[EBOTTOM],
- BottomEndVertex(),
- 0.,myAngle);
- }
- else {
- myBuilder.AddEdgeVertex(myEdges[EBOTTOM],
- BottomEndVertex(),
- myAngle,
- Standard_False);
- myBuilder.AddEdgeVertex(myEdges[EBOTTOM],
- BottomStartVertex(),
- 0.,
- Standard_True);
- }
- }
-
- myBuilder.CompleteEdge(myEdges[EBOTTOM]);
- EdgesBuilt[EBOTTOM] = Standard_True;
- }
-
- return myEdges[EBOTTOM];
-}
-
-//=======================================================================
-//function : AxisTopVertex
-//purpose :
-//=======================================================================
-
-const TheVertex& Primitives_OneAxis::AxisTopVertex ()
-{
- // do it if not done
- if (!VerticesBuilt[VAXISTOP]) {
-
- // deduct from others
- if (MeridianOnAxis(myVMax) && VerticesBuilt[VTOPSTART])
- myVertices[VAXISTOP] = myVertices[VTOPSTART];
-
- else if (MeridianOnAxis(myVMax) && VerticesBuilt[VTOPEND])
- myVertices[VAXISTOP] = myVertices[VTOPEND];
-
- else {
- Standard_DomainError_Raise_if(MeridianClosed(),
- "Primitives_OneAxis::AxisTopVertex");
- Standard_DomainError_Raise_if(VMaxInfinite(),
- "Primitives_OneAxis::AxisTopVertex");
-
- gp_Vec V = myAxes.Direction();
- V.Multiply(MeridianValue(myVMax).Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- myBuilder.MakeVertex(myVertices[VAXISTOP],P);
- }
-
- VerticesBuilt[VAXISTOP] = Standard_True;
- }
-
- return myVertices[VAXISTOP];
-}
-
-//=======================================================================
-//function : AxisBottomVertex
-//purpose :
-//=======================================================================
-
-const TheVertex& Primitives_OneAxis::AxisBottomVertex ()
-{
- // do it if not done
- if (!VerticesBuilt[VAXISBOT]) {
-
- // deduct from others
- if (MeridianOnAxis(myVMin) && VerticesBuilt[VBOTSTART])
- myVertices[VAXISBOT] = myVertices[VBOTSTART];
-
- else if (MeridianOnAxis(myVMin) && VerticesBuilt[VBOTEND])
- myVertices[VAXISBOT] = myVertices[VBOTEND];
-
- else {
- Standard_DomainError_Raise_if(MeridianClosed(),
- "Primitives_OneAxis::AxisBottomVertex");
- Standard_DomainError_Raise_if(VMinInfinite(),
- "Primitives_OneAxis::AxisBottomVertex");
-
- gp_Vec V = myAxes.Direction();
- V.Multiply(MeridianValue(myVMin).Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- myBuilder.MakeVertex(myVertices[VAXISBOT],P);
- }
-
- VerticesBuilt[VAXISBOT] = Standard_True;
- }
-
- return myVertices[VAXISBOT];
-}
-
-//=======================================================================
-//function : TopStartVertex
-//purpose :
-//=======================================================================
-
-const TheVertex& Primitives_OneAxis::TopStartVertex ()
-{
- // do it if not done
- if (!VerticesBuilt[VTOPSTART]) {
-
- // deduct from others
- if (MeridianOnAxis(myVMax) && VerticesBuilt[VAXISTOP])
- myVertices[VTOPSTART] = myVertices[VAXISTOP];
- else if ((MeridianOnAxis(myVMax) || !HasSides()) && VerticesBuilt[VTOPEND])
- myVertices[VTOPSTART] = myVertices[VTOPEND];
- else if (MeridianClosed() && VerticesBuilt[VBOTSTART])
- myVertices[VTOPSTART] = myVertices[VBOTSTART];
- else if ((MeridianClosed() && !HasSides()) && VerticesBuilt[VBOTEND])
- myVertices[VTOPSTART] = myVertices[VBOTEND];
-
- else{
- gp_Pnt2d mp = MeridianValue(myVMax);
- gp_Vec V = myAxes.Direction();
- V.Multiply(mp.Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- V = myAxes.XDirection();
- V.Multiply(mp.X());
- P.Translate(V);
- myBuilder.MakeVertex(myVertices[VTOPSTART],P);
- }
-
- VerticesBuilt[VTOPSTART] = Standard_True;
- }
-
- return myVertices[VTOPSTART];
-}
-
-//=======================================================================
-//function : TopEndVertex
-//purpose :
-//=======================================================================
-
-const TheVertex& Primitives_OneAxis::TopEndVertex ()
-{
- // do it if not done
- if (!VerticesBuilt[VTOPEND]) {
-
-
- // deduct from others
- if (MeridianOnAxis(myVMax) && VerticesBuilt[VAXISTOP])
- myVertices[VTOPEND] = myVertices[VAXISTOP];
- else if ((MeridianOnAxis(myVMax) || !HasSides()) && VerticesBuilt[VTOPSTART])
- myVertices[VTOPEND] = myVertices[VTOPSTART];
- else if (MeridianClosed() && VerticesBuilt[VBOTEND])
- myVertices[VTOPEND] = myVertices[VBOTEND];
- else if ((MeridianClosed() && !HasSides()) && VerticesBuilt[VBOTSTART])
- myVertices[VTOPEND] = myVertices[VBOTSTART];
-
- else {
- gp_Pnt2d mp = MeridianValue(myVMax);
- gp_Vec V = myAxes.Direction();
- V.Multiply(mp.Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- V = myAxes.XDirection();
- V.Multiply(mp.X());
- P.Translate(V);
- P.Rotate(myAxes.Axis(),myAngle);
- myBuilder.MakeVertex(myVertices[VTOPEND],P);
- }
-
- VerticesBuilt[VTOPEND] = Standard_True;
- }
-
- return myVertices[VTOPEND];
-}
-
-//=======================================================================
-//function : BottomStartVertex
-//purpose :
-//=======================================================================
-
-const TheVertex& Primitives_OneAxis::BottomStartVertex ()
-{
- // do it if not done
- if (!VerticesBuilt[VBOTSTART]) {
-
- // deduct from others
- if (MeridianOnAxis(myVMin) && VerticesBuilt[VAXISBOT])
- myVertices[VBOTSTART] = myVertices[VAXISBOT];
- else if ((MeridianOnAxis(myVMin) || !HasSides()) && VerticesBuilt[VBOTEND])
- myVertices[VBOTSTART] = myVertices[VBOTEND];
- else if (MeridianClosed() && VerticesBuilt[VTOPSTART])
- myVertices[VBOTSTART] = myVertices[VTOPSTART];
- else if ((MeridianClosed() && !HasSides()) && VerticesBuilt[VTOPEND])
- myVertices[VBOTSTART] = myVertices[VTOPEND];
-
- else {
- gp_Pnt2d mp = MeridianValue(myVMin);
- gp_Vec V = myAxes.Direction();
- V.Multiply(mp.Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- V = myAxes.XDirection();
- V.Multiply(mp.X());
- P.Translate(V);
- myBuilder.MakeVertex(myVertices[VBOTSTART],P);
- }
-
- VerticesBuilt[VBOTSTART] = Standard_True;
- }
-
- return myVertices[VBOTSTART];
-}
-
-//=======================================================================
-//function : BottomEndVertex
-//purpose :
-//=======================================================================
-
-const TheVertex& Primitives_OneAxis::BottomEndVertex ()
-{
- // do it if not done
- if (!VerticesBuilt[VBOTEND]) {
-
- // deduct from others
- if (MeridianOnAxis(myVMin) && VerticesBuilt[VAXISBOT])
- myVertices[VBOTEND] = myVertices[VAXISBOT];
- else if ((MeridianOnAxis(myVMin) || !HasSides()) && VerticesBuilt[VBOTSTART])
- myVertices[VBOTEND] = myVertices[VBOTSTART];
- else if (MeridianClosed() && VerticesBuilt[VTOPEND])
- myVertices[VBOTEND] = myVertices[VTOPEND];
- else if (MeridianClosed() && !HasSides() && VerticesBuilt[VTOPSTART])
- myVertices[VBOTEND] = myVertices[VTOPSTART];
-
- else {
- gp_Pnt2d mp = MeridianValue(myVMin);
- gp_Vec V = myAxes.Direction();
- V.Multiply(mp.Y());
- gp_Pnt P = myAxes.Location().Translated(V);
- V = myAxes.XDirection();
- V.Multiply(mp.X());
- P.Translate(V);
- P.Rotate(myAxes.Axis(),myAngle);
- myBuilder.MakeVertex(myVertices[VBOTEND],P);
- }
-
- VerticesBuilt[VBOTEND] = Standard_True;
- }
-
- return myVertices[VBOTEND];
-}
+++ /dev/null
--- Created on: 1991-09-18
--- Created by: Christophe MARION
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class Wedge from Primitives(
- TheShell as any;
- TheFace as any;
- TheWire as any;
- TheEdge as any;
- TheVertex as any;
- TheBuilder as any)
-
- ---Purpose: A wedge is defined by :
- --
- -- Axes : an Axis2 (coordinate system)
- --
- -- YMin, YMax the coordinates of the ymin and ymax
- -- rectangular faces parallel to the ZX plane (of the
- -- coordinate systems)
- --
- -- ZMin,ZMax,XMin,XMax the rectangular
- -- left (YMin) face parallel to the Z and X axes.
- --
- -- Z2Min,Z2Max,X2Min,X2Max the rectangular
- -- right (YMax) face parallel to the Z and X axes.
- --
- -- For a box Z2Min = ZMin, Z2Max = ZMax,
- -- X2Min = XMin, X2Max = XMax
- --
- -- The wedge can be open in the corresponding direction
- -- of its Boolean myInfinite
-
-
-uses
-
- Direction from Primitives,
-
- Ax2 from gp,
- Pln from gp,
- Lin from gp,
- Pnt from gp
-
-raises
- DomainError,
- OutOfRange
-
-is
- Create(B : TheBuilder; Axes : Ax2 from gp; dx, dy, dz : Real)
- returns Wedge from Primitives
- ---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(B : TheBuilder; Axes : Ax2 from gp; dx, dy, dz, ltx : Real)
- returns Wedge from Primitives
- ---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(B : TheBuilder; Axes : Ax2 from gp; xmin, ymin, zmin, z2min, x2min,
- xmax, ymax, zmax, z2max, x2max : Real)
- returns Wedge from Primitives
- ---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;
-
- Axes(me) returns Ax2 from gp
- ---Purpose: Returns the coordinates system from <me>.
- is static;
-
- GetXMin(me) returns Real
- ---Purpose: Returns Xmin value from <me>.
- is static;
-
- GetYMin(me) returns Real
- ---Purpose: Returns YMin value from <me>.
- is static;
-
- GetZMin(me) returns Real
- ---Purpose: Returns ZMin value from <me>.
- is static;
-
- GetZ2Min(me) returns Real
- ---Purpose: Returns Z2Min value from <me>.
- is static;
-
- GetX2Min(me) returns Real
- ---Purpose: Returns X2Min value from <me>.
- is static;
-
- GetXMax(me) returns Real
- ---Purpose: Returns XMax value from <me>.
- is static;
-
- GetYMax(me) returns Real
- ---Purpose: Returns YMax value from <me>.
- is static;
-
- GetZMax(me) returns Real
- ---Purpose: Returns ZMax value from <me>.
- is static;
-
- GetZ2Max(me) returns Real
- ---Purpose: Returns Z2Max value from <me>.
- is static;
-
- GetX2Max(me) returns Real
- ---Purpose: Returns X2Max value from <me>.
- is static;
-
- Open(me : in out; d1 : Direction from Primitives)
- ---Purpose: Opens <me> in <d1> direction. A face and its edges
- -- or vertices are said nonexistant.
- raises DomainError
- is static;
-
- Close(me : in out; d1 : Direction from Primitives)
- ---Purpose: Closes <me> in <d1> direction. A face and its
- -- edges or vertices are said existant.
- raises DomainError
- is static;
-
- IsInfinite(me; d1 : Direction from Primitives)
- ---Purpose: Returns True if <me> is open in <d1> direction.
- returns Boolean;
-
- Shell(me : in out) returns TheShell
- ---Purpose: Returns the Shell containing the Faces of <me>.
- --
- ---C++: return const &
- is static;
-
- HasFace(me; d1 : Direction from Primitives)
- ---Purpose: Returns True if <me> has a Face in <d1> direction.
- returns Boolean;
-
- Face(me : in out; d1 : Direction from Primitives) returns TheFace
- ---Purpose: Returns the Face of <me> located in <d1> direction.
- --
- ---C++: return const &
- raises DomainError
- is static;
-
- Plane(me : in out; d1 : Direction from Primitives) returns Pln from gp
- ---Purpose: Returns the plane of the Face of <me> located in
- -- <d1> direction.
- raises DomainError
- is static;
-
- HasWire(me; d1 : Direction from Primitives)
- ---Purpose: Returns True if <me> has a Wire in <d1> direction.
- returns Boolean;
-
- Wire(me : in out; d1 : Direction from Primitives) returns TheWire
- ---Purpose: Returns the Wire of <me> located in <d1> direction.
- --
- ---C++: return const &
- raises DomainError
- is static;
-
- HasEdge(me; d1, d2 : Direction from Primitives)
- ---Purpose: Returns True if <me> has an Edge in <d1><d2> direction.
- returns Boolean;
-
- Edge(me : in out; d1, d2 : Direction from Primitives) returns TheEdge
- ---Purpose: Returns the Edge of <me> located in <d1><d2> direction.
- --
- ---C++: return const &
- raises DomainError
- is static;
-
- Line(me : in out; d1, d2 : Direction from Primitives) returns Lin from gp
- ---Purpose: Returns the line of the Edge of <me> located in
- -- <d1><d2> direction.
- raises DomainError
- is static;
-
- HasVertex(me; d1, d2, d3 : Direction from Primitives)
- ---Purpose: Returns True if <me> has a Vertex in <d1><d2><d3>
- -- direction.
- returns Boolean;
-
- Vertex(me : in out; d1, d2, d3 : Direction from Primitives)
- returns TheVertex
- ---Purpose: Returns the Vertex of <me> located in <d1><d2><d3>
- -- direction.
- --
- ---C++: return const &
- raises DomainError
- is static;
-
- Point(me : in out; d1, d2, d3 : Direction from Primitives)
- returns Pnt from gp
- ---Purpose: Returns the point of the Vertex of <me> located in
- -- <d1><d2><d3> direction.
- raises DomainError
- is static;
-
-fields
- myBuilder : TheBuilder;
-
- myAxes : Ax2 from gp;
- XMin : Real;
- XMax : Real;
- YMin : Real;
- YMax : Real;
- ZMin : Real;
- ZMax : Real;
- Z2Min : Real;
- Z2Max : Real;
- X2Min : Real;
- X2Max : Real;
-
- -- the Topology
-
- myShell : TheShell;
- ShellBuilt : Boolean;
-
- myVertices : TheVertex [8];
- -- 0 : xmin ymin zmin
- -- 1 : xmax ymin zmin
- -- 2 : xmin ymax zmin
- -- 3 : xmax ymax zmin
- -- 4 : xmin ymin zmax
- -- 5 : xmax ymin zmax
- -- 6 : xmin ymax zmax
- -- 7 : xmax ymax zmax
- VerticesBuilt : Boolean [8];
-
- myEdges : TheEdge [12];
- -- 0 : xmin ymin
- -- 1 : xmax ymin
- -- 2 : xmin ymax
- -- 3 : xmax ymax
- -- 4 : ymin zmin
- -- 5 : ymax zmin
- -- 6 : ymin zmax
- -- 7 : ymax zmax
- -- 8 : zmin xmin
- -- 9 : zmax xmin
- -- 10 : zmin xmax
- -- 11 : zmax xmax
- EdgesBuilt : Boolean [12];
-
- myWires : TheWire [6];
- -- 0 : xmin
- -- 1 : xmax
- -- 2 : ymin
- -- 3 : ymax
- -- 4 : zmin
- -- 5 : zmax
- WiresBuilt : Boolean [6];
-
- myFaces : TheFace [6];
- -- 0 : xmin
- -- 1 : xmax
- -- 2 : ymin
- -- 3 : ymax
- -- 4 : zmin
- -- 5 : zmax
- FacesBuilt : Boolean [6];
-
- myInfinite : Boolean[6];
- -- 0 : xmin
- -- 1 : xmax
- -- 2 : ymin
- -- 3 : ymax
- -- 4 : zmin
- -- 5 : zmax
-
-end Wedge;
+++ /dev/null
-// Created on: 1991-09-27
-// Created by: Christophe MARION
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Precision.hxx>
-#include <gp_Vec.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Lin.hxx>
-#include <ElSLib.hxx>
-#include <ElCLib.hxx>
-
-#include <Standard_DomainError.hxx>
-#include <Standard_OutOfRange.hxx>
-
-#undef Standard_True
-#undef Standard_False
-
-#define Standard_True ((Standard_Boolean) 1)
-#define Standard_False ((Standard_Boolean) 0)
-
-#define NBFACES 6
-#define NBWIRES 6
-#define NBEDGES 12
-#define NBVERTICES 8
-
-static const Standard_Integer num[6] = {0,1,2,3,4,5};
-static const Standard_Integer val[6] = {0,4,0,2,0,1};
-static const Standard_Integer tab[6][6] = {{-1,-1, 0, 1, 8, 9},
- {-1,-1, 2, 3,10,11},
- { 0, 2,-1,-1, 4, 5},
- { 1, 3,-1,-1, 6, 7},
- { 8,10, 4, 6,-1,-1},
- { 9,11, 5, 7,-1,-1}};
-
-//=======================================================================
-//function : Primitives_Wedge_NumDir1
-//purpose : when giving a direction return the range of the face
-//=======================================================================
-
-static Standard_Integer Primitives_Wedge_NumDir1
- (const Primitives_Direction d1) { return num[d1]; }
-
-//=======================================================================
-//function : Primitives_Wedge_NumDir2
-//purpose : when giving two directions return the range of the edge
-//=======================================================================
-
-static Standard_Integer Primitives_Wedge_NumDir2
- (const Primitives_Direction d1,
- const Primitives_Direction d2)
-{
- Standard_Integer i1 = Primitives_Wedge_NumDir1(d1);
- Standard_Integer i2 = Primitives_Wedge_NumDir1(d2);
- if ( i1/2 == i2/2 ) Standard_DomainError::Raise();
- return tab[i1][i2];
-}
-
-//=======================================================================
-//function : Primitives_Wedge_NumDir3
-//purpose : when giving three directions return the range of the vertex
-//=======================================================================
-
-static Standard_Integer Primitives_Wedge_NumDir3
- (const Primitives_Direction d1,
- const Primitives_Direction d2,
- const Primitives_Direction d3)
-{
- Standard_Integer i1 = Primitives_Wedge_NumDir1(d1);
- Standard_Integer i2 = Primitives_Wedge_NumDir1(d2);
- Standard_Integer i3 = Primitives_Wedge_NumDir1(d3);
- if (( i1/2 == i2/2 ) ||
- ( i2/2 == i3/2 ) ||
- ( i3/2 == i1/2 )) Standard_DomainError::Raise();
- return val[i1]+val[i2]+val[i3];
-}
-
-//=======================================================================
-//function : Primitives_Wedge_Check
-//purpose : raise Standard_DomainError if something was built
-//=======================================================================
-
-static void Primitives_Wedge_Check(const Standard_Boolean V[],
- const Standard_Boolean E[],
- const Standard_Boolean W[],
- const Standard_Boolean F[])
-{
- Standard_Integer i;
- for (i = 0; i < NBVERTICES; i++)
- if (V[i]) Standard_DomainError::Raise();
- for (i = 0; i < NBEDGES; i++)
- if (E[i]) Standard_DomainError::Raise();
- for (i = 0; i < NBWIRES; i++)
- if (W[i]) Standard_DomainError::Raise();
- for (i = 0; i < NBFACES; i++)
- if (F[i]) Standard_DomainError::Raise();
-}
-
-//=======================================================================
-//function : Primitives_Wedge_Init
-//purpose : Set arrays to Standard_False
-//=======================================================================
-
-static void Primitives_Wedge_Init(Standard_Boolean& S,
- Standard_Boolean V[],
- Standard_Boolean E[],
- Standard_Boolean W[],
- Standard_Boolean F[])
-{
- Standard_Integer i;
- S = Standard_False;
- for (i = 0; i < NBVERTICES; i++)
- V[i] = Standard_False;
- for (i = 0; i < NBEDGES; i++)
- E[i] = Standard_False;
- for (i = 0; i < NBWIRES; i++)
- W[i] = Standard_False;
- for (i = 0; i < NBFACES; i++)
- F[i] = Standard_False;
-}
-
-//=======================================================================
-//function : Primitives_Wedge
-//purpose : build a box
-//=======================================================================
-
-Primitives_Wedge::Primitives_Wedge (const TheBuilder& B,
- const gp_Ax2& Axes,
- const Standard_Real dx,
- const Standard_Real dy,
- const Standard_Real dz) :
- myBuilder(B),
- myAxes(Axes),
- XMin(0),
- XMax(dx),
- YMin(0),
- YMax(dy),
- ZMin(0),
- ZMax(dz),
- Z2Min(0),
- Z2Max(dz),
- X2Min(0),
- X2Max(dx)
-{
- for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
- if ( ( dx <= Precision::Confusion() ) ||
- ( dy <= Precision::Confusion() ) ||
- ( dz <= Precision::Confusion() ) )
- Standard_DomainError::Raise();
- Primitives_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
- WiresBuilt,FacesBuilt);
-}
-
-//=======================================================================
-//function : Primitives_Wedge
-//purpose : build a STEP wedge
-//=======================================================================
-
-Primitives_Wedge::Primitives_Wedge (const TheBuilder& B,
- const gp_Ax2& Axes,
- const Standard_Real dx,
- const Standard_Real dy,
- const Standard_Real dz,
- const Standard_Real ltx) :
- myBuilder(B),
- myAxes(Axes),
- XMin(0),
- XMax(dx),
- YMin(0),
- YMax(dy),
- ZMin(0),
- ZMax(dz),
- Z2Min(0),
- Z2Max(dz),
- X2Min(0),
- X2Max(ltx)
-{
- for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
- if ( ( dx <= Precision::Confusion() ) ||
- ( dy <= Precision::Confusion() ) ||
- ( dz <= Precision::Confusion() ) ||
- ( ltx < 0 ) )
- Standard_DomainError::Raise();
- Primitives_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
- WiresBuilt,FacesBuilt);
-}
-
-//=======================================================================
-//function : Primitives_Wedge
-//purpose : build a wedge by giving all the fields
-//=======================================================================
-
-Primitives_Wedge::Primitives_Wedge (const TheBuilder& B,
- 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) :
- myBuilder(B),
- myAxes(Axes),
- XMin(xmin),
- XMax(xmax),
- YMin(ymin),
- YMax(ymax),
- ZMin(zmin),
- ZMax(zmax),
- Z2Min(z2min),
- Z2Max(z2max),
- X2Min(x2min),
- X2Max(x2max)
-{
- for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
- if ( ( XMax-XMin <= Precision::Confusion() ) ||
- ( YMax-YMin <= Precision::Confusion() ) ||
- ( ZMax-ZMin <= Precision::Confusion() ) ||
- ( Z2Max-Z2Min < 0 ) ||
- ( X2Max-X2Min < 0 ) )
- Standard_DomainError::Raise();
- Primitives_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
- WiresBuilt,FacesBuilt);
-}
-
-//=======================================================================
-//function : Axes,
-// GetXMin, GetYMin, GetZMin, GetZ2Min, GetX2Min
-// GetXMax, GetYMax, GetZMax, GetZ2Max, GetX2Max
-//purpose : trivial
-//=======================================================================
-
-gp_Ax2 Primitives_Wedge::Axes () const { return myAxes; }
-Standard_Real Primitives_Wedge::GetXMin () const { return XMin; }
-Standard_Real Primitives_Wedge::GetYMin () const { return YMin; }
-Standard_Real Primitives_Wedge::GetZMin () const { return ZMin; }
-Standard_Real Primitives_Wedge::GetZ2Min () const { return Z2Min; }
-Standard_Real Primitives_Wedge::GetX2Min () const { return X2Min; }
-Standard_Real Primitives_Wedge::GetXMax () const { return XMax; }
-Standard_Real Primitives_Wedge::GetYMax () const { return YMax; }
-Standard_Real Primitives_Wedge::GetZMax () const { return ZMax; }
-Standard_Real Primitives_Wedge::GetZ2Max () const { return Z2Max; }
-Standard_Real Primitives_Wedge::GetX2Max () const { return X2Max; }
-
-//=======================================================================
-//function : Open
-//purpose : trivial
-//=======================================================================
-
-void Primitives_Wedge::Open (const Primitives_Direction d1)
-{
- Primitives_Wedge_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
- myInfinite[Primitives_Wedge_NumDir1(d1)] = Standard_True;
-}
-
-//=======================================================================
-//function : Close
-//purpose : trivial
-//=======================================================================
-
-void Primitives_Wedge::Close (const Primitives_Direction d1)
-{
- Primitives_Wedge_Check(VerticesBuilt,EdgesBuilt,WiresBuilt,FacesBuilt);
- myInfinite[Primitives_Wedge_NumDir1(d1)] = Standard_False;
-}
-
-//=======================================================================
-//function : IsInfinite
-//purpose : true if it is open in the given direction
-//=======================================================================
-
-Standard_Boolean Primitives_Wedge::IsInfinite (const Primitives_Direction d1) const
-{ return myInfinite[Primitives_Wedge_NumDir1(d1)]; }
-
-//=======================================================================
-//function : Shell
-//purpose :
-//=======================================================================
-
-const TheShell& Primitives_Wedge::Shell() {
- if (!ShellBuilt) {
- myBuilder.MakeShell(myShell);
-
- if (HasFace(Primitives_XMin))
- myBuilder.AddShellFace(myShell,Face(Primitives_XMin));
- if (HasFace(Primitives_XMax))
- myBuilder.AddShellFace(myShell,Face(Primitives_XMax));
- if (HasFace(Primitives_YMin))
- myBuilder.AddShellFace(myShell,Face(Primitives_YMin));
- if (HasFace(Primitives_YMax))
- myBuilder.AddShellFace(myShell,Face(Primitives_YMax));
- if (HasFace(Primitives_ZMin))
- myBuilder.AddShellFace(myShell,Face(Primitives_ZMin));
- if (HasFace(Primitives_ZMax))
- myBuilder.AddShellFace(myShell,Face(Primitives_ZMax));
-
- myBuilder.CompleteShell(myShell);
- ShellBuilt = Standard_True;
- }
- return myShell;
-}
-
-//=======================================================================
-//function : HasFace
-//purpose : true if the face exist in one direction
-//=======================================================================
-
-Standard_Boolean Primitives_Wedge::HasFace (const Primitives_Direction d1) const
-{
- Standard_Boolean state = !myInfinite[Primitives_Wedge_NumDir1(d1)];
- if ( d1 == Primitives_YMax ) state = state && ( Z2Max != Z2Min )
- && ( X2Max != X2Min );
- return state;
-}
-
-//=======================================================================
-//function : Plane
-//purpose :
-//=======================================================================
-
-gp_Pln Primitives_Wedge::Plane(const Primitives_Direction d1)
-{
-
- Standard_Integer i = Primitives_Wedge_NumDir1(d1);
-
- gp_Dir D;
- gp_Vec VX = myAxes.XDirection();
- gp_Vec VY = myAxes.YDirection();
- gp_Vec VZ = myAxes.Direction();
-
- switch (i/2) {
-
- case 0 :
- D = myAxes.XDirection();
- break;
-
- case 1 :
- D = myAxes.YDirection();
- break;
-
- case 2 :
- D = myAxes.Direction();
- break;
-
- };
- Standard_Real X = 0., Y = 0., Z = 0.;
-
- switch (i) {
-
- case 0 :
- // XMin
- X = XMin;
- Y = YMin;
- Z = ZMin;
- if ( X2Min != XMin ) D = gp_Dir((YMax-YMin)*VX+(XMin-X2Min)*VY);
- break;
-
- case 1 :
- // XMax
- X = XMax;
- Y = YMin;
- Z = ZMin;
- if ( X2Max != XMax ) D = gp_Dir((YMax-YMin)*VX+(XMax-X2Max)*VY);
- break;
-
- case 2 :
- // YMin
- X = XMin;
- Y = YMin;
- Z = ZMin;
- break;
-
- case 3 :
- // YMax
- X = XMin;
- Y = YMax;
- Z = ZMin;
- break;
-
- case 4 :
- // ZMin
- X = XMin;
- Y = YMin;
- Z = ZMin;
- if ( Z2Min != ZMin ) D = gp_Dir((YMax-YMin)*VZ+(ZMin-Z2Min)*VY);
- break;
-
- case 5 :
- // ZMax
- X = XMin;
- Y = YMin;
- Z = ZMax;
- if ( Z2Max != ZMax ) D = gp_Dir((YMax-YMin)*VZ+(ZMax-Z2Max)*VY);
- break;
-
- };
-
- gp_Pnt P = myAxes.Location();
- P.Translate(X*gp_Vec(myAxes.XDirection()));
- P.Translate(Y*gp_Vec(myAxes.YDirection()));
- P.Translate(Z*gp_Vec(myAxes.Direction ()));
- gp_Pln plane(P,D);
- return plane;
-}
-
-//=======================================================================
-//function : Face
-//purpose : the face in one direction
-//=======================================================================
-
-const TheFace& Primitives_Wedge::Face
- (const Primitives_Direction d1)
-{
-
- Standard_Integer i = Primitives_Wedge_NumDir1(d1);
-
- if (!FacesBuilt[i]) {
- gp_Pln P = Plane(d1);
- myBuilder.MakeFace(myFaces[i],P);
- if (HasWire(d1)) myBuilder.AddFaceWire(myFaces[i],Wire(d1));
- if ( i%2 == 0 ) myBuilder.ReverseFace(myFaces[i]);
-
- // pcurves
-
- Primitives_Direction dd1 = Primitives_ZMin, dd2 = Primitives_YMax,
- dd3 = Primitives_ZMax,dd4 = Primitives_YMin;
-
- switch (i/2) {
-
- case 0 :
- // XMin XMax
- dd1 = Primitives_ZMin;
- dd2 = Primitives_YMax;
- dd3 = Primitives_ZMax;
- dd4 = Primitives_YMin;
- break;
-
- case 1 :
- // YMin YMax
- dd1 = Primitives_XMin;
- dd2 = Primitives_ZMax;
- dd3 = Primitives_XMax;
- dd4 = Primitives_ZMin;
- break;
-
- case 2 :
- // ZMin ZMax
- dd1 = Primitives_YMin;
- dd2 = Primitives_XMax;
- dd3 = Primitives_YMax;
- dd4 = Primitives_XMin;
- break;
-
- };
-
- gp_Lin L;
- gp_Dir DX = P.XAxis().Direction();
- gp_Dir DY = P.YAxis().Direction();
- Standard_Real U,V,DU,DV;
- if (HasEdge(d1,dd4)) {
- L = Line(d1,dd4);
- ElSLib::Parameters(P,L.Location(),U,V);
- DU = L.Direction() * DX;
- DV = L.Direction() * DY;
- myBuilder.SetPCurve(myEdges[Primitives_Wedge_NumDir2(d1,dd4)],
- myFaces[i],
- gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV)));
- }
- if (HasEdge(d1,dd3)) {
- L = Line(d1,dd3);
- ElSLib::Parameters(P,L.Location(),U,V);
- DU = L.Direction() * DX;
- DV = L.Direction() * DY;
- myBuilder.SetPCurve(myEdges[Primitives_Wedge_NumDir2(d1,dd3)],
- myFaces[i],
- gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV)));
- }
-
- if (HasEdge(d1,dd2)) {
- L = Line(d1,dd2);
- ElSLib::Parameters(P,L.Location(),U,V);
- DU = L.Direction() * DX;
- DV = L.Direction() * DY;
- myBuilder.SetPCurve(myEdges[Primitives_Wedge_NumDir2(d1,dd2)],
- myFaces[i],
- gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV)));
- }
-
- if (HasEdge(d1,dd1)) {
- L = Line(d1,dd1);
- ElSLib::Parameters(P,L.Location(),U,V);
- DU = L.Direction() * DX;
- DV = L.Direction() * DY;
- myBuilder.SetPCurve(myEdges[Primitives_Wedge_NumDir2(d1,dd1)],
- myFaces[i],
- gp_Lin2d(gp_Pnt2d(U,V),gp_Dir2d(DU,DV)));
- }
-
-
- myBuilder.CompleteFace(myFaces[i]);
- FacesBuilt[i] = Standard_True;
- }
-
- return myFaces[i];
-
-}
-
-//=======================================================================
-//function : HasWire
-//purpose : trivial
-//=======================================================================
-
-Standard_Boolean Primitives_Wedge::HasWire (const Primitives_Direction d1) const
-{
- Standard_Integer i = Primitives_Wedge_NumDir1(d1);
-
- if (myInfinite[i]) return Standard_False;
- Primitives_Direction dd1 = Primitives_XMin,dd2 = Primitives_YMax,dd3 = Primitives_XMax ,dd4 = Primitives_ZMin;
-
- switch (i/2) {
-
- case 0 :
- // XMin XMax
- dd1 = Primitives_ZMin;
- dd2 = Primitives_YMax;
- dd3 = Primitives_ZMax;
- dd4 = Primitives_YMin;
- break;
-
- case 1 :
- // YMin YMax
- dd1 = Primitives_XMin;
- dd2 = Primitives_ZMax;
- dd3 = Primitives_XMax;
- dd4 = Primitives_ZMin;
- break;
-
- case 2 :
- // ZMin ZMax
- dd1 = Primitives_YMin;
- dd2 = Primitives_XMax;
- dd3 = Primitives_YMax;
- dd4 = Primitives_XMin;
- break;
-#ifndef DEB
- default:
- break;
-#endif
- };
-
- return HasEdge(d1,dd1)||HasEdge(d1,dd2)||HasEdge(d1,dd3)||HasEdge(d1,dd4);
-
-}
-
-//=======================================================================
-//function : Wire
-//purpose : trivial
-//=======================================================================
-
-const TheWire& Primitives_Wedge::Wire
- (const Primitives_Direction d1)
-{
- Standard_Integer i = Primitives_Wedge_NumDir1(d1);
-
- Primitives_Direction dd1 = Primitives_XMin,dd2 = Primitives_YMax,dd3 = Primitives_XMax ,dd4 = Primitives_ZMin;
-
- if (!WiresBuilt[i]) {
-
- switch (i/2) {
-
- case 0 :
- // XMin XMax
- dd1 = Primitives_ZMin;
- dd2 = Primitives_YMax;
- dd3 = Primitives_ZMax;
- dd4 = Primitives_YMin;
- break;
-
- case 1 :
- // YMin YMax
- dd1 = Primitives_XMin;
- dd2 = Primitives_ZMax;
- dd3 = Primitives_XMax;
- dd4 = Primitives_ZMin;
- break;
-
- case 2 :
- // ZMin ZMax
- dd1 = Primitives_YMin;
- dd2 = Primitives_XMax;
- dd3 = Primitives_YMax;
- dd4 = Primitives_XMin;
- break;
- default:
- break;
- };
-
- myBuilder.MakeWire(myWires[i]);
-
- if (HasEdge(d1,dd4))
- myBuilder.AddWireEdge(myWires[i],Edge(d1,dd4),Standard_False);
- if (HasEdge(d1,dd3))
- myBuilder.AddWireEdge(myWires[i],Edge(d1,dd3),Standard_False);
- if (HasEdge(d1,dd2))
- myBuilder.AddWireEdge(myWires[i],Edge(d1,dd2),Standard_True );
- if (HasEdge(d1,dd1))
- myBuilder.AddWireEdge(myWires[i],Edge(d1,dd1),Standard_True );
-
- myBuilder.CompleteWire(myWires[i]);
- WiresBuilt[i] = Standard_True;
- }
-
- return myWires[i];
-
-}
-
-//=======================================================================
-//function : HasEdge
-//purpose : trivial
-//=======================================================================
-
-Standard_Boolean Primitives_Wedge::HasEdge (const Primitives_Direction d1,
- const Primitives_Direction d2) const
-{
- Standard_Boolean state = !(myInfinite[Primitives_Wedge_NumDir1(d1)] ||
- myInfinite[Primitives_Wedge_NumDir1(d2)]);
- Standard_Integer i = Primitives_Wedge_NumDir2(d1,d2);
- if ( i == 6 || i == 7 ) state = state && ( X2Max != X2Min );
- else if ( i == 1 || i == 3 ) state = state && ( Z2Max != Z2Min );
- return state;
-}
-
-//=======================================================================
-//function : Line
-//purpose : trivial
-//=======================================================================
-
-gp_Lin Primitives_Wedge::Line
- (const Primitives_Direction d1,
- const Primitives_Direction d2)
-{
- if (!HasEdge(d1,d2)) Standard_DomainError::Raise();
-
- Standard_Integer i = Primitives_Wedge_NumDir2(d1,d2);
-
- Standard_Real X =0., Y =0., Z =0.;
-
- gp_Dir D;
- gp_Vec VX = myAxes.XDirection();
- gp_Vec VY = myAxes.YDirection();
- gp_Vec VZ = myAxes.Direction();
-
- switch (i/4) {
-
- case 0 :
- D = myAxes.Direction();
- break;
-
- case 1 :
- D = myAxes.XDirection();
- break;
-
- case 2 :
- D = myAxes.YDirection();
- break;
-
- };
-
- switch (i) {
-
- case 0 :
- // XMin YMin
- X = XMin;
- Y = YMin;
- Z = ZMin;
- break;
-
- case 1 :
- // XMin YMax
- X = X2Min;
- Y = YMax;
- Z = Z2Min;
- break;
-
- case 2 :
- // XMax YMin
- X = XMax;
- Y = YMin;
- Z = ZMin;
- break;
-
- case 3 :
- // XMax YMax
- X = X2Max;
- Y = YMax;
- Z = Z2Min;
- break;
-
- case 4 :
- // YMin ZMin
- X = XMin;
- Y = YMin;
- Z = ZMin;
- break;
-
- case 5 :
- // YMin ZMax
- X = XMin;
- Y = YMin;
- Z = ZMax;
- break;
-
- case 6 :
- // YMax ZMin
- X = X2Min;
- Y = YMax;
- Z = Z2Min;
- break;
-
- case 7 :
- // YMax ZMax
- X = X2Min;
- Y = YMax;
- Z = Z2Max;
- break;
-
- case 8 :
- // ZMin XMin
- X = XMin;
- Y = YMin;
- Z = ZMin;
- if ( (XMin != X2Min) || (ZMin != Z2Min) )
- D = gp_Vec( (X2Min-XMin)*VX + (YMax-YMin)*VY + (Z2Min-ZMin)*VZ);
- break;
-
- case 9 :
- // ZMax XMin
- X = XMin;
- Y = YMin;
- Z = ZMax;
- if ( (XMin != X2Min) || (ZMax != Z2Max) )
- D = gp_Vec( (X2Min-XMin)*VX + (YMax-YMin)*VY + (Z2Max-ZMax)*VZ);
- break;
-
- case 10 :
- // ZMin XMax
- X = XMax;
- Y = YMin;
- Z = ZMin;
- if ( (XMax != X2Max) || (ZMin != Z2Min) )
- D = gp_Vec( (X2Max-XMax)*VX + (YMax-YMin)*VY + (Z2Min-ZMin)*VZ);
- break;
-
- case 11 :
- // ZMax XMax
- X = XMax;
- Y = YMin;
- Z = ZMax;
- if ( (XMax != X2Max) || (ZMax != Z2Max) )
- D = gp_Vec(gp_Pnt(XMax,YMin,ZMax),gp_Pnt(X2Max,YMax,Z2Max));
- D = gp_Vec( (X2Max-XMax)*VX + (YMax-YMin)*VY + (Z2Max-ZMax)*VZ);
- break;
-
- }
-
- gp_Pnt P = myAxes.Location();
- P.Translate(X*gp_Vec(myAxes.XDirection()));
- P.Translate(Y*gp_Vec(myAxes.YDirection()));
- P.Translate(Z*gp_Vec(myAxes.Direction ()));
- return gp_Lin(gp_Ax1(P,D));
-
-}
-
-//=======================================================================
-//function : Edge
-//purpose : trivial
-//=======================================================================
-
-const TheEdge& Primitives_Wedge::Edge
- (const Primitives_Direction d1,
- const Primitives_Direction d2)
-{
- if (!HasEdge(d1,d2)) Standard_DomainError::Raise();
-
- Standard_Integer i = Primitives_Wedge_NumDir2(d1,d2);
-
- if (!EdgesBuilt[i]) {
-
- Primitives_Direction dd1 = Primitives_XMin ,dd2 = Primitives_XMax;
-
- switch (i/4) {
-
- case 0 :
- dd1 = Primitives_ZMin;
- dd2 = Primitives_ZMax;
- break;
-
- case 1 :
- dd1 = Primitives_XMin;
- dd2 = Primitives_XMax;
- break;
-
- case 2 :
- dd1 = Primitives_YMin;
- dd2 = Primitives_YMax;
- break;
-
- default:
- break;
- };
-
- gp_Lin L = Line(d1,d2);
- myBuilder.MakeEdge(myEdges[i],L);
-
- if (HasVertex(d1,d2,dd2)) {
- myBuilder.AddEdgeVertex(myEdges[i],Vertex(d1,d2,dd2),
- ElCLib::Parameter(L,Point(d1,d2,dd2)),
- Standard_False);
- }
- if (HasVertex(d1,d2,dd1)) {
- myBuilder.AddEdgeVertex(myEdges[i],Vertex(d1,d2,dd1),
- ElCLib::Parameter(L,Point(d1,d2,dd1)),
- Standard_True );
- }
-
- if ( Z2Max == Z2Min ) {
- if ( i == 6 ) {
- myEdges[7] = myEdges[6];
- EdgesBuilt[7] = Standard_True;
- }
- else if ( i == 7 ) {
- myEdges[6] = myEdges[7];
- EdgesBuilt[6] = Standard_True;
- }
- }
- if ( X2Max == X2Min ) {
- if ( i == 1 ) {
- myEdges[3] = myEdges[1];
- EdgesBuilt[3] = Standard_True;
- }
- else if ( i == 3 ) {
- myEdges[1] = myEdges[3];
- EdgesBuilt[1] = Standard_True;
- }
- }
-
- myBuilder.CompleteEdge(myEdges[i]);
- EdgesBuilt[i] = Standard_True;
- }
-
- return myEdges[i];
-
-}
-
-//=======================================================================
-//function : HasVertex
-//purpose : trivial
-//=======================================================================
-
-Standard_Boolean Primitives_Wedge::HasVertex
- (const Primitives_Direction d1,
- const Primitives_Direction d2,
- const Primitives_Direction d3) const
-{ return !(myInfinite[Primitives_Wedge_NumDir1(d1)] ||
- myInfinite[Primitives_Wedge_NumDir1(d2)] ||
- myInfinite[Primitives_Wedge_NumDir1(d3)]); }
-
-//=======================================================================
-//function : Point
-//purpose : trivial
-//=======================================================================
-
-gp_Pnt Primitives_Wedge::Point
- (const Primitives_Direction d1,
- const Primitives_Direction d2,
- const Primitives_Direction d3)
-{
- if (!HasVertex(d1,d2,d3)) Standard_DomainError::Raise();
-
- Standard_Integer i = Primitives_Wedge_NumDir3(d1,d2,d3);
-
- Standard_Real X =0., Y =0., Z =0.;
-
- switch (i) {
-
- case 0 :
- X = XMin;
- Y = YMin;
- Z = ZMin;
- break;
-
- case 1 :
- X = XMin;
- Y = YMin;
- Z = ZMax;
- break;
-
- case 2 :
- X = X2Min;
- Y = YMax;
- Z = Z2Min;
- break;
-
- case 3 :
- X = X2Min;
- Y = YMax;
- Z = Z2Max;
- break;
-
- case 4 :
- X = XMax;
- Y = YMin;
- Z = ZMin;
- break;
-
- case 5 :
- X = XMax;
- Y = YMin;
- Z = ZMax;
- break;
-
- case 6 :
- X = X2Max;
- Y = YMax;
- Z = Z2Min;
- break;
-
- case 7 :
- X = X2Max;
- Y = YMax;
- Z = Z2Max;
- break;
-
- };
-
- gp_Pnt P = myAxes.Location();
- P.Translate(X*gp_Vec(myAxes.XDirection()));
- P.Translate(Y*gp_Vec(myAxes.YDirection()));
- P.Translate(Z*gp_Vec(myAxes.Direction ()));
- return P;
-}
-
-//=======================================================================
-//function : Vertex
-//purpose : trivial
-//=======================================================================
-
-const TheVertex& Primitives_Wedge::Vertex
- (const Primitives_Direction d1,
- const Primitives_Direction d2,
- const Primitives_Direction d3)
-{
- if (!HasVertex(d1,d2,d3)) Standard_DomainError::Raise();
-
- Standard_Integer i = Primitives_Wedge_NumDir3(d1,d2,d3);
-
- if (!VerticesBuilt[i]) {
-
- myBuilder.MakeVertex(myVertices[i],Point(d1,d2,d3));
-
- if ( Z2Max == Z2Min ) {
- if ( i == 2 || i == 6 ) {
- myVertices[3] = myVertices[2];
- myVertices[7] = myVertices[6];
- VerticesBuilt[3] = Standard_True;
- VerticesBuilt[7] = Standard_True;
- }
- else if ( i == 3 || i == 7 ) {
- myVertices[2] = myVertices[3];
- myVertices[6] = myVertices[7];
- VerticesBuilt[2] = Standard_True;
- VerticesBuilt[6] = Standard_True;
- }
- }
- if ( X2Max == X2Min ) {
- if ( i == 2 || i == 3 ) {
- myVertices[6] = myVertices[2];
- myVertices[7] = myVertices[3];
- VerticesBuilt[6] = Standard_True;
- VerticesBuilt[7] = Standard_True;
- }
- else if ( i == 6 || i == 7 ) {
- myVertices[2] = myVertices[6];
- myVertices[3] = myVertices[7];
- VerticesBuilt[2] = Standard_True;
- VerticesBuilt[3] = Standard_True;
- }
- }
-
- VerticesBuilt[i] = Standard_True;
- }
-
- return myVertices[i];
-
-}
-
is
- deferred generic class LinearRegularSweep,
- Array2OfShapes,
- SequenceOfShapes;
-
-
--
-- The following classes provides a directing topology for the
-- LinearRegularSweep. This is the topology of an open or
+++ /dev/null
--- Created on: 1993-01-27
--- Created by: Philippe DAUTRY
--- 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.
-
-deferred generic class LinearRegularSweep from Sweep (
- TheShape as any; -- resulting topological objects.
- TheGenShape as any; -- Generating topological objects.
- TheDirShape as any; -- Directing topological objects.
- TheBuilder as any;
- TheGenShapeTool as any;
- TheDirShapeTool as any;
- TheShapeIterator as any;
- TheGenShapeIterator as any;
- TheDirShapeIterator as any)
-
-
- ---Purpose: This a generic class is used to build Sweept
- -- primitives with a generating "shape" and a
- -- directing "line".
- --
- -- The indexation and type analysis services required
- -- for the generatrix are given by <TheGenShapeTool>.
- --
- -- The indexation and type analysis services required
- -- for the directrix are given by <TheDirShapeTool>.
- --
- -- The iteration services required for the generatrix
- -- are given by <TheGenShapeIterator>.
- --
- -- The iteration services required for the directrix
- -- are given by <TheDirShapeIterator>.
- --
- -- The topology is like a grid of shapes. Each shape
- -- of the grid must be addressable without confusion
- -- by one or two objects from the generating or
- -- directing shapes. Here are exemples of correct
- -- associations to address:
- --
- -- - a vertex : GenVertex - DirVertex
- -- - an edge : GenVertex - DirEdge
- -- - : GenEdge - DirVertex
- -- - a face : GenEdge - DirEdge
- -- GenFace - DirVertex
- -- ...
- --
- -- "GenObject" is used to identify an object from the
- -- Generating Shape, and "DirObject" from the
- -- Directing Shape. So may they be from different
- -- types.
- --
- -- The method Has... is given because in some special
- -- cases, a vertex, an edge or a face may be
- -- geometricaly nonexistant or not usefull.
-
-uses
-
- Orientation from TopAbs,
- Array2OfBoolean from TColStd
-
-raises
-
- NoMoreObject from Standard,
- NoSuchObject from Standard,
- RangeError from Standard,
- DomainError from Standard
-
--- Nested classes
-
- class Array2OfShapes
- instantiates Array2 from TCollection (TheShape);
- class SequenceOfShapes
- instantiates Sequence from TCollection (TheShape);
-
-is
-
-
- -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
- Delete(me:out) is virtual ;
- ---C++: alias ~
-
- Initialize(aBuilder : TheBuilder;
- aGenShape : TheGenShape;
- aDirWire : TheDirShape);
- ---Purpose: Creates a LinearRegularSweep. <aBuilder> gives
- -- basic topological services.
-
-
- -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- -- Deferred Methods supporting the creation of the geometric part.
-
- -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
- MakeEmptyVertex(me : in out; aGenV: TheGenShape; aDirV: TheDirShape)
- returns TheShape
- ---Purpose: Builds the vertex addressed by [aGenV,aDirV], with its
- -- geometric part, but without subcomponents.
- is deferred;
-
- MakeEmptyDirectingEdge(me: in out; aGenV: TheGenShape; aDirE: TheDirShape)
- returns TheShape
- ---Purpose: Builds the edge addressed by [aGenV,aDirE], with its
- -- geometric part, but without subcomponents.
- is deferred;
-
- MakeEmptyGeneratingEdge(me: in out; aGenE: TheGenShape; aDirV: TheDirShape)
- returns TheShape
- ---Purpose: Builds the edge addressed by [aGenE,aDirV], with its
- -- geometric part, but without subcomponents.
- is deferred;
-
- SetParameters(me : in out;
- aNewFace : TheShape;
- aNewVertex : in out TheShape;
- aGenF : TheGenShape;
- aGenV : TheGenShape;
- aDirV : TheDirShape)
- ---Purpose: Sets the parameters of the new vertex on the new
- -- face. The new face and new vertex where generated
- -- from aGenF, aGenV and aDirV .
- is deferred;
-
- SetDirectingParameter(me : in out;
- aNewEdge : TheShape;
- aNewVertex : in out TheShape;
- aGenV : TheGenShape;
- aDirE : TheDirShape;
- aDirV : TheDirShape)
- ---Purpose: Sets the parameter of the new vertex on the new
- -- edge. The new edge and new vertex where generated
- -- from aGenV aDirE, and aDirV.
- is deferred;
-
- SetGeneratingParameter(me : in out;
- aNewEdge : TheShape;
- aNewVertex : in out TheShape;
- aGenE : TheGenShape;
- aGenV : TheGenShape;
- aDirV : TheDirShape)
- ---Purpose: Sets the parameter of the new vertex on the new
- -- edge. The new edge and new vertex where generated
- -- from aGenE, aGenV and aDirV .
- is deferred;
-
- MakeEmptyFace(me : in out;
- aGenS : TheGenShape;
- aDirS : TheDirShape)
- returns TheShape
- ---Purpose: Builds the face addressed by [aGenS,aDirS], with
- -- its geometric part, but without subcomponents. The
- -- couple aGenS, aDirS can be a "generating face and
- -- a directing vertex" or "a generating edge and a
- -- directing edge".
- is deferred;
-
- SetPCurve(me : in out;
- aNewFace : TheShape;
- aNewEdge : in out TheShape;
- aGenF : TheGenShape;
- aGenE : TheGenShape;
- aDirV : TheDirShape;
- orien : Orientation from TopAbs)
- ---Purpose: Sets the PCurve for a new edge on a new face. The
- -- new edge and the new face were generated using
- -- aGenF, aGenE and aDirV.
- is deferred;
-
- SetGeneratingPCurve(me : in out;
- aNewFace : TheShape;
- aNewEdge : in out TheShape;
- aGenE : TheGenShape;
- aDirE : TheDirShape;
- aDirV : TheDirShape;
- orien : Orientation from TopAbs)
-
- ---Purpose: Sets the PCurve for a new edge on a new face. The
- -- new edge and the new face were generated using
- -- aGenE, aDirE and aDirV.
- is deferred;
-
- SetDirectingPCurve(me : in out;
- aNewFace : TheShape;
- aNewEdge : in out TheShape;
- aGenE : TheGenShape;
- aGenV : TheGenShape;
- aDirE : TheDirShape;
- orien : Orientation from TopAbs)
-
- ---Purpose: Sets the PCurve for a new edge on a new face. The
- -- new edge and the new face were generated using
- -- aGenE, aDirE and aGenV.
- is deferred;
-
- DirectSolid(me : in out;
- aGenS : TheGenShape;
- aDirS : TheDirShape)
- returns Orientation from TopAbs
- ---Purpose: Returns the Orientation of the shell in the solid
- -- generated by the face aGenS with the edge aDirS.
- -- It is REVERSED if the surface is swept in the
- -- direction of the normal.
- is deferred;
-
- GGDShapeIsToAdd (me;
- aNewShape : TheShape;
- aNewSubShape : TheShape;
- aGenS : TheGenShape;
- aSubGenS : TheGenShape;
- aDirS : TheDirShape)
- returns Boolean from Standard
- ---Purpose: Returns true if aNewSubShape (addressed by
- -- aSubGenS and aDirS) must be added in aNewShape
- -- (addressed by aGenS and aDirS).
- is deferred;
-
- GDDShapeIsToAdd (me;
- aNewShape : TheShape;
- aNewSubShape : TheShape;
- aGenS : TheGenShape;
- aDirS : TheDirShape;
- aSubDirS : TheDirShape)
- returns Boolean from Standard
- ---Purpose: Returns true if aNewSubShape (addressed by
- -- aGenS and aSubDirS) must be added in aNewShape
- -- (addressed by aGenS and aDirS).
- is deferred;
-
-
- SeparatedWires (me;
- aNewShape : TheShape;
- aNewSubShape : TheShape;
- aGenS : TheGenShape;
- aSubGenS : TheGenShape;
- aDirS : TheDirShape)
- returns Boolean from Standard
- ---Purpose: In some particular cases the topology of a
- -- generated face must be composed of independant
- -- closed wires, in this case this function returns
- -- true.
- is deferred;
-
-
- SplitShell (me; aNewShape : TheShape)
- returns TheShape
- ---Purpose: In some particular cases the topology of a
- -- generated Shell must be composed of independant
- -- closed Shells, in this case this function returns
- -- a Compound of independant Shells.
- is virtual;
-
-
- -- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- -- Method coding the continuities on the edges between 2 faces
- -- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- SetContinuity(me : in out; aGenS : TheGenShape; aDirS : TheDirShape)
- ---Purpose: Called to propagate the continuity of every vertex
- -- between two edges of the generating wire aGenS on
- -- the generated edge and faces.
- is deferred;
-
-
- -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- -- User end methods.
- --
- -- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
- -- Shapes
- -- """"""
-
- HasShape(me; aGenS : TheGenShape; aDirS : TheDirShape)
- returns Boolean from Standard
- ---Purpose: Returns true if aDirS and aGenS addresses a
- -- resulting Shape. In some specific cases the shape
- -- can be geometrically inexsistant, then this
- -- function returns false.
- is deferred;
-
- Shape(me: in out; aGenS : TheGenShape; aDirS : TheDirShape)
- returns TheShape
- ---Purpose: Returns the resulting Shape indexed by aDirS and
- -- aGenS.
- is static;
-
-
- Shape(me: in out; aGenS : TheGenShape)
- returns TheShape
- ---Purpose: Returns the resulting Shape indexed by myDirWire
- -- and aGenS.
- is static;
-
- Shape(me: in out)
- returns TheShape
- ---Purpose: Returns the resulting Shape indexed by myDirWire
- -- and myGenShape.
- is static;
-
- FirstShape(me: in out)
- returns TheShape
- ---Purpose: Returns the resulting Shape indexed by the first
- -- Vertex of myDirWire and myGenShape.
- is static;
-
- LastShape(me: in out)
- returns TheShape
- ---Purpose: Returns the resulting Shape indexed by the last
- -- Vertex of myDirWire and myGenShape.
- is static;
-
-
- FirstShape(me: in out; aGenS : TheGenShape)
- returns TheShape
- ---Purpose: Returns the resulting Shape indexed by the first
- -- Vertex of myDirWire and aGenS.
- is static;
-
- LastShape(me: in out; aGenS : TheGenShape)
- returns TheShape
- ---Purpose: Returns the resulting Shape indexed by the last
- -- Vertex of myDirWire and aGenS.
- is static;
-
-
- Closed(me) returns Boolean from Standard is static;
-
-
-fields
-
- -- Topology builder.
-
- myBuilder : TheBuilder is protected;
-
- -- Generating shape
-
- myGenShape : TheGenShape is protected;
-
- -- Directing line
-
- myDirWire : TheDirShape is protected;
-
- -- shape tools.
-
- myGenShapeTool : TheGenShapeTool is protected;
- myDirShapeTool : TheDirShapeTool is protected;
-
- -- Array of built objects (NbGShapes,NbDShapes).
- myShapes : Array2OfShapes is protected;
-
- -- Array of built objects flags (NbGShapes,NbDShapes).
- myBuiltShapes : Array2OfBoolean from TColStd is protected;
-
-end LinearRegularSweep;
+++ /dev/null
-// Created on: 1992-07-02
-// Created by: Philippe DAUTRY
-// Copyright (c) 1992-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_RangeError.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_NoMoreObject.hxx>
-#include <Standard_DomainError.hxx>
-
-#include <TopAbs_Orientation.hxx>
-#include <TopAbs.hxx>
-
-//=======================================================================
-//function : Sweep_LinearRegularSweep
-//purpose : Create a Regular Sweep.
-//=======================================================================
-
-Sweep_LinearRegularSweep::Sweep_LinearRegularSweep
- (const TheBuilder& aBuilder,
- const TheGenShape& aGenShape,
- const TheDirShape& aDirShape):
-
- myBuilder(aBuilder),
- myGenShape(aGenShape),
- myDirWire(aDirShape),
-
- myGenShapeTool(aGenShape),
- myDirShapeTool(aDirShape),
-
- // *****************************************************************
- // Les Tableaux
- // *****************************************************************
-
- myShapes(1,myGenShapeTool.NbShapes(),
- 1,myDirShapeTool.NbShapes()),
- myBuiltShapes(1,myGenShapeTool.NbShapes(),
- 1,myDirShapeTool.NbShapes())
-{
- myBuiltShapes.Init(Standard_False);
-}
-
-void Sweep_LinearRegularSweep::Delete()
-{}
-
-//=======================================================================
-//function : Shape
-//purpose : Returns the global Shape.
-//=======================================================================
-
-TheShape Sweep_LinearRegularSweep::Shape ()
-{
- if (HasShape(myGenShape,myDirWire)) return Shape(myGenShape,myDirWire);
- else {
- TheShape bidon;
- return bidon;
- }
-}
-
-
-//=======================================================================
-//function : Shape
-//purpose : Returns the Shape generated with aGenS.
-//=======================================================================
-
-TheShape Sweep_LinearRegularSweep::Shape (const TheGenShape& aGenS)
-{
- if (myGenShapeTool.Index(aGenS) != 0 &&
- HasShape(aGenS,myDirWire)) return Shape(aGenS,myDirWire);
- else {
- TheShape bidon;
- return bidon;
- }
-}
-
-
-//=======================================================================
-//function : Shape
-//purpose : Returns the Shape indexed by the arguments.
-//=======================================================================
-
-TheShape Sweep_LinearRegularSweep::Shape (const TheGenShape& aGenS,
- const TheDirShape& aDirS)
-{
- Standard_Integer iGenS = myGenShapeTool.Index(aGenS);
- Standard_Integer iDirS = myDirShapeTool.Index(aDirS);
- if (!myBuiltShapes(iGenS,iDirS)){
- TheShape newShape;
- TheGenShape bGenS,cGenS,subGenS,subsubGenS;
- TheDirShape bDirS,subDirS;
- TheGenShapeIterator It;
- TheDirShapeIterator Kt;
- TheShapeIterator Lt;
- TopAbs_Orientation Or,Pr;
- if (myDirShapeTool.Type(aDirS)==TopAbs_VERTEX){
- //Ici on construit les "planchers" du Shape.
- TopAbs_ShapeEnum aGenSType = myGenShapeTool.Type(aGenS);
- switch (aGenSType){
- case TopAbs_VERTEX :
- myShapes(iGenS,iDirS)=MakeEmptyVertex(aGenS,aDirS);
- break;
- case TopAbs_EDGE :
- myShapes(iGenS,iDirS)=MakeEmptyGeneratingEdge(aGenS,aDirS);
- break;
- case TopAbs_WIRE :
- myBuilder.MakeWire(myShapes(iGenS,iDirS));
- break;
- case TopAbs_FACE :
- myShapes(iGenS,iDirS)=MakeEmptyFace(aGenS,aDirS);
- break;
- case TopAbs_SHELL :
- myBuilder.MakeShell(myShapes(iGenS,iDirS));
- break;
- case TopAbs_SOLID :
- Standard_NoSuchObject::Raise("Solids are not Processed");
- break;
- case TopAbs_COMPSOLID :
- Standard_NoSuchObject::Raise("Solids are not Processed");
- break;
- case TopAbs_COMPOUND :
- myBuilder.MakeCompound(myShapes(iGenS,iDirS));
- break;
- default:
- Standard_NoSuchObject::Raise("Unknown Shape");
- break;
- }
- bGenS = aGenS;
- myGenShapeTool.SetOrientation(bGenS,TopAbs_FORWARD);
- for (It.Init(bGenS);It.More();It.Next()){
- subGenS = It.Value();
- Or = It.Orientation();
- if(HasShape(subGenS,aDirS)){
- newShape = Shape(subGenS,aDirS);
- if (GGDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
- aGenS,subGenS,aDirS)){
- //Les "planchers" doivent etre construits par les
- //fonctions de construcion geometrique identiquement
- //au shape generateur.
- //On leur recolle juste une orientation pour etre bien
- //sur.
-
- myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
- TopAbs_ShapeEnum subGenSType = myGenShapeTool.Type(subGenS);
- if (aGenSType==TopAbs_FACE){
- if(subGenSType==TopAbs_VERTEX){
- SetParameters(myShapes(iGenS,iDirS),
- newShape,aGenS,subGenS,aDirS);
- }
- else if(subGenSType==TopAbs_EDGE){
- SetPCurve(myShapes(iGenS,iDirS),newShape,
- aGenS,subGenS,aDirS,Or);
- }
- else if(subGenSType==TopAbs_WIRE){
- TheGenShapeIterator Jt;
- cGenS = subGenS;
- myGenShapeTool.SetOrientation(cGenS,TopAbs_FORWARD);
- for (Jt.Init(cGenS);Jt.More();Jt.Next()){
- subsubGenS = Jt.Value();
- Pr = Jt.Orientation();
- if(HasShape(subsubGenS,aDirS)){
- TheShape newsubEdge = Shape(subsubGenS,aDirS);
- SetPCurve(myShapes(iGenS,iDirS),newsubEdge,
- aGenS,subsubGenS,aDirS,Pr);
- }
- }
- }
- }
- else if(aGenSType==TopAbs_EDGE){
- SetGeneratingParameter(myShapes(iGenS,iDirS),
- newShape,bGenS,subGenS,aDirS);
- }
- }
- }
- }
- }
- else if (myDirShapeTool.Type(aDirS)==TopAbs_EDGE){
- //Ici on construit les murs du Shape.
- TopAbs_ShapeEnum aGenSType = myGenShapeTool.Type(aGenS);
- TheShape newWire,newShell;
- Sweep_SequenceOfShapes WireSeq;
- Standard_Boolean sepwires = Standard_False;
- switch (aGenSType){
- case TopAbs_VERTEX :
- myShapes(iGenS,iDirS)=MakeEmptyDirectingEdge(aGenS,aDirS);
- break;
- case TopAbs_EDGE :
- //On cree un wire intermediaire qui contient tous les edges
- //du montant (face) du Shape pour le cas standard, et une
- //sequence de wires pour les cas merdiques necessitant des
- //wires independants.
- myBuilder.MakeWire(newWire);
- myShapes(iGenS,iDirS)=MakeEmptyFace(aGenS,aDirS);
- break;
- case TopAbs_WIRE :
- myBuilder.MakeShell(myShapes(iGenS,iDirS));
- break;
- case TopAbs_FACE :
- //On cree un shell intermediaire dans lequel on jette toutes
- //les faces en direct, pour eviter les empilages compliques
- //de shells et sous shells dans la structure du solide.
- myBuilder.MakeShell(newShell);
- myBuilder.MakeSolid(myShapes(iGenS,iDirS));
- break;
- case TopAbs_SHELL :
- myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
- break;
- case TopAbs_SOLID :
- Standard_NoSuchObject::Raise("Solids are not Processed");
- break;
- case TopAbs_COMPSOLID :
- Standard_NoSuchObject::Raise("Solids are not Processed");
- break;
- case TopAbs_COMPOUND :
- myBuilder.MakeCompound(myShapes(iGenS,iDirS));
- break;
- default:
- Standard_NoSuchObject::Raise("Unknown Shape");
- break;
- }
- bGenS = aGenS;
- myGenShapeTool.SetOrientation(bGenS,TopAbs_FORWARD);
- for (It.Init(bGenS);It.More();It.Next()){
- subGenS = It.Value();
- if(HasShape(subGenS,aDirS)){
- newShape = Shape(subGenS,aDirS);
- if (GGDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
- aGenS,subGenS,aDirS)){
- TopAbs_ShapeEnum subGenSType = myGenShapeTool.Type(subGenS);
- if (aGenSType==TopAbs_EDGE){
- Or = It.Orientation();
- if (SeparatedWires(myShapes(iGenS,iDirS),newShape,
- aGenS,subGenS,aDirS)){
- sepwires = Standard_True;
- TheShape wi;
- myBuilder.MakeWire(wi);
- myBuilder.Add(wi,newShape,Or);
- WireSeq.Append(wi);
- }
- else{
- myBuilder.Add(newWire,newShape,Or);
- }
- SetDirectingPCurve (myShapes(iGenS,iDirS),
- newShape,bGenS,subGenS,aDirS,Or);
- }
- else if (aGenSType==TopAbs_WIRE){
- Or = It.Orientation();
- myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
- }
- else if (aGenSType==TopAbs_FACE){
- Or = It.Orientation();
- if(subGenSType == TopAbs_WIRE) {
- for (Lt.Init(newShape);Lt.More();Lt.Next()){
- myBuilder.Add(newShell,Lt.Value(),
- TopAbs::Compose(Lt.Orientation(),Or));
- }
- }
- else if(subGenSType == TopAbs_EDGE) {
- myBuilder.Add(newShell,newShape,Or);
- }
- }
- else if(aGenSType == TopAbs_SHELL){
- Or = TopAbs_FORWARD;
- myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
- }
- else if(aGenSType == TopAbs_COMPOUND){
- Or = TopAbs_FORWARD;
- myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
- }
- else{
- Or = It.Orientation();
- myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
- }
- }
- }
- }
- bDirS = aDirS;
- for (Kt.Init(bDirS);Kt.More();Kt.Next()){
- subDirS = Kt.Value();
- if(HasShape(aGenS,subDirS)){
- newShape = Shape(aGenS,subDirS);
- if (GDDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
- aGenS,aDirS,subDirS)){
- if (aGenSType==TopAbs_EDGE){
- Or = TopAbs::Reverse(Kt.Orientation());
- myBuilder.Add(newWire,newShape,Or);
- SetGeneratingPCurve
- (myShapes(iGenS,iDirS),newShape,aGenS,aDirS,subDirS,Or);
- }
- else if(aGenSType==TopAbs_VERTEX){
- Or = Kt.Orientation();
- myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
- SetDirectingParameter
- (myShapes(iGenS,iDirS),newShape,aGenS,aDirS,subDirS);
- }
- else if(aGenSType==TopAbs_FACE){
- Or = Kt.Orientation();
- myBuilder.Add(newShell,newShape,Or);
- }
- }
- }
- }
- if (aGenSType==TopAbs_EDGE){
- if (sepwires){
- for(Standard_Integer ij = 1;ij <= WireSeq.Length();ij++){
- myBuilder.Add(myShapes(iGenS,iDirS),WireSeq.Value(ij));
- }
- }
- else{
- myBuilder.Add(myShapes(iGenS,iDirS),newWire);
- }
- myBuiltShapes(iGenS,iDirS) = Standard_True;
- SetContinuity(aGenS,aDirS);
- }
- if (aGenSType==TopAbs_WIRE){
- SetContinuity(aGenS,aDirS);
- }
- if (aGenSType==TopAbs_FACE){
- TheShape temp = SplitShell(newShell);
- TopAbs_Orientation Or = DirectSolid(aGenS,aDirS);
- Lt.Init(temp);
- if(Lt.More()) Lt.Next();
- if(Lt.More()){
- for (Lt.Init(temp);Lt.More();Lt.Next()){
- myBuilder.Add(myShapes(iGenS,iDirS),Lt.Value(),Or);
- }
- }
- else myBuilder.Add(myShapes(iGenS,iDirS),newShell,Or);
- }
- }
- else if (myDirShapeTool.Type(aDirS)==TopAbs_WIRE){
- TopAbs_ShapeEnum aGenSType = myGenShapeTool.Type(aGenS);
- switch (aGenSType){
- case TopAbs_VERTEX :
- myBuilder.MakeWire(myShapes(iGenS,iDirS));
- break;
- case TopAbs_EDGE :
- myBuilder.MakeShell(myShapes(iGenS,iDirS));
- break;
- case TopAbs_WIRE :
- myBuilder.MakeShell(myShapes(iGenS,iDirS));
- break;
- case TopAbs_FACE :
- myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
- break;
- case TopAbs_SHELL :
- myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
- break;
- case TopAbs_SOLID :
- Standard_NoSuchObject::Raise("Solids are not Processed");
- break;
- case TopAbs_COMPSOLID :
- Standard_NoSuchObject::Raise("Solids are not Processed");
- break;
- case TopAbs_COMPOUND :
- myBuilder.MakeCompound(myShapes(iGenS,iDirS));
- break;
- default:
- Standard_NoSuchObject::Raise("Unknown Shape");
- break;
- }
- bDirS = aDirS;
- for (Kt.Init(aDirS);Kt.More();Kt.Next()){
- subDirS = Kt.Value();
- if(HasShape(aGenS,subDirS)){
- Or = Kt.Orientation();
- newShape = Shape(aGenS,subDirS);
- myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
- }
- }
- }
- myBuiltShapes(iGenS,iDirS) = Standard_True;
- }
- return myShapes(iGenS,iDirS);
-}
-
-
-//=======================================================================
-//function : FirstShape
-//purpose : Returns the Shape indexed by the arguments.
-//=======================================================================
-
-TheShape Sweep_LinearRegularSweep::FirstShape ()
-{
- TheShape result;
- if (myDirShapeTool.HasFirstVertex()){
- if(HasShape(myGenShape,myDirShapeTool.FirstVertex()))
- result = Shape(myGenShape,myDirShapeTool.FirstVertex());
- }
- return result;
-}
-
-
-//=======================================================================
-//function : LastShape
-//purpose : Returns the Shape indexed by the arguments.
-//=======================================================================
-
-TheShape Sweep_LinearRegularSweep::LastShape ()
-{
- TheShape result;
- if (myDirShapeTool.HasLastVertex()){
- if(HasShape(myGenShape,myDirShapeTool.LastVertex()))
- result = Shape(myGenShape,myDirShapeTool.LastVertex());
- }
- return result;
-}
-
-
-//=======================================================================
-//function : FirstShape
-//purpose : Returns the Shape indexed by the arguments.
-//=======================================================================
-
-TheShape Sweep_LinearRegularSweep::FirstShape (const TheGenShape& aGenS)
-{
- TheShape result;
- if (myDirShapeTool.HasFirstVertex()){
- if(HasShape(aGenS,myDirShapeTool.FirstVertex()))
- result = Shape(aGenS,myDirShapeTool.FirstVertex());
- }
- return result;
-}
-
-
-//=======================================================================
-//function : LastShape
-//purpose : Returns the Shape indexed by the arguments.
-//=======================================================================
-
-TheShape Sweep_LinearRegularSweep::LastShape (const TheGenShape& aGenS)
-{
- TheShape result;
- if (myDirShapeTool.HasLastVertex()){
- if(HasShape(aGenS,myDirShapeTool.LastVertex()))
- result = Shape(aGenS,myDirShapeTool.LastVertex());
- }
- return result;
-}
-
-//=======================================================================
-//function : Closed
-//purpose :
-//=======================================================================
-
-Standard_Boolean Sweep_LinearRegularSweep::Closed()const
-{
- return myDirWire.Closed();
-}
-
-//=======================================================================
-//function : SplitShell
-//purpose :
-//=======================================================================
-
-TheShape Sweep_LinearRegularSweep::SplitShell(const TheShape& aNewShape)const
-{
- TheShape comp;
- myBuilder.MakeCompound(comp);
- myBuilder.Add(comp,aNewShape);
- return comp;
-}
-
BRepPrim
-Primitives
BRepSweep
Sweep
BRepPrimAPI