Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:18:05

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   DEFINE_STANDARD_ALLOC
0028 
0029   //! Constructor
0030   IntPolyh_Point()
0031       : myX(0.),
0032         myY(0.),
0033         myZ(0.),
0034         myU(0.),
0035         myV(0.),
0036         myPOC(1),
0037         myDegenerated(false)
0038   {
0039   }
0040 
0041   //! Constructor
0042   IntPolyh_Point(const double x, const double y, const double z, const double u, const double v)
0043       : myX(x),
0044         myY(y),
0045         myZ(z),
0046         myU(u),
0047         myV(v),
0048         myPOC(1),
0049         myDegenerated(false)
0050   {
0051   }
0052 
0053   //! Returns X coordinate of the 3D point
0054   double X() const { return myX; }
0055 
0056   //! Returns Y coordinate of the 3D point
0057   double Y() const { return myY; }
0058 
0059   //! Returns the Z coordinate of the 3D point
0060   double Z() const { return myZ; }
0061 
0062   //! Returns the U coordinate of the 2D point
0063   double U() const { return myU; }
0064 
0065   //! Returns the V coordinate of the 2D point
0066   double V() const { return myV; }
0067 
0068   //! Returns 0 if the point is not common with the other surface
0069   int PartOfCommon() const { return myPOC; }
0070 
0071   //! Sets the point
0072   void Set(const double x,
0073            const double y,
0074            const double z,
0075            const double u,
0076            const double v,
0077            const int    II = 1)
0078   {
0079     myX   = x;
0080     myY   = y;
0081     myZ   = z;
0082     myU   = u;
0083     myV   = v;
0084     myPOC = II;
0085   }
0086 
0087   //! Sets the X coordinate for the 3D point
0088   void SetX(const double x) { myX = x; }
0089 
0090   //! Sets the Y coordinate for the 3D point
0091   void SetY(const double y) { myY = y; }
0092 
0093   //! Sets the Z coordinate for the 3D point
0094   void SetZ(const double z) { myZ = z; }
0095 
0096   //! Sets the U coordinate for the 2D point
0097   void SetU(const double u) { myU = u; }
0098 
0099   //! Sets the V coordinate for the 2D point
0100   void SetV(const double v) { myV = v; }
0101 
0102   //! Sets the part of common
0103   void SetPartOfCommon(const int ii) { myPOC = ii; }
0104 
0105   //! Creates middle point from P1 and P2 and stores it to this
0106   Standard_EXPORT void Middle(const occ::handle<Adaptor3d_Surface>& MySurface,
0107                               const IntPolyh_Point&                 P1,
0108                               const IntPolyh_Point&                 P2);
0109   //! Addition
0110   Standard_EXPORT IntPolyh_Point Add(const IntPolyh_Point& P1) const;
0111 
0112   IntPolyh_Point operator+(const IntPolyh_Point& P1) const { return Add(P1); }
0113 
0114   //! Subtraction
0115   Standard_EXPORT IntPolyh_Point Sub(const IntPolyh_Point& P1) const;
0116 
0117   IntPolyh_Point operator-(const IntPolyh_Point& P1) const { return Sub(P1); }
0118 
0119   //! Division
0120   Standard_EXPORT IntPolyh_Point Divide(const double rr) const;
0121 
0122   IntPolyh_Point operator/(const double rr) const { return Divide(rr); }
0123 
0124   //! Multiplication
0125   Standard_EXPORT IntPolyh_Point Multiplication(const double rr) const;
0126 
0127   IntPolyh_Point operator*(const double rr) const { return Multiplication(rr); }
0128 
0129   //! Square modulus
0130   Standard_EXPORT double SquareModulus() const;
0131   //! Square distance to the other point
0132   Standard_EXPORT double SquareDistance(const IntPolyh_Point& P2) const;
0133   //! Dot
0134   Standard_EXPORT double Dot(const IntPolyh_Point& P2) const;
0135   //! Cross
0136   Standard_EXPORT void Cross(const IntPolyh_Point& P1, const IntPolyh_Point& P2);
0137   //! Dump
0138   Standard_EXPORT void Dump() const;
0139   //! Dump
0140   Standard_EXPORT void Dump(const int i) const;
0141 
0142   //! Sets the degenerated flag
0143   void SetDegenerated(const bool theFlag) { myDegenerated = theFlag; }
0144 
0145   //! Returns the degenerated flag
0146   bool Degenerated() const { return myDegenerated; }
0147 
0148 private:
0149   double myX;
0150   double myY;
0151   double myZ;
0152   double myU;
0153   double myV;
0154   int    myPOC;
0155   bool   myDegenerated;
0156 };
0157 
0158 #endif // _IntPolyh_Point_HeaderFile