mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +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,50 +14,58 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Geom_Conic.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_RangeError.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Geom_Conic,Geom_Curve)
|
||||
|
||||
typedef Geom_Conic Conic;
|
||||
typedef gp_Ax1 Ax1;
|
||||
typedef gp_Ax2 Ax2;
|
||||
typedef gp_Pnt Pnt;
|
||||
typedef gp_Vec Vec;
|
||||
|
||||
|
||||
|
||||
void Geom_Conic::Reverse () {
|
||||
//=======================================================================
|
||||
//function : UReverse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_Conic::Reverse ()
|
||||
{
|
||||
gp_Dir Vz = pos.Direction ();
|
||||
Vz.Reverse();
|
||||
pos.SetDirection (Vz);
|
||||
}
|
||||
|
||||
void Geom_Conic::SetAxis (const Ax1& A1) { pos.SetAxis (A1); }
|
||||
//=======================================================================
|
||||
//function : UReverse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_Conic::SetLocation (const Pnt& O) { pos.SetLocation (O); }
|
||||
GeomAbs_Shape Geom_Conic::Continuity () const
|
||||
{
|
||||
return GeomAbs_CN;
|
||||
}
|
||||
|
||||
void Geom_Conic::SetPosition (const Ax2& A2) { pos = A2; }
|
||||
//=======================================================================
|
||||
//function : UReverse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Ax1 Geom_Conic::Axis () const { return pos.Axis(); }
|
||||
gp_Ax1 Geom_Conic::XAxis () const
|
||||
{
|
||||
return gp_Ax1 (pos.Location(), pos.XDirection());
|
||||
}
|
||||
|
||||
GeomAbs_Shape Geom_Conic::Continuity () const { return GeomAbs_CN; }
|
||||
//=======================================================================
|
||||
//function : UReverse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Pnt Geom_Conic::Location () const { return pos.Location(); }
|
||||
gp_Ax1 Geom_Conic::YAxis () const
|
||||
{
|
||||
return gp_Ax1 (pos.Location(), pos.YDirection());
|
||||
}
|
||||
|
||||
const gp_Ax2& Geom_Conic::Position () const { return pos; }
|
||||
|
||||
Ax1 Geom_Conic::XAxis () const {return Ax1(pos.Location(), pos.XDirection());}
|
||||
|
||||
Ax1 Geom_Conic::YAxis () const {return Ax1(pos.Location(), pos.YDirection());}
|
||||
|
||||
Standard_Boolean Geom_Conic::IsCN (const Standard_Integer ) const { return Standard_True; }
|
||||
//=======================================================================
|
||||
//function : UReverse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Geom_Conic::IsCN (const Standard_Integer ) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -17,22 +17,8 @@
|
||||
#ifndef _Geom_Conic_HeaderFile
|
||||
#define _Geom_Conic_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_RangeError;
|
||||
class Standard_DomainError;
|
||||
class gp_Ax1;
|
||||
class gp_Pnt;
|
||||
class gp_Ax2;
|
||||
|
||||
|
||||
class Geom_Conic;
|
||||
DEFINE_STANDARD_HANDLE(Geom_Conic, Geom_Curve)
|
||||
@@ -62,27 +48,36 @@ DEFINE_STANDARD_HANDLE(Geom_Conic, Geom_Curve)
|
||||
//! also defines the origin of the parameter of the conic.
|
||||
class Geom_Conic : public Geom_Curve
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Changes the orientation of the conic's plane. The normal
|
||||
//! axis to the plane is A1. The XAxis and the YAxis are recomputed.
|
||||
//!
|
||||
//! raised if the A1 is parallel to the XAxis of the conic.
|
||||
Standard_EXPORT void SetAxis (const gp_Ax1& A1);
|
||||
void SetAxis (const gp_Ax1& theA1) { pos.SetAxis(theA1); }
|
||||
|
||||
//! changes the location point of the conic.
|
||||
Standard_EXPORT void SetLocation (const gp_Pnt& P);
|
||||
void SetLocation (const gp_Pnt& theP) { pos.SetLocation(theP); }
|
||||
|
||||
//! changes the local coordinate system of the conic.
|
||||
Standard_EXPORT void SetPosition (const gp_Ax2& A2);
|
||||
void SetPosition (const gp_Ax2& theA2) { pos = theA2; }
|
||||
|
||||
//! Returns the "main Axis" of this conic. This axis is
|
||||
//! normal to the plane of the conic.
|
||||
Standard_EXPORT gp_Ax1 Axis() const;
|
||||
|
||||
const gp_Ax1& Axis() const { return pos.Axis(); }
|
||||
|
||||
//! 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 Apex of the parabola.
|
||||
const gp_Pnt& Location() const { return pos.Location(); }
|
||||
|
||||
//! Returns the local coordinates system of the conic.
|
||||
//! The main direction of the Axis2Placement is normal to the
|
||||
//! plane of the conic. The X direction of the Axis2placement
|
||||
//! is in the plane of the conic and corresponds to the origin
|
||||
//! for the conic's parametric value u.
|
||||
const gp_Ax2& Position() const { return pos; }
|
||||
|
||||
//! Returns the eccentricity value of the conic e.
|
||||
//! e = 0 for a circle
|
||||
//! 0 < e < 1 for an ellipse (e = 0 if MajorRadius = MinorRadius)
|
||||
@@ -91,22 +86,7 @@ public:
|
||||
//! Exceptions
|
||||
//! Standard_DomainError in the case of a hyperbola if
|
||||
//! its major radius is null.
|
||||
Standard_EXPORT virtual Standard_Real Eccentricity() const = 0;
|
||||
|
||||
|
||||
//! 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 Apex of the parabola.
|
||||
Standard_EXPORT gp_Pnt Location() const;
|
||||
|
||||
|
||||
//! Returns the local coordinates system of the conic.
|
||||
//! The main direction of the Axis2Placement is normal to the
|
||||
//! plane of the conic. The X direction of the Axis2placement
|
||||
//! is in the plane of the conic and corresponds to the origin
|
||||
//! for the conic's parametric value u.
|
||||
Standard_EXPORT const gp_Ax2& Position() const;
|
||||
|
||||
virtual Standard_Real Eccentricity() const = 0;
|
||||
|
||||
//! Returns the XAxis of the conic.
|
||||
//! This axis defines the origin of parametrization of the conic.
|
||||
@@ -136,28 +116,10 @@ public:
|
||||
//! Raised if N < 0.
|
||||
Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Geom_Conic,Geom_Curve)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
gp_Ax2 pos;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Geom_Conic_HeaderFile
|
||||
|
@@ -14,31 +14,17 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Geom_ElementarySurface.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Geom_ElementarySurface,Geom_Surface)
|
||||
|
||||
typedef Geom_ElementarySurface ElementarySurface;
|
||||
typedef gp_Ax1 Ax1;
|
||||
typedef gp_Ax2 Ax2;
|
||||
typedef gp_Ax3 Ax3;
|
||||
typedef gp_Dir Dir;
|
||||
typedef gp_Pnt Pnt;
|
||||
typedef gp_Vec Vec;
|
||||
|
||||
//=======================================================================
|
||||
//function : Continuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_Shape Geom_ElementarySurface::Continuity () const {
|
||||
|
||||
GeomAbs_Shape Geom_ElementarySurface::Continuity () const
|
||||
{
|
||||
return GeomAbs_CN;
|
||||
}
|
||||
|
||||
@@ -47,8 +33,8 @@ GeomAbs_Shape Geom_ElementarySurface::Continuity () const {
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Geom_ElementarySurface::IsCNu (const Standard_Integer ) const {
|
||||
|
||||
Standard_Boolean Geom_ElementarySurface::IsCNu (const Standard_Integer ) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -57,92 +43,27 @@ Standard_Boolean Geom_ElementarySurface::IsCNu (const Standard_Integer ) const {
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Geom_ElementarySurface::IsCNv (const Standard_Integer ) const {
|
||||
|
||||
Standard_Boolean Geom_ElementarySurface::IsCNv (const Standard_Integer ) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Axis
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Ax1 Geom_ElementarySurface::Axis () const {
|
||||
|
||||
return pos.Axis();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAxis
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_ElementarySurface::SetAxis (const Ax1& A1) {
|
||||
|
||||
pos.SetAxis (A1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Location
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Pnt Geom_ElementarySurface::Location () const {
|
||||
|
||||
return pos.Location();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Position
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const gp_Ax3& Geom_ElementarySurface::Position () const {
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_ElementarySurface::SetPosition (const Ax3& A3) {
|
||||
|
||||
pos = A3;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetLocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_ElementarySurface::SetLocation (const Pnt& Loc) {
|
||||
|
||||
pos.SetLocation (Loc);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : UReverse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_ElementarySurface::UReverse () {
|
||||
|
||||
void Geom_ElementarySurface::UReverse ()
|
||||
{
|
||||
pos.YReverse();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : VReverse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Geom_ElementarySurface::VReverse () {
|
||||
|
||||
void Geom_ElementarySurface::VReverse ()
|
||||
{
|
||||
pos.ZReverse();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -17,20 +17,8 @@
|
||||
#ifndef _Geom_ElementarySurface_HeaderFile
|
||||
#define _Geom_ElementarySurface_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class gp_Ax1;
|
||||
class gp_Pnt;
|
||||
class gp_Ax3;
|
||||
|
||||
|
||||
class Geom_ElementarySurface;
|
||||
DEFINE_STANDARD_HANDLE(Geom_ElementarySurface, Geom_Surface)
|
||||
@@ -74,38 +62,30 @@ DEFINE_STANDARD_HANDLE(Geom_ElementarySurface, Geom_Surface)
|
||||
//! "main Direction" = - "X Direction" ^ "Y Direction"
|
||||
class Geom_ElementarySurface : public Geom_Surface
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
//! Changes the main axis (ZAxis) of the elementary surface.
|
||||
//!
|
||||
//! Raised if the direction of A1 is parallel to the XAxis of the
|
||||
//! coordinate system of the surface.
|
||||
Standard_EXPORT void SetAxis (const gp_Ax1& A1);
|
||||
|
||||
void SetAxis (const gp_Ax1& theA1) { pos.SetAxis(theA1); }
|
||||
|
||||
//! Changes the location of the local coordinates system of the
|
||||
//! surface.
|
||||
Standard_EXPORT void SetLocation (const gp_Pnt& Loc);
|
||||
|
||||
void SetLocation (const gp_Pnt& theLoc) { pos.SetLocation(theLoc); }
|
||||
|
||||
//! Changes the local coordinates system of the surface.
|
||||
Standard_EXPORT void SetPosition (const gp_Ax3& A3);
|
||||
void SetPosition (const gp_Ax3& theAx3) { pos = theAx3; }
|
||||
|
||||
|
||||
//! Returns the main axis of the surface (ZAxis).
|
||||
Standard_EXPORT gp_Ax1 Axis() const;
|
||||
|
||||
const gp_Ax1& Axis() const { return pos.Axis(); }
|
||||
|
||||
//! Returns the location point of the local coordinate system of the
|
||||
//! surface.
|
||||
Standard_EXPORT gp_Pnt Location() const;
|
||||
const gp_Pnt& Location() const { return pos.Location(); }
|
||||
|
||||
//! Returns the local coordinates system of the surface.
|
||||
Standard_EXPORT const gp_Ax3& Position() const;
|
||||
|
||||
const gp_Ax3& Position() const { return pos; }
|
||||
|
||||
//! Reverses the U parametric direction of the surface.
|
||||
Standard_EXPORT virtual void UReverse() Standard_OVERRIDE;
|
||||
@@ -116,8 +96,7 @@ public:
|
||||
//! me->UReversed()->Value(me->UReversedParameter(U),V)
|
||||
//! is the same point as
|
||||
//! me->Value(U,V)
|
||||
Standard_EXPORT virtual Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE = 0;
|
||||
|
||||
//! Reverses the V parametric direction of the surface.
|
||||
Standard_EXPORT virtual void VReverse() Standard_OVERRIDE;
|
||||
@@ -139,28 +118,10 @@ public:
|
||||
//! Returns True.
|
||||
Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Geom_ElementarySurface,Geom_Surface)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
gp_Ax3 pos;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Geom_ElementarySurface_HeaderFile
|
||||
|
@@ -17,24 +17,13 @@
|
||||
#ifndef _Geom_Surface_HeaderFile
|
||||
#define _Geom_Surface_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_RangeError;
|
||||
class Standard_NoSuchObject;
|
||||
class Geom_UndefinedDerivative;
|
||||
class Geom_UndefinedValue;
|
||||
|
||||
class gp_Trsf;
|
||||
class gp_GTrsf2d;
|
||||
class gp_Pnt;
|
||||
class gp_Vec;
|
||||
|
||||
|
||||
class Geom_Surface;
|
||||
DEFINE_STANDARD_HANDLE(Geom_Surface, Geom_Geometry)
|
||||
|
||||
|
Reference in New Issue
Block a user