mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
68
src/IntAna/IntAna.cdl
Executable file
68
src/IntAna/IntAna.cdl
Executable file
@@ -0,0 +1,68 @@
|
||||
-- File: IntAna.cdl
|
||||
-- Created: Tue Jun 30 17:11:11 1992
|
||||
-- Author: Laurent BUCHARD
|
||||
-- <lbr@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
package IntAna
|
||||
|
||||
---Purpose: This package provides the intersections between :
|
||||
--
|
||||
-- - Natural Quadrics when the result is a conic (QuadQuadGeo)
|
||||
--
|
||||
-- - A natural Quadric and a Quadric defined by its Coefficients
|
||||
-- (IntQuadQuad)
|
||||
--
|
||||
-- - 3 Pln (Int3Pln)
|
||||
--
|
||||
-- - a Line and a Torus (IntLinTorus)
|
||||
--
|
||||
-- - a Conic from gp and a Quadric defined by its Coefficients
|
||||
-- (IntConicQuad)
|
||||
--
|
||||
|
||||
---Level: Public
|
||||
--
|
||||
-- All the methods of the classes of this package are public.
|
||||
--
|
||||
|
||||
|
||||
uses TCollection, math, gp, StdFail, IntAna2d, GeomAbs
|
||||
|
||||
is
|
||||
|
||||
enumeration ResultType is Point,
|
||||
Line,
|
||||
Circle,
|
||||
PointAndCircle,
|
||||
Ellipse,
|
||||
Parabola,
|
||||
Hyperbola,
|
||||
Empty,
|
||||
Same,
|
||||
NoGeometricSolution;
|
||||
|
||||
|
||||
|
||||
class QuadQuadGeo;
|
||||
|
||||
class IntQuadQuad;
|
||||
|
||||
class Int3Pln;
|
||||
|
||||
class IntLinTorus;
|
||||
|
||||
class IntConicQuad;
|
||||
|
||||
class Curve;
|
||||
|
||||
class Quadric;
|
||||
--
|
||||
class ListOfCurve instantiates
|
||||
List from TCollection(Curve from IntAna);
|
||||
--
|
||||
end IntAna;
|
||||
|
||||
|
||||
|
236
src/IntAna/IntAna_Curve.cdl
Executable file
236
src/IntAna/IntAna_Curve.cdl
Executable file
@@ -0,0 +1,236 @@
|
||||
-- File: Curve.cdl
|
||||
-- Created: Tue Jun 30 15:41:37 1992
|
||||
-- Author: Laurent BUCHARD
|
||||
-- <lbr@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class Curve from IntAna
|
||||
|
||||
---Purpose: Definition of a parametric Curve which is the result
|
||||
-- of the intersection between two quadrics.
|
||||
|
||||
uses Pnt from gp,
|
||||
Vec from gp,
|
||||
Ax3 from gp,
|
||||
Cone from gp,
|
||||
Cylinder from gp,
|
||||
SurfaceType from GeomAbs
|
||||
|
||||
raises DomainError from Standard
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
---Purpose: Empty Constructor
|
||||
|
||||
returns Curve from IntAna;
|
||||
|
||||
|
||||
SetCylinderQuadValues(me :in out;
|
||||
Cylinder: Cylinder from gp;
|
||||
Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,Q1 : Real;
|
||||
Tol,DomInf,DomSup : Real;
|
||||
TwoZForATheta : Boolean from Standard;
|
||||
ZIsPositive : Boolean from Standard)
|
||||
|
||||
---Purpose: Sets the parameters used to compute Points and Derivative
|
||||
-- on the curve.
|
||||
|
||||
is static;
|
||||
|
||||
SetConeQuadValues(me :in out;
|
||||
Cone: Cone from gp;
|
||||
Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,Q1 : Real;
|
||||
Tol,DomInf,DomSup : Real;
|
||||
TwoZForATheta : Boolean from Standard;
|
||||
ZIsPositive : Boolean from Standard)
|
||||
|
||||
---Purpose: Sets the parameters used to compute Points and
|
||||
-- Derivative on the curve.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsOpen(me)
|
||||
|
||||
---Purpose: Returns TRUE if the curve is not infinite at the
|
||||
-- last parameter or at the first parameter of the domain.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Domain(me ; Theta1,Theta2 : out Real)
|
||||
|
||||
---Purpose: Returns the paramatric domain of the curve.
|
||||
|
||||
raises DomainError from Standard
|
||||
-- The exception DomainError is raised if IsRestricted
|
||||
-- returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsConstant(me)
|
||||
|
||||
---Purpose: Returns TRUE if the function is constant.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsFirstOpen(me)
|
||||
|
||||
---Purpose: Returns TRUE if the domain is open at the beginning.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsLastOpen(me)
|
||||
|
||||
---Purpose: Returns TRUE if the domain is open at the end.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Value(me: in out ;
|
||||
Theta: Real from Standard)
|
||||
|
||||
---Purpose: Returns the point at parameter Theta on the curve.
|
||||
|
||||
returns Pnt from gp
|
||||
|
||||
raises DomainError from Standard
|
||||
-- The exception DomainError is raised if Theta is not in
|
||||
-- the domain.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
D1u(me: in out ; Theta: Real from Standard;
|
||||
P: out Pnt from gp; V: out Vec from gp)
|
||||
|
||||
---Purpose: Returns the point and the first derivative at parameter
|
||||
-- Theta on the curve.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
raises DomainError from Standard
|
||||
-- The exception DomainError is raised if Theta is not in
|
||||
-- the domain.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
FindParameter(me; P: Pnt from gp; Para: out Real from Standard)
|
||||
|
||||
---Purpose: Tries to find the parameter of the point P on the curve.
|
||||
-- If the method returns False, the "projection" is
|
||||
-- impossible, and the value of Para is not significant.
|
||||
-- If the method returns True, Para is the parameter of the
|
||||
-- nearest intersection between the curve and the iso-theta
|
||||
-- containing P.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
---------------------------------------------------------------
|
||||
--
|
||||
-- Implementation :
|
||||
--
|
||||
|
||||
|
||||
SetIsFirstOpen(me : in out; Flag: Boolean from Standard)
|
||||
|
||||
---Purpose: If flag is True, the Curve is not defined at the
|
||||
-- first parameter of its domain.
|
||||
--
|
||||
is static;
|
||||
|
||||
SetIsLastOpen(me : in out; Flag: Boolean from Standard)
|
||||
|
||||
---Purpose: If flag is True, the Curve is not defined at the
|
||||
-- first parameter of its domain.
|
||||
is static;
|
||||
|
||||
|
||||
InternalValue(me; Theta1,Theta2: Real from Standard)
|
||||
|
||||
---Purpose: Protected function.
|
||||
|
||||
returns Pnt from gp
|
||||
|
||||
is static protected;
|
||||
|
||||
|
||||
InternalUVValue(me; Param: Real from Standard;
|
||||
U,V,A,B,C,Co,Si,Di: out Real from Standard)
|
||||
|
||||
---Purpose: Protected function.
|
||||
|
||||
is static;
|
||||
|
||||
--
|
||||
SetDomain(me:out;
|
||||
Theta1:Real from Standard;
|
||||
Theta2:Real from Standard)
|
||||
raises DomainError from Standard;
|
||||
--
|
||||
|
||||
fields
|
||||
|
||||
Z0Cte: Real from Standard;
|
||||
Z0Sin: Real from Standard;
|
||||
Z0Cos: Real from Standard;
|
||||
Z0SinSin: Real from Standard;
|
||||
Z0CosCos: Real from Standard;
|
||||
Z0CosSin: Real from Standard;
|
||||
|
||||
Z1Cte: Real from Standard;
|
||||
Z1Sin: Real from Standard;
|
||||
Z1Cos: Real from Standard;
|
||||
Z1SinSin: Real from Standard;
|
||||
Z1CosCos: Real from Standard;
|
||||
Z1CosSin: Real from Standard;
|
||||
|
||||
Z2Cte: Real from Standard;
|
||||
Z2Sin: Real from Standard;
|
||||
Z2Cos: Real from Standard;
|
||||
Z2SinSin: Real from Standard;
|
||||
Z2CosCos: Real from Standard;
|
||||
Z2CosSin: Real from Standard;
|
||||
|
||||
TwoCurves : Boolean from Standard;
|
||||
TakeZPositive : Boolean from Standard;
|
||||
Tolerance : Real from Standard;
|
||||
DomainInf : Real from Standard;
|
||||
DomainSup : Real from Standard;
|
||||
|
||||
RestrictedInf : Boolean from Standard;
|
||||
RestrictedSup : Boolean from Standard;
|
||||
|
||||
|
||||
LastZ : Real from Standard;
|
||||
LastDZ : Real from Standard;
|
||||
|
||||
firstbounded : Boolean from Standard;
|
||||
lastbounded : Boolean from Standard;
|
||||
|
||||
|
||||
typequadric : SurfaceType from GeomAbs;
|
||||
|
||||
RCyl : Real from Standard;
|
||||
Angle : Real from Standard;
|
||||
Ax3 : Ax3 from gp;
|
||||
|
||||
end Curve;
|
569
src/IntAna/IntAna_Curve.cxx
Executable file
569
src/IntAna/IntAna_Curve.cxx
Executable file
@@ -0,0 +1,569 @@
|
||||
// File: IntAna_Curve.cxx
|
||||
// Created: Tue Jun 30 10:40:07 1992
|
||||
// Author: Laurent BUCHARD
|
||||
// <lbr@topsn3>
|
||||
|
||||
#ifndef DEB
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Differents constructeurs sont proposes qui correspondent aux
|
||||
//-- polynomes en Z :
|
||||
//-- A(Sin(Theta),Cos(Theta)) Z**2
|
||||
//-- + B(Sin(Theta),Cos(Theta)) Z
|
||||
//-- + C(Sin(Theta),Cos(Theta))
|
||||
//--
|
||||
//-- Une Courbe est definie sur un domaine
|
||||
//--
|
||||
//-- Value retourne le point de parametre U(Theta),V(Theta)
|
||||
//-- ou V est la solution du polynome A V**2 + B V + C
|
||||
//-- (Selon les cas, on prend V+ ou V-)
|
||||
//--
|
||||
//-- D1u calcule le vecteur tangent a la courbe
|
||||
//-- et retourne le booleen Standard_False si ce calcul ne peut
|
||||
//-- pas etre mene a bien.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <IntAna_Curve.ixx>
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <math_DirectPolynomialRoots.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntAna_Curve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntAna_Curve::IntAna_Curve()
|
||||
{
|
||||
typequadric=GeomAbs_OtherSurface;
|
||||
firstbounded=Standard_False;
|
||||
lastbounded=Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetConeQuadValues
|
||||
//purpose : Description de l intersection Cone Quadrique
|
||||
//=======================================================================
|
||||
void IntAna_Curve::SetConeQuadValues(const gp_Cone& Cone,
|
||||
const Standard_Real Qxx,
|
||||
const Standard_Real Qyy,
|
||||
const Standard_Real Qzz,
|
||||
const Standard_Real Qxy,
|
||||
const Standard_Real Qxz,
|
||||
const Standard_Real Qyz,
|
||||
const Standard_Real Qx,
|
||||
const Standard_Real Qy,
|
||||
const Standard_Real Qz,
|
||||
const Standard_Real Q1,
|
||||
const Standard_Real TOL,
|
||||
const Standard_Real DomInf,
|
||||
const Standard_Real DomSup,
|
||||
const Standard_Boolean twocurves,
|
||||
const Standard_Boolean takezpositive)
|
||||
{
|
||||
|
||||
Ax3 = Cone.Position();
|
||||
RCyl = Cone.RefRadius();
|
||||
|
||||
Angle = Cone.SemiAngle();
|
||||
Standard_Real UnSurTgAngle = 1.0/(Tan(Cone.SemiAngle()));
|
||||
|
||||
typequadric= GeomAbs_Cone;
|
||||
|
||||
TwoCurves = twocurves; //-- deux Z pour un meme parametre
|
||||
TakeZPositive = takezpositive; //-- Prendre sur la courbe le Z Positif
|
||||
//-- ( -B + Sqrt()) et non (-B - Sqrt())
|
||||
|
||||
|
||||
Z0Cte = Q1; //-- Attention On a Z?Cos Cos(t)
|
||||
Z0Sin = 0.0; //-- et Non 2 Z?Cos Cos(t) !!!
|
||||
Z0Cos = 0.0; //-- Ce pour tous les Parametres
|
||||
Z0CosCos = 0.0; //-- ie pas de Coefficient 2
|
||||
Z0SinSin = 0.0; //-- devant les termes CS C S
|
||||
Z0CosSin = 0.0;
|
||||
|
||||
Z1Cte = 2.0*(UnSurTgAngle)*Qz;
|
||||
Z1Sin = Qy+Qy;
|
||||
Z1Cos = Qx+Qx;
|
||||
Z1CosCos = 0.0;
|
||||
Z1SinSin = 0.0;
|
||||
Z1CosSin = 0.0;
|
||||
|
||||
Z2Cte = Qzz * UnSurTgAngle*UnSurTgAngle;
|
||||
Z2Sin = (UnSurTgAngle+UnSurTgAngle)*Qyz;
|
||||
Z2Cos = (UnSurTgAngle+UnSurTgAngle)*Qxz;
|
||||
Z2CosCos = Qxx;
|
||||
Z2SinSin = Qyy;
|
||||
Z2CosSin = Qxy+Qxy;
|
||||
|
||||
Tolerance = TOL;
|
||||
DomainInf = DomInf;
|
||||
DomainSup = DomSup;
|
||||
|
||||
RestrictedInf = RestrictedSup = Standard_True; //-- Le Domaine est Borne
|
||||
firstbounded = lastbounded = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetCylinderQuadValues
|
||||
//purpose : Description de l intersection Cylindre Quadrique
|
||||
//=======================================================================
|
||||
void IntAna_Curve::SetCylinderQuadValues(const gp_Cylinder& Cyl,
|
||||
const Standard_Real Qxx,
|
||||
const Standard_Real Qyy,
|
||||
const Standard_Real Qzz,
|
||||
const Standard_Real Qxy,
|
||||
const Standard_Real Qxz,
|
||||
const Standard_Real Qyz,
|
||||
const Standard_Real Qx,
|
||||
const Standard_Real Qy,
|
||||
const Standard_Real Qz,
|
||||
const Standard_Real Q1,
|
||||
const Standard_Real TOL,
|
||||
const Standard_Real DomInf,
|
||||
const Standard_Real DomSup,
|
||||
const Standard_Boolean twocurves,
|
||||
const Standard_Boolean takezpositive)
|
||||
{
|
||||
|
||||
Ax3 = Cyl.Position();
|
||||
RCyl = Cyl.Radius();
|
||||
typequadric= GeomAbs_Cylinder;
|
||||
|
||||
TwoCurves = twocurves; //-- deux Z pour un meme parametre
|
||||
TakeZPositive = takezpositive; //-- Prendre sur la courbe le Z Positif
|
||||
Standard_Real RCylmul2 = RCyl+RCyl; //-- ( -B + Sqrt())
|
||||
|
||||
Z0Cte = Q1;
|
||||
Z0Sin = RCylmul2*Qy;
|
||||
Z0Cos = RCylmul2*Qx;
|
||||
Z0CosCos = Qxx*RCyl*RCyl;
|
||||
Z0SinSin = Qyy*RCyl*RCyl;
|
||||
Z0CosSin = RCylmul2*RCyl*Qxy;
|
||||
|
||||
Z1Cte = Qz+Qz;
|
||||
Z1Sin = RCylmul2*Qyz;
|
||||
Z1Cos = RCylmul2*Qxz;
|
||||
Z1CosCos = 0.0;
|
||||
Z1SinSin = 0.0;
|
||||
Z1CosSin = 0.0;
|
||||
|
||||
Z2Cte = Qzz;
|
||||
Z2Sin = 0.0;
|
||||
Z2Cos = 0.0;
|
||||
Z2CosCos = 0.0;
|
||||
Z2SinSin = 0.0;
|
||||
Z2CosSin = 0.0;
|
||||
|
||||
Tolerance = TOL;
|
||||
DomainInf = DomInf;
|
||||
DomainSup = DomSup;
|
||||
|
||||
RestrictedInf = RestrictedSup = Standard_True;
|
||||
firstbounded = lastbounded = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsOpen
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntAna_Curve::IsOpen() const
|
||||
{
|
||||
return(RestrictedInf && RestrictedSup);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Domain
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntAna_Curve::Domain(Standard_Real& DInf,
|
||||
Standard_Real& DSup) const
|
||||
{
|
||||
if(RestrictedInf && RestrictedSup) {
|
||||
DInf=DomainInf;
|
||||
DSup=DomainSup;
|
||||
if(TwoCurves) {
|
||||
DSup+=DSup-DInf;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Standard_DomainError::Raise("IntAna_Curve::Domain");
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsConstant
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntAna_Curve::IsConstant() const
|
||||
{
|
||||
//-- ??? Pas facile de decider a la seule vue des Param.
|
||||
return(Standard_False);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsFirstOpen
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntAna_Curve::IsFirstOpen() const
|
||||
{
|
||||
return(firstbounded);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsLastOpen
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntAna_Curve::IsLastOpen() const
|
||||
{
|
||||
return(lastbounded);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetIsFirstOpen
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntAna_Curve::SetIsFirstOpen(const Standard_Boolean Flag)
|
||||
{
|
||||
firstbounded = Flag;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetIsLastOpen
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntAna_Curve::SetIsLastOpen(const Standard_Boolean Flag)
|
||||
{
|
||||
lastbounded = Flag;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InternalUVValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntAna_Curve::InternalUVValue(const Standard_Real theta,
|
||||
Standard_Real& Param1,
|
||||
Standard_Real& Param2,
|
||||
Standard_Real& A,
|
||||
Standard_Real& B,
|
||||
Standard_Real& C,
|
||||
Standard_Real& cost,
|
||||
Standard_Real& sint,
|
||||
Standard_Real& SigneSqrtDis) const
|
||||
{
|
||||
Standard_Real Theta=theta;
|
||||
Standard_Boolean SecondSolution=Standard_False;
|
||||
|
||||
if((Theta<DomainInf) ||
|
||||
((Theta>DomainSup) && (!TwoCurves)) ||
|
||||
(Theta>(DomainSup+DomainSup-DomainInf+0.00000000000001))) {
|
||||
Standard_DomainError::Raise("IntAna_Curve::Domain");
|
||||
}
|
||||
|
||||
if(Theta>DomainSup) {
|
||||
Theta=DomainSup+DomainSup-Theta;
|
||||
SecondSolution=Standard_True;
|
||||
}
|
||||
|
||||
Param1=Theta;
|
||||
|
||||
if(!TwoCurves) {
|
||||
SecondSolution=TakeZPositive;
|
||||
}
|
||||
//
|
||||
cost = Cos(Theta);
|
||||
sint = Sin(Theta);
|
||||
Standard_Real costsint = cost*sint;
|
||||
|
||||
A=Z2Cte+sint*(Z2Sin+sint*Z2SinSin)+cost*(Z2Cos+cost*Z2CosCos)
|
||||
+Z2CosSin*costsint;
|
||||
|
||||
B=Z1Cte+sint*(Z1Sin+sint*Z1SinSin)+cost*(Z1Cos+cost*Z1CosCos)
|
||||
+Z1CosSin*costsint;
|
||||
|
||||
C=Z0Cte+sint*(Z0Sin+sint*Z0SinSin)+cost*(Z0Cos+cost*Z0CosCos)
|
||||
+Z0CosSin*costsint;
|
||||
|
||||
|
||||
Standard_Real Discriminant = B*B-4.0*A*C;
|
||||
|
||||
if(Abs(A)<=0.000000001) {
|
||||
//-- cout<<" IntAna_Curve:: Internal UV Value : A="<<A<<" -> Abs(A)="<<Abs(A)<<endl;
|
||||
if(Abs(B)<=0.0000000001) {
|
||||
//-- cout<<" Probleme : Pas de solutions "<<endl;
|
||||
Param2=0.0;
|
||||
}
|
||||
else {
|
||||
//modified by NIZNHY-PKV Fri Dec 2 16:02:46 2005f
|
||||
Param2 = -C/B;
|
||||
/*
|
||||
if(!SecondSolution) {
|
||||
//-- Cas Param2 = (-B+Sqrt(Discriminant))/(A+A);
|
||||
//-- = (-B+Sqrt(B**2 - Eps)) / 2A
|
||||
//-- = -C / B
|
||||
Param2 = -C/B;
|
||||
}
|
||||
else {
|
||||
//-- Cas Param2 = (-B-Sqrt(Discriminant))/(A+A);
|
||||
//-- = (-B-Sqrt(B**2 - Eps)) / 2A
|
||||
if(A) {
|
||||
Param2 = -B/A;
|
||||
}
|
||||
else {
|
||||
Param2 = -B*10000000.0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
//modified by NIZNHY-PKV Fri Dec 2 16:02:54 2005t
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(Discriminant<=0.0000000001 ||
|
||||
Abs(Discriminant/(4*A))<=0.0000000001) Discriminant=0.0;
|
||||
SigneSqrtDis = (SecondSolution)? Sqrt(Discriminant)
|
||||
: -Sqrt(Discriminant);
|
||||
Param2=(-B+SigneSqrtDis)/(A+A);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt IntAna_Curve::Value(const Standard_Real theta)
|
||||
{
|
||||
Standard_Real A, B, C, U, V, sint, cost, SigneSqrtDis;
|
||||
//
|
||||
A=0.0; B=0.0; C=0.0;
|
||||
U=0.0; V=0.0;
|
||||
sint=0.0; cost=0.0;
|
||||
SigneSqrtDis=0.0;
|
||||
InternalUVValue(theta,U,V,A,B,C,cost,sint,SigneSqrtDis);
|
||||
//-- checked the parameter U and Raises Domain Error if Error
|
||||
return(InternalValue(U,V));
|
||||
}
|
||||
//=======================================================================
|
||||
//function : D1u
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntAna_Curve::D1u(const Standard_Real theta,
|
||||
gp_Pnt& Pt,
|
||||
gp_Vec& Vec)
|
||||
{
|
||||
//-- Pour detecter le cas ou le calcul est impossible
|
||||
Standard_Real A, B, C, U, V, sint, cost, SigneSqrtDis;
|
||||
A=0.0; B=0.0; C=0.0;
|
||||
U=0.0; V=0.0;
|
||||
sint=0.0; cost=0.0;
|
||||
//
|
||||
InternalUVValue(theta,U,V,A,B,C,cost,sint,SigneSqrtDis);
|
||||
//
|
||||
Pt = Value(theta);
|
||||
if(Abs(SigneSqrtDis)<0.0000000001 || Abs(A)<0.0000001) return(Standard_False);
|
||||
|
||||
|
||||
//-- Approximation de la derivee (mieux que le calcul mathematique!)
|
||||
Standard_Real dtheta = (DomainSup-DomainInf)*0.000001;
|
||||
Standard_Real theta2 = theta+dtheta;
|
||||
if((theta2<DomainInf) || ((theta2>DomainSup) && (!TwoCurves))
|
||||
|| (theta2>(DomainSup+DomainSup-DomainInf+0.00000000000001))) {
|
||||
dtheta = -dtheta;
|
||||
theta2 = theta+dtheta;
|
||||
}
|
||||
gp_Pnt P2 = Value(theta2);
|
||||
dtheta = 1.0/dtheta;
|
||||
Vec.SetCoord((P2.X()-Pt.X())*dtheta,
|
||||
(P2.Y()-Pt.Y())*dtheta,
|
||||
(P2.Z()-Pt.Z())*dtheta);
|
||||
|
||||
return(Standard_True);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FindParameter
|
||||
//purpose : Para est en sortie le parametre sur la courbe
|
||||
//=======================================================================
|
||||
Standard_Boolean IntAna_Curve::FindParameter (const gp_Pnt& P,
|
||||
Standard_Real& Para) const
|
||||
{
|
||||
Standard_Real theta,z, aTolPrecision=0.0001;
|
||||
Standard_Real PIpPI = Standard_PI+Standard_PI;
|
||||
//
|
||||
switch (typequadric) {
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
ElSLib::CylinderParameters(Ax3,RCyl,P,theta,z);
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cone :
|
||||
{
|
||||
ElSLib::ConeParameters(Ax3,RCyl,Angle,P,theta,z);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//
|
||||
Standard_Real epsAng = 1.e-8;
|
||||
Standard_Real tmin = DomainInf;
|
||||
Standard_Real tmax = DomainSup;
|
||||
Standard_Real U,V,A,B,C,sint,cost,SigneSqrtDis;
|
||||
Standard_Real z1,z2;
|
||||
|
||||
A=0.0; B=0.0; C=0.0;
|
||||
U=0.0; V=0.0;
|
||||
sint=0.0; cost=0.0;
|
||||
SigneSqrtDis=0.0;
|
||||
//U=V=A=B=C=sint=cost=SigneSqrtDis=0.0;
|
||||
//
|
||||
if (!firstbounded && tmin > theta && (tmin-theta) <= epsAng) {
|
||||
theta = tmin;
|
||||
}
|
||||
else if (!lastbounded && theta > tmax && (theta-tmax) <= epsAng) {
|
||||
theta = tmax;
|
||||
}
|
||||
//
|
||||
if (theta < tmin ) {
|
||||
theta = theta + PIpPI;
|
||||
}
|
||||
else if (theta > tmax) {
|
||||
theta = theta - PIpPI;
|
||||
}
|
||||
if (theta < tmin || theta > tmax) {
|
||||
if(theta>tmax) {
|
||||
InternalUVValue(tmax,U,V,A,B,C,cost,sint,SigneSqrtDis);
|
||||
gp_Pnt PMax(InternalValue(U,V));
|
||||
if(PMax.Distance(P) < aTolPrecision) {
|
||||
Para = tmax;
|
||||
return(Standard_True);
|
||||
}
|
||||
}
|
||||
if(theta<tmin) {
|
||||
InternalUVValue(tmin,U,V,A,B,C,cost,sint,SigneSqrtDis);
|
||||
gp_Pnt PMin(InternalValue(U,V));
|
||||
if(PMin.Distance(P) < aTolPrecision) {
|
||||
Para = tmin;
|
||||
return(Standard_True);
|
||||
}
|
||||
}
|
||||
//-- lbr le 14 Fev 96 : On teste malgre tout si le point n est pas le
|
||||
//-- point de debut ou de fin
|
||||
//-- cout<<"False 1 "<<endl;
|
||||
// theta = tmin; le 25 Nov 96
|
||||
}
|
||||
|
||||
if (TwoCurves) {
|
||||
if(theta > tmax)
|
||||
theta = tmax;
|
||||
if(theta < tmin)
|
||||
theta = tmin;
|
||||
InternalUVValue(theta,U,z1,A,B,C,cost,sint,SigneSqrtDis);
|
||||
A = B = C = sint = cost = SigneSqrtDis = 0.0;
|
||||
InternalUVValue(tmax+tmax - theta,U,z2,A,B,C,cost,sint,SigneSqrtDis);
|
||||
|
||||
if (Abs(z-z1) <= Abs(z-z2)) {
|
||||
Para = theta;
|
||||
}
|
||||
else {
|
||||
Para = tmax+tmax - theta;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Para = theta;
|
||||
}
|
||||
|
||||
if((Para<DomainInf) || ((Para>DomainSup) && (!TwoCurves))
|
||||
|| (Para>(DomainSup+DomainSup-DomainInf+0.00000000000001))) {
|
||||
return(Standard_False);
|
||||
}
|
||||
|
||||
InternalUVValue(Para,U,V,A,B,C,cost,sint,SigneSqrtDis);
|
||||
gp_Pnt PPara = InternalValue(U,V);
|
||||
Standard_Real Dist = PPara.Distance(P);
|
||||
if(Dist > aTolPrecision) {
|
||||
//-- Il y a eu un probleme
|
||||
//-- On teste si le point est un point double
|
||||
InternalUVValue(tmin,U,V,A,B,C,cost,sint,SigneSqrtDis);
|
||||
PPara = InternalValue(U,V);
|
||||
Dist = PPara.Distance(P);
|
||||
if(Dist <= aTolPrecision) {
|
||||
Para = tmin;
|
||||
return(Standard_True);
|
||||
}
|
||||
|
||||
InternalUVValue(tmax,U,V,A,B,C,cost,sint,SigneSqrtDis);
|
||||
PPara = InternalValue(U,V);
|
||||
Dist = PPara.Distance(P);
|
||||
if(Dist <= aTolPrecision) {
|
||||
Para = tmax;
|
||||
return(Standard_True);
|
||||
}
|
||||
if (TwoCurves) {
|
||||
Standard_Real Theta = DomainSup+DomainSup-DomainInf;
|
||||
InternalUVValue(Theta,U,V,A,B,C,cost,sint,SigneSqrtDis);
|
||||
PPara = InternalValue(U,V);
|
||||
Dist = PPara.Distance(P);
|
||||
if(Dist <= aTolPrecision) {
|
||||
Para = Theta;
|
||||
return(Standard_True);
|
||||
}
|
||||
}
|
||||
return(Standard_False);
|
||||
}
|
||||
return(Standard_True);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : InternalValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt IntAna_Curve::InternalValue(const Standard_Real U,
|
||||
const Standard_Real _V) const
|
||||
{
|
||||
//-- cout<<" ["<<U<<","<<V<<"]";
|
||||
Standard_Real V = _V;
|
||||
if(V > 100000.0 ) { V= 100000.0; }
|
||||
if(V < -100000.0 ) { V=-100000.0; }
|
||||
|
||||
switch(typequadric) {
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
//------------------------------------------------
|
||||
//-- Parametrage : X = V * Cos(U) ---
|
||||
//-- Y = V * Sin(U) ---
|
||||
//-- Z = (V-RCyl) / Tan(SemiAngle)--
|
||||
//------------------------------------------------
|
||||
//-- Angle Vaut Cone.SemiAngle()
|
||||
return(ElSLib::ConeValue(U,(V-RCyl)/Sin(Angle),Ax3,RCyl,Angle));
|
||||
}
|
||||
break;
|
||||
|
||||
case GeomAbs_Cylinder:
|
||||
return(ElSLib::CylinderValue(U,V,Ax3,RCyl));
|
||||
case GeomAbs_Sphere:
|
||||
return(ElSLib::SphereValue(U,V,Ax3,RCyl));
|
||||
default:
|
||||
return(gp_Pnt(0.0,0.0,0.0));
|
||||
}
|
||||
return(gp_Pnt(0.0,0.0,0.0));
|
||||
}
|
||||
|
||||
//
|
||||
//=======================================================================
|
||||
//function : SetDomain
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntAna_Curve::SetDomain(const Standard_Real DInf,
|
||||
const Standard_Real DSup)
|
||||
{
|
||||
if(DInf>=DSup) {
|
||||
Standard_DomainError::Raise("IntAna_Curve::Domain");
|
||||
}
|
||||
//
|
||||
DomainInf=DInf;
|
||||
DomainSup=DSup;
|
||||
}
|
89
src/IntAna/IntAna_Int3Pln.cdl
Executable file
89
src/IntAna/IntAna_Int3Pln.cdl
Executable file
@@ -0,0 +1,89 @@
|
||||
-- File: Int3Pln.cdl
|
||||
-- Created: Thu May 16 17:29:06 1991
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@topsn3>
|
||||
---Copyright: Matra Datavision 1991
|
||||
|
||||
|
||||
|
||||
class Int3Pln from IntAna
|
||||
|
||||
---Purpose: Intersection between 3 planes. The algorithm searches
|
||||
-- for an intersection point. If two of the planes are
|
||||
-- parallel or identical, IsEmpty returns TRUE.
|
||||
|
||||
uses Pln from gp,
|
||||
Pnt from gp
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
returns Int3Pln from IntAna;
|
||||
|
||||
|
||||
Create(P1,P2,P3 : Pln from gp)
|
||||
|
||||
---Purpose: Determination of the intersection point between
|
||||
-- 3 planes.
|
||||
|
||||
returns Int3Pln from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out; P1,P2,P3 : Pln from gp)
|
||||
|
||||
---Purpose: Determination of the intersection point between
|
||||
-- 3 planes.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns True if the computation was successful.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
IsEmpty(me)
|
||||
|
||||
---Purpose: Returns TRUE if there is no intersection POINT.
|
||||
-- If 2 planes are identical or parallel, IsEmpty
|
||||
-- will return TRUE.
|
||||
|
||||
returns Boolean from Standard
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail
|
||||
--- The exception NotDone is raised when IsDone() returns False.
|
||||
is static;
|
||||
|
||||
|
||||
Value(me)
|
||||
|
||||
---Purpose: Returns the intersection point.
|
||||
|
||||
returns Pnt from gp
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard
|
||||
--- The exception NotDone is raised when IsDone() returns False.
|
||||
--- The exception Domain is raised when IsEmpty() returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
done: Boolean from Standard;
|
||||
empt: Boolean from Standard;
|
||||
pnt : Pnt from gp;
|
||||
|
||||
end Int3Pln;
|
52
src/IntAna/IntAna_Int3Pln.cxx
Executable file
52
src/IntAna/IntAna_Int3Pln.cxx
Executable file
@@ -0,0 +1,52 @@
|
||||
//-- File : IntAna_Int3Pln.cxx
|
||||
|
||||
|
||||
#ifndef DEB
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
#include <IntAna_Int3Pln.ixx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <math_Gauss.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <gp.hxx>
|
||||
|
||||
IntAna_Int3Pln::IntAna_Int3Pln () : done(Standard_False) {}
|
||||
|
||||
|
||||
IntAna_Int3Pln::IntAna_Int3Pln (const gp_Pln& P1, const gp_Pln& P2,
|
||||
const gp_Pln& P3) {
|
||||
|
||||
Perform(P1,P2,P3);
|
||||
}
|
||||
|
||||
void IntAna_Int3Pln::Perform (const gp_Pln& P1, const gp_Pln& P2,
|
||||
const gp_Pln& P3) {
|
||||
|
||||
done=Standard_False;
|
||||
static math_Matrix M(1,3,1,3);
|
||||
static math_Vector V(1,3);
|
||||
|
||||
P1.Coefficients(M(1,1),M(1,2),M(1,3),V(1));
|
||||
P2.Coefficients(M(2,1),M(2,2),M(2,3),V(2));
|
||||
P3.Coefficients(M(3,1),M(3,2),M(3,3),V(3));
|
||||
|
||||
math_Gauss Resol(M,gp::Resolution());
|
||||
|
||||
if (!Resol.IsDone()) {
|
||||
empt=Standard_True;
|
||||
}
|
||||
else {
|
||||
empt=Standard_False;
|
||||
V=-V;
|
||||
Resol.Solve(V);
|
||||
pnt.SetCoord(V(1),V(2),V(3));
|
||||
}
|
||||
done=Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
22
src/IntAna/IntAna_Int3Pln.lxx
Executable file
22
src/IntAna/IntAna_Int3Pln.lxx
Executable file
@@ -0,0 +1,22 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
|
||||
inline Standard_Boolean IntAna_Int3Pln::IsDone () const {
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntAna_Int3Pln::IsEmpty () const {
|
||||
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return empt;
|
||||
}
|
||||
|
||||
inline const gp_Pnt& IntAna_Int3Pln::Value () const {
|
||||
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
if (empt) {Standard_DomainError::Raise();}
|
||||
return pnt;
|
||||
}
|
||||
|
345
src/IntAna/IntAna_IntConicQuad.cdl
Executable file
345
src/IntAna/IntAna_IntConicQuad.cdl
Executable file
@@ -0,0 +1,345 @@
|
||||
-- File: IntConicQuad.cdl
|
||||
-- Created: Thu Aug 6 10:51:07 1992
|
||||
-- Author: Laurent BUCHARD
|
||||
-- <lbr@sdsun2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class IntConicQuad from IntAna
|
||||
|
||||
---Purpose: This class provides the analytic intersection between
|
||||
-- a conic defined as an element of gp (Lin,Circ,Elips,
|
||||
-- Parab,Hypr) and a quadric as defined in the class
|
||||
-- Quadric from IntAna.
|
||||
-- The intersection between a conic and a plane is treated
|
||||
-- as a special case.
|
||||
--
|
||||
-- The result of the intersection are points (Pnt from
|
||||
-- gp), associated with the parameter on the conic.
|
||||
--
|
||||
-- A call to an Intersection L:Lin from gp and
|
||||
-- SPH: Sphere from gp can be written either :
|
||||
-- IntAna_IntConicQuad Inter(L,IntAna_Quadric(SPH))
|
||||
-- or :
|
||||
-- IntAna_IntConicQuad Inter(L,SPH) (it is necessary
|
||||
-- to include IntAna_Quadric.hxx in this case)
|
||||
|
||||
|
||||
|
||||
uses Pnt from gp,
|
||||
Lin from gp,
|
||||
Circ from gp,
|
||||
Elips from gp,
|
||||
Parab from gp,
|
||||
Hypr from gp,
|
||||
Pln from gp,
|
||||
Quadric from IntAna
|
||||
|
||||
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard,
|
||||
DomainError from Standard
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create
|
||||
|
||||
---Purpose: Empty constructor.
|
||||
--
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
|
||||
Create(L: Lin from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Creates the intersection between a line and a quadric.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me:in out; L: Lin from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Intersects a line and a quadric.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(C: Circ from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Creates the intersection between a circle and a quadric.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out; C: Circ from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Intersects a circle and a quadric.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(E: Elips from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Creates the intersection between an ellipse and a quadric.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me:in out; E: Elips from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Intersects an ellipse and a quadric.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(P: Parab from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Creates the intersection between a parabola and a quadric.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me:in out; P: Parab from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Intersects a parabola and a quadric.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(H: Hypr from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Creates the intersection between an hyperbola and
|
||||
-- a quadric.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me:in out; H: Hypr from gp; Q: Quadric from IntAna)
|
||||
|
||||
---Purpose: Intersects an hyperbola and a quadric.
|
||||
|
||||
is static;
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- Intersection between a Conic from gp and a Pln from IntAna
|
||||
-- The intersection is computed with Tolerances.
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Create(L : Lin from gp; P: Pln from gp;
|
||||
Tolang: Real from Standard)
|
||||
|
||||
---Purpose: Intersection between a line and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
L : Lin from gp; P: Pln from gp; Tolang: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a line and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(C : Circ from gp; P: Pln from gp;
|
||||
Tolang,Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersection between a circle and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
-- Tol is used to determine if a distance is null.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
C : Circ from gp; P: Pln from gp; Tolang,Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a circle and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
-- Tol is used to determine if a distance is null.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(E : Elips from gp; P: Pln from gp;
|
||||
Tolang,Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersection between an ellipse and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
-- Tol is used to determine if a distance is null.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
E : Elips from gp; P: Pln from gp; Tolang,Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects an ellipse and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
-- Tol is used to determine if a distance is null.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(Pb: Parab from gp; P: Pln from gp;
|
||||
Tolang: Real from Standard)
|
||||
|
||||
---Purpose: Intersection between a parabola and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
Pb: Parab from gp; P: Pln from gp; Tolang: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a parabola and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(H : Hypr from gp; P: Pln from gp;
|
||||
Tolang: Real from Standard)
|
||||
|
||||
---Purpose: Intersection between an hyperbola and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
|
||||
returns IntConicQuad from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
H : Hypr from gp; P: Pln from gp; Tolang: Real from Standard)
|
||||
|
||||
---Purpose: Intersects an hyperbola and a plane.
|
||||
-- Tolang is used to determine if the angle between two
|
||||
-- vectors is null.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns TRUE if the creation completed.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
|
||||
IsInQuadric(me)
|
||||
|
||||
---Purpose: Returns TRUE if the conic is in the quadric.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsParallel(me)
|
||||
|
||||
---Purpose: Returns TRUE if the line is in a quadric which
|
||||
-- is parallel to the quadric.
|
||||
---C++: inline
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbPoints(me)
|
||||
|
||||
---Purpose: Returns the number of intersection point.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Integer from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IsInQuadric returns
|
||||
-- True or IsParallel returns True.
|
||||
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; N: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point of range N.
|
||||
--
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
returns Pnt from gp
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IsInQuadric returns
|
||||
-- True or IsParallel returns true.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbPoints.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ParamOnConic(me; N: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the parameter on the line of the intersection
|
||||
-- point of range N.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Real from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IsInQuadric returns
|
||||
-- True or IsParallel returns true.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbPoints.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
parallel : Boolean from Standard;
|
||||
inquadric : Boolean from Standard;
|
||||
|
||||
nbpts : Integer from Standard;
|
||||
|
||||
pnts : Pnt from gp [4];
|
||||
paramonc : Real from Standard [4];
|
||||
|
||||
end IntConicQuad;
|
||||
|
||||
|
518
src/IntAna/IntAna_IntConicQuad.cxx
Executable file
518
src/IntAna/IntAna_IntConicQuad.cxx
Executable file
@@ -0,0 +1,518 @@
|
||||
// File: IntAna_IntConicQuad.cxx
|
||||
// Created: Mon Jul 27 12:18:35 1992
|
||||
// Author: Laurent BUCHARD
|
||||
// <lbr@sdsun2>
|
||||
|
||||
#ifndef DEB
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
#define CREATE IntAna_IntConicQuad::IntAna_IntConicQuad
|
||||
#define PERFORM void IntAna_IntConicQuad::Perform
|
||||
|
||||
|
||||
|
||||
#include <IntAna_IntConicQuad.ixx>
|
||||
|
||||
#include <IntAna_QuadQuadGeo.hxx>
|
||||
|
||||
#include <IntAna2d_AnaIntersection.hxx>
|
||||
#include <IntAna2d_IntPoint.hxx>
|
||||
#include <IntAna_ResultType.hxx>
|
||||
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
#include <math_DirectPolynomialRoots.hxx>
|
||||
#include <math_TrigonometricFunctionRoots.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
|
||||
static Standard_Real PIpPI = Standard_PI+Standard_PI;
|
||||
//=============================================================================
|
||||
//== E m p t y C o n s t r u c t o r
|
||||
//==
|
||||
CREATE(void) {
|
||||
done=Standard_False;
|
||||
}
|
||||
//=============================================================================
|
||||
//== L i n e - Q u a d r i c
|
||||
//==
|
||||
CREATE(const gp_Lin& L,const IntAna_Quadric& Quad) {
|
||||
Perform(L,Quad);
|
||||
}
|
||||
|
||||
PERFORM(const gp_Lin& L,const IntAna_Quadric& Quad) {
|
||||
|
||||
Standard_Real Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte;
|
||||
done=inquadric=parallel=Standard_False;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Substitution de x=t Lx + Lx0 ( exprime dans )
|
||||
//-- y=t Ly + Ly0 ( le systeme de coordonnees )
|
||||
//-- z=t Lz + Lz0 ( canonique )
|
||||
//--
|
||||
//-- Dans Qxx x**2 + Qyy y**2 + Qzz z**2
|
||||
//-- + 2 ( Qxy x y + Qxz x z + Qyz y z )
|
||||
//-- + 2 ( Qx x + Qy y + Qz z )
|
||||
//-- + QCte
|
||||
//--
|
||||
//-- Done un polynome en t : A2 t**2 + A1 t + A0 avec :
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
Standard_Real Lx0,Ly0,Lz0,Lx,Ly,Lz;
|
||||
|
||||
|
||||
nbpts=0;
|
||||
|
||||
L.Direction().Coord(Lx,Ly,Lz);
|
||||
L.Location().Coord(Lx0,Ly0,Lz0);
|
||||
|
||||
Quad.Coefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte);
|
||||
|
||||
Standard_Real A0=(QCte + Qxx*Lx0*Lx0 + Qyy*Ly0*Ly0 + Qzz*Lz0*Lz0
|
||||
+ 2.0* ( Lx0*( Qx + Qxy*Ly0 + Qxz*Lz0)
|
||||
+ Ly0*( Qy + Qyz*Lz0 )
|
||||
+ Qz*Lz0 )
|
||||
);
|
||||
|
||||
|
||||
Standard_Real A1=2.0*( Lx*( Qx + Qxx*Lx0 + Qxy*Ly0 + Qxz*Lz0 )
|
||||
+Ly*( Qy + Qxy*Lx0 + Qyy*Ly0 + Qyz*Lz0 )
|
||||
+Lz*( Qz + Qxz*Lx0 + Qyz*Ly0 + Qzz*Lz0 ));
|
||||
|
||||
Standard_Real A2=(Qxx*Lx*Lx + Qyy*Ly*Ly + Qzz*Lz*Lz
|
||||
+ 2.0*( Lx*( Qxy*Ly + Qxz*Lz )
|
||||
+ Qyz*Ly*Lz));
|
||||
|
||||
math_DirectPolynomialRoots LinQuadPol(A2,A1,A0);
|
||||
|
||||
if( LinQuadPol.IsDone()) {
|
||||
done=Standard_True;
|
||||
if(LinQuadPol.InfiniteRoots()) {
|
||||
inquadric=Standard_True;
|
||||
}
|
||||
else {
|
||||
nbpts= LinQuadPol.NbSolutions();
|
||||
|
||||
for(Standard_Integer i=1 ; i<=nbpts; i++) {
|
||||
Standard_Real t= LinQuadPol.Value(i);
|
||||
paramonc[i-1] = t;
|
||||
pnts[i-1]=gp_Pnt( Lx0+Lx*t
|
||||
,Ly0+Ly*t
|
||||
,Lz0+Lz*t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//== C i r c l e - Q u a d r i c
|
||||
//==
|
||||
CREATE(const gp_Circ& C,const IntAna_Quadric& Quad) {
|
||||
Perform(C,Quad);
|
||||
}
|
||||
|
||||
PERFORM(const gp_Circ& C,const IntAna_Quadric& Quad) {
|
||||
|
||||
Standard_Real Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Dans le repere liee a C.Position() :
|
||||
//-- xC = R * Cos[t]
|
||||
//-- yC = R * Sin[t]
|
||||
//-- zC = 0
|
||||
//--
|
||||
//-- On exprime la quadrique dans ce repere et on substitue
|
||||
//-- xC,yC et zC a x,y et z
|
||||
//--
|
||||
//-- On Obtient un polynome en Cos[t] et Sin[t] de degre 2
|
||||
//----------------------------------------------------------------------
|
||||
done=inquadric=parallel=Standard_False;
|
||||
|
||||
Quad.Coefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte);
|
||||
Quad.NewCoefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte,C.Position());
|
||||
|
||||
Standard_Real R=C.Radius();
|
||||
Standard_Real RR=R*R;
|
||||
|
||||
Standard_Real P_CosCos = RR * Qxx; //-- Cos Cos
|
||||
Standard_Real P_SinSin = RR * Qyy; //-- Sin Sin
|
||||
Standard_Real P_Sin = R * Qy; //-- 2 Sin
|
||||
Standard_Real P_Cos = R * Qx; //-- 2 Cos
|
||||
Standard_Real P_CosSin = RR * Qxy; //-- 2 Cos Sin
|
||||
Standard_Real P_Cte = QCte; //-- 1
|
||||
|
||||
math_TrigonometricFunctionRoots CircQuadPol( P_CosCos-P_SinSin
|
||||
,P_CosSin
|
||||
,P_Cos+P_Cos
|
||||
,P_Sin+P_Sin
|
||||
,P_Cte+P_SinSin
|
||||
,0.0,PIpPI);
|
||||
|
||||
if(CircQuadPol.IsDone()) {
|
||||
done=Standard_True;
|
||||
if(CircQuadPol.InfiniteRoots()) {
|
||||
inquadric=Standard_True;
|
||||
}
|
||||
else {
|
||||
nbpts= CircQuadPol.NbSolutions();
|
||||
|
||||
for(Standard_Integer i=1 ; i<=nbpts; i++) {
|
||||
Standard_Real t= CircQuadPol.Value(i);
|
||||
paramonc[i-1] = t;
|
||||
pnts[i-1] = ElCLib::CircleValue(t,C.Position(),R);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//== E l i p s - Q u a d r i c
|
||||
//==
|
||||
CREATE(const gp_Elips& E,const IntAna_Quadric& Quad) {
|
||||
Perform(E,Quad);
|
||||
}
|
||||
|
||||
PERFORM(const gp_Elips& E,const IntAna_Quadric& Quad) {
|
||||
|
||||
Standard_Real Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte;
|
||||
|
||||
done=inquadric=parallel=Standard_False;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Dans le repere liee a E.Position() :
|
||||
//-- xE = R * Cos[t]
|
||||
//-- yE = r * Sin[t]
|
||||
//-- zE = 0
|
||||
//--
|
||||
//-- On exprime la quadrique dans ce repere et on substitue
|
||||
//-- xE,yE et zE a x,y et z
|
||||
//--
|
||||
//-- On Obtient un polynome en Cos[t] et Sin[t] de degre 2
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
Quad.Coefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte);
|
||||
Quad.NewCoefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte,E.Position());
|
||||
|
||||
Standard_Real R=E.MajorRadius();
|
||||
Standard_Real r=E.MinorRadius();
|
||||
|
||||
|
||||
Standard_Real P_CosCos = R*R * Qxx; //-- Cos Cos
|
||||
Standard_Real P_SinSin = r*r * Qyy; //-- Sin Sin
|
||||
Standard_Real P_Sin = r * Qy; //-- 2 Sin
|
||||
Standard_Real P_Cos = R * Qx; //-- 2 Cos
|
||||
Standard_Real P_CosSin = R*r * Qxy; //-- 2 Cos Sin
|
||||
Standard_Real P_Cte = QCte; //-- 1
|
||||
|
||||
math_TrigonometricFunctionRoots ElipsQuadPol( P_CosCos-P_SinSin
|
||||
,P_CosSin
|
||||
,P_Cos+P_Cos
|
||||
,P_Sin+P_Sin
|
||||
,P_Cte+P_SinSin
|
||||
,0.0,PIpPI);
|
||||
|
||||
if(ElipsQuadPol.IsDone()) {
|
||||
done=Standard_True;
|
||||
if(ElipsQuadPol.InfiniteRoots()) {
|
||||
inquadric=Standard_True;
|
||||
}
|
||||
else {
|
||||
nbpts= ElipsQuadPol.NbSolutions();
|
||||
for(Standard_Integer i=1 ; i<=nbpts; i++) {
|
||||
Standard_Real t= ElipsQuadPol.Value(i);
|
||||
paramonc[i-1] = t;
|
||||
pnts[i-1] = ElCLib::EllipseValue(t,E.Position(),R,r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//== P a r a b - Q u a d r i c
|
||||
//==
|
||||
CREATE(const gp_Parab& P,const IntAna_Quadric& Quad) {
|
||||
Perform(P,Quad);
|
||||
}
|
||||
|
||||
PERFORM(const gp_Parab& P,const IntAna_Quadric& Quad) {
|
||||
|
||||
Standard_Real Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte;
|
||||
|
||||
done=inquadric=parallel=Standard_False;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Dans le repere liee a P.Position() :
|
||||
//-- xP = y*y / (2 p)
|
||||
//-- yP = y
|
||||
//-- zP = 0
|
||||
//--
|
||||
//-- On exprime la quadrique dans ce repere et on substitue
|
||||
//-- xP,yP et zP a x,y et z
|
||||
//--
|
||||
//-- On Obtient un polynome en y de degre 4
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
Quad.Coefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte);
|
||||
Quad.NewCoefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte,P.Position());
|
||||
|
||||
Standard_Real f=P.Focal();
|
||||
Standard_Real Un_Sur_2p = 0.25 / f;
|
||||
|
||||
Standard_Real A4 = Qxx * Un_Sur_2p * Un_Sur_2p;
|
||||
Standard_Real A3 = (Qxy+Qxy) * Un_Sur_2p;
|
||||
Standard_Real A2 = Qyy + (Qx+Qx) * Un_Sur_2p;
|
||||
Standard_Real A1 = Qy+Qy;
|
||||
Standard_Real A0 = QCte;
|
||||
|
||||
math_DirectPolynomialRoots ParabQuadPol(A4,A3,A2,A1,A0);
|
||||
|
||||
if( ParabQuadPol.IsDone()) {
|
||||
done=Standard_True;
|
||||
if(ParabQuadPol.InfiniteRoots()) {
|
||||
inquadric=Standard_True;
|
||||
}
|
||||
else {
|
||||
nbpts= ParabQuadPol.NbSolutions();
|
||||
|
||||
for(Standard_Integer i=1 ; i<=nbpts; i++) {
|
||||
Standard_Real t= ParabQuadPol.Value(i);
|
||||
paramonc[i-1] = t;
|
||||
pnts[i-1] = ElCLib::ParabolaValue(t,P.Position(),f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//== H y p r - Q u a d r i c
|
||||
//==
|
||||
CREATE(const gp_Hypr& H,const IntAna_Quadric& Quad) {
|
||||
Perform(H,Quad);
|
||||
}
|
||||
|
||||
PERFORM(const gp_Hypr& H,const IntAna_Quadric& Quad) {
|
||||
|
||||
Standard_Real Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte;
|
||||
|
||||
done=inquadric=parallel=Standard_False;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Dans le repere liee a P.Position() :
|
||||
//-- xH = R Ch[t]
|
||||
//-- yH = r Sh[t]
|
||||
//-- zH = 0
|
||||
//--
|
||||
//-- On exprime la quadrique dans ce repere et on substitue
|
||||
//-- xP,yP et zP a x,y et z
|
||||
//--
|
||||
//-- On Obtient un polynome en Exp[t] de degre 4
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
Quad.Coefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte);
|
||||
Quad.NewCoefficients(Qxx,Qyy,Qzz,Qxy,Qxz,Qyz,Qx,Qy,Qz,QCte,H.Position());
|
||||
|
||||
Standard_Real R=H.MajorRadius();
|
||||
Standard_Real r=H.MinorRadius();
|
||||
|
||||
Standard_Real RR=R*R;
|
||||
Standard_Real rr=r*r;
|
||||
Standard_Real Rr=R*r;
|
||||
|
||||
Standard_Real A4 = RR * Qxx + Rr* ( Qxy + Qxy ) + rr * Qyy;
|
||||
Standard_Real A3 = 4.0* ( R*Qx + r*Qy );
|
||||
Standard_Real A2 = 2.0* ( (QCte+QCte) + Qxx*RR - Qyy*rr );
|
||||
Standard_Real A1 = 4.0* ( R*Qx - r*Qy);
|
||||
Standard_Real A0 = Qxx*RR - Rr*(Qxy+Qxy) + Qyy*rr;
|
||||
|
||||
math_DirectPolynomialRoots HyperQuadPol(A4,A3,A2,A1,A0);
|
||||
|
||||
if( HyperQuadPol.IsDone()) {
|
||||
done=Standard_True;
|
||||
if(HyperQuadPol.InfiniteRoots()) {
|
||||
inquadric=Standard_True;
|
||||
}
|
||||
else {
|
||||
nbpts= HyperQuadPol.NbSolutions();
|
||||
Standard_Integer bonnessolutions = 0;
|
||||
for(Standard_Integer i=1 ; i<=nbpts; i++) {
|
||||
Standard_Real t= HyperQuadPol.Value(i);
|
||||
if(t>=RealEpsilon()) {
|
||||
Standard_Real Lnt = Log(t);
|
||||
paramonc[bonnessolutions] = Lnt;
|
||||
pnts[bonnessolutions] = ElCLib::HyperbolaValue(Lnt,H.Position(),R,r);
|
||||
bonnessolutions++;
|
||||
}
|
||||
}
|
||||
nbpts=bonnessolutions;
|
||||
}
|
||||
}
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
IntAna_IntConicQuad::IntAna_IntConicQuad (const gp_Lin& L, const gp_Pln& P,
|
||||
const Standard_Real Tolang) {
|
||||
Perform(L,P,Tolang);
|
||||
}
|
||||
|
||||
|
||||
IntAna_IntConicQuad::IntAna_IntConicQuad (const gp_Circ& C, const gp_Pln& P,
|
||||
const Standard_Real Tolang,
|
||||
const Standard_Real Tol) {
|
||||
Perform(C,P,Tolang,Tol);
|
||||
}
|
||||
|
||||
|
||||
IntAna_IntConicQuad::IntAna_IntConicQuad (const gp_Elips& E, const gp_Pln& P,
|
||||
const Standard_Real Tolang,
|
||||
const Standard_Real Tol) {
|
||||
Perform(E,P,Tolang,Tol);
|
||||
}
|
||||
|
||||
|
||||
IntAna_IntConicQuad::IntAna_IntConicQuad (const gp_Parab& Pb, const gp_Pln& P,
|
||||
const Standard_Real Tolang){
|
||||
Perform(Pb,P,Tolang);
|
||||
}
|
||||
|
||||
|
||||
IntAna_IntConicQuad::IntAna_IntConicQuad (const gp_Hypr& H, const gp_Pln& P,
|
||||
const Standard_Real Tolang){
|
||||
Perform(H,P,Tolang);
|
||||
}
|
||||
|
||||
|
||||
void IntAna_IntConicQuad::Perform (const gp_Lin& L, const gp_Pln& P,
|
||||
const Standard_Real Tolang) {
|
||||
|
||||
// Tolang represente la tolerance angulaire a partir de laquelle on considere
|
||||
// que l angle entre 2 vecteurs est nul. On raisonnera sur le cosinus de cet
|
||||
// angle, (on a Cos(t) equivalent a t au voisinage de Pi/2).
|
||||
|
||||
done=Standard_False;
|
||||
|
||||
Standard_Real A,B,C,D;
|
||||
Standard_Real Al,Bl,Cl;
|
||||
Standard_Real Dis,Direc;
|
||||
|
||||
P.Coefficients(A,B,C,D);
|
||||
gp_Pnt Orig(L.Location());
|
||||
L.Direction().Coord(Al,Bl,Cl);
|
||||
|
||||
Direc=A*Al+B*Bl+C*Cl;
|
||||
Dis = A*Orig.X() + B*Orig.Y() + C*Orig.Z() + D;
|
||||
|
||||
if (Abs(Direc) < Tolang) {
|
||||
parallel= Standard_True;
|
||||
if (Abs(Dis) < Tolang) {
|
||||
inquadric=Standard_True;
|
||||
}
|
||||
else {
|
||||
inquadric=Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
parallel=Standard_False;
|
||||
inquadric=Standard_False;
|
||||
nbpts = 1;
|
||||
paramonc [0] = - Dis/Direc;
|
||||
pnts[0].SetCoord(Orig.X()+paramonc[0]*Al
|
||||
, Orig.Y()+paramonc[0]*Bl
|
||||
, Orig.Z()+paramonc[0]*Cl);
|
||||
}
|
||||
done=Standard_True;
|
||||
}
|
||||
|
||||
|
||||
void IntAna_IntConicQuad::Perform (const gp_Circ& C, const gp_Pln& P,
|
||||
const Standard_Real Tolang,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
|
||||
done=Standard_False;
|
||||
|
||||
gp_Pln Plconic(gp_Ax3(C.Position()));
|
||||
IntAna_QuadQuadGeo IntP(Plconic,P,Tolang,Tol);
|
||||
if (!IntP.IsDone()) {return;}
|
||||
if (IntP.TypeInter() == IntAna_Empty) {
|
||||
parallel=Standard_True;
|
||||
Standard_Real distmax = P.Distance(C.Location()) + C.Radius()*Tolang;
|
||||
if (distmax < Tol) {
|
||||
inquadric = Standard_True;
|
||||
}
|
||||
else {
|
||||
inquadric = Standard_False;
|
||||
}
|
||||
done=Standard_True;
|
||||
}
|
||||
else if(IntP.TypeInter() == IntAna_Same) {
|
||||
inquadric = Standard_True;
|
||||
done = Standard_True;
|
||||
}
|
||||
else {
|
||||
inquadric=Standard_False;
|
||||
parallel=Standard_False;
|
||||
gp_Lin Ligsol(IntP.Line(1));
|
||||
|
||||
gp_Vec V0(Plconic.Location(),Ligsol.Location());
|
||||
gp_Vec Axex(Plconic.Position().XDirection());
|
||||
gp_Vec Axey(Plconic.Position().YDirection());
|
||||
|
||||
gp_Pnt2d Orig(Axex.Dot(V0),Axey.Dot(V0));
|
||||
gp_Vec2d Dire(Axex.Dot(Ligsol.Direction()),
|
||||
Axey.Dot(Ligsol.Direction()));
|
||||
|
||||
gp_Lin2d Ligs(Orig,Dire);
|
||||
gp_Pnt2d Pnt2dBid(0.0,0.0);
|
||||
gp_Dir2d Dir2dBid(1.0,0.0);
|
||||
gp_Ax2d Ax2dBid(Pnt2dBid,Dir2dBid);
|
||||
gp_Circ2d Cir(Ax2dBid,C.Radius());
|
||||
|
||||
IntAna2d_AnaIntersection Int2d(Ligs,Cir);
|
||||
|
||||
if (!Int2d.IsDone()) {return;}
|
||||
|
||||
nbpts=Int2d.NbPoints();
|
||||
for (Standard_Integer i=1; i<=nbpts; i++) {
|
||||
|
||||
gp_Pnt2d resul(Int2d.Point(i).Value());
|
||||
Standard_Real X= resul.X();
|
||||
Standard_Real Y= resul.Y();
|
||||
pnts[i-1].SetCoord(Plconic.Location().X() + X*Axex.X() + Y*Axey.X(),
|
||||
Plconic.Location().Y() + X*Axex.Y() + Y*Axey.Y(),
|
||||
Plconic.Location().Z() + X*Axex.Z() + Y*Axey.Z());
|
||||
paramonc[i-1]=Int2d.Point(i).ParamOnSecond();
|
||||
}
|
||||
done=Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IntAna_IntConicQuad::Perform (const gp_Elips& E, const gp_Pln& Pln,
|
||||
const Standard_Real,
|
||||
const Standard_Real){
|
||||
Perform(E,Pln);
|
||||
}
|
||||
|
||||
|
||||
void IntAna_IntConicQuad::Perform (const gp_Parab& P, const gp_Pln& Pln,
|
||||
const Standard_Real){
|
||||
Perform(P,Pln);
|
||||
}
|
||||
|
||||
|
||||
void IntAna_IntConicQuad::Perform (const gp_Hypr& H, const gp_Pln& Pln,
|
||||
const Standard_Real){
|
||||
Perform(H,Pln);
|
||||
}
|
||||
|
||||
|
46
src/IntAna/IntAna_IntConicQuad.lxx
Executable file
46
src/IntAna/IntAna_IntConicQuad.lxx
Executable file
@@ -0,0 +1,46 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
inline Standard_Boolean IntAna_IntConicQuad::IsDone() const {
|
||||
return(done);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntAna_IntConicQuad::IsInQuadric() const {
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return(inquadric);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntAna_IntConicQuad::IsParallel() const {
|
||||
if(!done) {StdFail_NotDone::Raise();}
|
||||
return(parallel);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntAna_IntConicQuad::NbPoints() const {
|
||||
if(!done) {StdFail_NotDone::Raise();}
|
||||
if (parallel || inquadric) {Standard_DomainError::Raise();}
|
||||
return(nbpts);
|
||||
}
|
||||
|
||||
|
||||
inline const gp_Pnt& IntAna_IntConicQuad::Point
|
||||
(const Standard_Integer i) const {
|
||||
|
||||
if(!done) {StdFail_NotDone::Raise();}
|
||||
if (parallel || inquadric) {Standard_DomainError::Raise();}
|
||||
if((i>nbpts)||(i<=0)) {Standard_OutOfRange::Raise();}
|
||||
return(pnts[i-1]);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntAna_IntConicQuad::ParamOnConic
|
||||
(const Standard_Integer i) const {
|
||||
|
||||
if(!done) {StdFail_NotDone::Raise();}
|
||||
if (parallel || inquadric) {Standard_DomainError::Raise();}
|
||||
if((i>nbpts)||(i<=0)) {Standard_OutOfRange::Raise();}
|
||||
return(paramonc[i-1]);
|
||||
}
|
127
src/IntAna/IntAna_IntLinTorus.cdl
Executable file
127
src/IntAna/IntAna_IntLinTorus.cdl
Executable file
@@ -0,0 +1,127 @@
|
||||
-- File: IntLinTorus.cdl
|
||||
-- Created: Thu May 16 17:47:17 1991
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@topsn3>
|
||||
---Copyright: Matra Datavision 1991
|
||||
|
||||
|
||||
class IntLinTorus from IntAna
|
||||
|
||||
---Purpose: Intersection between a line and a torus.
|
||||
|
||||
uses Lin from gp,
|
||||
Torus from gp,
|
||||
Pnt from gp
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
returns IntLinTorus from IntAna;
|
||||
|
||||
Create(L : Lin from gp; T : Torus from gp)
|
||||
|
||||
---Purpose: Creates the intersection between a line and a torus.
|
||||
|
||||
returns IntLinTorus from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out; L : Lin from gp; T : Torus from gp)
|
||||
|
||||
---Purpose: Intersects a line and a torus.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns True if the computation was successful.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbPoints(me)
|
||||
|
||||
---Purpose: Returns the number of intersection points.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Integer from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Value(me; Index : Integer from Standard)
|
||||
|
||||
---Purpose: Returns the intersection point of range Index.
|
||||
--
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
returns Pnt from gp
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception OutOfRange is raised if Index <= 0 or
|
||||
-- Index > NbPoints
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ParamOnLine(me; Index : Integer from Standard)
|
||||
|
||||
---Purpose: Returns the parameter on the line of the intersection
|
||||
-- point of range Index.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Real from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception OutOfRange is raised if Index <= 0 or
|
||||
-- Index > NbPoints
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
ParamOnTorus(me; Index : Integer from Standard;
|
||||
FI,THETA: out Real from Standard)
|
||||
|
||||
---Purpose: Returns the parameters on the torus of the intersection
|
||||
-- point of range Index.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
raises NotDone from StdFail,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception OutOfRange is raised if Index <= 0 or
|
||||
-- Index > NbPoints
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard;
|
||||
nbpt : Integer from Standard;
|
||||
thePoint: Pnt from gp [4];
|
||||
theParam: Real from Standard [4];
|
||||
theFi : Real from Standard [4];
|
||||
theTheta: Real from Standard [4];
|
||||
|
||||
end IntLinTorus;
|
374
src/IntAna/IntAna_IntLinTorus.cxx
Executable file
374
src/IntAna/IntAna_IntLinTorus.cxx
Executable file
@@ -0,0 +1,374 @@
|
||||
//-- IntAna_IntLinTorus.cxx
|
||||
//-- lbr : la methode avec les coefficients est catastrophique.
|
||||
//-- Mise en place d'une vraie solution.
|
||||
|
||||
#include <IntAna_IntLinTorus.ixx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <math_DirectPolynomialRoots.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
|
||||
|
||||
|
||||
IntAna_IntLinTorus::IntAna_IntLinTorus () : done(Standard_False)
|
||||
{}
|
||||
|
||||
IntAna_IntLinTorus::IntAna_IntLinTorus (const gp_Lin& L, const gp_Torus& T) {
|
||||
Perform(L,T);
|
||||
}
|
||||
|
||||
|
||||
void IntAna_IntLinTorus::Perform (const gp_Lin& L, const gp_Torus& T) {
|
||||
gp_Pnt PL=L.Location();
|
||||
gp_Dir DL=L.Direction();
|
||||
|
||||
// Reparametrize the line:
|
||||
// set its location as nearest to the location of torus
|
||||
gp_Pnt TorLoc = T.Location();
|
||||
Standard_Real ParamOfNewPL = gp_Vec(PL, TorLoc).Dot(gp_Vec(DL));
|
||||
gp_Pnt NewPL( PL.XYZ() + ParamOfNewPL * DL.XYZ() );
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//-- Coefficients de la ligne dans le repere du cone
|
||||
//--
|
||||
gp_Trsf trsf;
|
||||
trsf.SetTransformation(T.Position());
|
||||
NewPL.Transform(trsf);
|
||||
DL.Transform(trsf);
|
||||
|
||||
Standard_Real a,b,c,x1,y1,z1,x0,y0,z0;
|
||||
Standard_Real a0,a1,a2,a3,a4;
|
||||
Standard_Real R,r,R2,r2;
|
||||
|
||||
x1 = DL.X(); y1 = DL.Y(); z1 = DL.Z();
|
||||
x0 = NewPL.X(); y0 = NewPL.Y(); z0 = NewPL.Z();
|
||||
R = T.MajorRadius(); R2 = R*R;
|
||||
r = T.MinorRadius(); r2 = r*r;
|
||||
|
||||
a = x1*x1+y1*y1+z1*z1;
|
||||
b = 2.0*(x1*x0+y1*y0+z1*z0);
|
||||
c = x0*x0+y0*y0+z0*z0 - (R2+r2);
|
||||
|
||||
a4 = a*a;
|
||||
a3 = 2.0*a*b;
|
||||
a2 = 2.0*a*c+4.0*R2*z1*z1+b*b;
|
||||
a1 = 2.0*b*c+8.0*R2*z1*z0;
|
||||
a0 = c*c+4.0*R2*(z0*z0-r2);
|
||||
|
||||
Standard_Real u,v;
|
||||
math_DirectPolynomialRoots mdpr(a4,a3,a2,a1,a0);
|
||||
if(mdpr.IsDone()) {
|
||||
Standard_Integer nbsolvalid = 0;
|
||||
Standard_Integer n = mdpr.NbSolutions();
|
||||
for(Standard_Integer i = 1; i<=n ; i++) {
|
||||
Standard_Real t = mdpr.Value(i);
|
||||
t += ParamOfNewPL;
|
||||
gp_Pnt PSolL(ElCLib::Value(t,L));
|
||||
ElSLib::Parameters(T,PSolL,u,v);
|
||||
gp_Pnt PSolT(ElSLib::Value(u,v,T));
|
||||
a0 = PSolT.SquareDistance(PSolL);
|
||||
|
||||
if(a0>0.0000000001) {
|
||||
#if 0
|
||||
cout<<" ------- Erreur : P Ligne < > P Tore "<<endl;
|
||||
cout<<"Ligne : X:"<<PSolL.X()<<" Y:"<<PSolL.Y()<<" Z:"<<PSolL.Z()<<" l:"<<t<<endl;
|
||||
cout<<"Tore : X:"<<PSolT.X()<<" Y:"<<PSolT.Y()<<" Z:"<<PSolT.Z()<<" u:"<<u<<" v:"<<v<<endl;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
theParam[nbsolvalid] = t;
|
||||
theFi[nbsolvalid] = u;
|
||||
theTheta[nbsolvalid] = v;
|
||||
thePoint[nbsolvalid] = PSolL;
|
||||
nbsolvalid++;
|
||||
}
|
||||
}
|
||||
nbpt = nbsolvalid;
|
||||
done = Standard_True;
|
||||
}
|
||||
else {
|
||||
nbpt = 0;
|
||||
done = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
static void MULT_A3_B1(Standard_Real& c4,
|
||||
Standard_Real& c3,
|
||||
Standard_Real& c2,
|
||||
Standard_Real& c1,
|
||||
Standard_Real& c0,
|
||||
const Standard_Real a3,
|
||||
const Standard_Real a2,
|
||||
const Standard_Real a1,
|
||||
const Standard_Real a0,
|
||||
const Standard_Real b1,
|
||||
const Standard_Real b0) {
|
||||
c4 = a3 * b1;
|
||||
c3 = a3 * b0 + a2 * b1;
|
||||
c2 = a2 * b0 + a1 * b1;
|
||||
c1 = a1 * b0 + a0 * b1;
|
||||
c0 = a0 * b0;
|
||||
}
|
||||
|
||||
static void MULT_A2_B2(Standard_Real& c4,
|
||||
Standard_Real& c3,
|
||||
Standard_Real& c2,
|
||||
Standard_Real& c1,
|
||||
Standard_Real& c0,
|
||||
const Standard_Real a2,
|
||||
const Standard_Real a1,
|
||||
const Standard_Real a0,
|
||||
const Standard_Real b2,
|
||||
const Standard_Real b1,
|
||||
const Standard_Real b0) {
|
||||
c4 = a2 * b2;
|
||||
c3 = a2 * b1 + a1 * b2;
|
||||
c2 = a2 * b0 + a1 * b1 + a0 * b2;
|
||||
c1 = a1 * b0 + a0 * b1;
|
||||
c0 = a0 * b0;
|
||||
}
|
||||
|
||||
static void MULT_A2_B1(Standard_Real& c3,
|
||||
Standard_Real& c2,
|
||||
Standard_Real& c1,
|
||||
Standard_Real& c0,
|
||||
const Standard_Real a2,
|
||||
const Standard_Real a1,
|
||||
const Standard_Real a0,
|
||||
const Standard_Real b1,
|
||||
const Standard_Real b0) {
|
||||
c3 = a2 * b1;
|
||||
c2 = a2 * b0 + a1 * b1;
|
||||
c1 = a1 * b0 + a0 * b1;
|
||||
c0 = a0 * b0;
|
||||
}
|
||||
|
||||
void IntAna_IntLinTorus::Perform (const gp_Lin& L, const gp_Torus& T) {
|
||||
TColStd_Array1OfReal C(1,31);
|
||||
T.Coefficients(C);
|
||||
const gp_Pnt& PL=L.Location();
|
||||
const gp_Dir& DL=L.Direction();
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//-- X = ax1 l + ax0
|
||||
//-- X2 = ax2 l2 + 2 ax1 ax0 l + bx2
|
||||
//-- X3 = ax3 l3 + 3 ax2 ax0 l2 + 3 ax1 bx2 l + bx3
|
||||
//-- X4 = ax4 l4 + 4 ax3 ax0 l3 + 6 ax2 bx2 l2 + 4 ax1 bx3 l + bx4
|
||||
|
||||
Standard_Real ax1,ax2,ax3,ax4,ax0,bx2,bx3,bx4;
|
||||
Standard_Real ay1,ay2,ay3,ay4,ay0,by2,by3,by4;
|
||||
Standard_Real az1,az2,az3,az4,az0,bz2,bz3,bz4;
|
||||
Standard_Real c0,c1,c2,c3,c4;
|
||||
ax1=DL.X(); ax0=PL.X(); ay1=DL.Y(); ay0=PL.Y(); az1=DL.Z(); az0=PL.Z();
|
||||
ax2=ax1*ax1; ax3=ax2*ax1; ax4=ax3*ax1; bx2=ax0*ax0; bx3=bx2*ax0; bx4=bx3*ax0;
|
||||
ay2=ay1*ay1; ay3=ay2*ay1; ay4=ay3*ay1; by2=ay0*ay0; by3=by2*ay0; by4=by3*ay0;
|
||||
az2=az1*az1; az3=az2*az1; az4=az3*az1; bz2=az0*az0; bz3=bz2*az0; bz4=bz3*az0;
|
||||
|
||||
//--------------------------------------------------------------------------- Terme X**4
|
||||
Standard_Real c=C(1);
|
||||
Standard_Real a4 = c *ax4;
|
||||
Standard_Real a3 = c *4.0*ax3*ax0;
|
||||
Standard_Real a2 = c *6.0*ax2*bx2;
|
||||
Standard_Real a1 = c *4.0*ax1*bx3;
|
||||
Standard_Real a0 = c *bx4;
|
||||
//--------------------------------------------------------------------------- Terme Y**4
|
||||
c = C(2);
|
||||
a4+= c*ay4;
|
||||
a3+= c*4.0*ay3*ay0;
|
||||
a2+= c*6.0*ay2*by2;
|
||||
a1+= c*4.0*ay1*by3;
|
||||
a0+= c*by4;
|
||||
//--------------------------------------------------------------------------- Terme Z**4
|
||||
c = C(3);
|
||||
a4+= c*az4 ;
|
||||
a3+= c*4.0*az3*az0;
|
||||
a2+= c*6.0*az2*bz2;
|
||||
a1+= c*4.0*az1*bz3;
|
||||
a0+= c*bz4;
|
||||
//--------------------------------------------------------------------------- Terme X**3 Y
|
||||
c = C(4);
|
||||
MULT_A3_B1(c4,c3,c2,c1,c0, ax3, 3.0*ax2*ax0, 3.0*ax1*bx2, bx3, ay1,ay0);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme X**3 Z
|
||||
c = C(5);
|
||||
MULT_A3_B1(c4,c3,c2,c1,c0, ax3, 3.0*ax2*ax0, 3.0*ax1*bx2, bx3, az1,az0);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Y**3 X
|
||||
c = C(6);
|
||||
MULT_A3_B1(c4,c3,c2,c1,c0, ay3, 3.0*ay2*ay0, 3.0*ay1*by2, by3, ax1,ax0);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Y**3 Z
|
||||
c = C(7);
|
||||
MULT_A3_B1(c4,c3,c2,c1,c0, ay3, 3.0*ay2*ay0, 3.0*ay1*by2, by3, az1,az0);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Z**3 X
|
||||
c = C(8);
|
||||
MULT_A3_B1(c4,c3,c2,c1,c0, az3, 3.0*az2*az0, 3.0*az1*bz2, bz3, ax1,ax0);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Z**3 Y
|
||||
c = C(9);
|
||||
MULT_A3_B1(c4,c3,c2,c1,c0, az3, 3.0*az2*az0, 3.0*az1*bz2, bz3, ay1,ay0);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------- Terme X**2 Y**2
|
||||
c = C(10);
|
||||
MULT_A2_B2(c4,c3,c2,c1,c0, ax2, 2.0*ax1*ax0, bx2, ay2,2.0*ay1*ay0, by2);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme X**2 Z**2
|
||||
c = C(11);
|
||||
MULT_A2_B2(c4,c3,c2,c1,c0, ax2, 2.0*ax1*ax0, bx2, az2,2.0*az1*az0, bz2);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Y**2 Z**2
|
||||
c = C(12);
|
||||
MULT_A2_B2(c4,c3,c2,c1,c0, ay2, 2.0*ay1*ay0, by2, az2,2.0*az1*az0, bz2);
|
||||
a4+= c*c4; a3+= c*c3; a2+= c*c2; a1+= c*c1; a0+= c*c0;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------- Terme X**3
|
||||
c = C(13);
|
||||
a3+= c*( ax3 );
|
||||
a2+= c*( 3.0*ax2*ax0 );
|
||||
a1+= c*( 3.0*ax1*bx2 );
|
||||
a0+= c*( bx3 );
|
||||
//--------------------------------------------------------------------------- Terme Y**3
|
||||
c = C(14);
|
||||
a3+= c*( ay3 );
|
||||
a2+= c*( 3.0*ay2*ay0 );
|
||||
a1+= c*( 3.0*ay1*by2 );
|
||||
a0+= c*( by3 );
|
||||
//--------------------------------------------------------------------------- Terme Y**3
|
||||
c = C(15);
|
||||
a3+= c*( az3 );
|
||||
a2+= c*( 3.0*az2*az0 );
|
||||
a1+= c*( 3.0*az1*bz2 );
|
||||
a0+= c*( bz3 );
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------- Terme X**2 Y
|
||||
c = C(16);
|
||||
MULT_A2_B1(c3,c2,c1,c0, ax2, 2.0*ax1*ax0, bx2, ay1,ay0);
|
||||
a3+= c*c3; a2+= c* c2; a1+= c* c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme X**2 Z
|
||||
c = C(17);
|
||||
MULT_A2_B1(c3,c2,c1,c0, ax2, 2.0*ax1*ax0, bx2, az1,az0);
|
||||
a3+= c*c3; a2+= c* c2; a1+= c* c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Y**2 X
|
||||
c = C(18);
|
||||
MULT_A2_B1(c3,c2,c1,c0, ay2, 2.0*ay1*ay0, by2, ax1,ax0);
|
||||
a3+= c*c3; a2+= c* c2; a1+= c* c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Y**2 Z
|
||||
c = C(19);
|
||||
MULT_A2_B1(c3,c2,c1,c0, ay2, 2.0*ay1*ay0, by2, az1,az0);
|
||||
a3+= c*c3; a2+= c* c2; a1+= c* c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Z**2 X
|
||||
c = C(20);
|
||||
MULT_A2_B1(c3,c2,c1,c0, az2, 2.0*az1*az0, bz2, ax1,ax0);
|
||||
a3+= c*c3; a2+= c* c2; a1+= c* c1; a0+= c*c0;
|
||||
//--------------------------------------------------------------------------- Terme Z**2 Y
|
||||
c = C(21);
|
||||
MULT_A2_B1(c3,c2,c1,c0, az2, 2.0*az1*az0, bz2, ay1,ay0);
|
||||
a3+= c*c3; a2+= c* c2; a1+= c* c1; a0+= c*c0;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------- Terme X**2
|
||||
c = C(22);
|
||||
a2+= c*ax2;
|
||||
a1+= c*2.0*ax1*ax0;
|
||||
a0+= c*bx2;
|
||||
//--------------------------------------------------------------------------- Terme Y**2
|
||||
c = C(23);
|
||||
a2+= c*ay2;
|
||||
a1+= c*2.0*ay1*ay0;
|
||||
a0+= c*by2;
|
||||
//--------------------------------------------------------------------------- Terme Z**2
|
||||
c = C(24);
|
||||
a2+= c*az2;
|
||||
a1+= c*2.0*az1*az0;
|
||||
a0+= c*bz2;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------- Terme X Y
|
||||
c = C(25);
|
||||
a2+= c*(ax1*ay1);
|
||||
a1+= c*(ax1*ay0 + ax0*ay1);
|
||||
a0+= c*(ax0*ay0);
|
||||
//--------------------------------------------------------------------------- Terme X Z
|
||||
c = C(26);
|
||||
a2+= c*(ax1*az1);
|
||||
a1+= c*(ax1*az0 + ax0*az1);
|
||||
a0+= c*(ax0*az0);
|
||||
//--------------------------------------------------------------------------- Terme Y Z
|
||||
c = C(27);
|
||||
a2+= c*(ay1*az1);
|
||||
a1+= c*(ay1*az0 + ay0*az1);
|
||||
a0+= c*(ay0*az0);
|
||||
|
||||
//--------------------------------------------------------------------------- Terme X
|
||||
c = C(28);
|
||||
a1+= c*ax1;
|
||||
a0+= c*ax0;
|
||||
//--------------------------------------------------------------------------- Terme Y
|
||||
c = C(29);
|
||||
a1+= c*ay1;
|
||||
a0+= c*ay0;
|
||||
//--------------------------------------------------------------------------- Terme Z
|
||||
c = C(30);
|
||||
a1+= c*az1;
|
||||
a0+= c*az0;
|
||||
|
||||
//--------------------------------------------------------------------------- Terme Constant
|
||||
c = C(31);
|
||||
a0+=c;
|
||||
|
||||
|
||||
|
||||
cout<<"\n ---------- Coefficients Line - Torus : "<<endl;
|
||||
cout<<" a0 : "<<a0<<endl;
|
||||
cout<<" a1 : "<<a1<<endl;
|
||||
cout<<" a2 : "<<a2<<endl;
|
||||
cout<<" a3 : "<<a3<<endl;
|
||||
cout<<" a4 : "<<a4<<endl;
|
||||
|
||||
Standard_Real u,v;
|
||||
math_DirectPolynomialRoots mdpr(a4,a3,a2,a1,a0);
|
||||
if(mdpr.IsDone()) {
|
||||
Standard_Integer nbsolvalid = 0;
|
||||
Standard_Integer n = mdpr.NbSolutions();
|
||||
for(Standard_Integer i = 1; i<=n ; i++) {
|
||||
Standard_Real t = mdpr.Value(i);
|
||||
gp_Pnt PSolL(ax0+ax1*t, ay0+ay1*t, az0+az1*t);
|
||||
ElSLib::Parameters(T,PSolL,u,v);
|
||||
gp_Pnt PSolT(ElSLib::Value(u,v,T));
|
||||
|
||||
a0 = PSolT.SquareDistance(PSolL);
|
||||
if(a0>0.0000000001) {
|
||||
cout<<" ------- Erreur : P Ligne < > P Tore ";
|
||||
cout<<"Ligne : X:"<<PSolL.X()<<" Y:"<<PSolL.Y()<<" Z:"<<PSolL.Z()<<" l:"<<t<<endl;
|
||||
cout<<"Tore : X:"<<PSolL.X()<<" Y:"<<PSolL.Y()<<" Z:"<<PSolL.Z()<<" u:"<<u<<" v:"<<v<<endl;
|
||||
}
|
||||
else {
|
||||
theParam[nbsolvalid] = t;
|
||||
theFi[nbsolvalid] = v;
|
||||
theTheta[nbsolvalid] = u;
|
||||
thePoint[nbsolvalid] = PSolL;
|
||||
nbsolvalid++;
|
||||
}
|
||||
}
|
||||
nbpt = nbsolvalid;
|
||||
done = Standard_True;
|
||||
}
|
||||
else {
|
||||
nbpt = 0;
|
||||
done = Standard_False;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
38
src/IntAna/IntAna_IntLinTorus.lxx
Executable file
38
src/IntAna/IntAna_IntLinTorus.lxx
Executable file
@@ -0,0 +1,38 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
inline Standard_Boolean IntAna_IntLinTorus::IsDone () const {
|
||||
return done;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntAna_IntLinTorus::NbPoints () const {
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
return nbpt;
|
||||
}
|
||||
|
||||
inline const gp_Pnt& IntAna_IntLinTorus::Value
|
||||
(const Standard_Integer Index) const {
|
||||
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
if(Index<=0 || Index>nbpt) { Standard_OutOfRange::Raise();}
|
||||
return thePoint[Index-1];
|
||||
}
|
||||
|
||||
inline Standard_Real IntAna_IntLinTorus::ParamOnLine
|
||||
(const Standard_Integer Index) const {
|
||||
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
if(Index<=0 || Index>nbpt) { Standard_OutOfRange::Raise();}
|
||||
return theParam[Index-1];
|
||||
}
|
||||
|
||||
inline void IntAna_IntLinTorus::ParamOnTorus
|
||||
(const Standard_Integer Index,
|
||||
Standard_Real& FI, Standard_Real& THETA) const {
|
||||
|
||||
if (!done) {StdFail_NotDone::Raise();}
|
||||
if(Index<=0 || Index>nbpt) { Standard_OutOfRange::Raise();}
|
||||
FI=theFi[Index-1];
|
||||
THETA=theTheta[Index-1];
|
||||
}
|
||||
|
308
src/IntAna/IntAna_IntQuadQuad.cdl
Executable file
308
src/IntAna/IntAna_IntQuadQuad.cdl
Executable file
@@ -0,0 +1,308 @@
|
||||
-- File: IntQuadQuad.cdl
|
||||
-- Created: Wed May 15 14:31:58 1991
|
||||
-- Author: Isabelle GRIGNON
|
||||
-- <isg@topsn3>
|
||||
---Copyright: Matra Datavision 1991, 1992
|
||||
|
||||
|
||||
|
||||
class IntQuadQuad from IntAna
|
||||
|
||||
---Purpose: This class provides the analytic intersection between a
|
||||
-- cylinder or a cone from gp and another quadric, as defined
|
||||
-- in the class Quadric from IntAna.
|
||||
-- This algorithm is used when the geometric intersection
|
||||
-- (class QuadQuadGeo from IntAna) returns no geometric
|
||||
-- solution.
|
||||
-- The result of the intersection may be
|
||||
-- - Curves as defined in the class Curve from IntAna
|
||||
-- - Points (Pnt from gp)
|
||||
|
||||
|
||||
|
||||
uses Cylinder from gp,
|
||||
Cone from gp,
|
||||
Quadric from IntAna,
|
||||
Curve from IntAna,
|
||||
Pnt from gp
|
||||
|
||||
raises OutOfRange from Standard,
|
||||
NotDone from StdFail,
|
||||
DomainError from Standard
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
---Purpose: Empty Constructor
|
||||
|
||||
returns IntQuadQuad from IntAna;
|
||||
|
||||
|
||||
|
||||
|
||||
Create(C: Cylinder from gp; Q: Quadric from IntAna;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between a cylinder and a quadric .
|
||||
-- Tol est a definir plus precisemment.
|
||||
|
||||
returns IntQuadQuad from IntAna;
|
||||
|
||||
|
||||
Create(C: Cone from gp; Q: Quadric from IntAna;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between a cone and a quadric.
|
||||
-- Tol est a definir plus precisemment.
|
||||
|
||||
returns IntQuadQuad from IntAna;
|
||||
|
||||
|
||||
|
||||
Perform(me: in out; C: Cylinder from gp; Q: Quadric from IntAna;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a cylinder and a quadric .
|
||||
-- Tol est a definir plus precisemment.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Perform(me: in out; C: Cone from gp; Q: Quadric from IntAna;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a cone and a quadric.
|
||||
-- Tol est a definir plus precisemment.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns True if the computation was successful.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
|
||||
IdenticalElements(me)
|
||||
|
||||
---Purpose: Returns TRUE if the cylinder, the cone or the sphere
|
||||
-- is identical to the quadric.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbCurve(me)
|
||||
|
||||
---Purpose: Returns the number of curves solution.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Integer from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Curve(me; N: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the curve of range N.
|
||||
--
|
||||
---C++: return const&
|
||||
|
||||
returns Curve from IntAna
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbCurve.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
NbPnt(me)
|
||||
|
||||
---Purpose: Returns the number of contact point.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Integer from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; N: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point of range N.
|
||||
--
|
||||
---C++: return const&
|
||||
|
||||
returns Pnt from gp
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbPnt.
|
||||
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Parameters(me; N: Integer from Standard;
|
||||
U1,U2: out Real from Standard)
|
||||
|
||||
---Purpose: Returns the paramaters on the "explicit quadric"
|
||||
-- (i.e the cylinder or the cone, the
|
||||
-- first argument given to the constructor) of the
|
||||
-- point of range N.
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbPnt.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasNextCurve(me; I: Integer from Standard)
|
||||
|
||||
---Purpose: Returns True if the Curve I shares its last bound
|
||||
-- with another curve.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbCurve.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NextCurve(me; I : Integer from Standard;
|
||||
Opposite : in out Boolean from Standard)
|
||||
|
||||
---Purpose: If HasNextCurve(I) returns True, this function
|
||||
-- returns the Index J of the curve which has a
|
||||
-- common bound with the curve I. If Opposite ==
|
||||
-- True , then the last parameter of the curve I, and
|
||||
-- the last parameter of the curve J give the same
|
||||
-- point. Else the last parameter of the curve I and
|
||||
-- the first parameter of the curve J are the same
|
||||
-- point.
|
||||
|
||||
returns Integer from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True. It is also raised when HasNextCurve returns
|
||||
-- False.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbCurve.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
HasPreviousCurve(me; I: Integer from Standard)
|
||||
|
||||
---Purpose: Returns True if the Curve I shares its first bound
|
||||
-- with another curve.
|
||||
|
||||
returns Boolean from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbCurve.
|
||||
|
||||
is static;
|
||||
|
||||
PreviousCurve(me; I : Integer from Standard;
|
||||
Opposite : in out Boolean from Standard)
|
||||
|
||||
---Purpose: if HasPreviousCurve(I) returns True, this function
|
||||
-- returns the Index J of the curve which has a
|
||||
-- common bound with the curve I. If Opposite ==
|
||||
-- True , then the first parameter of the curve I,
|
||||
-- and the first parameter of the curve J give the
|
||||
-- same point. Else the first parameter of the curve
|
||||
-- I and the last parameter of the curve J are the
|
||||
-- same point.
|
||||
|
||||
returns Integer from Standard
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
-- The exception NotDone is raised if IsDone returns False.
|
||||
-- The exception DomainError is raised if IdenticalElements
|
||||
-- returns True. It is also raised when HasPreviousCurve
|
||||
-- returns False.
|
||||
-- The exception OutOfRange is raised if N<=0 or N>NbCurve.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
InternalSetNextAndPrevious(me: in out)
|
||||
|
||||
---Purpose: Set the next and previous fields. Private method.
|
||||
is static protected;
|
||||
|
||||
|
||||
fields
|
||||
done : Boolean from Standard is protected;
|
||||
identical : Boolean from Standard is protected;
|
||||
TheCurve : Curve from IntAna [12] is protected;
|
||||
previouscurve : Integer from Standard [12] is protected;
|
||||
nextcurve : Integer from Standard [12] is protected;
|
||||
NbCurves : Integer from Standard is protected;
|
||||
|
||||
Nbpoints : Integer from Standard is protected;
|
||||
Thepoints : Pnt from gp [2] is protected;
|
||||
--
|
||||
myNbMaxCurves : Integer from Standard is protected;
|
||||
myEpsilon : Real from Standard is protected;
|
||||
myEpsilonCoeffPolyNull : Real from Standard is protected;
|
||||
|
||||
end IntQuadQuad;
|
||||
|
1264
src/IntAna/IntAna_IntQuadQuad.cxx
Executable file
1264
src/IntAna/IntAna_IntQuadQuad.cxx
Executable file
File diff suppressed because it is too large
Load Diff
26
src/IntAna/IntAna_IntQuadQuad.lxx
Executable file
26
src/IntAna/IntAna_IntQuadQuad.lxx
Executable file
@@ -0,0 +1,26 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
inline Standard_Boolean IntAna_IntQuadQuad::IsDone () const
|
||||
{
|
||||
return(done);
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntAna_IntQuadQuad::IdenticalElements () const {
|
||||
if(!done) {StdFail_NotDone::Raise("IntQuadQuad Not done");}
|
||||
return(identical);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntAna_IntQuadQuad::NbCurve () const {
|
||||
if(!done) {StdFail_NotDone::Raise("IntQuadQuad Not done");}
|
||||
if (identical) {Standard_DomainError::Raise();}
|
||||
return(NbCurves);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntAna_IntQuadQuad::NbPnt () const
|
||||
{
|
||||
if(!done) {StdFail_NotDone::Raise("IntQuadQuad Not done");}
|
||||
if (identical) {Standard_DomainError::Raise();}
|
||||
return(Nbpoints);
|
||||
}
|
||||
|
453
src/IntAna/IntAna_QuadQuadGeo.cdl
Executable file
453
src/IntAna/IntAna_QuadQuadGeo.cdl
Executable file
@@ -0,0 +1,453 @@
|
||||
-- File: QuadQuadGeo.cdl
|
||||
-- Created: Thu Aug 6 10:51:07 1992
|
||||
-- Author: Laurent BUCHARD
|
||||
-- <lbr@sdsun2>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
class QuadQuadGeo from IntAna
|
||||
|
||||
---Purpose: Geometric intersections between two natural quadrics
|
||||
-- (Sphere , Cylinder , Cone , Pln from gp).
|
||||
-- The possible intersections are :
|
||||
-- - 1 point
|
||||
-- - 1 or 2 line(s)
|
||||
-- - 1 Point and 1 Line
|
||||
-- - 1 circle
|
||||
-- - 1 ellipse
|
||||
-- - 1 parabola
|
||||
-- - 1 or 2 hyperbola(s).
|
||||
-- - Empty : there is no intersection between the two quadrics.
|
||||
-- - Same : the quadrics are identical
|
||||
-- - NoGeometricSolution : there may be an intersection, but it
|
||||
-- is necessary to use an analytic algorithm to determine
|
||||
-- it. See class IntQuadQuad from IntAna.
|
||||
|
||||
|
||||
uses Pln from gp,
|
||||
Cylinder from gp,
|
||||
Cone from gp,
|
||||
Sphere from gp,
|
||||
Pnt from gp,
|
||||
Lin from gp,
|
||||
Circ from gp,
|
||||
Elips from gp,
|
||||
Parab from gp,
|
||||
Hypr from gp,
|
||||
Dir from gp,
|
||||
ResultType from IntAna
|
||||
|
||||
|
||||
|
||||
raises NotDone from StdFail,
|
||||
DomainError from Standard,
|
||||
OutOfRange from Standard
|
||||
is
|
||||
|
||||
Create
|
||||
|
||||
---Purpose: Empty constructor.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Create(P1,P2 : Pln from gp;
|
||||
TolAng, Tol : Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between two planes.
|
||||
-- TolAng is the angular tolerance used to determine
|
||||
-- if the planes are parallel.
|
||||
-- Tol is the tolerance used to determine if the planes
|
||||
-- are identical (only when they are parallel).
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me : in out;
|
||||
P1,P2 : Pln from gp;
|
||||
TolAng, Tol : Real from Standard)
|
||||
|
||||
---Purpose: Intersects two planes.
|
||||
-- TolAng is the angular tolerance used to determine
|
||||
-- if the planes are parallel.
|
||||
-- Tol is the tolerance used to determine if the planes
|
||||
-- are identical (only when they are parallel).
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(P : Pln from gp;
|
||||
C : Cylinder from gp;
|
||||
Tolang,Tol: Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between a plane and a cylinder.
|
||||
-- TolAng is the angular tolerance used to determine
|
||||
-- if the axis of the cylinder is parallel to the plane.
|
||||
-- Tol is the tolerance used to determine if the result
|
||||
-- is a circle or an ellipse. If the maximum distance between
|
||||
-- the ellipse solution and the circle centered at the ellipse
|
||||
-- center is less than Tol, the result will be the circle.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
P : Pln from gp;
|
||||
C : Cylinder from gp;
|
||||
Tolang,Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a plane and a cylinder.
|
||||
-- TolAng is the angular tolerance used to determine
|
||||
-- if the axis of the cylinder is parallel to the plane.
|
||||
-- Tol is the tolerance used to determine if the result
|
||||
-- is a circle or an ellipse. If the maximum distance between
|
||||
-- the ellipse solution and the circle centered at the ellipse
|
||||
-- center is less than Tol, the result will be the circle.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(P : Pln from gp;
|
||||
S : Sphere from gp)
|
||||
|
||||
---Purpose: Creates the intersection between a plane and a sphere.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
P : Pln from gp;
|
||||
S : Sphere from gp)
|
||||
|
||||
---Purpose: Intersects a plane and a sphere.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(P : Pln from gp;
|
||||
C : Cone from gp;
|
||||
Tolang,Tol: Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between a plane and a cone.
|
||||
-- TolAng is the angular tolerance used to determine
|
||||
-- if the axis of the cone is parallel or perpendicular
|
||||
-- to the plane, and if the generating line of the cone
|
||||
-- is parallel to the plane.
|
||||
-- Tol is the tolerance used to determine if the apex
|
||||
-- of the cone is in the plane.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me: in out;
|
||||
P : Pln from gp;
|
||||
C : Cone from gp;
|
||||
Tolang,Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a plane and a cone.
|
||||
-- TolAng is the angular tolerance used to determine
|
||||
-- if the axis of the cone is parallel or perpendicular
|
||||
-- to the plane, and if the generating line of the cone
|
||||
-- is parallel to the plane.
|
||||
-- Tol is the tolerance used to determine if the apex
|
||||
-- of the cone is in the plane.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(Cyl1,Cyl2: Cylinder from gp;
|
||||
Tol : Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between two cylinders.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me : in out;
|
||||
Cyl1,Cyl2: Cylinder from gp;
|
||||
Tol : Real from Standard)
|
||||
|
||||
---Purpose: Intersects two cylinders
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(Cyl: Cylinder from gp;
|
||||
Sph: Sphere from gp;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between a Cylinder and a Sphere.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me : in out;
|
||||
Cyl: Cylinder from gp;
|
||||
Sph: Sphere from gp;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a cylinder and a sphere.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(Cyl: Cylinder from gp;
|
||||
Con: Cone from gp;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between a Cylinder and a Cone
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me : in out;
|
||||
Cyl: Cylinder from gp;
|
||||
Con: Cone from gp;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a cylinder and a cone.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(Sph1: Sphere from gp;
|
||||
Sph2: Sphere from gp;
|
||||
Tol : Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection between two Spheres.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me : in out;
|
||||
Sph1: Sphere from gp;
|
||||
Sph2: Sphere from gp;
|
||||
Tol : Real from Standard)
|
||||
|
||||
---Purpose: Intersects a two spheres.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(Sph: Sphere from gp;
|
||||
Con: Cone from gp;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection beween a Sphere and a Cone.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me : in out;
|
||||
Sph: Sphere from gp;
|
||||
Con: Cone from gp;
|
||||
Tol: Real from Standard)
|
||||
|
||||
---Purpose: Intersects a sphere and a cone.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Create(Con1: Cone from gp; Con2: Cone from gp; Tol:Real from Standard)
|
||||
|
||||
---Purpose: Creates the intersection beween two cones.
|
||||
|
||||
returns QuadQuadGeo from IntAna;
|
||||
|
||||
|
||||
Perform(me : in out;
|
||||
Con1: Cone from gp;
|
||||
Con2: Cone from gp;
|
||||
Tol :Real from Standard)
|
||||
|
||||
---Purpose: Intersects two cones.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
IsDone(me)
|
||||
|
||||
---Purpose: Returns Standard_True if the computation was successful.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
|
||||
|
||||
TypeInter(me)
|
||||
|
||||
---Purpose: Returns the type of intersection.
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns ResultType from IntAna
|
||||
|
||||
raises NotDone from StdFail
|
||||
--- The exception NotDone is raised if IsDone return Standard_False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NbSolutions(me)
|
||||
|
||||
---Purpose: Returns the number of interesections.
|
||||
-- The possible intersections are :
|
||||
-- - 1 point
|
||||
-- - 1 or 2 line(s)
|
||||
-- - 1 Point and 1 Line
|
||||
-- - 1 circle
|
||||
-- - 1 ellipse
|
||||
-- - 1 parabola
|
||||
-- - 1 or 2 hyperbola(s).
|
||||
--
|
||||
---C++: inline
|
||||
|
||||
returns Integer from Standard
|
||||
|
||||
raises NotDone from StdFail
|
||||
--- The exception NotDone is raised if IsDone returns Standard_False.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Point(me; Num: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the point solution of range Num.
|
||||
|
||||
returns Pnt from gp
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
--- The exception NotDone is raised if IsDone return Standard_False.
|
||||
-- The exception DomainError is raised if TypeInter does not return
|
||||
-- IntAna_Point or TypeInter does not return IntAna_PointAndCircle.
|
||||
-- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Line(me; Num: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the line solution of range Num.
|
||||
|
||||
returns Lin from gp
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
--- The exception NotDone is raised if IsDone return Standard_False.
|
||||
-- The exception DomainError is raised if TypeInter does not return
|
||||
-- IntAna_Line.
|
||||
-- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Circle(me; Num: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the circle solution of range Num.
|
||||
|
||||
returns Circ from gp
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
--- The exception NotDone is raised if IsDone return Standard_False.
|
||||
-- The exception DomainError is raised if TypeInter does not return
|
||||
-- IntAna_Circle or TypeInter does not return IntAna_PointAndCircle.
|
||||
-- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Ellipse(me; Num: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the ellipse solution of range Num.
|
||||
|
||||
returns Elips from gp
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
--- The exception NotDone is raised if IsDone return Standard_False.
|
||||
-- The exception DomainError is raised if TypeInter does not return
|
||||
-- IntAna_Ellipse.
|
||||
-- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Parabola(me; Num: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the parabola solution of range Num.
|
||||
|
||||
returns Parab from gp
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
--- The exception NotDone is raised if IsDone return Standard_False.
|
||||
-- The exception DomainError is raised if TypeInter does not return
|
||||
-- IntAna_Parabola.
|
||||
-- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions.
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
Hyperbola(me; Num: Integer from Standard)
|
||||
|
||||
---Purpose: Returns the hyperbola solution of range Num.
|
||||
|
||||
returns Hypr from gp
|
||||
|
||||
raises DomainError from Standard,
|
||||
OutOfRange from Standard,
|
||||
NotDone from StdFail
|
||||
--- The exception NotDone is raised if IsDone return Standard_False.
|
||||
-- The exception DomainError is raised if TypeInter does not return
|
||||
-- IntAna_Hyperbola.
|
||||
-- The exception OutOfRange is raised if Num < 1 or Num > NbSolutions.
|
||||
|
||||
is static;
|
||||
|
||||
HasCommonGen(me) returns Boolean from Standard;
|
||||
PChar(me) returns Pnt from gp;
|
||||
---C++: return const&
|
||||
|
||||
InitTolerances(me:out)
|
||||
|
||||
---Purpose: Initialize the values of inner tolerances.
|
||||
|
||||
is protected;
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean from Standard is protected;
|
||||
|
||||
nbint : Integer from Standard is protected;
|
||||
typeres : ResultType from IntAna is protected;
|
||||
|
||||
pt1 : Pnt from gp is protected;
|
||||
pt2 : Pnt from gp is protected;
|
||||
|
||||
dir1 : Dir from gp is protected;
|
||||
dir2 : Dir from gp is protected;
|
||||
|
||||
param1 : Real from Standard is protected;
|
||||
param2 : Real from Standard is protected;
|
||||
param1bis : Real from Standard is protected;
|
||||
param2bis : Real from Standard is protected;
|
||||
--
|
||||
myEPSILON_DISTANCE : Real from Standard is protected;
|
||||
myEPSILON_ANGLE_CONE : Real from Standard is protected;
|
||||
myEPSILON_MINI_CIRCLE_RADIUS : Real from Standard is protected;
|
||||
myEPSILON_CYLINDER_DELTA_RADIUS : Real from Standard is protected;
|
||||
myEPSILON_CYLINDER_DELTA_DISTANCE: Real from Standard is protected;
|
||||
myEPSILON_AXES_PARA : Real from Standard is protected;
|
||||
--
|
||||
myCommonGen : Boolean from Standard is protected;
|
||||
myPChar : Pnt from gp is protected;
|
||||
|
||||
end QuadQuadGeo;
|
1944
src/IntAna/IntAna_QuadQuadGeo.cxx
Executable file
1944
src/IntAna/IntAna_QuadQuadGeo.cxx
Executable file
File diff suppressed because it is too large
Load Diff
17
src/IntAna/IntAna_QuadQuadGeo.lxx
Executable file
17
src/IntAna/IntAna_QuadQuadGeo.lxx
Executable file
@@ -0,0 +1,17 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
inline Standard_Boolean IntAna_QuadQuadGeo::IsDone() const {
|
||||
return(done);
|
||||
}
|
||||
|
||||
|
||||
inline IntAna_ResultType IntAna_QuadQuadGeo::TypeInter() const {
|
||||
if(!done) {StdFail_NotDone::Raise();}
|
||||
return(typeres);
|
||||
}
|
||||
|
||||
inline Standard_Integer IntAna_QuadQuadGeo::NbSolutions() const {
|
||||
if(!done) {StdFail_NotDone::Raise();}
|
||||
return(nbint);
|
||||
}
|
||||
|
125
src/IntAna/IntAna_Quadric.cdl
Executable file
125
src/IntAna/IntAna_Quadric.cdl
Executable file
@@ -0,0 +1,125 @@
|
||||
-- File: Quadric.cdl
|
||||
-- Created: Wed Jul 1 10:52:36 1992
|
||||
-- Author: Laurent BUCHARD
|
||||
-- <lbr@topsn3>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
|
||||
class Quadric from IntAna
|
||||
|
||||
|
||||
---Purpose: This class provides a description of Quadrics by their
|
||||
-- Coefficients in natural coordinate system.
|
||||
|
||||
|
||||
uses Ax3 from gp,
|
||||
Cylinder from gp,
|
||||
Cone from gp,
|
||||
Sphere from gp,
|
||||
Pln from gp
|
||||
|
||||
|
||||
is
|
||||
|
||||
|
||||
Create
|
||||
|
||||
---Purpose: Empty Constructor
|
||||
|
||||
returns Quadric from IntAna;
|
||||
|
||||
|
||||
Create(P : Pln from gp)
|
||||
|
||||
---Purpose: Creates a Quadric from a Pln
|
||||
|
||||
returns Quadric from IntAna;
|
||||
|
||||
|
||||
Create(Sph: Sphere from gp)
|
||||
|
||||
---Purpose: Creates a Quadric from a Sphere
|
||||
|
||||
returns Quadric from IntAna;
|
||||
|
||||
|
||||
Create(Cyl: Cylinder from gp)
|
||||
|
||||
---Purpose: Creates a Quadric from a Cylinder
|
||||
|
||||
returns Quadric from IntAna;
|
||||
|
||||
|
||||
|
||||
Create(Cone: Cone from gp)
|
||||
|
||||
---Purpose: Creates a Quadric from a Cone
|
||||
|
||||
returns Quadric from IntAna;
|
||||
|
||||
|
||||
SetQuadric(me: in out; P: Pln from gp)
|
||||
|
||||
---Purpose: Initializes the quadric with a Pln
|
||||
|
||||
is static;
|
||||
|
||||
SetQuadric(me: in out; Sph: Sphere from gp)
|
||||
|
||||
---Purpose: Initialize the quadric with a Sphere
|
||||
|
||||
is static;
|
||||
|
||||
SetQuadric(me: in out; Con: Cone from gp)
|
||||
|
||||
---Purpose: Initializes the quadric with a Cone
|
||||
|
||||
is static;
|
||||
|
||||
SetQuadric(me: in out; Cyl: Cylinder from gp)
|
||||
|
||||
---Purpose: Initializes the quadric with a Cylinder
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
|
||||
Coefficients(me; xCXX,xCYY,xCZZ,xCXY
|
||||
,xCXZ,xCYZ,xCX,xCY,xCZ,xCCte: out Real from Standard)
|
||||
|
||||
---Purpose: Returns the coefficients of the polynomial equation
|
||||
-- which define the quadric:
|
||||
-- xCXX x**2 + xCYY y**2 + xCZZ z**2
|
||||
-- + 2 ( xCXY x y + xCXZ x z + xCYZ y z )
|
||||
-- + 2 ( xCX x + xCY y + xCZ z )
|
||||
-- + xCCte
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
NewCoefficients(me; xCXX,xCYY,xCZZ,xCXY,xCXZ
|
||||
,xCYZ,xCX,xCY,xCZ,xCCte: in out Real from Standard;
|
||||
Axis: Ax3 from gp)
|
||||
|
||||
---Purpose: Returns the coefficients of the polynomial equation
|
||||
-- ( written in the natural coordinates system )
|
||||
-- in the local coordinates system defined by Axis
|
||||
|
||||
is static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
CXX : Real from Standard;
|
||||
CYY : Real from Standard;
|
||||
CZZ : Real from Standard;
|
||||
CXY : Real from Standard;
|
||||
CXZ : Real from Standard;
|
||||
CYZ : Real from Standard;
|
||||
CX : Real from Standard;
|
||||
CY : Real from Standard;
|
||||
CZ : Real from Standard;
|
||||
CCte : Real from Standard;
|
||||
|
||||
end Quadric;
|
260
src/IntAna/IntAna_Quadric.cxx
Executable file
260
src/IntAna/IntAna_Quadric.cxx
Executable file
@@ -0,0 +1,260 @@
|
||||
// File: IntAna_Quadric.cxx
|
||||
// Created: Wed Jul 1 11:37:37 1992
|
||||
// Author: Laurent BUCHARD
|
||||
// <lbr@topsn3>
|
||||
#ifndef DEB
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
#include <IntAna_Quadric.ixx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//--
|
||||
//-- Equation generale des quadriques :
|
||||
//--
|
||||
//-- f(x,y,z) = CXX X**2 + CYY Y**2 + CZZ Z**2
|
||||
//--
|
||||
//-- + 2 ( CXY X Y + CXZ X Z + CYZ Y Z )
|
||||
//--
|
||||
//-- + 2 ( CX X + CY Y + CZ Z)
|
||||
//--
|
||||
//-- + CCte
|
||||
//--
|
||||
//--
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Quadric Vide
|
||||
//----------------------------------------------------------------------
|
||||
IntAna_Quadric::IntAna_Quadric(void) {
|
||||
CXX=CYY=CZZ=CXY=CXZ=CYZ=CX=CY=CZ=0.0; CCte=1.0;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//-- Pln -----> Quadric
|
||||
//--
|
||||
//-- Coefficients sur gp_Pln retourne A,B,C,D
|
||||
//-- avec f(x,y,z) = A x + B y + C z + D
|
||||
//--
|
||||
//-- que l on identifie a 2( CX x + CY y + CZ z ) + CCte
|
||||
//----------------------------------------------------------------------
|
||||
void IntAna_Quadric::SetQuadric(const gp_Pln& P) {
|
||||
P.Coefficients(CX,CY,CZ,CCte);
|
||||
CX*=0.5;
|
||||
CY*=0.5;
|
||||
CZ*=0.5;
|
||||
CXX=CYY=CZZ=CXY=CXZ=CYZ=0.0;
|
||||
}
|
||||
|
||||
IntAna_Quadric::IntAna_Quadric(const gp_Pln& P) {
|
||||
P.Coefficients(CX,CY,CZ,CCte);
|
||||
CX*=0.5;
|
||||
CY*=0.5;
|
||||
CZ*=0.5;
|
||||
CXX=CYY=CZZ=CXY=CXZ=CYZ=0.0;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//-- Cylinder -----> Quadric
|
||||
//----------------------------------------------------------------------
|
||||
void IntAna_Quadric::SetQuadric(const gp_Cylinder& Cyl) {
|
||||
Cyl.Coefficients(CXX,CYY,CZZ,CXY,CXZ,CYZ,CX,CY,CZ,CCte);
|
||||
}
|
||||
|
||||
IntAna_Quadric::IntAna_Quadric(const gp_Cylinder& Cyl) {
|
||||
Cyl.Coefficients(CXX,CYY,CZZ,CXY,CXZ,CYZ,CX,CY,CZ,CCte);
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//-- Cone -----> Quadric
|
||||
//----------------------------------------------------------------------
|
||||
IntAna_Quadric::IntAna_Quadric(const gp_Cone& Cone) {
|
||||
Cone.Coefficients(CXX,CYY,CZZ,CXY,CXZ,CYZ,CX,CY,CZ,CCte);
|
||||
}
|
||||
|
||||
void IntAna_Quadric::SetQuadric(const gp_Cone& Cone) {
|
||||
Cone.Coefficients(CXX,CYY,CZZ,CXY,CXZ,CYZ,CX,CY,CZ,CCte);
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//-- Sphere -----> Quadric
|
||||
//----------------------------------------------------------------------
|
||||
void IntAna_Quadric::SetQuadric(const gp_Sphere& Sph) {
|
||||
Sph.Coefficients(CXX,CYY,CZZ,CXY,CXZ,CYZ,CX,CY,CZ,CCte);
|
||||
}
|
||||
|
||||
IntAna_Quadric::IntAna_Quadric(const gp_Sphere& Sph) {
|
||||
Sph.Coefficients(CXX,CYY,CZZ,CXY,CXZ,CYZ,CX,CY,CZ,CCte);
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//-- Returns the Coefficients of the Quadric
|
||||
//----------------------------------------------------------------------
|
||||
void IntAna_Quadric::Coefficients(Standard_Real& _CXX,Standard_Real& _CYY,Standard_Real& _CZZ,
|
||||
Standard_Real& _CXY,Standard_Real& _CXZ,Standard_Real& _CYZ,
|
||||
Standard_Real& _CX, Standard_Real& _CY, Standard_Real& _CZ,
|
||||
Standard_Real& _CCte) const
|
||||
{
|
||||
_CXX=CXX; _CYY=CYY; _CZZ=CZZ;
|
||||
_CXY=CXY; _CXZ=CXZ; _CYZ=CYZ;
|
||||
_CX=CX; _CY=CY; _CZ=CZ;
|
||||
_CCte=CCte;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//-- Computes the Coefficients in a new coordinate system
|
||||
//----------------------------------------------------------------------
|
||||
void IntAna_Quadric::NewCoefficients( Standard_Real& _CXX,Standard_Real& _CYY,Standard_Real& _CZZ
|
||||
,Standard_Real& _CXY,Standard_Real& _CXZ,Standard_Real& _CYZ
|
||||
,Standard_Real& _CX, Standard_Real& _CY, Standard_Real& _CZ
|
||||
,Standard_Real& _CCte
|
||||
,const gp_Ax3& Axis) const
|
||||
{
|
||||
Standard_Real t11,t12,t13,t14; // x = t11 X + t12 Y + t13 Z + t14
|
||||
Standard_Real t21,t22,t23,t24; // y = t21 X + t22 Y + t23 Z + t24
|
||||
Standard_Real t31,t32,t33,t34; // z = t31 X + t32 Y + t33 Z + t34
|
||||
|
||||
// = X DirX + Y DirY + Z DirZ + Loc
|
||||
|
||||
Standard_Real Cxx,Cyy,Czz,Cxy,Cxz,Cyz,Cx,Cy,Cz,Ccte;
|
||||
|
||||
|
||||
#ifdef DEB
|
||||
gp_Dir DirX = Axis.XDirection();
|
||||
gp_Dir DirY = Axis.YDirection();
|
||||
gp_Dir DirZ = Axis.Direction();
|
||||
#else
|
||||
Axis.XDirection();
|
||||
Axis.YDirection();
|
||||
Axis.Direction();
|
||||
#endif
|
||||
|
||||
gp_Trsf Trans;
|
||||
|
||||
Trans.SetTransformation(Axis);
|
||||
Trans.Invert();
|
||||
t11=Trans.Value(1,1); t12=Trans.Value(1,2); t13=Trans.Value(1,3); t14=Trans.Value(1,4);
|
||||
t21=Trans.Value(2,1); t22=Trans.Value(2,2); t23=Trans.Value(2,3); t24=Trans.Value(2,4);
|
||||
t31=Trans.Value(3,1); t32=Trans.Value(3,2); t33=Trans.Value(3,3); t34=Trans.Value(3,4);
|
||||
|
||||
|
||||
// P0(x,y,z)=_CXX x x + _CYY y y + ... + _CCte =0 (x,y,z "absolute" coordinates)
|
||||
// and P1(X(x,y,z),Y(x,y,z),Z(x,y,z))=P0(x,y,z)
|
||||
//
|
||||
// with P1(X,Y,Z)= Cxx X X + Cyy Y Y + Czz Z Z + 2 Cxy X Y ... + Ccte
|
||||
// = _CXX x x + _CYY y y + ... + _CCte
|
||||
|
||||
Standard_Real t11_P2=t11*t11; Standard_Real t21_P2=t21*t21; Standard_Real t31_P2=t31*t31;
|
||||
Standard_Real t12_P2=t12*t12; Standard_Real t22_P2=t22*t22; Standard_Real t32_P2=t32*t32;
|
||||
Standard_Real t13_P2=t13*t13; Standard_Real t23_P2=t23*t23; Standard_Real t33_P2=t33*t33;
|
||||
Standard_Real t14_P2=t14*t14; Standard_Real t24_P2=t24*t24; Standard_Real t34_P2=t34*t34;
|
||||
|
||||
Ccte = ((_CCte)
|
||||
+ t14_P2* (_CXX)
|
||||
+ t24_P2* (_CYY)
|
||||
+ t34_P2* (_CZZ)
|
||||
+ 2.0 * ( t14*( (_CX)
|
||||
+t24* (_CXY)
|
||||
+t34* (_CXZ))
|
||||
+t24*( (_CY)
|
||||
+t34* (_CYZ))
|
||||
+t34* (_CZ)));
|
||||
|
||||
Cxx = ( t11_P2* (_CXX)
|
||||
+ t21_P2* (_CYY)
|
||||
+ t31_P2* (_CZZ)
|
||||
+ 2.0*( t11*( t21* (_CXY)
|
||||
+t31* (_CXZ))
|
||||
+t21*t31* (_CYZ)));
|
||||
|
||||
Cyy = (t12_P2* (_CXX)
|
||||
+ t22_P2* (_CYY)
|
||||
+ t32_P2* (_CZZ)
|
||||
+ 2.0*( t12*( t22* (_CXY)
|
||||
+t32* (_CXZ))
|
||||
+t22*t32* (_CYZ)));
|
||||
|
||||
Czz = (t13_P2* (_CXX)
|
||||
+ t33_P2* (_CZZ)
|
||||
+ t23_P2* (_CYY)
|
||||
+ 2.0*( t13*( t23* (_CXY)
|
||||
+t33* (_CXZ))
|
||||
+t23*t33* (_CYZ)));
|
||||
|
||||
Cz = (t13* (_CX)
|
||||
+ t13*( t14* (_CXX)
|
||||
+ t24* (_CXY)
|
||||
+ t34* (_CXZ))
|
||||
+ t14*( t23* (_CXY)
|
||||
+t33* (_CXZ))
|
||||
+ t23*( (_CY)
|
||||
+t24* (_CYY)
|
||||
+t34* (_CYZ))
|
||||
+ t33*( t24* (_CYZ)
|
||||
+(_CZ)
|
||||
+ t34* (_CZZ)));
|
||||
|
||||
Cx = (t11* ((_CX)
|
||||
+t14* (_CXX)
|
||||
+t24* (_CXY)
|
||||
+t34* (_CXZ))
|
||||
+ t14*( t21* (_CXY)
|
||||
+t31* (_CXZ))
|
||||
+ t21*( (_CY)
|
||||
+t24* (_CYY)
|
||||
+t34* (_CYZ))
|
||||
+ t31*( t24* (_CYZ)
|
||||
+(_CZ)
|
||||
+t34* (_CZZ)));
|
||||
|
||||
Cxy = (t11*( t12* (_CXX)
|
||||
+t22* (_CXY)
|
||||
+t32* (_CXZ))
|
||||
+ t12*( t21* (_CXY)
|
||||
+t31* (_CXZ))
|
||||
+ t21*( t22* (_CYY)
|
||||
+t32* (_CYZ))
|
||||
+ t31*( t22* (_CYZ)
|
||||
+t32* (_CZZ)));
|
||||
|
||||
Cxz = (t11*( t13* (_CXX)
|
||||
+t23* (_CXY)
|
||||
+t33* (_CXZ))
|
||||
+ t13*( t21* (_CXY)
|
||||
+t31* (_CXZ))
|
||||
+ t21*( t23* (_CYY)
|
||||
+t33* (_CYZ))
|
||||
+ t31*( t23* (_CYZ)
|
||||
+t33* (_CZZ)));
|
||||
|
||||
Cy = (t12* ( (_CX)
|
||||
+t14* (_CXX)
|
||||
+t24* (_CXY)
|
||||
+t34* (_CXZ))
|
||||
+ t14*( t22* (_CXY)
|
||||
+t32* (_CXZ))
|
||||
+ t22*( (_CY)
|
||||
+t24* (_CYY)
|
||||
+t34* (_CYZ))
|
||||
+ t32*( (_CZ)
|
||||
+ t24* (_CYZ)
|
||||
+ t34* (_CZZ)));
|
||||
|
||||
Cyz = (t12*( t13* (_CXX)
|
||||
+t23* (_CXY)
|
||||
+t33* (_CXZ))
|
||||
+ t13*( t22* (_CXY)
|
||||
+t32* (_CXZ))
|
||||
+ t22*( t23* (_CYY)
|
||||
+t33* (_CYZ))
|
||||
+ t32*( t23* (_CYZ)
|
||||
+t33* (_CZZ)));
|
||||
|
||||
|
||||
_CXX=Cxx; _CYY=Cyy; _CZZ=Czz; _CX=Cx; _CY=Cy; _CZ=Cz;
|
||||
_CXY=Cxy; _CXZ=Cxz; _CYZ=Cyz; _CCte=Ccte;
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user