123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- /*************************************/
- /* Auteur : Rémi Synave */
- /* Date de création : 01/03/07 */
- /* Date de modification : 15/03/15 */
- /* Version : 0.4 */
- /*************************************/
- /***************************************************************************/
- /* This file is part of a2ri. */
- /* */
- /* a2ri is free software: you can redistribute it and/or modify it */
- /* under the terms of the GNU Lesser General Public License as published */
- /* by the Free Software Foundation, either version 3 of the License, or */
- /* (at your option) any later version. */
- /* */
- /* a2ri 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 Lesser General Public License for more details. */
- /* */
- /* You should have received a copy of the GNU Lesser General Public */
- /* License along with a2ri. */
- /* If not, see <http://www.gnu.org/licenses/>. */
- /***************************************************************************/
- #include "face.h"
- /********** INTERMEDIATE TYPES AND FUNCTIONS **********/
- /* Les fonctions intermédiaires sont préfixées de IF */
- /* et les types intermédiaires de IT */
- /********** MAIN FUNCTIONS **********/
- /**
- Affichage d'une face
- @param f face à afficher
- @return aucun
- */
- void
- vf_face_display (
- const vf_face * const f)
- {
- printf ("Face --> [vertex %d , edge %d , edge %d]\n", f->ve1, f->ve2, f->ve3);
- }
- /**
- Inversion de l'orientation de la face
- @param f pointeur sur la face à inverser
- @return aucun
- */
- void
- vf_face_reverse (
- vf_face * f)
- {
- int temp = f->ve1;
- f->ve1 = f->ve2;
- f->ve2 = temp;
- }
- /**
- Test de l'appartenance d'un sommet à une face
- @param f pointeur sur la face
- @param numvertex numero du sommet
- @return 1 si le sommet appartient à la face, 0 sinon
- */
- int
- vf_face_contains (
- const vf_face * const f,
- int numvertex)
- {
- return (f->ve1 == numvertex || f->ve2 == numvertex || f->ve3 == numvertex);
- }
- /**
- Affichage d'une face
- @param f face à afficher
- @return aucun
- */
- void
- vef_face_display (
- const vef_face * const f)
- {
- printf ("Face --> [vertex %d , edge %d , edge %d]\n", f->ed1, f->ed2, f->ed3);
- }
- /**
- Inversion de l'orientation de la face
- @param f pointeur sur la face à inverser
- @return aucun
- */
- void
- vef_face_reverse (
- vef_face * f)
- {
- int temp = f->ed1;
- f->ed1 = f->ed2;
- f->ed2 = temp;
- }
- /**
- Donne les trois points formant la face
- @param f la face dont on veut les trois sommets
- @param list list des aretes
- @param ve1 index du premier sommet
- @param ve2 index du second sommet
- @param ve3 index du troisième sommet
- @return aucun
- */
- void
- vef_face_get_vertices (
- const vef_face * const f,
- const vef_edge * const list,
- int * ve1,
- int * ve2,
- int * ve3)
- {
- if (list[f->ed1].ve1 == list[f->ed2].ve1
- || list[f->ed1].ve1 == list[f->ed2].ve2)
- {
- *ve1 = list[f->ed1].ve1;
- *ve3 = list[f->ed1].ve2;
- }
- else
- {
- *ve1 = list[f->ed1].ve2;
- *ve3 = list[f->ed1].ve1;
- }
- if (list[f->ed2].ve1 == list[f->ed3].ve1
- || list[f->ed2].ve1 == list[f->ed3].ve2)
- *ve2 = list[f->ed2].ve1;
- else
- *ve2 = list[f->ed2].ve2;
- }
- /**
- Test de l'appartenance d'une arete à une face
- @param f pointeur sur la face
- @param numvertex numero de l'arete
- @return 1 si l'arete appartient à la face, 0 sinon
- */
- int
- vef_face_contains (
- const vef_face * const f,
- int numedge)
- {
- return (f->ed1 == numedge || f->ed2 == numedge || f->ed3 == numedge);
- }
|