Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:46

0001 // Created on: 1993-06-16
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1993-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 _GProp_PEquation_HeaderFile
0018 #define _GProp_PEquation_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <GProp_EquaType.hxx>
0024 #include <gp_Pnt.hxx>
0025 #include <gp_Vec.hxx>
0026 #include <TColgp_Array1OfPnt.hxx>
0027 class gp_Pln;
0028 class gp_Lin;
0029 
0030 
0031 //! A framework to analyze a collection - or cloud
0032 //! - of points and to verify if they are coincident,
0033 //! collinear or coplanar within a given precision. If
0034 //! so, it also computes the mean point, the mean
0035 //! line or the mean plane of the points. If not, it
0036 //! computes the minimal box which includes all the points.
0037 class GProp_PEquation 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044   //! Constructs a framework to analyze the
0045   //! collection of points Pnts and computes:
0046   //! -   the mean point if the points in question are
0047   //! considered to be coincident within the precision Tol, or
0048   //! -   the mean line if they are considered to be
0049   //! collinear within the precision Tol, or
0050   //! -   the mean plane if they are considered to be
0051   //! coplanar within the precision Tol, or
0052   //! -   the minimal box which contains all the points. Use :
0053   //! -   the functions IsPoint, IsLinear, IsPlanar
0054   //! and IsSpace to find the result of the analysis, and
0055   //! -   the function Point, Line, Plane or Box to
0056   //! access the computed result.
0057   Standard_EXPORT GProp_PEquation(const TColgp_Array1OfPnt& Pnts, const Standard_Real Tol);
0058   
0059   //! Returns true if, according to the given
0060   //! tolerance, the points analyzed by this framework are  coplanar.
0061   //! Use the function  Plane  to access the computed result.
0062   Standard_EXPORT Standard_Boolean IsPlanar() const;
0063   
0064   //! Returns true if, according to the given
0065   //! tolerance, the points analyzed by this framework are  colinear.
0066   //! Use the function  Line  to access the computed result.
0067   Standard_EXPORT Standard_Boolean IsLinear() const;
0068   
0069   //! Returns true if, according to the given
0070   //! tolerance, the points analyzed by this framework are  coincident.
0071   //! Use the function  Point  to access the computed result.
0072   Standard_EXPORT Standard_Boolean IsPoint() const;
0073   
0074   //! Returns true if, according to the given
0075   //! tolerance value, the points analyzed by this
0076   //! framework are neither coincident, nor collinear, nor coplanar.
0077   //! Use the function Box to query the smallest box
0078   //! that includes the collection of points.
0079   Standard_EXPORT Standard_Boolean IsSpace() const;
0080   
0081   //! Returns the mean plane passing near all the
0082   //! points analyzed by this framework if, according
0083   //! to the given precision, the points are considered to be coplanar.
0084   //! Exceptions
0085   //! Standard_NoSuchObject if, according to the
0086   //! given precision value, the points analyzed by
0087   //! this framework are considered to be:
0088   //! -   coincident, or
0089   //! -   collinear, or
0090   //! -   not coplanar.
0091   Standard_EXPORT gp_Pln Plane() const;
0092   
0093   //! Returns the mean line passing near all the
0094   //! points analyzed by this framework if, according
0095   //! to the given precision value, the points are considered to be collinear.
0096   //! Exceptions
0097   //! Standard_NoSuchObject if, according to the
0098   //! given precision, the points analyzed by this
0099   //! framework are considered to be:
0100   //! -   coincident, or
0101   //! -   not collinear.
0102   Standard_EXPORT gp_Lin Line() const;
0103   
0104   //! Returns the mean point of all the points
0105   //! analyzed by this framework if, according to the
0106   //! given precision, the points are considered to be coincident.
0107   //! Exceptions
0108   //! Standard_NoSuchObject if, according to the
0109   //! given precision, the points analyzed by this
0110   //! framework are not considered to be coincident.
0111   Standard_EXPORT gp_Pnt Point() const;
0112   
0113   //! Returns the definition of the smallest box which
0114   //! contains all the points analyzed by this
0115   //! framework if, according to the given precision
0116   //! value, the points are considered to be neither
0117   //! coincident, nor collinear and nor coplanar.
0118   //! This box is centered on the barycenter P of the
0119   //! collection of points. Its sides are parallel to the
0120   //! three vectors V1, V2 and V3, the length of
0121   //! which is the length of the box in the corresponding direction.
0122   //! Note: Vectors V1, V2 and V3 are parallel to
0123   //! the three axes of principal inertia of the system
0124   //! composed of the collection of points where each point is of equal mass.
0125   //! Exceptions
0126   //! Standard_NoSuchObject if, according to the given precision,
0127   //! the points analyzed by this framework are considered to be coincident, collinear or coplanar.
0128   Standard_EXPORT void Box (gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const;
0129 
0130 
0131 
0132 
0133 protected:
0134 
0135 
0136 
0137 
0138 
0139 private:
0140 
0141 
0142 
0143   GProp_EquaType type;
0144   gp_Pnt g;
0145   gp_Vec v1;
0146   gp_Vec v2;
0147   gp_Vec v3;
0148 
0149 
0150 };
0151 
0152 
0153 
0154 
0155 
0156 
0157 
0158 #endif // _GProp_PEquation_HeaderFile