Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:10

0001 // Created on: 1999-03-05
0002 // Created by: Fabrice SERVANT
0003 // Copyright (c) 1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IntPolyh_Point_HeaderFile
0018 #define _IntPolyh_Point_HeaderFile
0019 
0020 #include <Adaptor3d_Surface.hxx>
0021 
0022 //! The class represents the point on the surface with
0023 //! both 3D and 2D points.
0024 class IntPolyh_Point
0025 {
0026 public:
0027 
0028   DEFINE_STANDARD_ALLOC
0029 
0030   //! Constructor
0031   IntPolyh_Point() :
0032     myX(0.), myY(0.), myZ(0.), myU(0.), myV(0.), myPOC(1), myDegenerated(Standard_False)
0033   {}
0034   //! Constructor
0035   IntPolyh_Point(const Standard_Real x,
0036                  const Standard_Real y,
0037                  const Standard_Real z,
0038                  const Standard_Real u,
0039                  const Standard_Real v)
0040   :
0041     myX(x), myY(y), myZ(z), myU(u), myV(v), myPOC(1), myDegenerated(Standard_False)
0042   {}
0043 
0044   //! Returns X coordinate of the 3D point
0045   Standard_Real X() const
0046   {
0047     return myX;
0048   }
0049   //! Returns Y coordinate of the 3D point
0050   Standard_Real Y() const
0051   {
0052     return myY;
0053   }
0054   //! Returns the Z coordinate of the 3D point
0055   Standard_Real Z() const
0056   {
0057     return myZ;
0058   }
0059   //! Returns the U coordinate of the 2D point
0060   Standard_Real U() const
0061   {
0062     return myU;
0063   }
0064   //! Returns the V coordinate of the 2D point
0065   Standard_Real V() const
0066   {
0067     return myV;
0068   }
0069   //! Returns 0 if the point is not common with the other surface
0070   Standard_Integer PartOfCommon() const
0071   {
0072     return myPOC;
0073   }
0074 
0075   //! Sets the point
0076   void Set (const Standard_Real x,
0077             const Standard_Real y,
0078             const Standard_Real z,
0079             const Standard_Real u,
0080             const Standard_Real v,
0081             const Standard_Integer II = 1)
0082   {
0083     myX = x;
0084     myY = y;
0085     myZ = z;
0086     myU = u;
0087     myV = v;
0088     myPOC = II;
0089   }
0090   //! Sets the X coordinate for the 3D point
0091   void SetX (const Standard_Real x)
0092   {
0093     myX = x;
0094   }
0095   //! Sets the Y coordinate for the 3D point
0096   void SetY (const Standard_Real y)
0097   {
0098     myY = y;
0099   }
0100   //! Sets the Z coordinate for the 3D point
0101   void SetZ (const Standard_Real z)
0102   {
0103     myZ = z;
0104   }
0105   //! Sets the U coordinate for the 2D point
0106   void SetU (const Standard_Real u)
0107   {
0108     myU = u;
0109   }
0110   //! Sets the V coordinate for the 2D point
0111   void SetV (const Standard_Real v)
0112   {
0113     myV = v;
0114   }
0115   //! Sets the part of common
0116   void SetPartOfCommon (const Standard_Integer ii)
0117   {
0118     myPOC = ii;
0119   }
0120   //! Creates middle point from P1 and P2 and stores it to this
0121   Standard_EXPORT void Middle (const Handle(Adaptor3d_Surface)& MySurface, const IntPolyh_Point& P1, const IntPolyh_Point& P2);
0122   //! Addition
0123   Standard_EXPORT IntPolyh_Point Add (const IntPolyh_Point& P1) const;
0124   IntPolyh_Point operator + (const IntPolyh_Point& P1) const
0125   {
0126     return Add(P1);
0127   }
0128   //! Subtraction
0129   Standard_EXPORT IntPolyh_Point Sub (const IntPolyh_Point& P1) const;
0130   IntPolyh_Point operator - (const IntPolyh_Point& P1) const
0131   {
0132     return Sub(P1);
0133   }
0134   //! Division
0135   Standard_EXPORT IntPolyh_Point Divide (const Standard_Real rr) const;
0136   IntPolyh_Point operator / (const Standard_Real rr) const
0137   {
0138     return Divide(rr);
0139   }
0140   //! Multiplication
0141   Standard_EXPORT IntPolyh_Point Multiplication (const Standard_Real rr) const;
0142   IntPolyh_Point operator * (const Standard_Real rr) const
0143   {
0144     return Multiplication(rr);
0145   }
0146   //! Square modulus
0147   Standard_EXPORT Standard_Real SquareModulus() const;
0148   //! Square distance to the other point
0149   Standard_EXPORT Standard_Real SquareDistance (const IntPolyh_Point& P2) const;
0150   //! Dot
0151   Standard_EXPORT Standard_Real Dot (const IntPolyh_Point& P2) const;
0152   //! Cross
0153   Standard_EXPORT void Cross (const IntPolyh_Point& P1, const IntPolyh_Point& P2);
0154   //! Dump
0155   Standard_EXPORT void Dump() const;
0156   //! Dump
0157   Standard_EXPORT void Dump (const Standard_Integer i) const;
0158   //! Sets the degenerated flag
0159   void SetDegenerated (const Standard_Boolean theFlag)
0160   {
0161     myDegenerated = theFlag;
0162   }
0163   //! Returns the degenerated flag
0164   Standard_Boolean Degenerated() const
0165   {
0166     return myDegenerated;
0167   }
0168 
0169 protected:
0170 
0171 private:
0172 
0173   Standard_Real myX;
0174   Standard_Real myY;
0175   Standard_Real myZ;
0176   Standard_Real myU;
0177   Standard_Real myV;
0178   Standard_Integer myPOC;
0179   Standard_Boolean myDegenerated;
0180 
0181 };
0182 
0183 #endif // _IntPolyh_Point_HeaderFile