mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0031034: Visualization - stack-use-after-scope reported by Clang address sanitizer in AIS_FixRelation::Compute()
Methods of classes Geom_ElementarySurface, Geom_Conic, and Geom2d_Conic setting or returning values of fields are made inline and return const& to avoid copying
This commit is contained in:
@@ -14,71 +14,16 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Geom2d_Conic.hxx>
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Geom2d_Conic,Geom2d_Curve)
|
||||
|
||||
typedef Geom2d_Conic Conic;
|
||||
|
||||
typedef gp_Ax2d Ax2d;
|
||||
typedef gp_Dir2d Dir2d;
|
||||
typedef gp_Pnt2d Pnt2d;
|
||||
typedef gp_Vec2d Vec2d;
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAxis
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2d_Conic::SetAxis(const gp_Ax22d& A)
|
||||
{
|
||||
pos.SetAxis(A);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetXAxis
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2d_Conic::SetXAxis (const Ax2d& A)
|
||||
{
|
||||
pos.SetXAxis(A);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetYAxis
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2d_Conic::SetYAxis (const Ax2d& A)
|
||||
{
|
||||
pos.SetYAxis(A);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetLocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2d_Conic::SetLocation (const Pnt2d& P)
|
||||
{
|
||||
pos.SetLocation (P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : XAxis
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Ax2d Geom2d_Conic::XAxis () const
|
||||
gp_Ax2d Geom2d_Conic::XAxis () const
|
||||
{
|
||||
return gp_Ax2d(pos.Location(), pos.XDirection());
|
||||
}
|
||||
@@ -88,40 +33,19 @@ Ax2d Geom2d_Conic::XAxis () const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Ax2d Geom2d_Conic::YAxis () const
|
||||
gp_Ax2d Geom2d_Conic::YAxis () const
|
||||
{
|
||||
return gp_Ax2d(pos.Location(), pos.YDirection());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Location
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Pnt2d Geom2d_Conic::Location () const
|
||||
{
|
||||
return pos.Location();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Position
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Ax22d& Geom2d_Conic::Position () const
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Reverse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom2d_Conic::Reverse () {
|
||||
|
||||
Dir2d Temp = pos.YDirection ();
|
||||
void Geom2d_Conic::Reverse ()
|
||||
{
|
||||
gp_Dir2d Temp = pos.YDirection ();
|
||||
Temp.Reverse ();
|
||||
pos.SetAxis(gp_Ax22d(pos.Location(), pos.XDirection(), Temp));
|
||||
}
|
||||
|
@@ -17,21 +17,8 @@
|
||||
#ifndef _Geom2d_Conic_HeaderFile
|
||||
#define _Geom2d_Conic_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_DomainError;
|
||||
class gp_Ax22d;
|
||||
class gp_Ax2d;
|
||||
class gp_Pnt2d;
|
||||
|
||||
|
||||
class Geom2d_Conic;
|
||||
DEFINE_STANDARD_HANDLE(Geom2d_Conic, Geom2d_Curve)
|
||||
@@ -53,30 +40,31 @@ DEFINE_STANDARD_HANDLE(Geom2d_Conic, Geom2d_Curve)
|
||||
//! the parameter of the conic.
|
||||
class Geom2d_Conic : public Geom2d_Curve
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Modifies this conic, redefining its local coordinate system
|
||||
//! partially, by assigning P as its origin
|
||||
Standard_EXPORT void SetAxis (const gp_Ax22d& A);
|
||||
//! partially, by assigning theA as its axis
|
||||
void SetAxis (const gp_Ax22d& theA) { pos.SetAxis(theA); }
|
||||
|
||||
Standard_EXPORT void SetXAxis (const gp_Ax2d& A);
|
||||
|
||||
//! Assigns the origin and unit vector of axis A to the
|
||||
//! origin of the local coordinate system of this conic and either:
|
||||
//! - its "X Direction", or
|
||||
//! - its "Y Direction".
|
||||
//! Assigns the origin and unit vector of axis theA to the
|
||||
//! origin of the local coordinate system of this conic and X Direction.
|
||||
//! The other unit vector of the local coordinate system
|
||||
//! of this conic is recomputed normal to A, without
|
||||
//! of this conic is recomputed normal to theA, without
|
||||
//! changing the orientation of the local coordinate
|
||||
//! system (right-handed or left-handed).
|
||||
Standard_EXPORT void SetYAxis (const gp_Ax2d& A);
|
||||
void SetXAxis (const gp_Ax2d& theAX) { pos.SetXAxis(theAX); }
|
||||
|
||||
//! Assigns the origin and unit vector of axis theA to the
|
||||
//! origin of the local coordinate system of this conic and Y Direction.
|
||||
//! The other unit vector of the local coordinate system
|
||||
//! of this conic is recomputed normal to theA, without
|
||||
//! changing the orientation of the local coordinate
|
||||
//! system (right-handed or left-handed).
|
||||
void SetYAxis (const gp_Ax2d& theAY) { pos.SetXAxis(theAY); }
|
||||
|
||||
//! Modifies this conic, redefining its local coordinate
|
||||
//! system fully, by assigning A as this coordinate system.
|
||||
Standard_EXPORT void SetLocation (const gp_Pnt2d& P);
|
||||
|
||||
//! system partially, by assigning theP as its origin.
|
||||
void SetLocation (const gp_Pnt2d& theP) { pos.SetLocation(theP); }
|
||||
|
||||
//! Returns the "XAxis" of the conic.
|
||||
//! This axis defines the origin of parametrization of the conic.
|
||||
@@ -102,12 +90,10 @@ public:
|
||||
//! Returns the location point of the conic.
|
||||
//! For the circle, the ellipse and the hyperbola it is the center of
|
||||
//! the conic. For the parabola it is the vertex of the parabola.
|
||||
Standard_EXPORT gp_Pnt2d Location() const;
|
||||
const gp_Pnt2d& Location() const { return pos.Location(); }
|
||||
|
||||
|
||||
//! Returns the local coordinates system of the conic.
|
||||
Standard_EXPORT const gp_Ax22d& Position() const;
|
||||
|
||||
const gp_Ax22d& Position() const { return pos; }
|
||||
|
||||
//! Reverses the direction of parameterization of <me>.
|
||||
//! The local coordinate system of the conic is modified.
|
||||
@@ -120,32 +106,13 @@ public:
|
||||
//! Returns GeomAbs_CN which is the global continuity of any conic.
|
||||
Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns True, the order of continuity of a conic is infinite.
|
||||
Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Geom2d_Conic,Geom2d_Curve)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
gp_Ax22d pos;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Geom2d_Conic_HeaderFile
|
||||
|
Reference in New Issue
Block a user