0030480: Visualization - Clear of Select3D_SensitiveGroup does not update internal...
[occt.git] / src / GeomAPI / GeomAPI_ProjectPointOnCurve.hxx
CommitLineData
42cf5bc1 1// Created on: 1994-03-17
2// Created by: Bruno DUMORTIER
3// Copyright (c) 1994-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _GeomAPI_ProjectPointOnCurve_HeaderFile
18#define _GeomAPI_ProjectPointOnCurve_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <Standard_Integer.hxx>
26#include <Extrema_ExtPC.hxx>
27#include <GeomAdaptor_Curve.hxx>
42cf5bc1 28class Standard_OutOfRange;
29class StdFail_NotDone;
30class gp_Pnt;
31class Geom_Curve;
32class Extrema_ExtPC;
33
34
35
36//! This class implements methods for computing all the orthogonal
37//! projections of a 3D point onto a 3D curve.
38class GeomAPI_ProjectPointOnCurve
39{
40public:
41
42 DEFINE_STANDARD_ALLOC
43
44
45 //! Creates an empty object. Use an
46 //! Init function for further initialization.
47 Standard_EXPORT GeomAPI_ProjectPointOnCurve();
48
49 //! Create the projection of a point <P> on a curve
50 //! <Curve>
51 Standard_EXPORT GeomAPI_ProjectPointOnCurve(const gp_Pnt& P, const Handle(Geom_Curve)& Curve);
52
53 //! Create the projection of a point <P> on a curve
54 //! <Curve> limited by the two points of parameter Umin and Usup.
09324e85 55 Standard_EXPORT GeomAPI_ProjectPointOnCurve(const gp_Pnt& P, const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
42cf5bc1 56
57 //! Init the projection of a point <P> on a curve
58 //! <Curve>
59 Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Curve)& Curve);
60
61 //! Init the projection of a point <P> on a curve
62 //! <Curve> limited by the two points of parameter Umin and Usup.
09324e85 63 Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
42cf5bc1 64
65 //! Init the projection of a point <P> on a curve
66 //! <Curve> limited by the two points of parameter Umin and Usup.
09324e85 67 Standard_EXPORT void Init (const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
42cf5bc1 68
69 //! Performs the projection of a point on the current curve.
70 Standard_EXPORT void Perform (const gp_Pnt& P);
71
72 //! Returns the number of computed
73 //! orthogonal projection points.
74 //! Note: if this algorithm fails, NbPoints returns 0.
75 Standard_EXPORT Standard_Integer NbPoints() const;
76Standard_EXPORT operator Standard_Integer() const;
77
78 //! Returns the orthogonal projection
79 //! on the curve. Index is a number of a computed point.
80 //! Exceptions
81 //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
82 //! NbPoints is the number of solution points.
83 Standard_EXPORT gp_Pnt Point (const Standard_Integer Index) const;
84
85 //! Returns the parameter on the curve
86 //! of the point, which is the orthogonal projection. Index is a
87 //! number of a computed point.
88 //! Exceptions
89 //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
90 //! NbPoints is the number of solution points.
09324e85 91 Standard_EXPORT Standard_Real Parameter (const Standard_Integer Index) const;
42cf5bc1 92
93 //! Returns the parameter on the curve
94 //! of the point, which is the orthogonal projection. Index is a
95 //! number of a computed point.
96 //! Exceptions
97 //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
98 //! NbPoints is the number of solution points.-
09324e85 99 Standard_EXPORT void Parameter (const Standard_Integer Index, Standard_Real& U) const;
42cf5bc1 100
101 //! Computes the distance between the
102 //! point and its orthogonal projection on the curve. Index is a number of a computed point.
103 //! Exceptions
104 //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
105 //! NbPoints is the number of solution points.
09324e85 106 Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
42cf5bc1 107
108 //! Returns the nearest orthogonal
109 //! projection of the point on the curve.
110 //! Exceptions: StdFail_NotDone if this algorithm fails.
111 Standard_EXPORT gp_Pnt NearestPoint() const;
112Standard_EXPORT operator gp_Pnt() const;
113
114 //! Returns the parameter on the curve
115 //! of the nearest orthogonal projection of the point.
116 //! Exceptions: StdFail_NotDone if this algorithm fails.
09324e85 117 Standard_EXPORT Standard_Real LowerDistanceParameter() const;
42cf5bc1 118
119 //! Computes the distance between the
120 //! point and its nearest orthogonal projection on the curve.
121 //! Exceptions: StdFail_NotDone if this algorithm fails.
09324e85 122 Standard_EXPORT Standard_Real LowerDistance() const;
42cf5bc1 123Standard_EXPORT operator Standard_Real() const;
124
125 //! return the algorithmic object from Extrema
126 const Extrema_ExtPC& Extrema() const;
127
42cf5bc1 128private:
129
42cf5bc1 130 Standard_Boolean myIsDone;
131 Standard_Integer myIndex;
132 Extrema_ExtPC myExtPC;
133 GeomAdaptor_Curve myC;
134
42cf5bc1 135};
136
137
138#include <GeomAPI_ProjectPointOnCurve.lxx>
139
140
141
142
143
144#endif // _GeomAPI_ProjectPointOnCurve_HeaderFile