Herezh_dev/herezh_pp/contact/Plan.h

125 lines
5.1 KiB
C++
Executable file

// This file is part of the Herezh++ application.
//
// The finite element software Herezh++ is dedicated to the field
// of mechanics for large transformations of solid structures.
// It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600)
// INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) <https://www.irdl.fr/>.
//
// Herezh++ is distributed under GPL 3 license ou ultérieure.
//
// Copyright (C) 1997-2021 Université Bretagne Sud (France)
// AUTHOR : Gérard Rio
// E-MAIL : gerardrio56@free.fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// For more information, please consult: <https://herezh.irdl.fr/>.
/************************************************************************
* DATE: 23/01/97 *
* $ *
* AUTEUR: G RIO (mailto:gerardrio56@free.fr) *
* $ *
* PROJET: Herezh++ *
* $ *
************************************************************************
* BUT: Def de la geometrie d'un plan: un point et une normale. *
* $ *
* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' * *
* VERIFICATION: *
* *
* ! date ! auteur ! but ! *
* ------------------------------------------------------------ *
* ! ! ! ! *
* $ *
* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' *
* MODIFICATIONS: *
* ! date ! auteur ! but ! *
* ------------------------------------------------------------ *
* $ *
************************************************************************/
#ifndef PLAN_H
#define PLAN_H
#include "Droite.h"
#include "Coordonnee.h"
/// @addtogroup Groupe_sur_les_contacts
/// @{
///
class Plan
{ // surcharge de l'operator de lecture
friend istream & operator >> (istream &, Plan &);
// surcharge de l'operator d'ecriture
friend ostream & operator << (ostream &, const Plan &);
public :
// CONSTRUCTEURS :
// par defaut
Plan ();
// avec les datas
Plan ( const Coordonnee& B, const Coordonnee& vec);
// avec la dimension
Plan (int dim);
// de copie
Plan ( const Plan& a);
// DESTRUCTEUR :
~Plan ();
// surcharge des operator
Plan& operator = ( const Plan & P);
// METHODES PUBLIQUES :
// retourne le point de ref du plan
inline const Coordonnee& PointPlan() const { return A;};
// retourne la normale au plan
inline const Coordonnee& Vecplan() const { return N;};
// change la dimension de la droite
void Change_dim(int dima) {A.Change_dim(dima);N.Change_dim(dima);};
// change le point de ref du plan
void Change_ptref( const Coordonnee& B);
// change le vecteur normal du plan
void Change_normal( const Coordonnee& vec);
// change toutes les donnees
void change_donnees( const Coordonnee& B, const Coordonnee& vec);
// calcul l'intercection M d'une droite avec le plan, ramene 0 s'il n'y
// a pas d'intersection, ramene -1 si l'intercection ne peut pas etre calculee
// et 1 s'il y a un point d'intercection
int Intersection( const Droite & D,Coordonnee& M)const;
// calcul la distance d'un point à la droite
double Distance_au_plan(const Coordonnee& M) const;
// calcul du projeté d'un point sur le plan
Coordonnee Projete(const Coordonnee& M) const
{return (M - ((M-A)*N)*N);};
// ramène true si les deux points sont du même coté du plan, false sinon
bool DuMemeCote(const Coordonnee& M1, const Coordonnee& M2) const;
protected :
// VARIABLES PROTEGEES :
Coordonnee A; // un point du plan
Coordonnee N; // normale au plan
// METHODES PROTEGEES :
};
/// @} // end of group
#endif