1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00
Files
occt/src/gp/gp_Ax3.lxx
abv d5f74e42d6 0024624: Lost word in license statement in source files
License statement text corrected; compiler warnings caused by Bison 2.41 disabled for MSVC; a few other compiler warnings on 54-bit Windows eliminated by appropriate type cast
Wrong license statements corrected in several files.
Copyright and license statements added in XSD and GLSL files.
Copyright year updated in some files.
Obsolete documentation files removed from DrawResources.
2014-02-20 16:15:17 +04:00

200 lines
5.2 KiB
Plaintext

// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax1.hxx>
inline gp_Ax3::gp_Ax3() : vydir(0.,1.,0.), vxdir(1.,0.,0.)
{ }
inline gp_Ax3::gp_Ax3(const gp_Ax2& A) :
axis(A.Axis()),
vydir(A.YDirection()),
vxdir(A.XDirection())
{ }
inline gp_Ax3::gp_Ax3(const gp_Pnt& P, const gp_Dir& N, const gp_Dir& Vx) :
axis(P, N), vydir(N), vxdir(N)
{
vxdir.CrossCross(Vx, N);
vydir.Cross(vxdir);
}
inline void gp_Ax3::XReverse()
{ vxdir.Reverse(); }
inline void gp_Ax3::YReverse()
{ vydir.Reverse(); }
inline void gp_Ax3::ZReverse()
{ axis.Reverse(); }
inline void gp_Ax3::SetAxis(const gp_Ax1& A1)
{
Standard_Boolean direct = Direct();
axis = A1;
vxdir = axis.Direction().CrossCrossed (vxdir, axis.Direction());
if(direct) { vydir = axis.Direction().Crossed(vxdir); }
else { vydir = vxdir.Crossed(axis.Direction()); }
}
inline void gp_Ax3::SetDirection(const gp_Dir& V)
{
Standard_Boolean direct = Direct();
axis.SetDirection (V);
vxdir = V.CrossCrossed (vxdir, V);
if (direct) { vydir = V.Crossed (vxdir); }
else { vydir = vxdir.Crossed (V); }
}
inline void gp_Ax3::SetLocation(const gp_Pnt& P)
{ axis.SetLocation(P); }
inline void gp_Ax3::SetXDirection(const gp_Dir& Vx)
{
Standard_Boolean direct = Direct();
vxdir = axis.Direction().CrossCrossed (Vx, axis.Direction());
if (direct) { vydir = axis.Direction().Crossed(vxdir); }
else { vydir = vxdir.Crossed(axis.Direction()); }
}
inline void gp_Ax3::SetYDirection(const gp_Dir& Vy)
{
Standard_Boolean direct = Direct();
vxdir = Vy.Crossed (axis.Direction());
vydir = (axis.Direction()).Crossed (vxdir);
if (!direct) { vxdir.Reverse(); }
}
inline Standard_Real gp_Ax3::Angle(const gp_Ax3& Other) const
{ return axis.Angle (Other.axis); }
inline const gp_Ax1& gp_Ax3::Axis()const
{ return axis; }
inline gp_Ax2 gp_Ax3::Ax2()const
{
gp_Dir zz = axis.Direction();
if (!Direct()) { zz.Reverse(); }
return gp_Ax2 (axis.Location(),zz,vxdir);
}
inline const gp_Dir& gp_Ax3::Direction()const
{ return axis.Direction(); }
inline const gp_Pnt& gp_Ax3::Location()const
{ return axis.Location(); }
inline const gp_Dir& gp_Ax3::XDirection()const
{ return vxdir; }
inline const gp_Dir& gp_Ax3::YDirection()const
{ return vydir; }
inline Standard_Boolean gp_Ax3::Direct()const
{ return (vxdir.Crossed(vydir).Dot(axis.Direction()) > 0.); }
inline Standard_Boolean gp_Ax3::IsCoplanar
(const gp_Ax3& Other,
const Standard_Real LinearTolerance,
const Standard_Real AngularTolerance)const
{
gp_Vec vec(axis.Location(),Other.axis.Location());
Standard_Real D1 = gp_Vec(axis.Direction() ).Dot(vec);
if (D1 < 0) D1 = - D1;
Standard_Real D2 = gp_Vec(Other.axis.Direction()).Dot(vec);
if (D2 < 0) D2 = - D2;
return (D1 <= LinearTolerance && D2 <= LinearTolerance &&
axis.IsParallel (Other.axis, AngularTolerance));
}
inline Standard_Boolean gp_Ax3::IsCoplanar
(const gp_Ax1& A1,
const Standard_Real LinearTolerance,
const Standard_Real AngularTolerance)const
{
gp_Vec vec(axis.Location(),A1.Location());
Standard_Real D1 = gp_Vec(axis.Direction()).Dot(vec);
if (D1 < 0) D1 = - D1;
Standard_Real D2 = (gp_Vec(A1.Direction()).Crossed(vec)).Magnitude();
if (D2 < 0) D2 = - D2;
return (D1 <= LinearTolerance && D2 <= LinearTolerance &&
axis.IsNormal (A1, AngularTolerance));
}
inline void gp_Ax3::Rotate(const gp_Ax1& A1,
const Standard_Real Ang)
{
axis.Rotate (A1,Ang);
vxdir.Rotate (A1,Ang);
vydir.Rotate (A1,Ang);
}
inline gp_Ax3 gp_Ax3::Rotated(const gp_Ax1& A1,
const Standard_Real Ang)const
{
gp_Ax3 Temp = *this;
Temp.Rotate (A1,Ang);
return Temp;
}
inline void gp_Ax3::Scale(const gp_Pnt& P, const Standard_Real S)
{
axis.Scale (P,S);
if (S < 0.) {
vxdir.Reverse ();
vydir.Reverse ();
}
}
inline gp_Ax3 gp_Ax3::Scaled(const gp_Pnt& P,
const Standard_Real S)const
{
gp_Ax3 Temp = *this;
Temp.Scale (P,S);
return Temp;
}
inline void gp_Ax3::Transform(const gp_Trsf& T)
{
axis.Transform (T);
vxdir.Transform (T);
vydir.Transform (T);
}
inline gp_Ax3 gp_Ax3::Transformed(const gp_Trsf& T)const
{
gp_Ax3 Temp = *this;
Temp.Transform (T);
return Temp;
}
inline void gp_Ax3::Translate(const gp_Vec& V)
{ axis.Translate (V); }
inline gp_Ax3 gp_Ax3::Translated(const gp_Vec& V)const
{
gp_Ax3 Temp = *this;
Temp.Translate (V);
return Temp;
}
inline void gp_Ax3::Translate(const gp_Pnt& P1, const gp_Pnt& P2)
{ Translate(gp_Vec(P1,P2)); }
inline gp_Ax3 gp_Ax3::Translated(const gp_Pnt& P1, const gp_Pnt& P2)const
{ return Translated(gp_Vec(P1,P2)); }