// 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) . // // Herezh++ is distributed under GPL 3 license ou ultérieure. // // Copyright (C) 1997-2022 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 . // // For more information, please consult: . /************************************************************************ * DATE: 19/01/2007 * * $ * * AUTEUR: G RIO (mailto:gerardrio56@free.fr) * * $ * * PROJET: Herezh++ * * $ * ************************************************************************ * BUT: Def géométrie d'un cercle: un centre , un rayon * * et une normale au plan du cercle dans le cas 3D * * $ * * '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' * * * VERIFICATION: * * * * ! date ! auteur ! but ! * * ------------------------------------------------------------ * * ! ! ! ! * * $ * * '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' * * MODIFICATIONS: * * ! date ! auteur ! but ! * * ------------------------------------------------------------ * * $ * ************************************************************************/ #ifndef CERCLEE_H #define CERCLEE_H #include "Droite.h" #include "Coordonnee.h" /// @addtogroup Groupe_sur_les_contacts /// @{ /// class Cercle { // surcharge de l'operator de lecture friend istream & operator >> (istream &, Cercle &); // surcharge de l'operator d'ecriture friend ostream & operator << (ostream &, const Cercle &); public : // CONSTRUCTEURS : // par defaut Cercle (); // avec les datas Cercle ( const Coordonnee& B, const double& r, const Coordonnee* N); // avec la dimension Cercle (int dim); // de copie Cercle ( const Cercle& a); // DESTRUCTEUR : ~Cercle (); // surcharge des operator Cercle& operator = ( const Cercle & P); // METHODES PUBLIQUES : // retourne le centre du Cercle inline const Coordonnee& CentreCercle() const { return centre;}; // retourne le rayon du Cercle inline double RayonCercle() const { return rayon;}; // retourne la normale au cercle en 3D sinon NULL inline const Coordonnee* NormaleCercle() const { return N;}; // change le centre du Cercle void Change_centre( const Coordonnee& B); // change le rayon du Cercle void Change_rayon( const double & r); // change la normale au Cercle en 3D, sinon c'est inutile, warning void Change_Normale( const Coordonnee& N); // change toutes les donnees // N n'est utilisé qu'en 3D, en 2D on met NULL void change_donnees( const Coordonnee& B, const double& r,const Coordonnee* N); // calcul les deux intercections M1 et M2 d'une droite avec le Cercle, // 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 deux points d'intercection int Intersection( const Droite & D,Coordonnee& M1, Coordonnee& M2); // calcul la distance d'un point au Cercle double Distance_au_Cercle(const Coordonnee& M) const; // calcul du projeté d'un point sur le plan Coordonnee Projete(const Coordonnee& M) const; // indique si oui ou non le projeté du point est dans le cercle bool ProjeteDedans(const Coordonnee& M) const { return ((Projete(M)-centre).Carre() < rayon*rayon);}; // fonction valable uniquement en 2D, sinon erreur // ramène true si le point est à l'intérieur du cercle, false sinon bool Dedans(const Coordonnee& M)const ; protected : // VARIABLES PROTEGEES : Coordonnee centre; // centre du Cercle double rayon; // rayon du Cercle Coordonnee* N; // normal au cercle : utilisé qu'en 3D // la grandeur stockée est normée // METHODES PROTEGEES : }; /// @} // end of group #endif