Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-08 09:16:20

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