summaryrefslogtreecommitdiff
path: root/inc/BRepExtrema_SolutionElem.hxx
blob: 1bf1a1973819e04ab922d74e1331e826f5df2212 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _BRepExtrema_SolutionElem_HeaderFile
#define _BRepExtrema_SolutionElem_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _gp_Pnt_HeaderFile
#include <gp_Pnt.hxx>
#endif
#ifndef _BRepExtrema_SupportType_HeaderFile
#include <BRepExtrema_SupportType.hxx>
#endif
#ifndef _TopoDS_Vertex_HeaderFile
#include <TopoDS_Vertex.hxx>
#endif
#ifndef _TopoDS_Edge_HeaderFile
#include <TopoDS_Edge.hxx>
#endif
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
class gp_Pnt;
class TopoDS_Vertex;
class TopoDS_Edge;
class TopoDS_Face;


//! This class is used to store information relative to the <br>
//! minimum distance between two shapes. <br>
class BRepExtrema_SolutionElem
{
 public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  
  Standard_EXPORT BRepExtrema_SolutionElem()
  : myDist(0.), myPoint(0.,0.,0.), mySupType(BRepExtrema_IsVertex), myPar1(0.), myPar2(0.)
  {
  }
  //! initialisation of the fields <br>
  //! This constructor is used when the solution of a distance is a Vertex. <br>
  //! The different initialized fields are: <br>
  //!            _ the distance d <br>
  //!            _ the solution point <br>
  //!            _ the type of solution <br>
  //!            _ and the Vertex. <br>
  Standard_EXPORT BRepExtrema_SolutionElem(const Standard_Real d,const gp_Pnt& Pt,const BRepExtrema_SupportType SolType,const TopoDS_Vertex& vertex)
  : myDist(d), myPoint(Pt), mySupType(SolType), myVertex(vertex), myPar1(0.), myPar2(0.)
  {
  }
  //! initialisation of  the fiels. <br>
  //! This constructor is used when the  solution of distance is on an Edge. <br>
  //! The different initialized fields are: <br>
  //!            _ the distance d, <br>
  //!            _ the solution point, <br>
  //!            _ the type of solution, <br>
  //!            _ the Edge, <br>
  //!            _ and the parameter t to locate the solution. <br>
  Standard_EXPORT BRepExtrema_SolutionElem(const Standard_Real d,const gp_Pnt& Pt,const BRepExtrema_SupportType SolType,const TopoDS_Edge& edge,const Standard_Real t)
  : myDist(d), myPoint(Pt), mySupType(SolType), myEdge(edge), myPar1(t), myPar2(0.)
  {
  }
  //! initialisation of the fields <br>
  //! This constructor is used when the  solution of distance is in <br>
  //! a Face. The different initialized fields are: <br>
  //!            _ the distance d, <br>
  //!            _ the solution point, <br>
  //!            _ the type of solution, <br>
  //!            _ the Face, <br>
  //!            _ and the parameter u et v to locate the solution. <br>
  Standard_EXPORT BRepExtrema_SolutionElem(const Standard_Real d,const gp_Pnt& Pt,const BRepExtrema_SupportType SolType,const TopoDS_Face& face,const Standard_Real u,const Standard_Real v)
  : myDist(d), myPoint(Pt), mySupType(SolType), myFace(face), myPar1(u), myPar2(v)
  {
  }
  //! returns the value of the minimum distance. <br>
  Standard_EXPORT Standard_Real Dist() const
  {
    return myDist;
  }
  //! returns the solution point. <br>
  Standard_EXPORT const gp_Pnt & Point() const
  {
    return myPoint;
  }
  //! returns the Support type : <br>
  //!	    IsVertex => The solution is a vertex. <br>
  //! 	    IsOnEdge => The solution belongs to an Edge. <br>
  //! 	    IsInFace => The solution is inside a Face. <br>
  Standard_EXPORT BRepExtrema_SupportType SupportKind() const
  {
    return mySupType;
  }
  //! returns the vertex if the solution is a Vertex. <br>
  Standard_EXPORT const TopoDS_Vertex & Vertex() const
  {
    return myVertex;
  }
  //! returns the vertex if the solution is an Edge. <br>
  Standard_EXPORT const TopoDS_Edge & Edge() const
  {
    return myEdge;
  }
  //! returns the vertex if the solution is an Face. <br>
  Standard_EXPORT const TopoDS_Face & Face() const
  {
    return myFace;
  }
  //! returns the parameter t if the solution is on Edge. <br>
  Standard_EXPORT void EdgeParameter(Standard_Real& par1) const
  {
    par1 = myPar1;
  }
  //! returns the parameters u et v if the solution is in a Face. <br>
  Standard_EXPORT void FaceParameter(Standard_Real& par1,Standard_Real& par2) const
  {
    par1 = myPar1;
    par2 = myPar2;
  }

 private:

  Standard_Real myDist;
  gp_Pnt myPoint;
  BRepExtrema_SupportType mySupType;
  TopoDS_Vertex myVertex;
  TopoDS_Edge myEdge;
  TopoDS_Face myFace;
  Standard_Real myPar1;
  Standard_Real myPar2;
};

#endif