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>
23 #include <GeomAbs_UVSense.hxx>
27 #include <gp_GTrsf2d.hxx>
31 #include <gp_Trsf.hxx>
32 #include <gp_Trsf2d.hxx>
35 #include <Precision.hxx>
36 #include <Standard_ConstructionError.hxx>
37 #include <Standard_RangeError.hxx>
38 #include <Standard_Type.hxx>
40 IMPLEMENT_STANDARD_RTTIEXT(Geom_Plane,Geom_ElementarySurface)
42 typedef Geom_Plane Plane;
54 //=======================================================================
57 //=======================================================================
59 Handle(Geom_Geometry) Geom_Plane::Copy () const {
61 Handle(Geom_Plane) Pl = new Plane ( pos);
68 //=======================================================================
69 //function : Geom_Plane
71 //=======================================================================
73 Geom_Plane::Geom_Plane (const gp_Ax3& A3) {
79 //=======================================================================
80 //function : Geom_Plane
82 //=======================================================================
84 Geom_Plane::Geom_Plane (const gp_Pln& Pl) {
90 //=======================================================================
91 //function : Geom_Plane
93 //=======================================================================
95 Geom_Plane::Geom_Plane (const Pnt& P, const Dir& V) {
102 //=======================================================================
103 //function : Geom_Plane
105 //=======================================================================
107 Geom_Plane::Geom_Plane ( const Standard_Real A,
108 const Standard_Real B,
109 const Standard_Real C,
110 const Standard_Real D) {
112 gp_Pln Pl (A, B, C, D);
113 pos = Pl.Position ();
117 //=======================================================================
120 //=======================================================================
122 void Geom_Plane::SetPln (const gp_Pln& Pl)
123 { pos = Pl.Position(); }
125 //=======================================================================
128 //=======================================================================
130 gp_Pln Geom_Plane::Pln () const {
132 return gp_Pln (Position());
136 //=======================================================================
137 //function : UReverse
139 //=======================================================================
141 void Geom_Plane::UReverse() {
145 //=======================================================================
146 //function : UReversedParameter
148 //=======================================================================
150 Standard_Real Geom_Plane::UReversedParameter( const Standard_Real U) const {
156 //=======================================================================
157 //function : VReverse
159 //=======================================================================
161 void Geom_Plane::VReverse() {
167 //=======================================================================
168 //function : VReversedParameter
170 //=======================================================================
172 Standard_Real Geom_Plane::VReversedParameter( const Standard_Real V) const {
177 //=======================================================================
178 //function : Transform
180 //=======================================================================
182 void Geom_Plane::Transform (const Trsf& T)
183 { pos.Transform (T); }
185 //=======================================================================
186 //function : IsUClosed
188 //=======================================================================
190 Standard_Boolean Geom_Plane::IsUClosed () const {
192 return Standard_False;
195 //=======================================================================
196 //function : IsVClosed
198 //=======================================================================
200 Standard_Boolean Geom_Plane::IsVClosed () const {
202 return Standard_False;
205 //=======================================================================
206 //function : IsUPeriodic
208 //=======================================================================
210 Standard_Boolean Geom_Plane::IsUPeriodic () const {
212 return Standard_False;
215 //=======================================================================
216 //function : IsVPeriodic
218 //=======================================================================
220 Standard_Boolean Geom_Plane::IsVPeriodic () const {
222 return Standard_False;
225 //=======================================================================
228 //=======================================================================
230 void Geom_Plane::Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const {
232 U1 = -Precision::Infinite();
233 U2 = Precision::Infinite();
234 V1 = -Precision::Infinite();
235 V2 = Precision::Infinite();
239 //=======================================================================
240 //function : Coefficients
242 //=======================================================================
244 void Geom_Plane::Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D) const {
246 gp_Pln Pl (Position());
247 Pl.Coefficients (A, B, C, D);
251 //=======================================================================
254 //=======================================================================
256 void Geom_Plane::D0 (const Standard_Real U, const Standard_Real V, Pnt& P) const {
258 P = ElSLib::PlaneValue (U, V, pos);
263 //=======================================================================
266 //=======================================================================
268 void Geom_Plane::D1 ( const Standard_Real U, const Standard_Real V,
269 Pnt& P, Vec& D1U, Vec& D1V) const
272 ElSLib::PlaneD1 (U, V, pos, P, D1U, D1V);
276 //=======================================================================
279 //=======================================================================
281 void Geom_Plane::D2 ( const Standard_Real U , const Standard_Real V,
284 Vec& D2U, Vec& D2V, Vec& D2UV) const
287 ElSLib::PlaneD1 (U, V, pos, P, D1U, D1V);
288 D2U.SetCoord (0.0, 0.0, 0.0);
289 D2V.SetCoord (0.0, 0.0, 0.0);
290 D2UV.SetCoord (0.0, 0.0, 0.0);
294 //=======================================================================
297 //=======================================================================
299 void Geom_Plane::D3 ( const Standard_Real U, const Standard_Real V,
302 Vec& D2U, Vec& D2V, Vec& D2UV,
303 Vec& D3U, Vec& D3V, Vec& D3UUV, Vec& D3UVV) const
305 ElSLib::PlaneD1 (U, V, pos, P, D1U, D1V);
306 D2U.SetCoord (0.0, 0.0, 0.0);
307 D2V.SetCoord (0.0, 0.0, 0.0);
308 D2UV.SetCoord (0.0, 0.0, 0.0);
309 D3U.SetCoord (0.0, 0.0, 0.0);
310 D3V.SetCoord (0.0, 0.0, 0.0);
311 D3UUV.SetCoord (0.0, 0.0, 0.0);
312 D3UVV.SetCoord (0.0, 0.0, 0.0);
317 //=======================================================================
320 //=======================================================================
322 Vec Geom_Plane::DN ( const Standard_Real , const Standard_Real ,
323 const Standard_Integer Nu, const Standard_Integer Nv ) const {
325 Standard_RangeError_Raise_if (Nu < 0 || Nv < 0 || Nu + Nv < 1, " ");
326 if (Nu == 0 && Nv == 1) {
327 return Vec (pos.YDirection());
329 else if (Nu == 1 && Nv == 0) {
330 return Vec (pos.XDirection());
332 return Vec (0.0, 0.0, 0.0);
336 //=======================================================================
339 //=======================================================================
341 Handle(Geom_Curve) Geom_Plane::UIso (const Standard_Real U) const
343 Handle(Geom_Line) GL = new Geom_Line (ElSLib::PlaneUIso(pos,U));
348 //=======================================================================
351 //=======================================================================
353 Handle(Geom_Curve) Geom_Plane::VIso (const Standard_Real V) const
355 Handle(Geom_Line) GL = new Geom_Line (ElSLib::PlaneVIso(pos,V));
359 //=======================================================================
360 //function : TransformParameters
362 //=======================================================================
364 void Geom_Plane::TransformParameters(Standard_Real& U,
369 if (!Precision::IsInfinite(U)) U *= Abs(T.ScaleFactor());
370 if (!Precision::IsInfinite(V)) V *= Abs(T.ScaleFactor());
373 //=======================================================================
374 //function : ParametricTransformation
376 //=======================================================================
378 gp_GTrsf2d Geom_Plane::ParametricTransformation(const gp_Trsf& T) const
381 T2.SetScale(gp::Origin2d(), Abs(T.ScaleFactor()));
382 return gp_GTrsf2d(T2);