CommitLineData
42cf5bc1 1// Created on: 1992-09-28
2// Created by: Remi GILET
3// Copyright (c) 1992-1999 Matra Datavision
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
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <GCE2d_Root.hxx>
d1a67b9d 25#include <Geom2d_Parabola.hxx>
26
42cf5bc1 27class StdFail_NotDone;
28class gp_Parab2d;
29class gp_Ax22d;
30class gp_Ax2d;
31class gp_Pnt2d;
32
33
34//! This class implements the following algorithms used to
35//! create Parabola from Geom2d.
36//! * Create an Parabola from two apex and the center.
37//! Defines the parabola in the parameterization range :
38//! ]-infinite,+infinite[
39//! The vertex of the parabola is the "Location" point of the
40//! local coordinate system "XAxis" of the parabola.
41//! The "XAxis" of the parabola is its axis of symmetry.
42//! The "Xaxis" is oriented from the vertex of the parabola to the
43//! Focus of the parabola.
44//! The equation of the parabola in the local coordinate system is
45//! Y**2 = (2*P) * X
46//! P is the distance between the focus and the directrix of the
47//! parabola called Parameter).
48//! The focal length F = P/2 is the distance between the vertex
49//! and the focus of the parabola.
50class GCE2d_MakeParabola : public GCE2d_Root
51{
52public:
53
54 DEFINE_STANDARD_ALLOC
55
56
57 //! Creates a parabola from a non persistent one.
58 Standard_EXPORT GCE2d_MakeParabola(const gp_Parab2d& Prb);
59
60 //! Creates a parabola with its local coordinate system and it's focal
61 //! length "Focal".
62 //! The "Location" point of "Axis" is the vertex of the parabola
63 //! Status is "NegativeFocusLength" if Focal < 0.0
64 Standard_EXPORT GCE2d_MakeParabola(const gp_Ax22d& Axis, const Standard_Real Focal);
65
66 //! Creates a parabola with its "MirrorAxis" and it's focal length "Focal".
67 //! MirrorAxis is the axis of symmetry of the curve, it is the
68 //! "XAxis". The "YAxis" is parallel to the directrix of the
69 //! parabola. The "Location" point of "MirrorAxis" is the vertex of the parabola
70 //! Status is "NegativeFocusLength" if Focal < 0.0
71 Standard_EXPORT GCE2d_MakeParabola(const gp_Ax2d& MirrorAxis, const Standard_Real Focal, const Standard_Boolean Sense);
72
42cf5bc1 73 //! D is the directrix of the parabola and F the focus point.
74 //! The symmetry axis "XAxis" of the parabola is normal to the
75 //! directrix and pass through the focus point F, but its
76 //! "Location" point is the vertex of the parabola.
77 //! The "YAxis" of the parabola is parallel to D and its "Location"
78 //! point is the vertex of the parabola.
79 Standard_EXPORT GCE2d_MakeParabola(const gp_Ax2d& D, const gp_Pnt2d& F, const Standard_Boolean Sense = Standard_True);
80
81 //! Make a parabola with focal point S1 and
82 //! center O
83 //! The branch of the parabola returned will have <S1> as
84 //! focal point
85 //! The implicit orientation of the parabola is:
86 //! - the same one as the parabola Prb,
87 //! - the sense defined by the coordinate system Axis or the directrix D,
88 //! - the trigonometric sense if Sense is not given or is true, or
89 //! - the opposite sense if Sense is false.
90 //! Warning
91 //! The MakeParabola class does not prevent the
92 //! construction of a parabola with a null focal distance.
93 //! If an error occurs (that is, when IsDone returns
94 //! false), the Status function returns:
95 //! - gce_NullFocusLength if Focal is less than 0.0, or
96 //! - gce_NullAxis if points S1 and O are coincident.
97 Standard_EXPORT GCE2d_MakeParabola(const gp_Pnt2d& S1, const gp_Pnt2d& O);
98
99 //! Returns the constructed parabola.
100 //! Exceptions StdFail_NotDone if no parabola is constructed.
101 Standard_EXPORT const Handle(Geom2d_Parabola)& Value() const;
42cf5bc1 102
d1a67b9d 103 operator const Handle(Geom2d_Parabola)& () const { return Value(); }
42cf5bc1 104
105private:
42cf5bc1 106 Handle(Geom2d_Parabola) TheParabola;
42cf5bc1 107};
108