1 // Created on: 1993-03-10
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
19 #include <Geom_Curve.hxx>
20 #include <Geom_Geometry.hxx>
21 #include <Geom_Line.hxx>
22 #include <Geom_Plane.hxx>
26 #include <gp_GTrsf2d.hxx>
30 #include <gp_Trsf.hxx>
31 #include <gp_Trsf2d.hxx>
34 #include <Precision.hxx>
35 #include <Standard_ConstructionError.hxx>
36 #include <Standard_RangeError.hxx>
37 #include <Standard_Type.hxx>
39 IMPLEMENT_STANDARD_RTTIEXT(Geom_Plane,Geom_ElementarySurface)
41 typedef Geom_Plane Plane;
53 //=======================================================================
56 //=======================================================================
58 Handle(Geom_Geometry) Geom_Plane::Copy () const {
60 Handle(Geom_Plane) Pl = new Plane ( pos);
67 //=======================================================================
68 //function : Geom_Plane
70 //=======================================================================
72 Geom_Plane::Geom_Plane (const gp_Ax3& A3) {
78 //=======================================================================
79 //function : Geom_Plane
81 //=======================================================================
83 Geom_Plane::Geom_Plane (const gp_Pln& Pl) {
89 //=======================================================================
90 //function : Geom_Plane
92 //=======================================================================
94 Geom_Plane::Geom_Plane (const Pnt& P, const Dir& V) {
101 //=======================================================================
102 //function : Geom_Plane
104 //=======================================================================
106 Geom_Plane::Geom_Plane ( const Standard_Real A,
107 const Standard_Real B,
108 const Standard_Real C,
109 const Standard_Real D) {
111 gp_Pln Pl (A, B, C, D);
112 pos = Pl.Position ();
116 //=======================================================================
119 //=======================================================================
121 void Geom_Plane::SetPln (const gp_Pln& Pl)
122 { pos = Pl.Position(); }
124 //=======================================================================
127 //=======================================================================
129 gp_Pln Geom_Plane::Pln () const {
131 return gp_Pln (Position());
135 //=======================================================================
136 //function : UReverse
138 //=======================================================================
140 void Geom_Plane::UReverse() {
144 //=======================================================================
145 //function : UReversedParameter
147 //=======================================================================
149 Standard_Real Geom_Plane::UReversedParameter( const Standard_Real U) const {
155 //=======================================================================
156 //function : VReverse
158 //=======================================================================
160 void Geom_Plane::VReverse() {
166 //=======================================================================
167 //function : VReversedParameter
169 //=======================================================================
171 Standard_Real Geom_Plane::VReversedParameter( const Standard_Real V) const {
176 //=======================================================================
177 //function : Transform
179 //=======================================================================
181 void Geom_Plane::Transform (const Trsf& T)
182 { pos.Transform (T); }
184 //=======================================================================
185 //function : IsUClosed
187 //=======================================================================
189 Standard_Boolean Geom_Plane::IsUClosed () const {
191 return Standard_False;
194 //=======================================================================
195 //function : IsVClosed
197 //=======================================================================
199 Standard_Boolean Geom_Plane::IsVClosed () const {
201 return Standard_False;
204 //=======================================================================
205 //function : IsUPeriodic
207 //=======================================================================
209 Standard_Boolean Geom_Plane::IsUPeriodic () const {
211 return Standard_False;
214 //=======================================================================
215 //function : IsVPeriodic
217 //=======================================================================
219 Standard_Boolean Geom_Plane::IsVPeriodic () const {
221 return Standard_False;
224 //=======================================================================
227 //=======================================================================
229 void Geom_Plane::Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const {
231 U1 = -Precision::Infinite();
232 U2 = Precision::Infinite();
233 V1 = -Precision::Infinite();
234 V2 = Precision::Infinite();
238 //=======================================================================
239 //function : Coefficients
241 //=======================================================================
243 void Geom_Plane::Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D) const {
245 gp_Pln Pl (Position());
246 Pl.Coefficients (A, B, C, D);
250 //=======================================================================
253 //=======================================================================
255 void Geom_Plane::D0 (const Standard_Real U, const Standard_Real V, Pnt& P) const {
257 P = ElSLib::PlaneValue (U, V, pos);
262 //=======================================================================
265 //=======================================================================
267 void Geom_Plane::D1 ( const Standard_Real U, const Standard_Real V,
268 Pnt& P, Vec& D1U, Vec& D1V) const
271 ElSLib::PlaneD1 (U, V, pos, P, D1U, D1V);
275 //=======================================================================
278 //=======================================================================
280 void Geom_Plane::D2 ( const Standard_Real U , const Standard_Real V,
283 Vec& D2U, Vec& D2V, Vec& D2UV) const
286 ElSLib::PlaneD1 (U, V, pos, P, D1U, D1V);
287 D2U.SetCoord (0.0, 0.0, 0.0);
288 D2V.SetCoord (0.0, 0.0, 0.0);
289 D2UV.SetCoord (0.0, 0.0, 0.0);
293 //=======================================================================
296 //=======================================================================
298 void Geom_Plane::D3 ( const Standard_Real U, const Standard_Real V,
301 Vec& D2U, Vec& D2V, Vec& D2UV,
302 Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV) const
304 ElSLib::PlaneD1 (U, V, pos, P, D1U, D1V);
305 D2U.SetCoord (0.0, 0.0, 0.0);
306 D2V.SetCoord (0.0, 0.0, 0.0);
307 D2UV.SetCoord (0.0, 0.0, 0.0);
308 D3U.SetCoord (0.0, 0.0, 0.0);
309 D3V.SetCoord (0.0, 0.0, 0.0);
310 D3UUV.SetCoord (0.0, 0.0, 0.0);
311 D3UVV.SetCoord (0.0, 0.0, 0.0);
316 //=======================================================================
319 //=======================================================================
321 Vec Geom_Plane::DN ( const Standard_Real , const Standard_Real ,
322 const Standard_Integer Nu, const Standard_Integer Nv ) const {
324 Standard_RangeError_Raise_if (Nu < 0 || Nv < 0 || Nu + Nv < 1, " ");
325 if (Nu == 0 && Nv == 1) {
326 return Vec (pos.YDirection());
328 else if (Nu == 1 && Nv == 0) {
329 return Vec (pos.XDirection());
331 return Vec (0.0, 0.0, 0.0);
335 //=======================================================================
338 //=======================================================================
340 Handle(Geom_Curve) Geom_Plane::UIso (const Standard_Real U) const
342 Handle(Geom_Line) GL = new Geom_Line (ElSLib::PlaneUIso(pos,U));
347 //=======================================================================
350 //=======================================================================
352 Handle(Geom_Curve) Geom_Plane::VIso (const Standard_Real V) const
354 Handle(Geom_Line) GL = new Geom_Line (ElSLib::PlaneVIso(pos,V));
358 //=======================================================================
359 //function : TransformParameters
361 //=======================================================================
363 void Geom_Plane::TransformParameters(Standard_Real& U,
368 if (!Precision::IsInfinite(U)) U *= Abs(T.ScaleFactor());
369 if (!Precision::IsInfinite(V)) V *= Abs(T.ScaleFactor());
372 //=======================================================================
373 //function : ParametricTransformation
375 //=======================================================================
377 gp_GTrsf2d Geom_Plane::ParametricTransformation(const gp_Trsf& T) const
380 T2.SetScale(gp::Origin2d(), Abs(T.ScaleFactor()));
381 return gp_GTrsf2d(T2);
384 //=======================================================================
385 //function : DumpJson
387 //=======================================================================
388 void Geom_Plane::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
390 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
392 OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom_ElementarySurface)