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_Parab2d.lxx

167 lines
4.7 KiB
Plaintext

// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_ConstructionError.hxx>
inline gp_Parab2d::gp_Parab2d () :focalLength(RealLast()){ }
inline gp_Parab2d::gp_Parab2d(const gp_Ax22d& theMirrorAxis,
const Standard_Real theFocalLength) :
pos (theMirrorAxis),
focalLength (theFocalLength)
{
Standard_ConstructionError_Raise_if (theFocalLength < 0.0, "gp_Parab2d() - focal length should be >= 0");
}
inline gp_Parab2d::gp_Parab2d(const gp_Ax2d& theMirrorAxis,
const Standard_Real theFocalLength,
const Standard_Boolean theSense) :
focalLength (theFocalLength)
{
pos = gp_Ax22d(theMirrorAxis,theSense);
Standard_ConstructionError_Raise_if (theFocalLength < 0.0, "gp_Parab2d() - focal length should be >= 0");
}
inline void gp_Parab2d::SetFocal (const Standard_Real Focal)
{
Standard_ConstructionError_Raise_if (Focal < 0.0, "gp_Parab2d::SetFocal() - focal length should be >= 0");
focalLength = Focal;
}
inline void gp_Parab2d::SetLocation (const gp_Pnt2d& P)
{ pos.SetLocation(P); }
inline void gp_Parab2d::SetMirrorAxis (const gp_Ax2d& A)
{ pos.SetXAxis(A); }
inline void gp_Parab2d::SetAxis (const gp_Ax22d& A)
{ pos.SetAxis(A); }
inline gp_Ax2d gp_Parab2d::Directrix() const
{
gp_Pnt2d P (pos.Location().X() - focalLength * pos.XDirection().X(),
pos.Location().Y() - focalLength * pos.XDirection().Y() );
gp_Dir2d V (pos.YDirection());
return gp_Ax2d(P, V);
}
inline Standard_Real gp_Parab2d::Focal() const
{ return focalLength; }
inline gp_Pnt2d gp_Parab2d::Focus() const
{
return gp_Pnt2d (pos.Location().X() + focalLength * pos.XDirection().X(),
pos.Location().Y() + focalLength * pos.XDirection().Y());
}
inline gp_Pnt2d gp_Parab2d::Location () const
{ return pos.Location(); }
inline gp_Ax2d gp_Parab2d::MirrorAxis () const
{ return pos.XAxis(); }
inline gp_Ax22d gp_Parab2d::Axis () const
{ return pos; }
inline Standard_Real gp_Parab2d::Parameter() const
{ return 2.0 * focalLength; }
inline void gp_Parab2d::Reverse()
{
gp_Dir2d Temp = pos.YDirection ();
Temp.Reverse ();
pos.SetAxis(gp_Ax22d(pos.Location(),pos.XDirection(),Temp));
}
inline gp_Parab2d gp_Parab2d::Reversed() const
{
gp_Parab2d P = *this;
gp_Dir2d Temp = pos.YDirection ();
Temp.Reverse ();
P.pos.SetAxis(gp_Ax22d(pos.Location(),pos.XDirection(),Temp));
return P;
}
inline Standard_Boolean gp_Parab2d::IsDirect() const
{ return (pos.XDirection().Crossed(pos.YDirection())) >= 0.0; }
inline void gp_Parab2d::Rotate (const gp_Pnt2d& P,
const Standard_Real Ang)
{pos.Rotate (P, Ang);}
inline gp_Parab2d gp_Parab2d::Rotated (const gp_Pnt2d& P,
const Standard_Real Ang) const
{
gp_Parab2d Prb = *this;
Prb.pos.Rotate (P, Ang);
return Prb;
}
inline void gp_Parab2d::Scale (const gp_Pnt2d& P,
const Standard_Real S)
{
focalLength *= S;
if (focalLength < 0) focalLength = - focalLength;
pos.Scale (P, S);
}
inline gp_Parab2d gp_Parab2d::Scaled (const gp_Pnt2d& P,
const Standard_Real S) const
{
gp_Parab2d Prb = *this;
Prb.focalLength *= S;
if (Prb.focalLength < 0) Prb.focalLength = - Prb.focalLength;
Prb.pos.Scale (P, S);
return Prb;
}
inline void gp_Parab2d::Transform (const gp_Trsf2d& T)
{
focalLength *= T.ScaleFactor();
if (focalLength < 0) focalLength = - focalLength;
pos.Transform (T);
}
inline gp_Parab2d gp_Parab2d::Transformed (const gp_Trsf2d& T) const
{
gp_Parab2d Prb = *this;
Prb.focalLength *= T.ScaleFactor();
if (Prb.focalLength < 0) Prb.focalLength = - Prb.focalLength;
Prb.pos.Transform (T);
return Prb;
}
inline void gp_Parab2d::Translate (const gp_Vec2d& V)
{ pos.Translate (V); }
inline gp_Parab2d gp_Parab2d::Translated (const gp_Vec2d& V) const
{
gp_Parab2d Prb = *this;
Prb.pos.Translate(V);
return Prb;
}
inline void gp_Parab2d::Translate (const gp_Pnt2d& P1,
const gp_Pnt2d& P2)
{ pos.Translate (P1, P2); }
inline gp_Parab2d gp_Parab2d::Translated (const gp_Pnt2d& P1,
const gp_Pnt2d& P2) const
{
gp_Parab2d Prb = *this;
Prb.pos.Translate (P1, P2);
return Prb;
}