mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
165
src/gce/gce.cdl
Executable file
165
src/gce/gce.cdl
Executable file
@@ -0,0 +1,165 @@
|
||||
-- File: gce.cdl
|
||||
-- Created: Thu Apr 30 11:36:51 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
package gce
|
||||
|
||||
uses gp,
|
||||
StdFail
|
||||
|
||||
--- Level : Public
|
||||
-- All methods of all classes will be public.
|
||||
|
||||
|
||||
|
||||
is
|
||||
|
||||
enumeration ErrorType is Done, ConfusedPoints, NegativeRadius, ColinearPoints,
|
||||
IntersectionError, NullAxis, NullAngle, NullRadius,
|
||||
InvertAxis,BadAngle,InvertRadius,NullFocusLength,
|
||||
NullVector,BadEquation;
|
||||
--- Purpose: Indicates the outcome of a construction, i.e.
|
||||
-- whether it is successful or not, as explained below.
|
||||
-- gce_Done: Construction was successful.
|
||||
-- gce_ConfusedPoints: Two points are coincident.
|
||||
-- gce_NegativeRadius: Radius value is negative.
|
||||
-- gce_ColinearPoints: Three points are collinear.
|
||||
-- gce_IntersectionError: Intersection cannot be computed.
|
||||
-- gce_NullAxis: Axis is undefined.
|
||||
-- gce_NullAngle: Angle value is invalid (usually null).
|
||||
-- gce_NullRadius: Radius is null.
|
||||
-- gce_InvertAxis: Axis value is invalid.
|
||||
-- gce_BadAngle: Angle value is invalid.
|
||||
-- gce_InvertRadius: Radius value is incorrect
|
||||
-- (usually with respect to another radius).
|
||||
-- gce_NullFocusLength: Focal distance is null.
|
||||
-- gce_NullVector: Vector is null.
|
||||
-- gce_BadEquation: Coefficients are
|
||||
-- incorrect (applies to the equation of a geometric object).
|
||||
|
||||
|
||||
private deferred class Root;
|
||||
---Purpose: Root of classes with error report.
|
||||
|
||||
class MakeDir2d;
|
||||
---Purpose: Makes a dir2d from gp.
|
||||
|
||||
class MakeLin2d;
|
||||
---Purpose: Makes a Lin2d from gp.
|
||||
|
||||
class MakeCirc2d;
|
||||
---Purpose: Makes a Circ2d from gp.
|
||||
|
||||
class MakeHypr2d;
|
||||
---Purpose: Makes an hypr2d from gp.
|
||||
|
||||
class MakeElips2d;
|
||||
---Purpose: Makes an Elips2d from gp.
|
||||
|
||||
class MakeParab2d;
|
||||
---Purpose: Makes a parab2d from gp.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---Purpose : Constructions of Trsf2d from gp.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
class MakeTranslation2d;
|
||||
---Purpose: Returns a translation transformation.
|
||||
|
||||
class MakeMirror2d;
|
||||
---Purpose: Returns a symmetry transformation.
|
||||
|
||||
class MakeRotation2d;
|
||||
---Purpose: Returns a rotation transformation.
|
||||
|
||||
class MakeScale2d;
|
||||
---Purpose: Returns a scaling transformation.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---Purpose: scalar product.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
--class MakeDot;
|
||||
---Purpose: Makes a scalar product between the two vectors P1P2 and P3P4.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---Purpose: vector product.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
--class MakeCross2d;
|
||||
---Purpose: Makes a Cross between the two vectors P1P2 and P1P3.
|
||||
|
||||
--class MakeDotCross;
|
||||
---Purpose: Makes the triple scalar product P1P2 * (P3P4 ^ P5P6).
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---Purpose : Constructions of 3d geometrical elements from gp.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
class MakeDir;
|
||||
---Purpose: Makes a dir from gp.
|
||||
|
||||
class MakeLin;
|
||||
---Purpose: Makes a Line <L> from gp.
|
||||
|
||||
class MakeCirc;
|
||||
---Purpose: Makes a Circle <C> from gp.
|
||||
|
||||
class MakeHypr;
|
||||
---Purpose: Makes an hyperbola <H> from gp.
|
||||
|
||||
class MakeElips;
|
||||
---Purpose: Makes an ellipse <E> from gp.
|
||||
|
||||
class MakeParab;
|
||||
---Purpose: Makes a parabola <P> from gp.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---Purpose : Constructions of planes from gp.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
class MakePln;
|
||||
---Purpose: Makes a plane <Pl> from gp.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---Purpose: Construction of surfaces from gp.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
class MakeCylinder;
|
||||
---Purpose: Makes a cylinder <Cyl> from gp.
|
||||
|
||||
class MakeCone;
|
||||
---Purpose: Makes a cone <Cone> from gp.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---Purpose : Constructions of Trsf from gp.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
class MakeTranslation;
|
||||
---Purpose: returns a translation transformation.
|
||||
|
||||
class MakeMirror;
|
||||
---Purpose: returns a symmetry transformation.
|
||||
|
||||
class MakeRotation;
|
||||
---Purpose: returns a rotation transformation.
|
||||
|
||||
class MakeScale;
|
||||
---Purpose: returns a scaling transformation.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---Purpose: vector product.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
--class MakeCross;
|
||||
---Purpose: Makes a Cross product between the two vectors P1P2 and P1P3.
|
||||
|
||||
--class MakeDotCross;
|
||||
---Purpose: Makes the triple scalar product P1P2 * (P3P4 ^ P5P6).
|
||||
|
||||
end gce;
|
||||
|
||||
|
||||
|
120
src/gce/gce_MakeCirc.cdl
Executable file
120
src/gce/gce_MakeCirc.cdl
Executable file
@@ -0,0 +1,120 @@
|
||||
-- File: MakeCirc.cdl
|
||||
-- Created: Wed Aug 26 14:31:09 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeCirc from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create Circ from gp.
|
||||
--
|
||||
-- * Create a Circ coaxial to another and passing
|
||||
-- though a point.
|
||||
-- * Create a Circ coaxial to another at the distance
|
||||
-- Dist.
|
||||
-- * Create a Circ passing through 3 points.
|
||||
-- * Create a Circ with its center and the normal of its
|
||||
-- plane and its radius.
|
||||
-- * Create a Circ with its center and its plane and its
|
||||
-- radius.
|
||||
-- * Create a Circ with its axis and radius.
|
||||
-- * Create a Circ with two points giving its axis and
|
||||
-- its radius.
|
||||
-- * Create a Circ with is Ax2 and its Radius.
|
||||
|
||||
uses Pnt from gp,
|
||||
Circ from gp,
|
||||
Dir from gp,
|
||||
Ax1 from gp,
|
||||
Ax2 from gp,
|
||||
Pln from gp,
|
||||
Real from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A2 : Ax2 from gp ;
|
||||
Radius : Real from Standard) returns MakeCirc;
|
||||
--- Purpose :
|
||||
-- A2 locates the circle and gives its orientation in 3D space.
|
||||
--- Warnings :
|
||||
-- It is not forbidden to create a circle with Radius = 0.0
|
||||
--- The status is "NegativeRadius" if Radius < 0.0
|
||||
|
||||
Create(Circ : Circ from gp ;
|
||||
Dist : Real from Standard) returns MakeCirc;
|
||||
---Purpose : Makes a Circ from gp <TheCirc> coaxial to another
|
||||
-- Circ <Circ> at a distance <Dist>.
|
||||
-- If Dist is greater than zero the result is encloses
|
||||
-- the circle <Circ>, else the result is enclosed by the
|
||||
-- circle <Circ>.
|
||||
|
||||
Create(Circ : Circ from gp;
|
||||
Point : Pnt from gp) returns MakeCirc;
|
||||
---Purpose : Makes a Circ from gp <TheCirc> coaxial to another
|
||||
-- Circ <Circ> and passing through a Pnt2d <Point>.
|
||||
|
||||
Create(P1,P2,P3 : Pnt from gp) returns MakeCirc;
|
||||
---Purpose : Makes a Circ from gp <TheCirc> passing through 3
|
||||
-- Pnt2d <P1>,<P2>,<P3>.
|
||||
|
||||
Create(Center : Pnt from gp ;
|
||||
Norm : Dir from gp ;
|
||||
Radius : Real from Standard) returns MakeCirc;
|
||||
---Purpose : Makes a Circ from gp <TheCirc> with its center
|
||||
-- <Center> and the normal of its plane <Norm> and
|
||||
-- its radius <Radius>.
|
||||
|
||||
Create(Center : Pnt from gp ;
|
||||
Plane : Pln from gp ;
|
||||
Radius : Real from Standard) returns MakeCirc;
|
||||
---Purpose : Makes a Circ from gp <TheCirc> with its center
|
||||
-- <Center> and the normal of its plane <Plane> and
|
||||
-- its radius <Radius>.
|
||||
|
||||
Create(Center : Pnt from gp ;
|
||||
Ptaxis : Pnt from gp ;
|
||||
Radius : Real from Standard) returns MakeCirc;
|
||||
---Purpose : Makes a Circ from gp <TheCirc> with its center
|
||||
-- <Center> and a point <Ptaxis> giving the normal
|
||||
-- of its plane <Plane> and its radius <Radius>.
|
||||
|
||||
Create(Axis : Ax1 from gp ;
|
||||
Radius : Real from Standard) returns MakeCirc;
|
||||
---Purpose : Makes a Circ from gp <TheCirc> with its center
|
||||
-- <Center> and its radius <Radius>.
|
||||
-- Warning
|
||||
-- The MakeCirc class does not prevent the
|
||||
-- construction of a circle with a null radius.
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_Negative Radius if:
|
||||
-- - Radius is less than 0.0, or
|
||||
-- - Dist is less than 0.0 and the absolute value of
|
||||
-- Dist is greater than the radius of Circ;
|
||||
-- - gce_IntersectionError if the points P1, P2 and
|
||||
-- P3 are collinear, and the three are not coincident;
|
||||
-- - gce_ConfusedPoints if two of the three points
|
||||
-- P1, P2 and P3 are coincident; or
|
||||
-- - gce_NullAxis if Center and Ptaxis are coincident.
|
||||
|
||||
Value(me) returns Circ from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed circle.
|
||||
-- Exceptions StdFail_NotDone if no circle is constructed.
|
||||
|
||||
Operator(me) returns Circ from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Circ() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheCirc : Circ from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeCirc;
|
349
src/gce/gce_MakeCirc.cxx
Executable file
349
src/gce/gce_MakeCirc.cxx
Executable file
@@ -0,0 +1,349 @@
|
||||
// File: gce_MakeCirc.cxx
|
||||
// Created: Wed Sep 2 10:34:28 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeCirc.ixx>
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
|
||||
#include <gce_MakeDir.hxx>
|
||||
|
||||
#include <Extrema_POnCurv.hxx>
|
||||
#include <Extrema_ExtElC.hxx>
|
||||
//=======================================================================
|
||||
//function : gce_MakeCirc
|
||||
//purpose :
|
||||
// Creation d un cercle 3d de gp passant par trois points. +
|
||||
// Trois cas de figures : +
|
||||
// 1/ Les trois points sont confondus. +
|
||||
// ----------------------------------- +
|
||||
// Le resultat est le cercle centre en Point1 de rayon zero. +
|
||||
// 2/ Deux des trois points sont confondus. +
|
||||
// ---------------------------------------- +
|
||||
// Pas de solution (Erreur : Points confondus). +
|
||||
// 3/ Les trois points sont distinct. +
|
||||
// ---------------------------------- +
|
||||
// On cree la mediatrice a P1P2 ainsi que la mediatrice a P1P3. +
|
||||
// La solution a pour centre l intersection de ces deux droite et +
|
||||
// pour rayon la distance entre ce centre et l un des trois points. +
|
||||
//=========================================================================
|
||||
gce_MakeCirc::gce_MakeCirc(const gp_Pnt& P1 ,
|
||||
const gp_Pnt& P2 ,
|
||||
const gp_Pnt& P3) {
|
||||
//=========================================================================
|
||||
// Traitement. +
|
||||
//=========================================================================
|
||||
Standard_Real dist1, dist2, dist3, aResolution;
|
||||
//
|
||||
aResolution=gp::Resolution();
|
||||
//
|
||||
dist1 = P1.Distance(P2);
|
||||
dist2 = P1.Distance(P3);
|
||||
dist3 = P2.Distance(P3);
|
||||
//
|
||||
if ((dist1<aResolution) && (dist2<aResolution) && (dist3<aResolution)) {
|
||||
gp_Dir Dirx(1.,0.,0.);
|
||||
gp_Dir Dirz(0.,0.,1.);
|
||||
TheCirc = gp_Circ(gp_Ax2(P1,Dirx,Dirz), 0.);
|
||||
return;
|
||||
}
|
||||
if (!(dist1 >= aResolution && dist2 >= aResolution)) {
|
||||
TheError = gce_ConfusedPoints;
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Real x1,y1,z1,x2,y2,z2,x3,y3,z3;
|
||||
//
|
||||
P1.Coord(x1,y1,z1);
|
||||
P2.Coord(x2,y2,z2);
|
||||
P3.Coord(x3,y3,z3);
|
||||
gp_Dir Dir1(x2-x1,y2-y1,z2-z1);
|
||||
gp_Dir Dir2(x3-x2,y3-y2,z3-z2);
|
||||
//
|
||||
gp_Ax1 anAx1(P1, Dir1);
|
||||
gp_Lin aL12 (anAx1);
|
||||
if (aL12.Distance(P3)<aResolution) {
|
||||
TheError = gce_ColinearPoints;
|
||||
return;
|
||||
}
|
||||
//
|
||||
gp_Dir Dir3 = Dir1.Crossed(Dir2);
|
||||
//
|
||||
gp_Dir dir = Dir1.Crossed(Dir3);
|
||||
gp_Lin L1(gp_Pnt((P1.XYZ()+P2.XYZ())/2.),dir);
|
||||
dir = Dir2.Crossed(Dir3);
|
||||
gp_Lin L2(gp_Pnt((P3.XYZ()+P2.XYZ())/2.),dir);
|
||||
|
||||
Standard_Real Tol = 0.000000001;
|
||||
Extrema_ExtElC distmin(L1,L2,Tol);
|
||||
|
||||
if (!distmin.IsDone()) {
|
||||
TheError = gce_IntersectionError;
|
||||
}
|
||||
else {
|
||||
Standard_Integer nbext;
|
||||
//
|
||||
//
|
||||
if (distmin.IsParallel()) {
|
||||
TheError = gce_IntersectionError;
|
||||
return;
|
||||
}
|
||||
nbext = distmin.NbExt();
|
||||
//
|
||||
//
|
||||
if (nbext == 0) {
|
||||
TheError = gce_IntersectionError;
|
||||
}
|
||||
else {
|
||||
Standard_Real TheDist = RealLast();
|
||||
gp_Pnt pInt,pon1,pon2;
|
||||
Standard_Integer i = 1;
|
||||
Extrema_POnCurv Pon1,Pon2;
|
||||
while (i<=nbext) {
|
||||
if (distmin.SquareDistance(i)<TheDist) {
|
||||
TheDist = distmin.SquareDistance(i);
|
||||
distmin.Points(i,Pon1,Pon2);
|
||||
pon1 = Pon1.Value();
|
||||
pon2 = Pon2.Value();
|
||||
pInt = gp_Pnt((pon1.XYZ()+pon2.XYZ())/2.);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Mar 3 11:30:34 2005f
|
||||
//Dir2.Cross(Dir1);
|
||||
//modified by NIZNHY-PKV Thu Mar 3 11:30:37 2005t
|
||||
dist1 = P1.Distance(pInt);
|
||||
dist2 = P2.Distance(pInt);
|
||||
dist3 = P3.Distance(pInt);
|
||||
pInt.Coord(x3,y3,z3);
|
||||
Dir1 = gp_Dir(x1-x3,y1-y3,z1-z3);
|
||||
//modified by NIZNHY-PKV Thu Mar 3 11:31:11 2005f
|
||||
//Dir2 = gp_Dir(x2-x3,y2-y3,z2-z3);
|
||||
//modified by NIZNHY-PKV Thu Mar 3 11:31:13 2005t
|
||||
//
|
||||
TheCirc = gp_Circ(gp_Ax2(pInt, Dir3, Dir1),(dist1+dist2+dist3)/3.);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : gce_MakeCirc
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gce_MakeCirc::gce_MakeCirc(const gp_Ax2& A2 ,
|
||||
const Standard_Real Radius ) {
|
||||
if (Radius < 0.) {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
else {
|
||||
TheError = gce_Done;
|
||||
TheCirc = gp_Circ(A2,Radius);
|
||||
}
|
||||
}
|
||||
//=========================================================================
|
||||
// Creation d un gp_Circ par son centre <Center>, son plan <Plane> et +
|
||||
// son rayon <Radius>. +
|
||||
//=========================================================================
|
||||
gce_MakeCirc::gce_MakeCirc(const gp_Pnt& Center ,
|
||||
const gp_Pln& Plane ,
|
||||
const Standard_Real Radius ) {
|
||||
gce_MakeCirc C = gce_MakeCirc(Center,Plane.Position().Direction(),Radius);
|
||||
TheCirc = C.Value();
|
||||
TheError = C.Status();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : gce_MakeCirc
|
||||
//purpose : Creation d un gp_Circ par son centre <Center>,
|
||||
//sa normale <Norm> et son rayon <Radius>.
|
||||
//=======================================================================
|
||||
gce_MakeCirc::gce_MakeCirc(const gp_Pnt& Center ,
|
||||
const gp_Dir& Norm ,
|
||||
const Standard_Real Radius ) {
|
||||
if (Radius < 0.) {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
else {
|
||||
Standard_Real A = Norm.X();
|
||||
Standard_Real B = Norm.Y();
|
||||
Standard_Real C = Norm.Z();
|
||||
Standard_Real Aabs = Abs(A);
|
||||
Standard_Real Babs = Abs(B);
|
||||
Standard_Real Cabs = Abs(C);
|
||||
gp_Ax2 Pos;
|
||||
|
||||
//=========================================================================
|
||||
// pour determiner l'axe X : +
|
||||
// on dit que le produit scalaire Vx.Norm = 0. +
|
||||
// et on recherche le max(A,B,C) pour faire la division. +
|
||||
// l'une des coordonnees du vecteur est nulle. +
|
||||
//=========================================================================
|
||||
|
||||
if( Babs <= Aabs && Babs <= Cabs) {
|
||||
if(Aabs > Cabs) { Pos = gp_Ax2(Center,Norm,gp_Dir(-C,0.,A)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(C,0.,-A)); }
|
||||
}
|
||||
else if( Aabs <= Babs && Aabs <= Cabs) {
|
||||
if(Babs > Cabs) { Pos = gp_Ax2(Center,Norm,gp_Dir(0.,-C,B)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(0.,C,-B)); }
|
||||
}
|
||||
else {
|
||||
if(Aabs > Babs) { Pos = gp_Ax2(Center,Norm,gp_Dir(-B,A,0.)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(B,-A,0.)); }
|
||||
}
|
||||
TheCirc = gp_Circ(Pos,Radius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : gce_MakeCirc
|
||||
//purpose : Creation d un gp_Circ par son centre <Center>,
|
||||
// sa normale <Ptaxis> et son rayon <Radius>
|
||||
//=======================================================================
|
||||
gce_MakeCirc::gce_MakeCirc(const gp_Pnt& Center ,
|
||||
const gp_Pnt& Ptaxis ,
|
||||
const Standard_Real Radius ) {
|
||||
if (Radius < 0.) {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
else {
|
||||
if (Center.Distance(Ptaxis) <= gp::Resolution()) {
|
||||
TheError = gce_NullAxis;
|
||||
}
|
||||
else {
|
||||
Standard_Real A = Ptaxis.X()-Center.X();
|
||||
Standard_Real B = Ptaxis.Y()-Center.Y();
|
||||
Standard_Real C = Ptaxis.Z()-Center.Z();
|
||||
Standard_Real Aabs = Abs(A);
|
||||
Standard_Real Babs = Abs(B);
|
||||
Standard_Real Cabs = Abs(C);
|
||||
gp_Ax2 Pos;
|
||||
|
||||
//=========================================================================
|
||||
// pour determiner l'axe X : +
|
||||
// on dit que le produit scalaire Vx.Norm = 0. +
|
||||
// et on recherche le max(A,B,C) pour faire la division. +
|
||||
// l'une des coordonnees du vecteur est nulle. +
|
||||
//=========================================================================
|
||||
|
||||
gp_Dir Norm = gce_MakeDir(Center,Ptaxis);
|
||||
if( Babs <= Aabs && Babs <= Cabs) {
|
||||
if(Aabs > Cabs) { Pos = gp_Ax2(Center,Norm,gp_Dir(-C,0.,A)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(C,0.,-A)); }
|
||||
}
|
||||
else if( Aabs <= Babs && Aabs <= Cabs) {
|
||||
if(Babs > Cabs) { Pos = gp_Ax2(Center,Norm,gp_Dir(0.,-C,B)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(0.,C,-B)); }
|
||||
}
|
||||
else {
|
||||
if(Aabs > Babs) { Pos = gp_Ax2(Center,Norm,gp_Dir(-B,A,0.)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(B,-A,0.)); }
|
||||
}
|
||||
TheCirc = gp_Circ(Pos,Radius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : gce_MakeCirc
|
||||
//purpose : Creation d un gp_Circ par son axe <Axis> et son rayon <Radius>.
|
||||
//=======================================================================
|
||||
gce_MakeCirc::gce_MakeCirc(const gp_Ax1& Axis ,
|
||||
const Standard_Real Radius )
|
||||
{
|
||||
if (Radius < 0.) {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
else {
|
||||
gp_Dir Norm(Axis.Direction());
|
||||
gp_Pnt Center(Axis.Location());
|
||||
Standard_Real A = Norm.X();
|
||||
Standard_Real B = Norm.Y();
|
||||
Standard_Real C = Norm.Z();
|
||||
Standard_Real Aabs = Abs(A);
|
||||
Standard_Real Babs = Abs(B);
|
||||
Standard_Real Cabs = Abs(C);
|
||||
gp_Ax2 Pos;
|
||||
|
||||
//=========================================================================
|
||||
// pour determiner l'axe X : +
|
||||
// on dit que le produit scalaire Vx.Norm = 0. +
|
||||
// et on recherche le max(A,B,C) pour faire la division. +
|
||||
// l'une des coordonnees du vecteur est nulle. +
|
||||
//=========================================================================
|
||||
|
||||
if( Babs <= Aabs && Babs <= Cabs) {
|
||||
if(Aabs > Cabs) { Pos = gp_Ax2(Center,Norm,gp_Dir(-C,0.,A)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(C,0.,-A)); }
|
||||
}
|
||||
else if( Aabs <= Babs && Aabs <= Cabs) {
|
||||
if(Babs > Cabs) { Pos = gp_Ax2(Center,Norm,gp_Dir(0.,-C,B)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(0.,C,-B)); }
|
||||
}
|
||||
else {
|
||||
if(Aabs > Babs) { Pos = gp_Ax2(Center,Norm,gp_Dir(-B,A,0.)); }
|
||||
else { Pos = gp_Ax2(Center,Norm,gp_Dir(B,-A,0.)); }
|
||||
}
|
||||
TheCirc = gp_Circ(Pos,Radius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : gce_MakeCirc
|
||||
//purpose : Creation d un gp_Circ concentrique a un autre gp_circ a une distance +
|
||||
// donnee.
|
||||
//=======================================================================
|
||||
gce_MakeCirc::gce_MakeCirc(const gp_Circ& Circ ,
|
||||
const Standard_Real Dist )
|
||||
{
|
||||
Standard_Real Rad = Circ.Radius()+Dist;
|
||||
if (Rad < 0.) {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
else {
|
||||
TheCirc = gp_Circ(Circ.Position(),Rad);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : gce_MakeCirc
|
||||
//purpose : Creation d un gp_Circ concentrique a un autre gp_circ dont le rayon
|
||||
// est egal a la distance de <Point> a l axe de <Circ>.
|
||||
//=======================================================================
|
||||
gce_MakeCirc::gce_MakeCirc(const gp_Circ& Circ ,
|
||||
const gp_Pnt& P )
|
||||
{
|
||||
Standard_Real Rad = gp_Lin(Circ.Axis()).Distance(P);
|
||||
TheCirc = gp_Circ(Circ.Position(),Rad);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Circ& gce_MakeCirc::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheCirc;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Operator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Circ& gce_MakeCirc::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : operator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gce_MakeCirc::operator gp_Circ() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
115
src/gce/gce_MakeCirc2d.cdl
Executable file
115
src/gce/gce_MakeCirc2d.cdl
Executable file
@@ -0,0 +1,115 @@
|
||||
-- File: MakeCirc2d.cdl
|
||||
-- Created: Wed Aug 26 14:31:09 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeCirc2d from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create Circ2d from gp.
|
||||
--
|
||||
-- * Create a Circ2d concentric with another and passing
|
||||
-- though a point.
|
||||
-- * Create a Circ2d concentric with another at the distance
|
||||
-- Dist.
|
||||
-- * Create a Circ2d passing through 3 points.
|
||||
-- * Create a Circ2d with its center and radius.
|
||||
-- * Create a Circ2d with its center and a point given
|
||||
-- the radius.
|
||||
-- * Create a Circ2d with its axis and its radius.
|
||||
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Circ2d from gp,
|
||||
Real from Standard,
|
||||
ErrorType from gce,
|
||||
Ax2d from gp,
|
||||
Ax22d from gp
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (XAxis : Ax2d from gp ;
|
||||
Radius : Real from Standard ;
|
||||
Sense : Boolean from Standard = Standard_True) returns MakeCirc2d;
|
||||
--- Purpose :
|
||||
-- The location point of XAxis is the center of the circle.
|
||||
-- Warnings :
|
||||
-- It is not forbidden to create a circle with Radius = 0.0
|
||||
-- If Sense is true the local coordinate system of the solution
|
||||
-- is direct and non direct in the other case.
|
||||
-- The status is "NegativeRadius" if Radius < 0.0.
|
||||
|
||||
Create (Axis : Ax22d from gp ;
|
||||
Radius : Real from Standard) returns MakeCirc2d;
|
||||
--- Purpose :
|
||||
-- The location point of Axis is the center of the circle.
|
||||
-- Warnings :
|
||||
-- It is not forbidden to create a circle with Radius = 0.0
|
||||
|
||||
Create(Circ : Circ2d from gp ;
|
||||
Dist : Real from Standard)
|
||||
returns MakeCirc2d;
|
||||
---Purpose : Makes a Circ2d from gp <TheCirc> concentric with another
|
||||
-- circ2d <Circ> with a distance <Dist>.
|
||||
-- If Dist is greater than zero the result encloses
|
||||
-- the circle <Circ>, else the result is enclosed by the
|
||||
-- circle <Circ>.
|
||||
-- The local coordinate system of the solution is the
|
||||
-- same as Circ.
|
||||
|
||||
Create(Circ : Circ2d from gp;
|
||||
Point : Pnt2d from gp)
|
||||
returns MakeCirc2d;
|
||||
---Purpose : Makes a Circ2d from gp <TheCirc> concentric with another
|
||||
-- circ2d <Circ> and passing through a Pnt2d <Point>.
|
||||
-- The local coordinate system of the solution is the
|
||||
-- same as Circ.
|
||||
|
||||
Create(P1 : Pnt2d from gp;
|
||||
P2 : Pnt2d from gp;
|
||||
P3 : Pnt2d from gp)
|
||||
returns MakeCirc2d;
|
||||
---Purpose : Makes a Circ2d from gp <TheCirc> passing through 3
|
||||
-- Pnt2d <P1>,<P2>,<P3>.
|
||||
-- The local coordinate system of the solution is given
|
||||
-- by the three points P1, P2, P3.
|
||||
|
||||
Create(Center : Pnt2d from gp ;
|
||||
Radius : Real from Standard ;
|
||||
Sense : Boolean from Standard = Standard_True)
|
||||
returns MakeCirc2d;
|
||||
---Purpose : Makes a Circ2d from gp <TheCirc> with its center
|
||||
-- <Center> and its radius <Radius>.
|
||||
-- If Sense is true the local coordinate system of
|
||||
-- the solution is direct and non direct in the other case.
|
||||
|
||||
Create(Center : Pnt2d from gp ;
|
||||
Point : Pnt2d from gp ;
|
||||
Sense : Boolean from Standard = Standard_True)
|
||||
returns MakeCirc2d;
|
||||
---Purpose : Makes a Circ2d from gp <TheCirc> with its center
|
||||
-- <Center> and a point giving the radius.
|
||||
-- If Sense is true the local coordinate system of
|
||||
-- the solution is direct and non direct in the other case.
|
||||
|
||||
Value(me) returns Circ2d from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed circle.
|
||||
-- Exceptions StdFail_NotDone if no circle is constructed.
|
||||
|
||||
Operator(me) returns Circ2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Circ2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheCirc2d : Circ2d from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeCirc2d;
|
208
src/gce/gce_MakeCirc2d.cxx
Executable file
208
src/gce/gce_MakeCirc2d.cxx
Executable file
@@ -0,0 +1,208 @@
|
||||
// File: gce_MakeCirc2d.cxx
|
||||
// Created: Wed Sep 2 10:34:28 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeCirc2d.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <IntAna2d_AnaIntersection.hxx>
|
||||
#include <IntAna2d_IntPoint.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un cercle 2d de gp passant par trois points. +
|
||||
// Trois cas de figures : +
|
||||
// 1/ Les trois points sont confondus. +
|
||||
// ----------------------------------- +
|
||||
// Le resultat est le cercle centre en Point1 de rayon zero. +
|
||||
// 2/ Deux des trois points sont confondus. +
|
||||
// ---------------------------------------- +
|
||||
// On cree la mediatrice a deux points non confondus ainsi que la +
|
||||
// droite passant par ces deux points. +
|
||||
// La solution a pour centre l intersection de ces deux droite et +
|
||||
// pour rayon la distance entre ce centre et l un des trois points. +
|
||||
// 3/ Les trois points sont distinct. +
|
||||
// ---------------------------------- +
|
||||
// On cree la mediatrice a P1P2 ainsi que la mediatrice a P1P3. +
|
||||
// La solution a pour centre l intersection de ces deux droite et +
|
||||
// pour rayon la distance entre ce centre et l un des trois points. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCirc2d::gce_MakeCirc2d(const gp_Pnt2d& P1 ,
|
||||
const gp_Pnt2d& P2 ,
|
||||
const gp_Pnt2d& P3 )
|
||||
{
|
||||
gp_Dir2d dirx(1.0,0.0);
|
||||
|
||||
//=========================================================================
|
||||
// Traitement. +
|
||||
//=========================================================================
|
||||
|
||||
Standard_Real dist1 = P1.Distance(P2);
|
||||
Standard_Real dist2 = P1.Distance(P3);
|
||||
Standard_Real dist3 = P2.Distance(P3);
|
||||
|
||||
if ((dist1<gp::Resolution()) && (dist2<gp::Resolution()) &&
|
||||
(dist3<gp::Resolution())) {
|
||||
TheCirc2d = gp_Circ2d(gp_Ax2d(P1,dirx),0.0);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else {
|
||||
gp_Lin2d L1;
|
||||
gp_Lin2d L2;
|
||||
Standard_Real x1,y1,x2,y2,x3,y3;
|
||||
P1.Coord(x1,y1);
|
||||
P2.Coord(x2,y2);
|
||||
P3.Coord(x3,y3);
|
||||
if (dist1 >= RealEpsilon()) {
|
||||
L1 = gp_Lin2d(gp_Pnt2d((P1.XY()+P2.XY())/2.0),
|
||||
gp_Dir2d(P1.Y()-P2.Y(),P2.X()-P1.X()));
|
||||
}
|
||||
if (dist2 >= RealEpsilon()) {
|
||||
L2 = gp_Lin2d(gp_Pnt2d((P1.XY()+P3.XY())/2.0),
|
||||
gp_Dir2d(P1.Y()-P3.Y(),P3.X()-P1.X()));
|
||||
}
|
||||
if (dist2 <= RealEpsilon()) {
|
||||
L2 = gp_Lin2d(P1,gp_Dir2d(P1.Y()-P2.Y(),P2.X()-P1.X()));
|
||||
}
|
||||
else if (dist1 <= RealEpsilon()) {
|
||||
L1 = gp_Lin2d(P1,gp_Dir2d(P1.Y()-P3.Y(),P3.X()-P1.X()));
|
||||
}
|
||||
else if (dist3 <= RealEpsilon()) {
|
||||
L2 = gp_Lin2d(P1,gp_Dir2d(P1.Y()-P2.Y(),P2.X()-P1.X()));
|
||||
}
|
||||
IntAna2d_AnaIntersection Intp(L1,L2);
|
||||
if (Intp.IsDone()) {
|
||||
if (!Intp.IsEmpty()) {
|
||||
gp_Pnt2d pInt(Intp.Point(1).Value());
|
||||
dist1 = P1.Distance(pInt);
|
||||
dist2 = P2.Distance(pInt);
|
||||
dist3 = P3.Distance(pInt);
|
||||
Standard_Real xc,yc;
|
||||
pInt.Coord(xc,yc);
|
||||
gp_Dir2d d1(x1-xc,y1-yc);
|
||||
gp_Dir2d d2(xc-x3,yc-y3);
|
||||
TheCirc2d = gp_Circ2d(gp_Ax22d(pInt,d1,d2),(dist1+dist2+dist3)/3.);
|
||||
Standard_Real Alpha1 = ElCLib::Parameter(TheCirc2d,P1);
|
||||
Standard_Real Alpha2 = ElCLib::Parameter(TheCirc2d,P2);
|
||||
Standard_Real Alpha3 = ElCLib::Parameter(TheCirc2d,P3);
|
||||
if (!((Alpha1 <= Alpha2) && (Alpha2 <= Alpha3))) {
|
||||
TheCirc2d.Reverse();
|
||||
}
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
else {
|
||||
TheError = gce_IntersectionError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// Creation d un gp_Circ2d par son Axe <XAxis> et son rayon <Radius>. +
|
||||
//==========================================================================
|
||||
|
||||
gce_MakeCirc2d::gce_MakeCirc2d(const gp_Ax2d& XAxis ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Boolean Sense )
|
||||
{
|
||||
if (Radius >= 0.) {
|
||||
TheCirc2d = gp_Circ2d(XAxis,Radius,Sense);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// Creation d un gp_Circ2d par son Repere <Axis> et son rayon <Radius>. +
|
||||
//==========================================================================
|
||||
|
||||
gce_MakeCirc2d::gce_MakeCirc2d(const gp_Ax22d& Axis ,
|
||||
const Standard_Real Radius )
|
||||
{
|
||||
if (Radius >= 0.) {
|
||||
TheCirc2d = gp_Circ2d(Axis,Radius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// Creation d un gp_Circ2d par son centre <Center> et son rayon +
|
||||
// <Radius>. +
|
||||
//==========================================================================
|
||||
|
||||
gce_MakeCirc2d::gce_MakeCirc2d(const gp_Pnt2d& Center ,
|
||||
const Standard_Real Radius ,
|
||||
const Standard_Boolean Sense )
|
||||
{
|
||||
if (Radius >= 0.) {
|
||||
TheCirc2d = gp_Circ2d(gp_Ax2d(Center,gp_Dir2d(1.0,0.0)),Radius,Sense);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// Creation d un gp_Circ2d par son centre <Center> et un point de sa +
|
||||
// circonference <Point>. +
|
||||
//==========================================================================
|
||||
|
||||
gce_MakeCirc2d::gce_MakeCirc2d(const gp_Pnt2d& Center ,
|
||||
const gp_Pnt2d& Point ,
|
||||
const Standard_Boolean Sense )
|
||||
{
|
||||
TheCirc2d = gp_Circ2d(gp_Ax2d(Center,gp_Dir2d(1.0,0.0)),
|
||||
Point.Distance(Center),Sense);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// Creation d un cercle <TheCirc2d> concentrique a <Circ> passant par le +
|
||||
// point <Point1>. +
|
||||
//==========================================================================
|
||||
|
||||
gce_MakeCirc2d::gce_MakeCirc2d(const gp_Circ2d& Circ ,
|
||||
const gp_Pnt2d& Point )
|
||||
{
|
||||
TheCirc2d = gp_Circ2d(Circ.Axis(),Point.Distance(Circ.Location()));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// Creation d un cercle <TheCirc2d> concentrique a <Circ> a une distance +
|
||||
// <Dist1>. +
|
||||
//==========================================================================
|
||||
|
||||
gce_MakeCirc2d::gce_MakeCirc2d(const gp_Circ2d& Circ ,
|
||||
const Standard_Real Dist1 )
|
||||
{
|
||||
TheCirc2d = gp_Circ2d(Circ.Axis(),Abs(Circ.Radius()+Dist1));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
const gp_Circ2d& gce_MakeCirc2d::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheCirc2d;
|
||||
}
|
||||
|
||||
const gp_Circ2d& gce_MakeCirc2d::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeCirc2d::operator gp_Circ2d() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
|
147
src/gce/gce_MakeCone.cdl
Executable file
147
src/gce/gce_MakeCone.cdl
Executable file
@@ -0,0 +1,147 @@
|
||||
-- File: MakeCone.cdl
|
||||
-- Created: Wed Aug 26 14:30:57 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeCone from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create a Cone from gp.
|
||||
-- * Create a Cone coaxial to another and passing
|
||||
-- through a point.
|
||||
-- * Create a Cone coaxial to another at a distance
|
||||
-- <Dist>.
|
||||
-- * Create a Cone by 4 points.
|
||||
-- * Create a Cone by its axis and 2 points.
|
||||
-- * Create a Cone by 2 points and 2 radius.
|
||||
-- * Create a Cone by an Ax2 an angle and the radius of
|
||||
-- its reference section.
|
||||
|
||||
uses Pnt from gp,
|
||||
Ax1 from gp,
|
||||
Lin from gp,
|
||||
Cone from gp,
|
||||
Ax2 from gp,
|
||||
Real from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A2 : Ax2 from gp ;
|
||||
Ang : Real from Standard ;
|
||||
Radius : Real from Standard ) returns MakeCone;
|
||||
--- Purpose :
|
||||
-- Creates an infinite conical surface. A2 locates the cone
|
||||
-- in the space and defines the reference plane of the surface.
|
||||
-- Ang is the conical surface semi-angle between 0 and PI/2 radians.
|
||||
-- Radius is the radius of the circle in the reference plane of
|
||||
-- the cone.
|
||||
-- If Radius is lower than 0.0 the status is "
|
||||
-- If Ang < Resolution from gp or Ang >= (PI/2) - Resolution.
|
||||
|
||||
Create(Cone : Cone from gp;
|
||||
Point : Pnt from gp) returns MakeCone;
|
||||
---Purpose : Makes a Cone from gp <TheCone> coaxial to another
|
||||
-- Cone <Cone> and passing through a Pnt <Point>.
|
||||
|
||||
Create(Cone : Cone from gp ;
|
||||
Dist : Real from Standard) returns MakeCone;
|
||||
---Purpose : Makes a Cone from gp <TheCone> coaxial to another
|
||||
-- Cone <Cone> at the distance <Dist> which can
|
||||
-- be greater or lower than zero.
|
||||
|
||||
Create(P1 : Pnt from gp;
|
||||
P2 : Pnt from gp;
|
||||
P3 : Pnt from gp;
|
||||
P4 : Pnt from gp) returns MakeCone;
|
||||
---Purpose : Makes a Cone from gp <TheCone> by four points <P1>,
|
||||
-- <P2>,<P3> and <P4>.
|
||||
-- Its axis is <P1P2> and the radius of its base is
|
||||
-- the distance between <P3> and <P1P2>.
|
||||
-- The distance between <P4> and <P1P2> is the radius of
|
||||
-- the section passing through <P4>.
|
||||
-- If <P1> and <P2> are confused or <P3> and <P4> are
|
||||
-- confused we have the status "ConfusedPoints"
|
||||
-- if <P1>,<P2>,<P3>,<P4> are colinear we have the
|
||||
-- status "ColinearPoints"
|
||||
-- If <P3P4> is perpendicular to <P1P2> we have the
|
||||
-- status "NullAngle".
|
||||
-- <P3P4> is colinear to <P1P2> we have the status
|
||||
-- "NullAngle".
|
||||
|
||||
Create(Axis : Ax1 from gp;
|
||||
P1,P2 : Pnt from gp) returns MakeCone;
|
||||
---Purpose: Makes a Cone by its axis <Axis> and and two points.
|
||||
-- The distance between <P1> and the axis is the radius
|
||||
-- of the section passing through <P1>.
|
||||
-- The distance between <P2> and the axis is the radius
|
||||
-- of the section passing through <P2>.
|
||||
-- If <P1P2> is colinear to <Axis> we have the status
|
||||
-- "NullAngle"
|
||||
-- If <P3P4> is perpendicular to <Axis> we have the status
|
||||
-- "NullAngle"
|
||||
-- If <P1> and <P2> are confused we have the status
|
||||
-- "ConfusedPoints"
|
||||
|
||||
Create(Axis : Lin from gp;
|
||||
P1,P2 : Pnt from gp) returns MakeCone;
|
||||
---Purpose: Makes a Cone by its axis <Axis> and and two points.
|
||||
-- The distance between <P1> and the axis is the radius
|
||||
-- of the section passing through <P1>
|
||||
-- The distance between <P2> and the axis is the radius
|
||||
-- of the section passing through <P2>
|
||||
-- If <P1P2> is colinear to <Axis> we have the status
|
||||
-- "NullAngle"
|
||||
-- If <P3P4> is perpendicular to <Axis> we have the status
|
||||
-- "NullAngle"
|
||||
-- If <P1> and <P2> are confused we have the status
|
||||
-- "ConfusedPoints"
|
||||
|
||||
Create(P1 : Pnt from gp ;
|
||||
P2 : Pnt from gp ;
|
||||
R1 : Real from Standard;
|
||||
R2 : Real from Standard) returns MakeCone;
|
||||
---Purpose: Makes a Cone with two points and two radius.
|
||||
-- The axis of the solution is the line passing through
|
||||
-- <P1> and <P2>.
|
||||
-- <R1> is the radius of the section passing through <P1>
|
||||
-- and <R2> the radius of the section passing through <P2>.
|
||||
-- If <P1> and <P2> are confused we have the status "NullAxis".
|
||||
-- Warning
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_NegativeRadius if Radius, R1 or R2 is less than 0.0;
|
||||
-- - gce_BadAngle if Ang is less than
|
||||
-- gp::Resolution() or greater than Pi/2.- gp::Resolution();
|
||||
-- - gce_ConfusedPoints if P1 and P2 or P3 and P4 are coincident;
|
||||
-- - gce_NullAxis if the points P1 and P2, are coincident (5th syntax only);
|
||||
-- - gce_NullAngle if:
|
||||
-- - the vector joining P1 to P2 is parallel to either
|
||||
-- Axis or the line joining P3 to P4, or
|
||||
-- - R1 and R2 are equal, (that is, their difference is
|
||||
-- less than gp::Resolution()); or
|
||||
-- - gce_NullRadius if:
|
||||
-- - the vector joining P1 to P2 is perpendicular to the line joining P3 to P4,
|
||||
-- - the vector joining P1 to P2 is perpendicular to Axis, or
|
||||
-- - P1, P2, P3, and P4 are collinear.
|
||||
|
||||
Value(me) returns Cone from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed cone.
|
||||
-- Exceptions StdFail_NotDone if no cone is constructed.
|
||||
|
||||
Operator(me) returns Cone from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Cone() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheCone : Cone from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeCone;
|
203
src/gce/gce_MakeCone.cxx
Executable file
203
src/gce/gce_MakeCone.cxx
Executable file
@@ -0,0 +1,203 @@
|
||||
// File: gce_MakeCirc.cxx
|
||||
// Created: Wed Sep 2 10:34:28 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeCone.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Construction d un cone par son axe , le rayon de sa base et le demi +
|
||||
// angle d ouverture. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCone::gce_MakeCone(const gp_Ax2& A2 ,
|
||||
const Standard_Real Ang ,
|
||||
const Standard_Real Radius)
|
||||
{
|
||||
if (Radius < 0.0) { TheError = gce_NegativeRadius; }
|
||||
else {
|
||||
if (Ang <= gp::Resolution() || PI/2-Ang <= gp::Resolution()) {
|
||||
TheError = gce_BadAngle;
|
||||
}
|
||||
else {
|
||||
TheError = gce_Done;
|
||||
TheCone = gp_Cone(A2,Ang,Radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cone de gp par quatre points P1, P2, P3 et P4. +
|
||||
// P1 et P2 donnent l axe du cone, la distance de P3 a l axe donne +
|
||||
// le rayon de la base du cone et la distance de P4 a l axe donne le +
|
||||
// rayon du cone pour la section passant par P4. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCone::gce_MakeCone(const gp_Pnt& P1 ,
|
||||
const gp_Pnt& P2 ,
|
||||
const gp_Pnt& P3 ,
|
||||
const gp_Pnt& P4 )
|
||||
{
|
||||
if (P1.Distance(P2)<RealEpsilon() || P3.Distance(P4)<RealEpsilon()) { TheError = gce_ConfusedPoints; return; }
|
||||
|
||||
gp_Dir D1(P2.XYZ()-P1.XYZ());
|
||||
Standard_Real cos = D1.Dot(gp_Dir(P4.XYZ()-P1.XYZ()));
|
||||
Standard_Real dist = P1.Distance(P4);
|
||||
gp_Pnt PP4(P1.XYZ()+cos*dist*D1.XYZ());
|
||||
cos = D1.Dot(gp_Dir(P3.XYZ()-P1.XYZ()));
|
||||
dist = P1.Distance(P3);
|
||||
gp_Pnt PP3(P1.XYZ()+cos*dist*D1.XYZ());
|
||||
|
||||
Standard_Real Dist13 = PP3.Distance(P1);
|
||||
Standard_Real Dist14 = PP4.Distance(P1);
|
||||
if(Abs(Dist13-Dist14)<RealEpsilon()) { TheError = gce_NullAngle; return; }
|
||||
gp_Lin L1(P1,D1);
|
||||
Standard_Real Dist3 = L1.Distance(P3);
|
||||
Standard_Real Dist4 = L1.Distance(P4);
|
||||
Standard_Real DifRad = Dist3-Dist4;
|
||||
Standard_Real angle = Abs(ATan(DifRad/(Dist13-Dist14)));
|
||||
if(Abs(PI/2.-angle) < RealEpsilon() || Abs(angle) < RealEpsilon()) { TheError = gce_NullRadius; return; }
|
||||
Standard_Real R1 = PP3.Distance(P3);
|
||||
Standard_Real R2 = PP4.Distance(P4);
|
||||
if (R1 < 0.0 || R2 < 0.0) { TheError = gce_NegativeRadius; return; }
|
||||
gp_Dir DD1(PP4.XYZ()-PP3.XYZ());
|
||||
gp_Dir D2;
|
||||
Standard_Real x = DD1.X();
|
||||
Standard_Real y = DD1.Y();
|
||||
Standard_Real z = DD1.Z();
|
||||
if (Abs(x) > gp::Resolution()) { D2 = gp_Dir(-y,x,0.0); }
|
||||
else if (Abs(y) > gp::Resolution()) { D2 = gp_Dir(-y,x,0.0); }
|
||||
else if (Abs(z) > gp::Resolution()) { D2 = gp_Dir(0.0,-z,y); }
|
||||
if (R1 > R2) { angle *= -1; }
|
||||
TheCone = gp_Cone(gp_Ax2(PP3,DD1,D2),angle,R1);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cone de gp par son axe et deux points P1, P2. +
|
||||
// La distance de P1 a l axe donne le rayon de la base du cone et la +
|
||||
// distance de P2 a l axe donne le rayon du cone pour la section passant +
|
||||
// par P2. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCone::gce_MakeCone(const gp_Ax1& Axis ,
|
||||
const gp_Pnt& P1 ,
|
||||
const gp_Pnt& P2 )
|
||||
{
|
||||
gp_Pnt P3(Axis.Location());
|
||||
gp_Pnt P4(P3.XYZ()+Axis.Direction().XYZ());
|
||||
gce_MakeCone Cone(P3,P4,P1,P2);
|
||||
if (Cone.IsDone()) {
|
||||
TheCone = Cone.Value();
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else {
|
||||
TheError = Cone.Status();
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cone parallele a un autre cone passant par un +
|
||||
// donne. +
|
||||
//=========================================================================
|
||||
|
||||
//gce_MakeCone::gce_MakeCone(const gp_Cone& cone ,
|
||||
// const gp_Pnt& P )
|
||||
gce_MakeCone::gce_MakeCone(const gp_Cone& ,
|
||||
const gp_Pnt& )
|
||||
{
|
||||
TheError = gce_ConfusedPoints;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cone parallele a un autre cone a une distance +
|
||||
// donnee. +
|
||||
//=========================================================================
|
||||
|
||||
//gce_MakeCone::gce_MakeCone(const gp_Cone& cone ,
|
||||
// const Standard_Real Dist )
|
||||
gce_MakeCone::gce_MakeCone(const gp_Cone& ,
|
||||
const Standard_Real )
|
||||
{
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cone de gp par son axe et deux points P1, P2. +
|
||||
// La distance de P1 a l axe donne le rayon de la base du cone et la +
|
||||
// distance de P2 a l axe donne le rayon du cone pour la section passant +
|
||||
// par P2. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCone::gce_MakeCone(const gp_Lin& Axis ,
|
||||
const gp_Pnt& P1 ,
|
||||
const gp_Pnt& P2 )
|
||||
{
|
||||
gp_Pnt P3(Axis.Location());
|
||||
gp_Pnt P4(P3.XYZ()+Axis.Direction().XYZ());
|
||||
gce_MakeCone Cone(P3,P4,P1,P2);
|
||||
if (Cone.IsDone()) {
|
||||
TheCone = Cone.Value();
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else { TheError = Cone.Status(); }
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// cone par deux points (axe du cone.) et deux rayons (rayon des +
|
||||
// sections passant par chacun de ces points). +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCone::gce_MakeCone(const gp_Pnt& P1 ,
|
||||
const gp_Pnt& P2 ,
|
||||
const Standard_Real R1 ,
|
||||
const Standard_Real R2 )
|
||||
{
|
||||
Standard_Real dist = P1.Distance(P2);
|
||||
if (dist < RealEpsilon()) { TheError = gce_NullAxis; }
|
||||
else {
|
||||
if (R1 < 0.0 || R2 < 0.0) {
|
||||
TheError = gce_NegativeRadius;
|
||||
}
|
||||
else {
|
||||
Standard_Real Angle = Abs(atan((R1-R2)/dist));
|
||||
if (Abs(PI/2.-Angle)<RealEpsilon() || Abs(Angle)<RealEpsilon()) {
|
||||
TheError = gce_NullAngle;
|
||||
}
|
||||
else {
|
||||
gp_Dir D1(P2.XYZ()-P1.XYZ());
|
||||
gp_Dir D2;
|
||||
Standard_Real x = D1.X();
|
||||
Standard_Real y = D1.Y();
|
||||
Standard_Real z = D1.Z();
|
||||
if (Abs(x) > gp::Resolution()) { D2 = gp_Dir(-y,x,0.0); }
|
||||
else if (Abs(y) > gp::Resolution()) { D2 = gp_Dir(-y,x,0.0); }
|
||||
else if (Abs(z) > gp::Resolution()) { D2 = gp_Dir(0.0,-z,y); }
|
||||
if (R1 > R2) { Angle *= -1; }
|
||||
TheCone = gp_Cone(gp_Ax2(P1,D1,D2),Angle,R1);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Cone& gce_MakeCone::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheCone;
|
||||
}
|
||||
|
||||
const gp_Cone& gce_MakeCone::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeCone::operator gp_Cone() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
88
src/gce/gce_MakeCylinder.cdl
Executable file
88
src/gce/gce_MakeCylinder.cdl
Executable file
@@ -0,0 +1,88 @@
|
||||
-- File: MakeCylinder.cdl
|
||||
-- Created: Wed Aug 26 14:30:57 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeCylinder from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create a Cylinder from gp.
|
||||
-- * Create a Cylinder coaxial to another and passing
|
||||
-- through a point.
|
||||
-- * Create a Cylinder coaxial to another at a distance
|
||||
-- <Dist>.
|
||||
-- * Create a Cylinder with 3 points.
|
||||
-- * Create a Cylinder by its axis and radius.
|
||||
-- * Create a cylinder by its circular base.
|
||||
|
||||
uses Pnt from gp,
|
||||
Ax1 from gp,
|
||||
Ax2 from gp,
|
||||
Circ from gp,
|
||||
Cylinder from gp,
|
||||
Real from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A2 : Ax2 from gp ;
|
||||
Radius : Real from Standard) returns MakeCylinder;
|
||||
--- Purpose :<A2> is the local cartesian coordinate system of <me>.
|
||||
-- The status is "NegativeRadius" if R < 0.0
|
||||
|
||||
Create(Cyl : Cylinder from gp;
|
||||
Point : Pnt from gp) returns MakeCylinder;
|
||||
---Purpose : Makes a Cylinder from gp <TheCylinder> coaxial to another
|
||||
-- Cylinder <Cylinder> and passing through a Pnt <Point>.
|
||||
|
||||
Create(Cyl : Cylinder from gp ;
|
||||
Dist : Real from Standard) returns MakeCylinder;
|
||||
---Purpose : Makes a Cylinder from gp <TheCylinder> coaxial to another
|
||||
-- Cylinder <Cylinder> at the distance <Dist> which can
|
||||
-- be greater or lower than zero.
|
||||
-- The radius of the result is the absolute value of the
|
||||
-- radius of <Cyl> plus <Dist>
|
||||
|
||||
Create(P1 : Pnt from gp;
|
||||
P2 : Pnt from gp;
|
||||
P3 : Pnt from gp) returns MakeCylinder;
|
||||
---Purpose : Makes a Cylinder from gp <TheCylinder> with 3 points
|
||||
-- <P1>,<P2>,<P3>.
|
||||
-- Its axis is <P1P2> and its radius is the distance
|
||||
-- between <P3> and <P1P2>
|
||||
|
||||
Create(Axis : Ax1 from gp ;
|
||||
Radius : Real from Standard) returns MakeCylinder;
|
||||
---Purpose: Makes a Cylinder by its axis <Axis> and radius <Radius>.
|
||||
|
||||
Create(Circ : Circ from gp) returns MakeCylinder;
|
||||
---Purpose: Makes a Cylinder by its circular base.
|
||||
-- Warning
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_NegativeRadius if:
|
||||
-- - Radius is less than 0.0, or
|
||||
-- - Dist is negative and has an absolute value
|
||||
-- which is greater than the radius of Cyl; or
|
||||
-- - gce_ConfusedPoints if points P1 and P2 are coincident.
|
||||
|
||||
Value(me) returns Cylinder from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed cylinder.
|
||||
-- Exceptions StdFail_NotDone if no cylinder is constructed.
|
||||
|
||||
Operator(me) returns Cylinder from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Cylinder() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheCylinder : Cylinder from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeCylinder;
|
135
src/gce/gce_MakeCylinder.cxx
Executable file
135
src/gce/gce_MakeCylinder.cxx
Executable file
@@ -0,0 +1,135 @@
|
||||
// File: gce_MakeCylinder.cxx
|
||||
// Created: Wed Sep 2 10:34:28 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeCylinder.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cylindre de gp par son Ax2 A2 et son rayon +
|
||||
// Radius. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCylinder::gce_MakeCylinder(const gp_Ax2& A2 ,
|
||||
const Standard_Real Radius )
|
||||
{
|
||||
if (Radius < 0.0) { TheError = gce_NegativeRadius; }
|
||||
else {
|
||||
TheCylinder = gp_Cylinder(A2,Radius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cylindre de gp par son axe Axis et son rayon +
|
||||
// Radius. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCylinder::gce_MakeCylinder(const gp_Ax1& Axis ,
|
||||
const Standard_Real Radius )
|
||||
{
|
||||
if (Radius < 0.0) { TheError = gce_NegativeRadius; }
|
||||
else {
|
||||
gp_Dir D(Axis.Direction());
|
||||
gp_Dir Direc;
|
||||
Standard_Real x = D.X();
|
||||
Standard_Real y = D.Y();
|
||||
Standard_Real z = D.Z();
|
||||
if (Abs(x) > gp::Resolution()) { Direc = gp_Dir(-y,x,0.0); }
|
||||
else if (Abs(y) > gp::Resolution()) { Direc = gp_Dir(-y,x,0.0); }
|
||||
else if (Abs(z) > gp::Resolution()) { Direc = gp_Dir(0.0,-z,y); }
|
||||
TheCylinder = gp_Cylinder(gp_Ax2(Axis.Location(),D,Direc),Radius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cylindre de gp par un cercle. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCylinder::gce_MakeCylinder(const gp_Circ& Circ )
|
||||
{
|
||||
TheCylinder = gp_Cylinder(Circ.Position(),Circ.Radius());
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cylindre de gp par trois points P1, P2, P3. +
|
||||
// P1 et P2 donnent l axe du cylindre, la distance de P3 a l axe donne +
|
||||
// le rayon du cylindre. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCylinder::gce_MakeCylinder(const gp_Pnt& P1 ,
|
||||
const gp_Pnt& P2 ,
|
||||
const gp_Pnt& P3 )
|
||||
{
|
||||
if (P1.Distance(P2) < gp::Resolution()) { TheError = gce_ConfusedPoints; }
|
||||
else {
|
||||
gp_Dir D1(P2.XYZ()-P1.XYZ());
|
||||
gp_Dir D2;
|
||||
Standard_Real x = D1.X();
|
||||
Standard_Real y = D1.Y();
|
||||
Standard_Real z = D1.Z();
|
||||
if (Abs(x) > gp::Resolution()) { D2 = gp_Dir(-y,x,0.0); }
|
||||
else if (Abs(y) > gp::Resolution()) { D2 = gp_Dir(-y,x,0.0); }
|
||||
else if (Abs(z) > gp::Resolution()) { D2 = gp_Dir(0.0,-z,y); }
|
||||
TheCylinder = gp_Cylinder(gp_Ax2(P1,D1,D2 ),gp_Lin(P1,D1).Distance(P3));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cylindre de gp concentrique a un autre cylindre de +
|
||||
// gp a une distance Dist. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCylinder::gce_MakeCylinder(const gp_Cylinder& Cyl ,
|
||||
const Standard_Real Dist )
|
||||
{
|
||||
Standard_Real Rad = Cyl.Radius()+Dist;
|
||||
if (Rad < 0.) { TheError = gce_NegativeRadius; }
|
||||
else {
|
||||
TheCylinder = gp_Cylinder(Cyl);
|
||||
TheCylinder.SetRadius(Rad);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Constructions d un cylindre de gp concentrique a un autre cylindre de +
|
||||
// gp passant par le point P. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeCylinder::gce_MakeCylinder(const gp_Cylinder& Cyl ,
|
||||
const gp_Pnt& P )
|
||||
{
|
||||
gp_Lin L(Cyl.Axis());
|
||||
Standard_Real Rad = L.Distance(P);
|
||||
TheCylinder = gp_Cylinder(Cyl);
|
||||
TheCylinder.SetRadius(Rad);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
const gp_Cylinder& gce_MakeCylinder::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheCylinder;
|
||||
}
|
||||
|
||||
const gp_Cylinder& gce_MakeCylinder::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeCylinder::operator gp_Cylinder() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
73
src/gce/gce_MakeDir.cdl
Executable file
73
src/gce/gce_MakeDir.cdl
Executable file
@@ -0,0 +1,73 @@
|
||||
-- File: MakeDir.cdl
|
||||
-- Created: Wed Aug 26 14:30:57 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeDir from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create a Dir from gp.
|
||||
-- * Create a Dir parallel to another and passing
|
||||
-- through a point.
|
||||
-- * Create a Dir passing through 2 points.
|
||||
-- * Create a Dir from its axis (Ax1 from gp).
|
||||
-- * Create a Dir from a point and a direction.
|
||||
|
||||
uses Pnt from gp,
|
||||
Dir from gp,
|
||||
Vec from gp,
|
||||
XYZ from gp,
|
||||
Real from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (V : Vec) returns MakeDir;
|
||||
--- Purpose : Normalizes the vector V and creates a direction.
|
||||
-- Status is "NullVector" if V.Magnitude() <= Resolution.
|
||||
|
||||
Create (Coord : XYZ) returns MakeDir;
|
||||
--- Purpose : Creates a direction from a triplet of coordinates.
|
||||
-- Status is "NullVector" if Coord.Modulus() <=
|
||||
-- Resolution from gp.
|
||||
|
||||
Create ( Xv, Yv, Zv : Real) returns MakeDir;
|
||||
--- Purpose : Creates a direction with its 3 cartesian coordinates.
|
||||
-- Status is "NullVector" if Sqrt(Xv*Xv + Yv*Yv + Zv*Zv)
|
||||
-- <= Resolution
|
||||
|
||||
Create(P1 : Pnt from gp;
|
||||
P2 : Pnt from gp) returns MakeDir;
|
||||
---Purpose : Make a Dir from gp <TheDir> passing through 2
|
||||
-- Pnt <P1>,<P2>.
|
||||
-- Status is "ConfusedPoints" if <p1> and <P2> are confused.
|
||||
-- Warning
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_ConfusedPoints if points P1 and P2 are coincident, or
|
||||
-- - gce_NullVector if one of the following is less
|
||||
-- than or equal to gp::Resolution():
|
||||
-- - the magnitude of vector V,
|
||||
-- - the modulus of Coord,
|
||||
-- - Sqrt(Xv*Xv + Yv*Yv + Zv*Zv).
|
||||
|
||||
Value(me) returns Dir from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed unit vector.
|
||||
-- Exceptions StdFail_NotDone if no unit vector is constructed.
|
||||
|
||||
Operator(me) returns Dir from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Dir() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheDir : Dir from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeDir;
|
68
src/gce/gce_MakeDir.cxx
Executable file
68
src/gce/gce_MakeDir.cxx
Executable file
@@ -0,0 +1,68 @@
|
||||
// File: gce_MakeDir.cxx
|
||||
// Created: Wed Sep 2 11:35:00 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeDir.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une direction 3d (Dir) de gp a partir de 2 Pnt de gp. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeDir::gce_MakeDir(const gp_Pnt& P1,
|
||||
const gp_Pnt& P2)
|
||||
{
|
||||
if (P1.Distance(P2) <= gp::Resolution()) { TheError = gce_ConfusedPoints; }
|
||||
else {
|
||||
TheDir = gp_Dir(P2.XYZ()-P1.XYZ());
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeDir::gce_MakeDir(const gp_XYZ& Coord)
|
||||
{
|
||||
if (Coord.Modulus() <= gp::Resolution()) { TheError = gce_NullVector; }
|
||||
else {
|
||||
TheDir = gp_Dir(Coord);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeDir::gce_MakeDir(const gp_Vec& V)
|
||||
{
|
||||
if (V.Magnitude() <= gp::Resolution()) { TheError = gce_NullVector; }
|
||||
else {
|
||||
TheDir = gp_Dir(V);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeDir::gce_MakeDir(const Standard_Real Xv,
|
||||
const Standard_Real Yv,
|
||||
const Standard_Real Zv)
|
||||
{
|
||||
if (Xv*Xv+Yv*Yv+Zv*Zv <= gp::Resolution()) { TheError = gce_NullVector; }
|
||||
else {
|
||||
TheDir = gp_Dir(Xv,Yv,Zv);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Dir& gce_MakeDir::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheDir;
|
||||
}
|
||||
|
||||
const gp_Dir& gce_MakeDir::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeDir::operator gp_Dir() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
72
src/gce/gce_MakeDir2d.cdl
Executable file
72
src/gce/gce_MakeDir2d.cdl
Executable file
@@ -0,0 +1,72 @@
|
||||
-- File: MakeDir2d.cdl
|
||||
-- Created: Wed Aug 26 14:30:57 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeDir2d from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create a Dir2d from gp.
|
||||
-- * Create a Dir2d with 2 points.
|
||||
-- * Create a Dir2d with a Vec2d.
|
||||
-- * Create a Dir2d with a XY from gp.
|
||||
-- * Create a Dir2d with a 2 Reals (Coordinates).
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Vec2d from gp,
|
||||
Dir2d from gp,
|
||||
XY from gp,
|
||||
Real from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (V : Vec2d from gp) returns MakeDir2d;
|
||||
--- Purpose : Normalizes the vector V and creates a direction.
|
||||
-- Status is "NullVector" if V.Magnitude() <= Resolution.
|
||||
|
||||
Create (Coord : XY from gp) returns MakeDir2d;
|
||||
--- Purpose : Creates a direction from a triplet of coordinates.
|
||||
-- Status is "NullVector" if Coord.Modulus() <=
|
||||
-- Resolution from gp.
|
||||
|
||||
Create ( Xv, Yv : Real from Standard) returns MakeDir2d;
|
||||
--- Purpose : Creates a direction with its 3 cartesian coordinates.
|
||||
-- Status is "NullVector" if Sqrt(Xv*Xv + Yv*Yv )
|
||||
-- <= Resolution
|
||||
|
||||
Create(P1 : Pnt2d from gp;
|
||||
P2 : Pnt2d from gp) returns MakeDir2d;
|
||||
---Purpose : Make a Dir2d from gp <TheDir> passing through 2
|
||||
-- Pnt <P1>,<P2>.
|
||||
-- Status is "ConfusedPoints" if <P1> and <P2> are confused.
|
||||
-- Warning
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_ConfusedPoints if points P1 and P2 are coincident, or
|
||||
-- - gce_NullVector if one of the following is less
|
||||
-- than or equal to gp::Resolution():
|
||||
-- - the magnitude of vector V,
|
||||
-- - the modulus of Coord,
|
||||
-- - Sqrt(Xv*Xv + Yv*Yv).
|
||||
|
||||
Value(me) returns Dir2d from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed unit vector.
|
||||
-- Exceptions StdFail_NotDone if no unit vector is constructed.
|
||||
|
||||
Operator(me) returns Dir2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Dir2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheDir2d : Dir2d from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeDir2d;
|
67
src/gce/gce_MakeDir2d.cxx
Executable file
67
src/gce/gce_MakeDir2d.cxx
Executable file
@@ -0,0 +1,67 @@
|
||||
// File: gce_MakeDir2d.cxx
|
||||
// Created: Wed Sep 2 11:35:00 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeDir2d.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une direction 2d (Dir2d) de gp a partir de 2 Pnt2d de gp. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeDir2d::gce_MakeDir2d(const gp_Pnt2d& P1,
|
||||
const gp_Pnt2d& P2)
|
||||
{
|
||||
if (P1.Distance(P2) <= gp::Resolution()) { TheError = gce_ConfusedPoints; }
|
||||
else {
|
||||
TheDir2d = gp_Dir2d(P2.XY()-P1.XY());
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeDir2d::gce_MakeDir2d(const gp_XY& Coord)
|
||||
{
|
||||
if (Coord.Modulus() <= gp::Resolution()) { TheError = gce_NullVector; }
|
||||
else {
|
||||
TheDir2d = gp_Dir2d(Coord);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeDir2d::gce_MakeDir2d(const gp_Vec2d& V)
|
||||
{
|
||||
if (V.Magnitude() <= gp::Resolution()) { TheError = gce_NullVector; }
|
||||
else {
|
||||
TheDir2d = gp_Dir2d(V);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeDir2d::gce_MakeDir2d(const Standard_Real Xv,
|
||||
const Standard_Real Yv)
|
||||
{
|
||||
if (Xv*Xv+Yv*Yv <= gp::Resolution()) { TheError = gce_NullVector; }
|
||||
else {
|
||||
TheDir2d = gp_Dir2d(Xv,Yv);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Dir2d& gce_MakeDir2d::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheDir2d;
|
||||
}
|
||||
|
||||
const gp_Dir2d& gce_MakeDir2d::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeDir2d::operator gp_Dir2d() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
73
src/gce/gce_MakeElips.cdl
Executable file
73
src/gce/gce_MakeElips.cdl
Executable file
@@ -0,0 +1,73 @@
|
||||
-- File: MakeElips.cdl
|
||||
-- Created: Wed Aug 26 14:31:40 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeElips from gce inherits Root from gce
|
||||
|
||||
---Purpose :This class implements the following algorithms used to
|
||||
-- create an ellipse from gp.
|
||||
--
|
||||
-- * Create an ellipse from its center, and two points:
|
||||
-- one on the ciconference giving the major radius, the
|
||||
-- other giving the value of the small radius.
|
||||
|
||||
uses Pnt from gp,
|
||||
Ax2 from gp,
|
||||
Elips from gp
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A2 : Ax2 from gp;
|
||||
MajorRadius, MinorRadius : Real from Standard)
|
||||
returns MakeElips;
|
||||
--- Purpose :The major radius of the ellipse is on the "XAxis" and the
|
||||
-- minor radius is on the "YAxis" of the ellipse. The "XAxis"
|
||||
-- is defined with the "XDirection" of A2 and the "YAxis" is
|
||||
-- defined with the "YDirection" of A2.
|
||||
-- Warnings :
|
||||
-- It is not forbidden to create an ellipse with
|
||||
-- MajorRadius = MinorRadius.
|
||||
|
||||
Create(S1,S2 : Pnt from gp;
|
||||
Center : Pnt from gp) returns MakeElips;
|
||||
---Purpose: Make an ellipse with its center and two points.
|
||||
-- Warning
|
||||
-- The MakeElips class does not prevent the
|
||||
-- construction of an ellipse where the MajorRadius is
|
||||
-- equal to the MinorRadius.
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_InvertRadius if MajorRadius is less than MinorRadius;
|
||||
-- - gce_NegativeRadius if MinorRadius is less than 0.0;
|
||||
-- - gce_NullAxis if the points S1 and Center are coincident; or
|
||||
-- - gce_InvertAxis if:
|
||||
-- - the major radius computed with Center and S1
|
||||
-- is less than the minor radius computed with Center, S1 and S2, or
|
||||
-- - Center, S1 and S2 are collinear.
|
||||
|
||||
Value(me) returns Elips from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed ellipse.
|
||||
-- Exceptions StdFail_NotDone if no ellipse is constructed.
|
||||
|
||||
Operator(me) returns Elips from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Elips() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheElips : Elips from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeElips;
|
||||
|
||||
|
||||
|
||||
|
67
src/gce/gce_MakeElips.cxx
Executable file
67
src/gce/gce_MakeElips.cxx
Executable file
@@ -0,0 +1,67 @@
|
||||
// File: gce_MakeElips.cxx
|
||||
// Created: Wed Sep 2 12:35:36 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeElips.ixx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une Ellipse 3d de gp a partir de son Ax2 et de son +
|
||||
// grand rayon <MajorRadius> et son petit rayon <MinorRadius>. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeElips::gce_MakeElips(const gp_Ax2& A2 ,
|
||||
const Standard_Real MajorRadius ,
|
||||
const Standard_Real MinorRadius )
|
||||
{
|
||||
if (MajorRadius < MinorRadius ) { TheError = gce_InvertRadius;}
|
||||
else if (MinorRadius < 0.0) { TheError = gce_NegativeRadius; }
|
||||
else {
|
||||
TheElips = gp_Elips(A2,MajorRadius,MinorRadius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une Ellipse 3d de gp de centre <Center> et de sommets +
|
||||
// <S1> et <S2>. +
|
||||
// <S1> donne le grand rayon et <S2> le petit rayon. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeElips::gce_MakeElips(const gp_Pnt& S1 ,
|
||||
const gp_Pnt& S2 ,
|
||||
const gp_Pnt& Center )
|
||||
{
|
||||
Standard_Real D1 = S1.Distance(Center);
|
||||
if (D1 < gp::Resolution()) { TheError = gce_NullAxis; }
|
||||
else {
|
||||
gp_Dir XAxis(gp_XYZ(S1.XYZ()-Center.XYZ()));
|
||||
Standard_Real D2 = gp_Lin(Center,XAxis).Distance(S2);
|
||||
if (D1 < D2 || D2 < gp::Resolution()) { TheError = gce_InvertAxis; }
|
||||
else {
|
||||
gp_Dir Norm(XAxis.Crossed(gp_Dir(gp_XYZ(S2.XYZ()-Center.XYZ()))));
|
||||
TheElips = gp_Elips(gp_Ax2(Center,Norm,XAxis),D1,D2);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Elips& gce_MakeElips::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheElips;
|
||||
}
|
||||
|
||||
const gp_Elips& gce_MakeElips::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeElips::operator gp_Elips() const
|
||||
{
|
||||
return Value();
|
||||
}
|
97
src/gce/gce_MakeElips2d.cdl
Executable file
97
src/gce/gce_MakeElips2d.cdl
Executable file
@@ -0,0 +1,97 @@
|
||||
-- File: MakeElips2d.cdl
|
||||
-- Created: Wed Aug 26 14:31:40 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeElips2d from gce inherits Root from gce
|
||||
|
||||
---Purpose :This class implements the following algorithms used to
|
||||
-- create Elips2d from gp.
|
||||
--
|
||||
-- * Create an ellipse from its center, and two points:
|
||||
-- one on the ciconference giving the major radius, the
|
||||
-- other giving the value of the small radius.
|
||||
-- * Create an ellipse from its major axis and its major
|
||||
-- radius and its minor radius.
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Ax2d from gp,
|
||||
Ax22d from gp,
|
||||
Elips2d from gp
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (MajorAxis : Ax2d from gp ;
|
||||
MajorRadius, MinorRadius : Real from Standard ;
|
||||
Sense : Boolean from Standard = Standard_True)
|
||||
returns MakeElips2d;
|
||||
--- Purpose :
|
||||
-- Creates an ellipse with the major axis, the major and the
|
||||
-- minor radius. The location of the MajorAxis is the center
|
||||
-- of the ellipse.
|
||||
-- The sense of parametrization is given by Sense.
|
||||
-- It is possible to create an ellipse with MajorRadius = MinorRadius.
|
||||
-- the status is "InvertRadius" if MajorRadius < MinorRadius or
|
||||
-- "NegativeRadius" if MinorRadius < 0.0
|
||||
|
||||
Create (A : Ax22d from gp ;
|
||||
MajorRadius, MinorRadius : Real from Standard )
|
||||
returns MakeElips2d;
|
||||
--- Purpose :
|
||||
-- Axis defines the Xaxis and Yaxis of the ellipse which defines
|
||||
-- the origin and the sense of parametrization.
|
||||
-- Creates an ellipse with the AxisPlacement the major and the
|
||||
-- minor radius. The location of Axis is the center
|
||||
-- of the ellipse.
|
||||
-- It is possible to create an ellipse with MajorRadius = MinorRadius.
|
||||
-- the status is "InvertRadius" if MajorRadius < MinorRadius or
|
||||
-- "NegativeRadius" if MinorRadius < 0.0
|
||||
|
||||
Create(S1,S2 : Pnt2d from gp;
|
||||
Center : Pnt2d from gp) returns MakeElips2d;
|
||||
---Purpose: Makes an Elips2d with its center and two points.
|
||||
-- The sense of parametrization is given by S1, S2,
|
||||
-- and Center.
|
||||
-- Depending on the constructor, the implicit orientation of the ellipse is:
|
||||
-- - the sense defined by A,
|
||||
-- - the sense defined by points Center, S1 and S2,
|
||||
-- - the trigonometric sense if Sense is not given or is true, or
|
||||
-- - the opposite if Sense is false.
|
||||
-- It is possible to construct an ellipse where the major
|
||||
-- and minor radii are equal.
|
||||
-- Warning
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_InvertRadius if MajorRadius is less than MinorRadius,
|
||||
-- - gce_NegativeRadius if MajorRadius or
|
||||
-- MinorRadius is less than 0.0,
|
||||
-- - gce_NullAxis if points S1, S2 and Center are collinear, or
|
||||
-- - gce_InvertAxis if the major radius computed with
|
||||
-- Center and S1 is less than the minor radius
|
||||
-- computed with Center, S1 and S2.
|
||||
|
||||
Value(me) returns Elips2d from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed ellipse.
|
||||
-- Exceptions StdFail_NotDone if no ellipse is constructed.
|
||||
|
||||
Operator(me) returns Elips2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Elips2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheElips2d : Elips2d from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeElips2d;
|
||||
|
||||
|
||||
|
||||
|
74
src/gce/gce_MakeElips2d.cxx
Executable file
74
src/gce/gce_MakeElips2d.cxx
Executable file
@@ -0,0 +1,74 @@
|
||||
// File: gce_MakeElips2d.cxx
|
||||
// Created: Wed Sep 2 12:35:36 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeElips2d.ixx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une Ellipse 2d de gp de centre <Center> et de sommets +
|
||||
// <S1> et <S2>. +
|
||||
// <CenterS1> donne le grand axe . +
|
||||
// <S1> donne le grand rayon et <S2> le petit rayon. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeElips2d::gce_MakeElips2d(const gp_Pnt2d& S1 ,
|
||||
const gp_Pnt2d& S2 ,
|
||||
const gp_Pnt2d& Center )
|
||||
{
|
||||
Standard_Real D1 = S1.Distance(Center);
|
||||
gp_Dir2d XAxis(gp_XY(S1.XY()-Center.XY()));
|
||||
gp_Dir2d YAxis(gp_XY(S2.XY()-Center.XY()));
|
||||
Standard_Real D2 = gp_Lin2d(Center,XAxis).Distance(S2);
|
||||
if (D1 < D2) { TheError = gce_InvertAxis; }
|
||||
else if (D2 < gp::Resolution()) { TheError = gce_NullAxis; }
|
||||
else {
|
||||
TheElips2d = gp_Elips2d(gp_Ax22d(Center,XAxis,YAxis),D1,D2);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeElips2d::gce_MakeElips2d(const gp_Ax2d& MajorAxis ,
|
||||
const Standard_Real MajorRadius ,
|
||||
const Standard_Real MinorRadius ,
|
||||
const Standard_Boolean Sense )
|
||||
{
|
||||
if (MajorRadius < 0.0) { TheError = gce_NegativeRadius; }
|
||||
else if (MajorRadius < MinorRadius) { TheError = gce_InvertRadius; }
|
||||
else {
|
||||
TheElips2d = gp_Elips2d(MajorAxis,MajorRadius,MinorRadius,Sense);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeElips2d::gce_MakeElips2d(const gp_Ax22d& A ,
|
||||
const Standard_Real MajorRadius ,
|
||||
const Standard_Real MinorRadius )
|
||||
{
|
||||
if (MajorRadius < 0.0) { TheError = gce_NegativeRadius; }
|
||||
else if (MajorRadius < MinorRadius) { TheError = gce_InvertRadius; }
|
||||
else {
|
||||
TheElips2d = gp_Elips2d(A,MajorRadius,MinorRadius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Elips2d& gce_MakeElips2d::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheElips2d;
|
||||
}
|
||||
|
||||
const gp_Elips2d& gce_MakeElips2d::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeElips2d::operator gp_Elips2d() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
110
src/gce/gce_MakeHypr.cdl
Executable file
110
src/gce/gce_MakeHypr.cdl
Executable file
@@ -0,0 +1,110 @@
|
||||
-- File: MakeHypr.cdl
|
||||
-- Created: Wed Aug 26 14:31:28 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeHypr from gce inherits Root from gce
|
||||
|
||||
---Purpose :This class implements the following algorithms used to
|
||||
-- create Hyperbola from gp.
|
||||
-- * Create an Hyperbola from its center, and two points:
|
||||
-- one on its axis of symmetry giving the major radius, the
|
||||
-- other giving the value of the small radius.
|
||||
-- The three points give the plane of the hyperbola.
|
||||
-- * Create an hyperbola from its axisplacement and its
|
||||
-- MajorRadius and its MinorRadius.
|
||||
--
|
||||
--
|
||||
-- ^YAxis
|
||||
-- |
|
||||
-- FirstConjugateBranch
|
||||
-- |
|
||||
-- Other | Main
|
||||
-- --------------------- C ------------------------------>XAxis
|
||||
-- Branch | Branch
|
||||
-- |
|
||||
-- |
|
||||
-- SecondConjugateBranch
|
||||
-- |
|
||||
--
|
||||
-- The local cartesian coordinate system of the ellipse is an
|
||||
-- axis placement (two axis).
|
||||
--
|
||||
-- The "XDirection" and the "YDirection" of the axis placement
|
||||
-- define the plane of the hyperbola.
|
||||
--
|
||||
-- The "Direction" of the axis placement defines the normal axis
|
||||
-- to the hyperbola's plane.
|
||||
--
|
||||
-- The "XAxis" of the hyperbola ("Location", "XDirection") is the
|
||||
-- major axis and the "YAxis" of the hyperbola ("Location",
|
||||
-- "YDirection") is the minor axis.
|
||||
--
|
||||
-- Warnings :
|
||||
-- The major radius (on the major axis) can be lower than the
|
||||
-- minor radius (on the minor axis).
|
||||
|
||||
|
||||
uses Pnt from gp,
|
||||
Hypr from gp,
|
||||
Ax2 from gp
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A2 : Ax2 from gp ;
|
||||
MajorRadius, MinorRadius : Real from Standard ) returns MakeHypr;
|
||||
--- Purpose :
|
||||
-- A2 is the local coordinate system of the hyperbola.
|
||||
-- In the local coordinates system A2 the equation of the
|
||||
-- hyperbola is :
|
||||
-- X*X / MajorRadius*MajorRadius - Y*Y / MinorRadius*MinorRadius = 1.0
|
||||
-- It is not forbidden to create an Hyperbola with MajorRadius =
|
||||
-- MinorRadius.
|
||||
-- For the hyperbola the MajorRadius can be lower than the
|
||||
-- MinorRadius.
|
||||
-- The status is "NegativeRadius" if MajorRadius < 0.0 and
|
||||
-- "InvertRadius" if MinorRadius > MajorRadius.
|
||||
|
||||
Create(S1,S2 : Pnt from gp;
|
||||
Center : Pnt from gp) returns MakeHypr;
|
||||
---Purpose: Constructs a hyperbola
|
||||
-- - centered on the point Center, where:
|
||||
-- - the plane of the hyperbola is defined by Center, S1 and S2,
|
||||
-- - its major axis is defined by Center and S1,
|
||||
-- - its major radius is the distance between Center and S1, and
|
||||
-- - its minor radius is the distance between S2 and the major axis.
|
||||
-- Warning
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_NegativeRadius if MajorRadius is less than 0.0;
|
||||
-- - gce_InvertRadius if:
|
||||
-- - the major radius (computed with Center, S1) is
|
||||
-- less than the minor radius (computed with Center, S1 and S2), or
|
||||
-- - MajorRadius is less than MinorRadius; or
|
||||
-- - gce_ColinearPoints if S1, S2 and Center are collinear.
|
||||
|
||||
Value(me) returns Hypr from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed hyperbola.
|
||||
-- Exceptions StdFail_NotDone if no hyperbola is constructed.
|
||||
|
||||
Operator(me) returns Hypr from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++ : alias "Standard_EXPORT operator gp_Hypr() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheHypr : Hypr from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeHypr;
|
||||
|
||||
|
||||
|
||||
|
60
src/gce/gce_MakeHypr.cxx
Executable file
60
src/gce/gce_MakeHypr.cxx
Executable file
@@ -0,0 +1,60 @@
|
||||
// File: gce_MakeElips.cxx
|
||||
// Created: Wed Sep 2 12:35:36 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeHypr.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une Hyperbole 3d de gp de centre <Center> et de sommets +
|
||||
// <S1> et <S2>. +
|
||||
// <CenterS1> donne le grand axe . +
|
||||
// <S1> donne le grand rayon et <S2> le petit rayon. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeHypr::gce_MakeHypr(const gp_Pnt& S1 ,
|
||||
const gp_Pnt& S2 ,
|
||||
const gp_Pnt& Center )
|
||||
{
|
||||
gp_Dir XAxis(gp_XYZ(S1.XYZ()-Center.XYZ()));
|
||||
gp_Lin L(Center,XAxis);
|
||||
Standard_Real D = S1.Distance(Center);
|
||||
Standard_Real d = L.Distance(S2);
|
||||
if (d > D) { TheError = gce_InvertAxis; }
|
||||
else {
|
||||
gp_Dir Norm(XAxis.Crossed(gp_Dir(gp_XYZ(S2.XYZ()-Center.XYZ()))));
|
||||
TheHypr = gp_Hypr(gp_Ax2(Center,Norm,XAxis),D,d);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeHypr::gce_MakeHypr(const gp_Ax2& A2 ,
|
||||
const Standard_Real MajorRadius ,
|
||||
const Standard_Real MinorRadius )
|
||||
{
|
||||
if (MajorRadius < MinorRadius) { TheError = gce_InvertRadius; }
|
||||
else if (MajorRadius < 0.0) { TheError = gce_NegativeRadius; }
|
||||
else {
|
||||
TheHypr = gp_Hypr(A2,MajorRadius,MinorRadius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Hypr& gce_MakeHypr::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheHypr;
|
||||
}
|
||||
|
||||
const gp_Hypr& gce_MakeHypr::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeHypr::operator gp_Hypr() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
105
src/gce/gce_MakeHypr2d.cdl
Executable file
105
src/gce/gce_MakeHypr2d.cdl
Executable file
@@ -0,0 +1,105 @@
|
||||
-- File: MakeHypr2d.cdl
|
||||
-- Created: Wed Aug 26 14:31:28 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeHypr2d from gce inherits Root from gce
|
||||
|
||||
---Purpose :This class implements the following algorithms used to
|
||||
-- create a 2d Hyperbola from gp.
|
||||
-- * Create a 2d Hyperbola from its center and two points:
|
||||
-- one on its axis of symmetry giving the major radius, the
|
||||
-- other giving the value of the small radius.
|
||||
-- * Create a 2d Hyperbola from its major axis and its major
|
||||
-- radius and its minor radius.
|
||||
--
|
||||
--
|
||||
-- ^YAxis
|
||||
-- |
|
||||
-- FirstConjugateBranch
|
||||
-- |
|
||||
-- Other | Main
|
||||
-- --------------------- C ------------------------------>XAxis
|
||||
-- Branch | Branch
|
||||
-- |
|
||||
-- |
|
||||
-- SecondConjugateBranch
|
||||
-- |
|
||||
--
|
||||
-- An axis placement (one axis) is associated with the hyperbola.
|
||||
-- This axis is the "XAxis" or major axis of the hyperbola. It is
|
||||
-- the symmetry axis of the main branch of hyperbola.
|
||||
-- The "YAxis" is normal to this axis and pass throught its location
|
||||
-- point. It is the minor axis.
|
||||
--
|
||||
-- The major radius is the distance between the Location point
|
||||
-- of the hyperbola C and the vertex of the Main Branch (or the
|
||||
-- Other branch). The minor radius is the distance between the
|
||||
-- Location point of the hyperbola C and the vertex of the First
|
||||
-- (or Second) Conjugate branch.
|
||||
-- The major radius can be lower than the minor radius.
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Ax2d from gp,
|
||||
Ax22d from gp,
|
||||
Hypr2d from gp,
|
||||
Boolean from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create(S1,S2 : Pnt2d from gp;
|
||||
Center : Pnt2d from gp) returns MakeHypr2d;
|
||||
---Purpose: Constructs a hyperbola
|
||||
-- centered on the point Center, where:
|
||||
-- - the major axis of the hyperbola is defined by Center and point S1,
|
||||
-- - the major radius is the distance between Center and S1, and
|
||||
-- - the minor radius is the distance between point S2 and the major axis.
|
||||
|
||||
Create (MajorAxis : Ax2d from gp ;
|
||||
MajorRadius : Real from Standard;
|
||||
MinorRadius : Real from Standard;
|
||||
Sense : Boolean from Standard) returns MakeHypr2d;
|
||||
--- Purpose : Constructs a hyperbola with major and minor radii MajorRadius and
|
||||
-- MinorRadius, where:
|
||||
-- - the center of the hyperbola is the origin of the axis MajorAxis, and
|
||||
-- - the major axis is defined by MajorAxis if Sense
|
||||
-- is true, or the opposite axis to MajorAxis if Sense is false; or
|
||||
-- - centered on the origin of the coordinate system
|
||||
-- A, with major and minor radii MajorRadius and
|
||||
-- MinorRadius, where its major axis is the "X Axis"
|
||||
-- of A (A is the local coordinate system of the hyperbola).
|
||||
|
||||
Create (A : Ax22d from gp ;
|
||||
MajorRadius : Real from Standard;
|
||||
MinorRadius : Real from Standard) returns MakeHypr2d;
|
||||
--- Purpose :Creates a Hypr2d centered on the origin of the coordinate system
|
||||
-- A, with major and minor radii MajorRadius and
|
||||
-- MinorRadius, where its major axis is the "X Axis"
|
||||
-- of A (A is the local coordinate system of the hyperbola).
|
||||
|
||||
|
||||
Value(me) returns Hypr2d from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed hyperbola.
|
||||
-- Exceptions StdFail_NotDone if no hyperbola is constructed.
|
||||
|
||||
Operator(me) returns Hypr2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++ : alias "Standard_EXPORT operator gp_Hypr2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheHypr2d : Hypr2d from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeHypr2d;
|
||||
|
||||
|
||||
|
||||
|
72
src/gce/gce_MakeHypr2d.cxx
Executable file
72
src/gce/gce_MakeHypr2d.cxx
Executable file
@@ -0,0 +1,72 @@
|
||||
// File: gce_MakeHypr2d.cxx
|
||||
// Created: Wed Sep 2 12:35:36 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeHypr2d.ixx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une Hyperbola 2d de gp de centre <Center> et de sommets +
|
||||
// <S1> et <S2>. +
|
||||
// <CenterS1> donne le grand axe . +
|
||||
// <S1> donne le grand rayon et <S2> le petit rayon. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeHypr2d::gce_MakeHypr2d(const gp_Pnt2d& S1 ,
|
||||
const gp_Pnt2d& S2 ,
|
||||
const gp_Pnt2d& Center )
|
||||
{
|
||||
gp_Dir2d XAxis(gp_XY(S1.XY()-Center.XY()));
|
||||
gp_Dir2d YAxis(gp_XY(S2.XY()-Center.XY()));
|
||||
gp_Ax22d Axis(Center,XAxis,YAxis);
|
||||
gp_Lin2d L(Center,XAxis);
|
||||
Standard_Real D1 = S1.Distance(Center);
|
||||
Standard_Real D2 = L.Distance(S2);
|
||||
if (D1 >= D2) {
|
||||
TheHypr2d = gp_Hypr2d(Axis,D1,D2);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else { TheError = gce_InvertAxis; }
|
||||
}
|
||||
|
||||
gce_MakeHypr2d::gce_MakeHypr2d(const gp_Ax2d& MajorAxis ,
|
||||
const Standard_Real MajorRadius ,
|
||||
const Standard_Real MinorRadius ,
|
||||
const Standard_Boolean Sense )
|
||||
{
|
||||
if (MajorRadius < 0.0 || MinorRadius < 0.0) { TheError = gce_NegativeRadius;}
|
||||
else {
|
||||
TheHypr2d = gp_Hypr2d(MajorAxis,MajorRadius,MinorRadius,Sense);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeHypr2d::gce_MakeHypr2d(const gp_Ax22d& A ,
|
||||
const Standard_Real MajorRadius ,
|
||||
const Standard_Real MinorRadius )
|
||||
{
|
||||
if (MajorRadius < 0.0 || MinorRadius < 0.0) { TheError = gce_NegativeRadius;}
|
||||
else {
|
||||
TheHypr2d = gp_Hypr2d(A,MajorRadius,MinorRadius);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
const gp_Hypr2d& gce_MakeHypr2d::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheHypr2d;
|
||||
}
|
||||
|
||||
const gp_Hypr2d& gce_MakeHypr2d::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeHypr2d::operator gp_Hypr2d() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
65
src/gce/gce_MakeLin.cdl
Executable file
65
src/gce/gce_MakeLin.cdl
Executable file
@@ -0,0 +1,65 @@
|
||||
-- File: MakeLin.cdl
|
||||
-- Created: Wed Aug 26 14:30:57 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeLin from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create a Lin from gp.
|
||||
-- * Create a Lin parallel to another and passing
|
||||
-- through a point.
|
||||
-- * Create a Lin passing through 2 points.
|
||||
-- * Create a lin from its axis (Ax1 from gp).
|
||||
-- * Create a lin from a point and a direction.
|
||||
|
||||
uses Pnt from gp,
|
||||
Lin from gp,
|
||||
Ax1 from gp,
|
||||
Dir from gp,
|
||||
Real from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A1 : Ax1 from gp) returns MakeLin;
|
||||
--- Purpose : Creates a line located along the axis A1.
|
||||
|
||||
|
||||
Create (P : Pnt from gp;
|
||||
V : Dir from gp) returns MakeLin;
|
||||
--- Purpose :
|
||||
-- <P> is the location point (origin) of the line and
|
||||
-- <V> is the direction of the line.
|
||||
|
||||
Create(Lin : Lin from gp;
|
||||
Point : Pnt from gp) returns MakeLin;
|
||||
---Purpose : Make a Lin from gp <TheLin> parallel to another
|
||||
-- Lin <Lin> and passing through a Pnt <Point>.
|
||||
|
||||
Create(P1 : Pnt from gp;
|
||||
P2 : Pnt from gp) returns MakeLin;
|
||||
---Purpose : Make a Lin from gp <TheLin> passing through 2
|
||||
-- Pnt <P1>,<P2>.
|
||||
-- It returns false if <p1> and <P2> are confused.
|
||||
|
||||
Value(me) returns Lin from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
--- Purpose: Returns the constructed line.
|
||||
-- Exceptions StdFail_NotDone is raised if no line is constructed.
|
||||
|
||||
Operator(me) returns Lin from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Lin() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheLin : Lin from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeLin;
|
74
src/gce/gce_MakeLin.cxx
Executable file
74
src/gce/gce_MakeLin.cxx
Executable file
@@ -0,0 +1,74 @@
|
||||
// File: gce_MakeLin.cxx
|
||||
// Created: Wed Sep 2 11:35:00 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeLin.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 3d de gp a partir d un Ax1 de gp. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin::gce_MakeLin(const gp_Ax1& A1)
|
||||
{
|
||||
TheLin = gp_Lin(A1);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 3d de gp a partir de son origine P (Pnt de gp) +
|
||||
// et d une direction V (Dir de gp). +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin::gce_MakeLin(const gp_Pnt& P,
|
||||
const gp_Dir& V)
|
||||
{
|
||||
TheLin = gp_Lin(P,V);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 3d de gp passant par les deux points <P1> et +
|
||||
// <P2>. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin::gce_MakeLin(const gp_Pnt& P1 ,
|
||||
const gp_Pnt& P2 )
|
||||
{
|
||||
if (P1.Distance(P2) >= gp::Resolution()) {
|
||||
TheLin = gp_Lin(P1,gp_Dir(P2.XYZ()-P1.XYZ()));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else { TheError = gce_ConfusedPoints; }
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 3d de gp parallele a une autre <Lin> et passant +
|
||||
// par le point <P>. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin::gce_MakeLin(const gp_Lin& Lin ,
|
||||
const gp_Pnt& P )
|
||||
{
|
||||
TheLin = gp_Lin(P,Lin.Direction());
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
const gp_Lin& gce_MakeLin::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheLin;
|
||||
}
|
||||
|
||||
const gp_Lin& gce_MakeLin::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeLin::operator gp_Lin() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
86
src/gce/gce_MakeLin2d.cdl
Executable file
86
src/gce/gce_MakeLin2d.cdl
Executable file
@@ -0,0 +1,86 @@
|
||||
|
||||
-- File: MakeLin2d.cdl
|
||||
-- Created: Wed Aug 26 14:30:57 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeLin2d from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create Lin2d from gp.
|
||||
--
|
||||
-- * Create a Lin2d parallel to another and passing
|
||||
-- through a point.
|
||||
-- * Create a Lin2d parallel to another at the distance
|
||||
-- Dist.
|
||||
-- * Create a Lin2d passing through 2 points.
|
||||
-- * Create a Lin2d from its axis (Ax1 from gp).
|
||||
-- * Create a Lin2d from a point and a direction.
|
||||
-- * Create a Lin2d from its equation.
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Lin2d from gp,
|
||||
Ax2d from gp,
|
||||
Dir2d from gp,
|
||||
Real from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A : Ax2d from gp) returns MakeLin2d;
|
||||
--- Purpose : Creates a line located with A.
|
||||
|
||||
Create (P : Pnt2d from gp;
|
||||
V : Dir2d from gp) returns MakeLin2d;
|
||||
--- Purpose :
|
||||
-- <P> is the location point (origin) of the line and
|
||||
-- <V> is the direction of the line.
|
||||
|
||||
Create (A, B, C : Real) returns MakeLin2d;
|
||||
--- Purpose :
|
||||
-- Creates the line from the equation A*X + B*Y + C = 0.0
|
||||
-- the status is "NullAxis"if Sqrt(A*A + B*B) <= Resolution from gp.
|
||||
|
||||
Create(Lin : Lin2d from gp ;
|
||||
Dist : Real from Standard) returns MakeLin2d;
|
||||
---Purpose : Make a Lin2d from gp <TheLin> parallel to another
|
||||
-- Lin2d <Lin> at a distance <Dist>.
|
||||
-- If Dist is greater than zero the result is on the
|
||||
-- right of the Line <Lin>, else the result is on the
|
||||
-- left of the Line <Lin>.
|
||||
|
||||
Create(Lin : Lin2d from gp;
|
||||
Point : Pnt2d from gp) returns MakeLin2d;
|
||||
---Purpose : Make a Lin2d from gp <TheLin> parallel to another
|
||||
-- Lin2d <Lin> and passing through a Pnt2d <Point>.
|
||||
|
||||
Create(P1 : Pnt2d from gp;
|
||||
P2 : Pnt2d from gp) returns MakeLin2d;
|
||||
---Purpose : Make a Lin2d from gp <TheLin> passing through 2
|
||||
-- Pnt2d <P1>,<P2>.
|
||||
-- It returns false if <P1> and <P2> are confused.
|
||||
-- Warning
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_NullAxis if Sqrt(A*A + B*B) is less
|
||||
-- than or equal to gp::Resolution(), or
|
||||
-- - gce_ConfusedPoints if points P1 and P2 are coincident.
|
||||
|
||||
Value(me) returns Lin2d from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---Purpose: Returns the constructed line.
|
||||
-- Exceptions StdFail_NotDone if no line is constructed.
|
||||
|
||||
Operator(me) returns Lin2d from gp
|
||||
is static;
|
||||
---C++: alias "Standard_EXPORT operator gp_Lin2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheLin2d : Lin2d from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeLin2d;
|
108
src/gce/gce_MakeLin2d.cxx
Executable file
108
src/gce/gce_MakeLin2d.cxx
Executable file
@@ -0,0 +1,108 @@
|
||||
// File: gce_MakeLin2d.cxx
|
||||
// Created: Wed Sep 2 11:35:00 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeLin2d.ixx>
|
||||
#include <gp.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 2d de gp a partir d un Ax2d de gp. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin2d::gce_MakeLin2d(const gp_Ax2d& A)
|
||||
{
|
||||
TheLin2d = gp_Lin2d(A);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 2d de gp a partir de son origine P (Pnt2d de gp)+
|
||||
// et d une direction V (Dir2d de gp). +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P,
|
||||
const gp_Dir2d& V)
|
||||
{
|
||||
TheLin2d = gp_Lin2d(P,V);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 2d de gp a partir des parametres de son +
|
||||
// equation. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin2d::gce_MakeLin2d(const Standard_Real A,
|
||||
const Standard_Real B,
|
||||
const Standard_Real C)
|
||||
{
|
||||
if (A*A + B*B <= gp::Resolution()) {
|
||||
TheError = gce_NullAxis;
|
||||
}
|
||||
else {
|
||||
TheLin2d = gp_Lin2d(A,B,C);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 2d de gp passant par les deux points <P1> et +
|
||||
// <P2>. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P1,
|
||||
const gp_Pnt2d& P2)
|
||||
{
|
||||
if (P1.Distance(P2) >= gp::Resolution()) {
|
||||
TheLin2d = gp_Lin2d(P1,gp_Dir2d(P2.XY()-P1.XY()));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else {
|
||||
TheError = gce_ConfusedPoints;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne +
|
||||
// <Line1> passant par le point <Point1>. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
|
||||
const gp_Pnt2d& Point)
|
||||
{
|
||||
TheLin2d = gp_Lin2d(Point,Line.Direction());
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne +
|
||||
// <Line1> a une distance <Dist1>. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
|
||||
const Standard_Real Dist)
|
||||
{
|
||||
gp_Pnt2d Point(Line.Location().XY()+
|
||||
Dist*gp_XY(-Line.Direction().Y(),Line.Direction().X()));
|
||||
TheLin2d = gp_Lin2d(Point,Line.Direction());
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
gp_Lin2d gce_MakeLin2d::Value() const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheLin2d;
|
||||
}
|
||||
|
||||
gp_Lin2d gce_MakeLin2d::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeLin2d::operator gp_Lin2d () const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
66
src/gce/gce_MakeMirror.cdl
Executable file
66
src/gce/gce_MakeMirror.cdl
Executable file
@@ -0,0 +1,66 @@
|
||||
-- File: MakeMirror.cdl
|
||||
-- Created: Tue Sep 1 15:33:36 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeMirror
|
||||
|
||||
from gce
|
||||
|
||||
---Purpose: This class mplements elementary construction algorithms for a
|
||||
-- symmetrical transformation in 3D space about a point,
|
||||
-- axis or plane. The result is a gp_Trsf transformation.
|
||||
-- A MakeMirror object provides a framework for:
|
||||
-- - defining the construction of the transformation,
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result.
|
||||
|
||||
|
||||
uses Pnt from gp,
|
||||
Ax1 from gp,
|
||||
Ax2 from gp,
|
||||
Dir from gp,
|
||||
Pln from gp,
|
||||
Lin from gp,
|
||||
Trsf from gp,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Point : Pnt from gp) returns MakeMirror;
|
||||
---Puprose: Makes a symmetry transformation of center <Point>.
|
||||
|
||||
Create(Axis : Ax1 from gp) returns MakeMirror;
|
||||
---Puprose: Makes a symmetry transformation of axis <Axis>.
|
||||
|
||||
Create(Line : Lin from gp) returns MakeMirror;
|
||||
---Puprose: Makes a symmetry transformation of axis <Line>.
|
||||
|
||||
Create(Point : Pnt from gp;
|
||||
Direc : Dir from gp) returns MakeMirror;
|
||||
---Purpose: Makes a symmetry transformation af axis defined by
|
||||
-- <Point> and <Direc>.
|
||||
|
||||
Create(Plane : Pln from gp) returns MakeMirror;
|
||||
---Purpose: Makes a symmetry transformation of plane <Plane>.
|
||||
|
||||
Create(Plane : Ax2 from gp) returns MakeMirror;
|
||||
---Purpose: Makes a symmetry transformation of plane <Plane>.
|
||||
|
||||
Value(me) returns Trsf from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed transformation.
|
||||
|
||||
Operator(me) returns Trsf from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Trsf() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheMirror : Trsf from gp;
|
||||
|
||||
end MakeMirror;
|
||||
|
79
src/gce/gce_MakeMirror.cxx
Executable file
79
src/gce/gce_MakeMirror.cxx
Executable file
@@ -0,0 +1,79 @@
|
||||
// File: gce_MakeMirror.cxx
|
||||
// Created: Fri Sep 4 10:56:35 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeMirror.ixx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie de gp par rapport a un point. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror::gce_MakeMirror(const gp_Pnt& Point )
|
||||
{
|
||||
TheMirror.SetMirror(Point);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie de gp par rapport a une droite. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror::gce_MakeMirror(const gp_Ax1& Axis )
|
||||
{
|
||||
TheMirror.SetMirror(Axis);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie de gp par rapport a une droite. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror::gce_MakeMirror(const gp_Lin& Line )
|
||||
{
|
||||
TheMirror.SetMirror(gp_Ax1(Line.Location(),Line.Direction()));
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie de gp par rapport a une droite definie +
|
||||
// par un point et une direction. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror::gce_MakeMirror(const gp_Pnt& Point ,
|
||||
const gp_Dir& Direc )
|
||||
{
|
||||
TheMirror.SetMirror(gp_Ax1(Point,Direc));
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie 3d de gp par rapport a un plan defini par +
|
||||
// un Ax2 (Normale au plan et axe x du plan). +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror::gce_MakeMirror(const gp_Ax2& Plane )
|
||||
{
|
||||
TheMirror.SetMirror(Plane);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie 3d de gp par rapport a un plan Plane. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror::gce_MakeMirror(const gp_Pln& Plane )
|
||||
{
|
||||
TheMirror.SetMirror(Plane.Position().Ax2());
|
||||
}
|
||||
|
||||
const gp_Trsf& gce_MakeMirror::Value() const
|
||||
{
|
||||
return TheMirror;
|
||||
}
|
||||
|
||||
const gp_Trsf& gce_MakeMirror::Operator() const
|
||||
{
|
||||
return TheMirror;
|
||||
}
|
||||
|
||||
gce_MakeMirror::operator gp_Trsf() const
|
||||
{
|
||||
return TheMirror;
|
||||
}
|
56
src/gce/gce_MakeMirror2d.cdl
Executable file
56
src/gce/gce_MakeMirror2d.cdl
Executable file
@@ -0,0 +1,56 @@
|
||||
-- File: MakeMirror2d.cdl
|
||||
-- Created: Tue Sep 1 15:33:36 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun1>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeMirror2d
|
||||
|
||||
from gce
|
||||
|
||||
---Purpose: This class implements elementary construction algorithms for a
|
||||
-- symmetrical transformation in 2D space about a point
|
||||
-- or axis. The result is a gp_Trsf2d transformation.
|
||||
-- A MakeMirror2d object provides a framework for:
|
||||
-- - defining the construction of the transformation,
|
||||
-- - implementing the construction algorithm, and consulting the result.
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Ax2d from gp,
|
||||
Dir2d from gp,
|
||||
Lin2d from gp,
|
||||
Trsf2d from gp,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Point : Pnt2d from gp) returns MakeMirror2d;
|
||||
---Puprose: Makes a symmetry transformation of center <Point>.
|
||||
|
||||
Create(Axis : Ax2d from gp) returns MakeMirror2d;
|
||||
---Puprose: Makes a symmetry transformation of axis <Axis>.
|
||||
|
||||
Create(Line : Lin2d from gp) returns MakeMirror2d;
|
||||
---Puprose: Makes a symmetry transformation of axis <Line>.
|
||||
|
||||
Create(Point : Pnt2d from gp;
|
||||
Direc : Dir2d from gp) returns MakeMirror2d;
|
||||
---Purpose: Makes a symmetry transformation af axis defined by
|
||||
-- <Point> and <Direc>.
|
||||
|
||||
Value(me) returns Trsf2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed transformation.
|
||||
|
||||
Operator(me) returns Trsf2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Trsf2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheMirror2d : Trsf2d from gp;
|
||||
|
||||
end MakeMirror2d;
|
||||
|
59
src/gce/gce_MakeMirror2d.cxx
Executable file
59
src/gce/gce_MakeMirror2d.cxx
Executable file
@@ -0,0 +1,59 @@
|
||||
// File: gce_MakeMirror2d.cxx
|
||||
// Created: Fri Sep 4 10:56:35 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeMirror2d.ixx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie 2d de gp par rapport a un point. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror2d::gce_MakeMirror2d(const gp_Pnt2d& Point )
|
||||
{
|
||||
TheMirror2d.SetMirror(Point);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie 2d de gp par rapport a une droite. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror2d::gce_MakeMirror2d(const gp_Ax2d& Axis )
|
||||
{
|
||||
TheMirror2d.SetMirror(Axis);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie 2d de gp par rapport a une droite. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror2d::gce_MakeMirror2d(const gp_Lin2d& Line )
|
||||
{
|
||||
TheMirror2d.SetMirror(gp_Ax2d(Line.Location(),Line.Direction()));
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une symetrie 2d de gp par rapport a une droite definie +
|
||||
// par un point et une direction. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeMirror2d::gce_MakeMirror2d(const gp_Pnt2d& Point ,
|
||||
const gp_Dir2d& Direc )
|
||||
{
|
||||
TheMirror2d.SetMirror(gp_Ax2d(Point,Direc));
|
||||
}
|
||||
|
||||
const gp_Trsf2d& gce_MakeMirror2d::Value() const
|
||||
{
|
||||
return TheMirror2d;
|
||||
}
|
||||
|
||||
const gp_Trsf2d& gce_MakeMirror2d::Operator() const
|
||||
{
|
||||
return TheMirror2d;
|
||||
}
|
||||
|
||||
gce_MakeMirror2d::operator gp_Trsf2d() const
|
||||
{
|
||||
return TheMirror2d;
|
||||
}
|
91
src/gce/gce_MakeParab.cdl
Executable file
91
src/gce/gce_MakeParab.cdl
Executable file
@@ -0,0 +1,91 @@
|
||||
-- File: MakeParab.cdl
|
||||
-- Created: Wed Aug 26 14:31:48 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeParab from gce inherits Root from gce
|
||||
|
||||
---Purpose :This class implements the following algorithms used to
|
||||
-- create Parab from gp.
|
||||
-- Defines the parabola in the parameterization range :
|
||||
-- ]-infinite, +infinite[
|
||||
-- The vertex of the parabola is the "Location" point of the
|
||||
-- local coordinate system (axis placement) of the parabola.
|
||||
--
|
||||
-- The "XDirection" and the "YDirection" of this system define
|
||||
-- the plane of the parabola.
|
||||
--
|
||||
-- The "XAxis" of the parabola ("Location", "XDirection") is
|
||||
-- the axis of symmetry of the parabola. The Xaxis is oriented
|
||||
-- from the vertex of the parabola to the Focus of the parabola.
|
||||
--
|
||||
-- The "YAxis" of the parabola ("Location", "YDirection") is
|
||||
-- parallel to the directrix of the parabola.
|
||||
--
|
||||
-- The equation of the parabola in the local coordinates system is
|
||||
-- Y**2 = (2*P) * X
|
||||
-- P is the distance between the focus and the directrix of the
|
||||
-- parabola (called Parameter).
|
||||
-- The focal length F = P/2 is the distance between the vertex
|
||||
-- and the focus of the parabola.
|
||||
--
|
||||
-- * Creates a parabola with its local coordinate system "A2"
|
||||
-- and it's focal length "Focal".
|
||||
-- * Create a parabola with its directrix and its focus point.
|
||||
|
||||
uses Pnt from gp,
|
||||
Parab from gp,
|
||||
Ax2 from gp,
|
||||
Ax1 from gp
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A2 : Ax2 from gp ;
|
||||
Focal : Real from Standard) returns MakeParab;
|
||||
--- Purpose ;
|
||||
-- Creates a parabola with its local coordinate system "A2"
|
||||
-- and it's focal length "Focal".
|
||||
-- The XDirection of A2 defines the axis of symmetry of the
|
||||
-- parabola. The YDirection of A2 is parallel to the directrix
|
||||
-- of the parabola. The Location point of A2 is the vertex of
|
||||
-- the parabola
|
||||
-- The status is "NullFocusLength" if Focal < 0.0
|
||||
|
||||
|
||||
Create (D : Ax1 from gp ;
|
||||
F : Pnt from gp ) returns MakeParab;
|
||||
--- Purpose :
|
||||
-- D is the directrix of the parabola and F the focus point.
|
||||
-- The symmetry axis (XAxis) of the parabola is normal to the
|
||||
-- directrix and pass through the focus point F, but its
|
||||
-- location point is the vertex of the parabola.
|
||||
-- The YAxis of the parabola is parallel to D and its location
|
||||
-- point is the vertex of the parabola. The normal to the plane
|
||||
-- of the parabola is the cross product between the XAxis and the
|
||||
-- YAxis.
|
||||
|
||||
Value(me) returns Parab from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed parabola.
|
||||
-- Exceptions StdFail_NotDone if no parabola is constructed.
|
||||
|
||||
Operator(me) returns Parab from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Parab() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheParab : Parab from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeParab;
|
||||
|
||||
|
||||
|
||||
|
42
src/gce/gce_MakeParab.cxx
Executable file
42
src/gce/gce_MakeParab.cxx
Executable file
@@ -0,0 +1,42 @@
|
||||
// File: gce_MakeParab.cxx
|
||||
// Created: Wed Sep 2 12:35:36 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeParab.ixx>
|
||||
#include <gp.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
gce_MakeParab::gce_MakeParab(const gp_Ax2& A2 ,
|
||||
const Standard_Real Focal )
|
||||
{
|
||||
if (Focal < 0.0) { TheError = gce_NullFocusLength; }
|
||||
else {
|
||||
TheParab = gp_Parab(A2,Focal);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeParab::gce_MakeParab(const gp_Ax1& D ,
|
||||
const gp_Pnt& F )
|
||||
{
|
||||
TheParab = gp_Parab(D,F);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
const gp_Parab& gce_MakeParab::Value () const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheParab;
|
||||
}
|
||||
|
||||
const gp_Parab& gce_MakeParab::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeParab::operator gp_Parab() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
111
src/gce/gce_MakeParab2d.cdl
Executable file
111
src/gce/gce_MakeParab2d.cdl
Executable file
@@ -0,0 +1,111 @@
|
||||
-- File: Parab2d.cdl
|
||||
-- Created: Wed Aug 26 14:31:48 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeParab2d from gce inherits Root from gce
|
||||
|
||||
---Purpose :This class implements the following algorithms used to
|
||||
-- create Parab2d from gp.
|
||||
-- Defines an infinite parabola.
|
||||
-- An axis placement one axis defines the local cartesian
|
||||
-- coordinate system ("XAxis") of the parabola.
|
||||
-- The vertex of the parabola is the "Location" point of the
|
||||
-- local coordinate system of the parabola.
|
||||
-- The "XAxis" of the parabola is its axis of symmetry.
|
||||
-- The "XAxis" is oriented from the vertex of the parabola to the
|
||||
-- Focus of the parabola.
|
||||
-- The "YAxis" is parallel to the directrix of the parabola and
|
||||
-- its "Location" point is the vertex of the parabola.
|
||||
-- The equation of the parabola in the local coordinate system is
|
||||
-- Y**2 = (2*P) * X
|
||||
-- P is the distance between the focus and the directrix of the
|
||||
-- parabola called Parameter).
|
||||
-- The focal length F = P/2 is the distance between the vertex
|
||||
-- and the focus of the parabola.
|
||||
--
|
||||
-- * Create a Parab2d from one apex and the center.
|
||||
-- * Create a Parab2d with the directrix and the focus point.
|
||||
-- * Create a Parab2d with its vertex point and its axis
|
||||
-- of symetry and its focus length.
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Ax2d from gp,
|
||||
Ax22d from gp,
|
||||
Parab2d from gp
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (MirrorAxis : Ax2d from gp ;
|
||||
Focal : Real from Standard ;
|
||||
Sense : Boolean from Standard = Standard_True)
|
||||
returns MakeParab2d;
|
||||
--- Purpose :
|
||||
-- Creates a parabola with its axis of symmetry ("MirrorAxis")
|
||||
-- and its focal length.
|
||||
--- Warnings : It is possible to have Focal = 0.
|
||||
-- The status is "NullFocalLength" Raised if Focal < 0.0
|
||||
|
||||
Create (A : Ax22d from gp ;
|
||||
Focal : Real from Standard )
|
||||
returns MakeParab2d;
|
||||
--- Purpose :
|
||||
-- Creates a parabola with its local coordinate system <A>
|
||||
-- and its focal length.
|
||||
--- Warnings : It is possible to have Focal = 0.
|
||||
-- The status is "NullFocalLength" Raised if Focal < 0.0
|
||||
|
||||
Create (D : Ax2d from gp ;
|
||||
F : Pnt2d from gp ;
|
||||
Sense : Boolean from Standard = Standard_True)
|
||||
returns MakeParab2d;
|
||||
--- Purpose :
|
||||
-- Creates a parabola with the directrix and the focus point.
|
||||
-- The sense of parametrization is given by Sense.
|
||||
|
||||
Create (D : Ax22d from gp ;
|
||||
F : Pnt2d from gp )
|
||||
returns MakeParab2d;
|
||||
--- Purpose :
|
||||
-- Creates a parabola with the local coordinate system and
|
||||
-- the focus point.
|
||||
-- The sense of parametrization is given by Sense.
|
||||
|
||||
Create(S1 : Pnt2d from gp ;
|
||||
Center : Pnt2d from gp ;
|
||||
Sense : Boolean from Standard = Standard_True) returns MakeParab2d;
|
||||
---Purpose: Make an Parab2d with S1 as the Focal point and Center
|
||||
-- as the apex of the parabola
|
||||
-- Warning
|
||||
-- The MakeParab2d class does not prevent the
|
||||
-- construction of a parabola with a null focal distance.
|
||||
-- If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_NullFocusLength if Focal is less than 0.0, or
|
||||
-- - gce_NullAxis if S1 and Center are coincident.
|
||||
|
||||
Value(me) returns Parab2d from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed parabola.
|
||||
-- Exceptions StdFail_NotDone if no parabola is constructed.
|
||||
|
||||
Operator(me) returns Parab2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Parab2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheParab2d : Parab2d from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakeParab2d;
|
||||
|
||||
|
||||
|
||||
|
80
src/gce/gce_MakeParab2d.cxx
Executable file
80
src/gce/gce_MakeParab2d.cxx
Executable file
@@ -0,0 +1,80 @@
|
||||
// File: gce_MakeParab2d.cxx
|
||||
// Created: Wed Sep 2 12:35:36 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeParab2d.ixx>
|
||||
#include <gp.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
gce_MakeParab2d::gce_MakeParab2d(const gp_Ax22d& A ,
|
||||
const Standard_Real Focal )
|
||||
{
|
||||
if (Focal < 0.0) { TheError = gce_NullFocusLength; }
|
||||
else {
|
||||
TheParab2d = gp_Parab2d(A,Focal);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeParab2d::gce_MakeParab2d(const gp_Ax2d& MirrorAxis ,
|
||||
const Standard_Real Focal ,
|
||||
const Standard_Boolean Sense )
|
||||
{
|
||||
if (Focal < 0.0) { TheError = gce_NullFocusLength; }
|
||||
else {
|
||||
TheParab2d = gp_Parab2d(MirrorAxis,Focal,Sense);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakeParab2d::gce_MakeParab2d(const gp_Ax2d& D ,
|
||||
const gp_Pnt2d& F ,
|
||||
const Standard_Boolean Sense )
|
||||
{
|
||||
TheParab2d = gp_Parab2d(D,F,Sense);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
gce_MakeParab2d::gce_MakeParab2d(const gp_Ax22d& D ,
|
||||
const gp_Pnt2d& F )
|
||||
{
|
||||
TheParab2d = gp_Parab2d(D,F);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une Parabole 2d de gp de centre <Center> et de sommet +
|
||||
// <S1> . +
|
||||
// <CenterS1> donne le grand axe . +
|
||||
// <S1> donne la focale. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeParab2d::gce_MakeParab2d(const gp_Pnt2d& S ,
|
||||
const gp_Pnt2d& Center ,
|
||||
const Standard_Boolean Sense )
|
||||
{
|
||||
if (S.Distance(Center) >= gp::Resolution()) {
|
||||
gp_Dir2d XAxis(gp_XY(S.XY()-Center.XY()));
|
||||
TheParab2d = gp_Parab2d(gp_Ax2d(Center,XAxis),S.Distance(Center),Sense);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
else { TheError = gce_NullAxis; }
|
||||
}
|
||||
|
||||
const gp_Parab2d& gce_MakeParab2d::Value () const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return TheParab2d;
|
||||
}
|
||||
|
||||
const gp_Parab2d& gce_MakeParab2d::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakeParab2d::operator gp_Parab2d() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
118
src/gce/gce_MakePln.cdl
Executable file
118
src/gce/gce_MakePln.cdl
Executable file
@@ -0,0 +1,118 @@
|
||||
-- File: MakePln.cdl
|
||||
-- Created: Wed Aug 26 14:30:57 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakePln from gce inherits Root from gce
|
||||
|
||||
---Purpose : This class implements the following algorithms used
|
||||
-- to create a Pln from gp.
|
||||
-- * Create a Pln parallel to another and passing
|
||||
-- through a point.
|
||||
-- * Create a Pln passing through 3 points.
|
||||
-- * Create a Pln by its normal.
|
||||
-- Defines a non-persistent plane.
|
||||
-- The plane is located in 3D space with an axis placement
|
||||
-- two axis. It is the local coordinate system of the plane.
|
||||
--
|
||||
-- The "Location" point and the main direction of this axis
|
||||
-- placement define the "Axis" of the plane. It is the axis
|
||||
-- normal to the plane which gives the orientation of the
|
||||
-- plane.
|
||||
--
|
||||
-- The "XDirection" and the "YDirection" of the axis
|
||||
-- placement define the plane ("XAxis" and "YAxis") .
|
||||
|
||||
uses Pnt from gp,
|
||||
Pln from gp,
|
||||
Ax1 from gp,
|
||||
Ax2 from gp,
|
||||
Dir from gp,
|
||||
Real from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create (A2 : Ax2 from gp) returns MakePln;
|
||||
--- Purpose :
|
||||
-- The coordinate system of the plane is defined with the axis
|
||||
-- placement A2.
|
||||
-- The "Direction" of A2 defines the normal to the plane.
|
||||
-- The "Location" of A2 defines the location (origin) of the plane.
|
||||
-- The "XDirection" and "YDirection" of A2 define the "XAxis" and
|
||||
-- the "YAxis" of the plane used to parametrize the plane.
|
||||
|
||||
|
||||
Create (P : Pnt from gp;
|
||||
V : Dir from gp) returns MakePln;
|
||||
--- Purpose :
|
||||
-- Creates a plane with the "Location" point <P>
|
||||
-- and the normal direction <V>.
|
||||
|
||||
Create (A, B, C, D : Real from Standard) returns MakePln;
|
||||
--- Purpose :
|
||||
-- Creates a plane from its cartesian equation :
|
||||
-- A * X + B * Y + C * Z + D = 0.0
|
||||
--- Purpose :
|
||||
-- the status is "BadEquation" if Sqrt (A*A + B*B + C*C) <=
|
||||
-- Resolution from gp.
|
||||
|
||||
Create(Pln : Pln from gp;
|
||||
Point : Pnt from gp) returns MakePln;
|
||||
---Purpose : Make a Pln from gp <ThePln> parallel to another
|
||||
-- Pln <Pln> and passing through a Pnt <Point>.
|
||||
|
||||
Create(Pln : Pln from gp ;
|
||||
Dist : Real from Standard) returns MakePln;
|
||||
---Purpose : Make a Pln from gp <ThePln> parallel to another
|
||||
-- Pln <Pln> at the distance <Dist> which can be greater
|
||||
-- or less than zero.
|
||||
-- In the first case the result is at the distance
|
||||
-- <Dist> to the plane <Pln> in the direction of the
|
||||
-- normal to <Pln>.
|
||||
-- Otherwize it is in the opposite direction.
|
||||
|
||||
Create(P1 : Pnt from gp;
|
||||
P2 : Pnt from gp;
|
||||
P3 : Pnt from gp) returns MakePln;
|
||||
---Purpose : Make a Pln from gp <ThePln> passing through 3
|
||||
-- Pnt <P1>,<P2>,<P3>.
|
||||
-- It returns false if <P1> <P2> <P3> are confused.
|
||||
|
||||
Create(P1 : Pnt from gp;
|
||||
P2 : Pnt from gp) returns MakePln;
|
||||
---Purpose : Make a Pln from gp <ThePln> perpendicular to the line
|
||||
-- passing through <P1>,<P2>.
|
||||
-- The status is "ConfusedPoints" if <P1> <P2> are confused.
|
||||
|
||||
Create(Axis : Ax1 from gp) returns MakePln;
|
||||
---Purpose: Make a pln passing through the location of <Axis>and
|
||||
-- normal to the Direction of <Axis>.
|
||||
-- Warning - If an error occurs (that is, when IsDone returns
|
||||
-- false), the Status function returns:
|
||||
-- - gce_BadEquation if Sqrt(A*A + B*B +
|
||||
-- C*C) is less than or equal to gp::Resolution(),
|
||||
-- - gce_ConfusedPoints if P1 and P2 are coincident, or
|
||||
-- - gce_ColinearPoints if P1, P2 and P3 are collinear.
|
||||
|
||||
Value(me) returns Pln from gp
|
||||
raises NotDone
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed plane.
|
||||
-- Exceptions StdFail_NotDone if no plane is constructed.
|
||||
|
||||
Operator(me) returns Pln from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Pln() const;"
|
||||
|
||||
fields
|
||||
|
||||
ThePln : Pln from gp;
|
||||
--The solution from gp.
|
||||
|
||||
end MakePln;
|
||||
|
133
src/gce/gce_MakePln.cxx
Executable file
133
src/gce/gce_MakePln.cxx
Executable file
@@ -0,0 +1,133 @@
|
||||
// File: gce_MakePln.cxx
|
||||
// Created: Wed Sep 2 10:34:28 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakePln.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
gce_MakePln::gce_MakePln(const gp_Ax2& A2)
|
||||
{
|
||||
ThePln = gp_Pln(gp_Ax3(A2));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
gce_MakePln::gce_MakePln(const gp_Pnt& P,
|
||||
const gp_Dir& V)
|
||||
{
|
||||
ThePln = gp_Pln(P,V);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
gce_MakePln::gce_MakePln(const gp_Pnt& P1,
|
||||
const gp_Pnt& P2)
|
||||
{
|
||||
if (P1.Distance(P2) <= gp::Resolution()) { TheError = gce_ConfusedPoints; }
|
||||
else {
|
||||
gp_Dir dir(P2.XYZ()-P1.XYZ());
|
||||
ThePln = gp_Pln(P1,dir);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
gce_MakePln::gce_MakePln(const Standard_Real A,
|
||||
const Standard_Real B,
|
||||
const Standard_Real C,
|
||||
const Standard_Real D)
|
||||
{
|
||||
if (A*A + B*B + C*C <= gp::Resolution()) {
|
||||
TheError = gce_BadEquation;
|
||||
}
|
||||
else {
|
||||
ThePln = gp_Pln(A,B,C,D);
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un gp_pln passant par trois points. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakePln::gce_MakePln(const gp_Pnt& P1 ,
|
||||
const gp_Pnt& P2 ,
|
||||
const gp_Pnt& P3 )
|
||||
{
|
||||
gp_XYZ V1(P2.XYZ()-P1.XYZ());
|
||||
gp_XYZ V2(P3.XYZ()-P1.XYZ());
|
||||
gp_XYZ Norm(V1.Crossed(V2));
|
||||
if (Norm.Modulus() < gp::Resolution()) { TheError = gce_ColinearPoints; }
|
||||
else {
|
||||
gp_Dir DNorm(Norm);
|
||||
gp_Dir Dx(V1);
|
||||
ThePln = gp_Pln(gp_Ax3(P1,DNorm,Dx));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un gp_pln parallele a un autre pln a une distance donnee. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakePln::gce_MakePln(const gp_Pln& Pl ,
|
||||
const Standard_Real Dist )
|
||||
{
|
||||
gp_Pnt Center(Pl.Location().XYZ()+Dist*gp_XYZ(Pl.Axis().Direction().XYZ()));
|
||||
ThePln=gp_Pln(gp_Ax3(Center,Pl.Axis().Direction(),Pl.XAxis().Direction()));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un gp_pln parallele a un autre pln passant par un point +
|
||||
// <Point1>. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakePln::gce_MakePln(const gp_Pln& Pl ,
|
||||
const gp_Pnt& Point )
|
||||
{
|
||||
ThePln = gp_Pln(gp_Ax3(Point,Pl.Axis().Direction(),Pl.XAxis().Direction()));
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un gp_pln a partir d un Ax1 (Point + Normale). +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakePln::gce_MakePln(const gp_Ax1& Axis )
|
||||
{
|
||||
ThePln = gp_Pln(Axis.Location(),Axis.Direction());
|
||||
TheError = gce_Done;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un gp_pln par un tableau de points. +
|
||||
//=========================================================================
|
||||
|
||||
/*gce_MakePln::gce_MakePln(const gp_Array1OfPnt& Pts ,
|
||||
Standard_Real ErrMax ,
|
||||
Standard_Real ErrMean )
|
||||
{
|
||||
TheError = gce_ConfusedPoints;
|
||||
}
|
||||
*/
|
||||
const gp_Pln& gce_MakePln::Value () const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
|
||||
return ThePln;
|
||||
}
|
||||
|
||||
const gp_Pln& gce_MakePln::Operator() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
gce_MakePln::operator gp_Pln() const
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
56
src/gce/gce_MakeRotation.cdl
Executable file
56
src/gce/gce_MakeRotation.cdl
Executable file
@@ -0,0 +1,56 @@
|
||||
-- File: MakeRotation.cdl
|
||||
-- Created: Wed Aug 26 14:32:33 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeRotation
|
||||
|
||||
from gce
|
||||
|
||||
---Purpose: This class implements elementary construction algorithms for a
|
||||
-- rotation in 3D space. The result is a gp_Trsf transformation.
|
||||
-- A MakeRotation object provides a framework for:
|
||||
-- - defining the construction of the transformation,
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result.
|
||||
|
||||
uses Pnt from gp,
|
||||
Lin from gp,
|
||||
Ax1 from gp,
|
||||
Dir from gp,
|
||||
Trsf from gp,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Line : Lin from gp ;
|
||||
Angle : Real from Standard) returns MakeRotation;
|
||||
---Purpose: Constructs a rotation through angle Angle about the axis defined by the line Line.
|
||||
|
||||
Create(Axis : Ax1 from gp ;
|
||||
Angle : Real from Standard) returns MakeRotation;
|
||||
---Purpose: Constructs a rotation through angle Angle about the axis defined by the axis Axis.
|
||||
|
||||
Create(Point : Pnt from gp ;
|
||||
Direc : Dir from gp ;
|
||||
Angle : Real from Standard) returns MakeRotation;
|
||||
---Purpose:
|
||||
-- Constructs a rotation through angle Angle about the axis defined by:
|
||||
-- the point Point and the unit vector Direc.
|
||||
|
||||
Value(me) returns Trsf from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed transformation.
|
||||
|
||||
Operator(me) returns Trsf from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Trsf() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheRotation : Trsf from gp;
|
||||
|
||||
end MakeRotation;
|
55
src/gce/gce_MakeRotation.cxx
Executable file
55
src/gce/gce_MakeRotation.cxx
Executable file
@@ -0,0 +1,55 @@
|
||||
// File: gce_MakeRotation.cxx
|
||||
// Created: Thu Sep 3 17:18:54 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeRotation.ixx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une rotation 3d de gp d angle Angle par rapport a une +
|
||||
// droite Line. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeRotation::
|
||||
gce_MakeRotation(const gp_Lin& Line ,
|
||||
const Standard_Real Angle ) {
|
||||
TheRotation.SetRotation(gp_Ax1(Line.Position()),Angle);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une rotation 3d de gp d angle Angle par rapport a un +
|
||||
// axe Axis. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeRotation::
|
||||
gce_MakeRotation(const gp_Ax1& Axis ,
|
||||
const Standard_Real Angle ) {
|
||||
TheRotation.SetRotation(Axis,Angle);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une rotation 3d de gp d angle Angle par rapport a une +
|
||||
// droite issue du point Point et de direction Direc. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeRotation::
|
||||
gce_MakeRotation(const gp_Pnt& Point ,
|
||||
const gp_Dir& Direc ,
|
||||
const Standard_Real Angle ) {
|
||||
TheRotation.SetRotation(gp_Ax1(Point,Direc),Angle);
|
||||
}
|
||||
|
||||
const gp_Trsf& gce_MakeRotation::Value() const
|
||||
{
|
||||
return TheRotation;
|
||||
}
|
||||
|
||||
const gp_Trsf& gce_MakeRotation::Operator() const
|
||||
{
|
||||
return TheRotation;
|
||||
}
|
||||
|
||||
gce_MakeRotation::operator gp_Trsf() const
|
||||
{
|
||||
return TheRotation;
|
||||
}
|
42
src/gce/gce_MakeRotation2d.cdl
Executable file
42
src/gce/gce_MakeRotation2d.cdl
Executable file
@@ -0,0 +1,42 @@
|
||||
-- File: MakeRotation2d.cdl
|
||||
-- Created: Wed Aug 26 14:32:33 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeRotation2d
|
||||
|
||||
from gce
|
||||
|
||||
---Purpose: Implements an elementary construction algorithm for
|
||||
-- a rotation in 2D space. The result is a gp_Trsf2d transformation.
|
||||
-- A MakeRotation2d object provides a framework for:
|
||||
-- - defining the construction of the transformation,
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result.
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Trsf2d from gp,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Point : Pnt2d from gp ;
|
||||
Angle : Real from Standard) returns MakeRotation2d;
|
||||
---Purpose: Constructs a rotation through angle Angle about the center Point.
|
||||
|
||||
Value(me) returns Trsf2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed transformation.
|
||||
|
||||
Operator(me) returns Trsf2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Trsf2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheRotation2d : Trsf2d from gp;
|
||||
|
||||
end MakeRotation2d;
|
32
src/gce/gce_MakeRotation2d.cxx
Executable file
32
src/gce/gce_MakeRotation2d.cxx
Executable file
@@ -0,0 +1,32 @@
|
||||
// File: gce_MakeRotation2d.cxx
|
||||
// Created: Thu Sep 3 17:18:54 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeRotation2d.ixx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une rotation 2d de gp d angle Angle par rapport a un +
|
||||
// point Point. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeRotation2d::
|
||||
gce_MakeRotation2d(const gp_Pnt2d& Point ,
|
||||
const Standard_Real Angle ) {
|
||||
TheRotation2d.SetRotation(Point,Angle);
|
||||
}
|
||||
|
||||
const gp_Trsf2d& gce_MakeRotation2d::Value() const
|
||||
{
|
||||
return TheRotation2d;
|
||||
}
|
||||
|
||||
const gp_Trsf2d& gce_MakeRotation2d::Operator() const
|
||||
{
|
||||
return TheRotation2d;
|
||||
}
|
||||
|
||||
gce_MakeRotation2d::operator gp_Trsf2d() const
|
||||
{
|
||||
return TheRotation2d;
|
||||
}
|
45
src/gce/gce_MakeScale.cdl
Executable file
45
src/gce/gce_MakeScale.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: Scale.cdl
|
||||
-- Created: Wed Aug 26 14:35:24 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeScale
|
||||
|
||||
from gce
|
||||
|
||||
---Purpose: Implements an elementary construction algorithm for
|
||||
-- a scaling transformation in 3D space. The result is a gp_Trsf transformation.
|
||||
-- A MakeScale object provides a framework for:
|
||||
-- - defining the construction of the transformation,
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result.
|
||||
|
||||
uses Pnt from gp,
|
||||
Trsf from gp,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Point : Pnt from gp ;
|
||||
Scale : Real from Standard) returns MakeScale;
|
||||
---Purpose: Constructs a scaling transformation with
|
||||
-- - Point as the center of the transformation, and
|
||||
-- - Scale as the scale factor.
|
||||
|
||||
Value(me) returns Trsf from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed transformation.
|
||||
|
||||
Operator(me) returns Trsf from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Trsf() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheScale : Trsf from gp;
|
||||
|
||||
end MakeScale;
|
||||
|
31
src/gce/gce_MakeScale.cxx
Executable file
31
src/gce/gce_MakeScale.cxx
Executable file
@@ -0,0 +1,31 @@
|
||||
// File: gce_MakeScale.cxx
|
||||
// Created: Fri Sep 4 14:28:10 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeScale.ixx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un homothetie de gp de centre Point et de rapport Scale. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeScale::
|
||||
gce_MakeScale(const gp_Pnt& Point ,
|
||||
const Standard_Real Scale ) {
|
||||
TheScale.SetScale(Point,Scale);
|
||||
}
|
||||
|
||||
const gp_Trsf& gce_MakeScale::Value() const
|
||||
{
|
||||
return TheScale;
|
||||
}
|
||||
|
||||
const gp_Trsf& gce_MakeScale::Operator() const
|
||||
{
|
||||
return TheScale;
|
||||
}
|
||||
|
||||
gce_MakeScale::operator gp_Trsf() const
|
||||
{
|
||||
return TheScale;
|
||||
}
|
46
src/gce/gce_MakeScale2d.cdl
Executable file
46
src/gce/gce_MakeScale2d.cdl
Executable file
@@ -0,0 +1,46 @@
|
||||
-- File: Scale2d.cdl
|
||||
-- Created: Wed Aug 26 14:35:24 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeScale2d
|
||||
|
||||
from gce
|
||||
|
||||
---Purpose: This class implements an elementary construction algorithm for
|
||||
-- a scaling transformation in 2D space. The result is a gp_Trsf2d transformation.
|
||||
-- A MakeScale2d object provides a framework for:
|
||||
-- - defining the construction of the transformation,
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result.
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Trsf2d from gp,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Point : Pnt2d from gp ;
|
||||
Scale : Real from Standard) returns MakeScale2d;
|
||||
--- Purpose:
|
||||
-- Constructs a scaling transformation with:
|
||||
-- - Point as the center of the transformation, and
|
||||
-- - Scale as the scale factor.
|
||||
|
||||
Value(me) returns Trsf2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed transformation.
|
||||
|
||||
Operator(me) returns Trsf2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Trsf2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheScale2d : Trsf2d from gp;
|
||||
|
||||
end MakeScale2d;
|
||||
|
31
src/gce/gce_MakeScale2d.cxx
Executable file
31
src/gce/gce_MakeScale2d.cxx
Executable file
@@ -0,0 +1,31 @@
|
||||
// File: gce_MakeScale2d.cxx
|
||||
// Created: Thu Sep 3 17:18:54 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeScale2d.ixx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d un homothetie de gp de centre Point et de rapport Scale. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeScale2d::
|
||||
gce_MakeScale2d(const gp_Pnt2d& Point ,
|
||||
const Standard_Real Scale ) {
|
||||
TheScale2d.SetScale(Point,Scale);
|
||||
}
|
||||
|
||||
const gp_Trsf2d& gce_MakeScale2d::Value() const
|
||||
{
|
||||
return TheScale2d;
|
||||
}
|
||||
|
||||
const gp_Trsf2d& gce_MakeScale2d::Operator() const
|
||||
{
|
||||
return TheScale2d;
|
||||
}
|
||||
|
||||
gce_MakeScale2d::operator gp_Trsf2d() const
|
||||
{
|
||||
return TheScale2d;
|
||||
}
|
49
src/gce/gce_MakeTranslation.cdl
Executable file
49
src/gce/gce_MakeTranslation.cdl
Executable file
@@ -0,0 +1,49 @@
|
||||
-- File: Translation.cdl
|
||||
-- Created: Wed Aug 26 14:32:08 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeTranslation
|
||||
|
||||
from gce
|
||||
|
||||
---Purpose: This class implements elementary construction algorithms for a
|
||||
-- translation in 3D space. The result is a gp_Trsf transformation.
|
||||
-- A MakeTranslation object provides a framework for:
|
||||
-- - defining the construction of the transformation,
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result.
|
||||
|
||||
uses Pnt from gp,
|
||||
Trsf from gp,
|
||||
Vec from gp,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Vect : Vec from gp) returns MakeTranslation;
|
||||
--- Purpose: Constructs a translation along the vector " Vect"
|
||||
|
||||
Create(Point1 : Pnt from gp;
|
||||
Point2 : Pnt from gp) returns MakeTranslation;
|
||||
---Purpose: Constructs a translation along the vector
|
||||
-- (Point1,Point2) defined from the point Point1 to the point Point2.
|
||||
|
||||
Value(me) returns Trsf from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose:
|
||||
-- Returns the constructed transformation.
|
||||
|
||||
Operator(me) returns Trsf from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Trsf() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheTranslation : Trsf from gp;
|
||||
|
||||
end MakeTranslation;
|
||||
|
41
src/gce/gce_MakeTranslation.cxx
Executable file
41
src/gce/gce_MakeTranslation.cxx
Executable file
@@ -0,0 +1,41 @@
|
||||
// File: gce_MakeTranslation.cxx
|
||||
// Created: Thu Sep 3 17:18:54 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeTranslation.ixx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une translation 3d de gp de vecteur de tanslation Vec. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeTranslation::
|
||||
gce_MakeTranslation(const gp_Vec& Vec ) {
|
||||
TheTranslation.SetTranslation(Vec);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une translation 3d de gp de vecteur de tanslation le +
|
||||
// vecteur reliant Point1 a Point2. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeTranslation::
|
||||
gce_MakeTranslation(const gp_Pnt& Point1 ,
|
||||
const gp_Pnt& Point2 ) {
|
||||
TheTranslation.SetTranslation(gp_Vec(Point1,Point2));
|
||||
}
|
||||
|
||||
const gp_Trsf& gce_MakeTranslation::Value() const
|
||||
{
|
||||
return TheTranslation;
|
||||
}
|
||||
|
||||
const gp_Trsf& gce_MakeTranslation::Operator() const
|
||||
{
|
||||
return TheTranslation;
|
||||
}
|
||||
|
||||
gce_MakeTranslation::operator gp_Trsf() const
|
||||
{
|
||||
return TheTranslation;
|
||||
}
|
48
src/gce/gce_MakeTranslation2d.cdl
Executable file
48
src/gce/gce_MakeTranslation2d.cdl
Executable file
@@ -0,0 +1,48 @@
|
||||
-- File: Translation2d.cdl
|
||||
-- Created: Wed Aug 26 14:32:08 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
class MakeTranslation2d
|
||||
|
||||
from gce
|
||||
|
||||
---Purpose: This class implements elementary construction algorithms for a
|
||||
-- translation in 2D space. The result is a gp_Trsf2d transformation.
|
||||
-- A MakeTranslation2d object provides a framework for:
|
||||
-- - defining the construction of the transformation,
|
||||
-- - implementing the construction algorithm, and
|
||||
-- - consulting the result.
|
||||
|
||||
uses Pnt2d from gp,
|
||||
Trsf2d from gp,
|
||||
Vec2d from gp,
|
||||
Real from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(Vect : Vec2d from gp) returns MakeTranslation2d;
|
||||
---Purpose: Constructs a translation along the vector Vect.
|
||||
|
||||
Create(Point1 : Pnt2d from gp;
|
||||
Point2 : Pnt2d from gp) returns MakeTranslation2d;
|
||||
--- Purpose: Constructs a translation along the vector
|
||||
--- (Point1,Point2) defined from the point Point1 to the point Point2.
|
||||
|
||||
Value(me) returns Trsf2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---Purpose: Returns the constructed transformation.
|
||||
|
||||
Operator(me) returns Trsf2d from gp
|
||||
is static;
|
||||
---C++: return const&
|
||||
---C++: alias "Standard_EXPORT operator gp_Trsf2d() const;"
|
||||
|
||||
fields
|
||||
|
||||
TheTranslation2d : Trsf2d from gp;
|
||||
|
||||
end MakeTranslation2d;
|
||||
|
41
src/gce/gce_MakeTranslation2d.cxx
Executable file
41
src/gce/gce_MakeTranslation2d.cxx
Executable file
@@ -0,0 +1,41 @@
|
||||
// File: gce_MakeTranslation2d.cxx
|
||||
// Created: Thu Sep 3 17:18:54 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun1>
|
||||
|
||||
#include <gce_MakeTranslation2d.ixx>
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une translation 2d de gp de vecteur de tanslation Vec. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeTranslation2d::
|
||||
gce_MakeTranslation2d(const gp_Vec2d& Vec ) {
|
||||
TheTranslation2d.SetTranslation(Vec);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Creation d une translation 2d de gp de vecteur de tanslation le +
|
||||
// vecteur reliant Point1 a Point2. +
|
||||
//=========================================================================
|
||||
|
||||
gce_MakeTranslation2d::
|
||||
gce_MakeTranslation2d(const gp_Pnt2d& Point1 ,
|
||||
const gp_Pnt2d& Point2 ) {
|
||||
TheTranslation2d.SetTranslation(gp_Vec2d(Point1,Point2));
|
||||
}
|
||||
|
||||
const gp_Trsf2d& gce_MakeTranslation2d::Value() const
|
||||
{
|
||||
return TheTranslation2d;
|
||||
}
|
||||
|
||||
const gp_Trsf2d& gce_MakeTranslation2d::Operator() const
|
||||
{
|
||||
return TheTranslation2d;
|
||||
}
|
||||
|
||||
gce_MakeTranslation2d::operator gp_Trsf2d() const
|
||||
{
|
||||
return TheTranslation2d;
|
||||
}
|
38
src/gce/gce_Root.cdl
Executable file
38
src/gce/gce_Root.cdl
Executable file
@@ -0,0 +1,38 @@
|
||||
-- File: Root.cdl
|
||||
-- Created: Tue Sep 29 12:29:04 1992
|
||||
-- Author: Remi GILET
|
||||
-- <reg@sdsun2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
private deferred class Root from gce
|
||||
|
||||
---Purpose : This class implements the common services for
|
||||
-- all classes of gce which report error.
|
||||
|
||||
uses
|
||||
|
||||
ErrorType from gce
|
||||
|
||||
is
|
||||
|
||||
IsDone(me) returns Boolean
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose: Returns true if the construction is successful.
|
||||
|
||||
Status(me) returns ErrorType from gce
|
||||
is static;
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Returns the status of the construction:
|
||||
-- - gce_Done, if the construction is successful, or
|
||||
-- - another value of the gce_ErrorType enumeration
|
||||
-- indicating why the construction failed.
|
||||
|
||||
fields
|
||||
|
||||
TheError : ErrorType from gce is protected;
|
||||
---Purpose: Enumeration to know why the algorithm didn t succeed.
|
||||
|
||||
end Root;
|
||||
|
2
src/gce/gce_Root.cxx
Executable file
2
src/gce/gce_Root.cxx
Executable file
@@ -0,0 +1,2 @@
|
||||
#include <gce_Root.ixx>
|
||||
|
26
src/gce/gce_Root.lxx
Executable file
26
src/gce/gce_Root.lxx
Executable file
@@ -0,0 +1,26 @@
|
||||
// File: gce_Root.cxx
|
||||
// Created: Tue Sep 29 12:34:39 1992
|
||||
// Author: Remi GILET
|
||||
// <reg@sdsun2>
|
||||
|
||||
inline Standard_Boolean gce_Root::IsDone () const
|
||||
{
|
||||
return TheError == gce_Done;
|
||||
}
|
||||
|
||||
inline gce_ErrorType gce_Root::Status() const
|
||||
{
|
||||
return TheError;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user