X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHEXABLOCK%2FHexVertex.hxx;h=4cfc41bd982868651dfb3d0bee123b6561964c0c;hb=a2834d297d501f7350ff00a36221dc1d53326a32;hp=d5fc0f09f480cabff9b8ead15c98bd76d3f790cf;hpb=2700c61199d430583deabc4393a7b85792729ff1;p=modules%2Fhexablock.git diff --git a/src/HEXABLOCK/HexVertex.hxx b/src/HEXABLOCK/HexVertex.hxx index d5fc0f0..4cfc41b 100755 --- a/src/HEXABLOCK/HexVertex.hxx +++ b/src/HEXABLOCK/HexVertex.hxx @@ -1,7 +1,7 @@ // Class : Gestion des sommets -// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// Copyright (C) 2009-2013 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -23,33 +23,43 @@ #ifndef __VERTEX_H_ #define __VERTEX_H_ +#include "Hex_defines.hxx" #include "HexEltBase.hxx" BEGIN_NAMESPACE_HEXA -class Vertex : public EltBase +class HEXABLOCKENGINE_EXPORT Vertex : public EltBase { public : double getX() { return v_x; } double getY() { return v_y; } double getZ() { return v_z; } - double getCoord (int dir); - - virtual int countVertex () { return 1; } - virtual Vertex* getVertex (int nro) { return this; } - void setX (double v) { v_x = v ; } void setY (double v) { v_y = v ; } void setZ (double v) { v_z = v ; } - virtual void setAssociation (Shape* forme) {} // PERIME + double getAssoX () { return is_associated ? gc_x : v_x ; } + double getAssoY () { return is_associated ? gc_y : v_y ; } + double getAssoZ () { return is_associated ? gc_z : v_z ; } + + int setAssociation (NewShape* geom, int subid); + void clearAssociation (); + + void setColor (double valeur) { v_scalar = valeur ; } + + Vertex (Document* prev, double x, double y, double z); + +#ifndef SWIG +public : + double getCoord (int dir); + virtual int countVertex () { return 1; } + virtual Vertex* getVertex (int nro) { return this; } + // Hexa5 - int setAssociation (NewShape* geom, int subid); int setAssociation (VertexShape* forme); int setAssociation (double* point); int setAssociation (double px, double py, double pz); - void clearAssociation (); VertexShape* getAssoVertex () { return v_shape ;} VertexShape* getAssociation () { return v_shape ;} @@ -57,20 +67,14 @@ public : void getAssoCoord (double &x, double &y, double &z); void getAssoCoord (double* point); - double getAssoX () { return is_associated ? gc_x : v_x ; } - double getAssoY () { return is_associated ? gc_y : v_y ; } - double getAssoZ () { return is_associated ? gc_z : v_z ; } - public : - Vertex (Document* prev, double x=0.0, double y=0.0, double z=0.0); Vertex (Vertex* other); virtual ~Vertex () {} virtual void dump () ; virtual void saveXml (XmlWriter* xml); - void setScalar (double val) { v_scalar = val ; } + void setScalar (double val) { setColor (val) ; } double getScalar () { return v_scalar ; } - void setColor (double valeur) { setScalar (valeur) ; } double* getPoint (double point[]); void setCoord (double x, double y, double z); @@ -79,15 +83,15 @@ public : bool isin (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax); Edge* getParent (int nro); - Vertex* makeSymetric (Vertex* other); - void translate (Vector* vecteur, double fact=1.0); - void replace (Vertex* old); + void translate (Vector* vecteur, double fact=1.0); + void replace (Vertex* old); Vertex* getClone () { return v_clone ; } void duplicate (Document* doc); static Vertex* createMiddle (Vertex* left, Vertex* right); bool definedBy (double px, double py, double pz, double eps2=1e-4); + double dist2 (Vertex* other); private : double v_x; @@ -98,95 +102,7 @@ private : Vertex* v_clone; double gc_x, gc_y, gc_z; VertexShape* v_shape; +#endif }; -// ========================================================= Constructeur bis -inline Vertex::Vertex (Vertex* other) - : EltBase (other->dad(), EL_VERTEX) -{ - if (other!= NULL) - { - v_x = other->v_x; - v_y = other->v_y; - v_z = other->v_z; - v_scalar = other->v_scalar; - gc_x = other->gc_x; - gc_y = other->gc_y; - gc_z = other->gc_z; - v_clone = NULL; - v_shape = other->v_shape; - } - else - { - v_x = v_y = v_z = 0; - gc_x = gc_y = gc_z = 0; - v_scalar = 0; - v_shape = NULL; - v_clone = NULL; - } -} -// ===================================================== getCoord -inline double Vertex::getCoord (int dir) -{ - double val = 0; - switch (dir) - { - case dir_x : val = v_x; - break; - case dir_y : val = v_y; - break; - case dir_z : val = v_z; - break; - } - return val; -} -// ========================================================= dump -inline void Vertex::dump () -{ - printName (" = "); - if (NOT isHere ()) - { - printf ("(*** deleted ***)\n"); - return; - } - - printf ("(%g, %g, %g)", v_x,v_y,v_z); - dumpRef (); -} -// ========================================================= setCoord -inline void Vertex::setCoord (double x, double y, double z) -{ - v_x = x; - v_y = y; - v_z = z; -} -// ========================================================= isin -inline bool Vertex::isin (double xmin, double xmax, double ymin, double ymax, - double zmin, double zmax) -{ - bool rep = v_x >= xmin && v_x <= xmax - && v_y >= ymin && v_y <= ymax - && v_z >= zmin && v_z <= zmax; - return rep; -} -// ========================================================= getPoint -inline double* Vertex::getPoint (double point[]) -{ - point [dir_x] = v_x; - point [dir_y] = v_y; - point [dir_z] = v_z; - return point; -} -// ========================================================= duplicate -inline void Vertex::duplicate (Document* cible) -{ - v_clone = new Vertex (cible, v_x, v_y, v_z); - v_clone->v_scalar = v_scalar; -} -// ========================================================= duplicate -inline bool Vertex::definedBy (double px, double py, double pz, double eps2) -{ - double dist2 = carre (v_x-px) + carre (v_y-py) + carre (v_z-pz); - return dist2 < eps2; -} END_NAMESPACE_HEXA #endif