]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCK/HexVertex.hxx
Salome HOME
First publish of HEXABLOCKcomponant
[modules/hexablock.git] / src / HEXABLOCK / HexVertex.hxx
1
2 // Class : Gestion des sommets 
3 //
4 #ifndef __VERTEX_H_
5 #define __VERTEX_H_
6
7 #include "HexEltBase.hxx"
8
9 BEGIN_NAMESPACE_HEXA
10
11 class Vertex : public EltBase 
12 {
13 public :
14    double getX()   { return v_x; }
15    double getY()   { return v_y; }
16    double getZ()   { return v_z; }
17
18    void setX (double v)   { v_x = v ; }
19    void setY (double v)   { v_y = v ; }
20    void setZ (double v)   { v_z = v ; }
21
22 public :
23    Vertex (Document* prev, double x=0.0, double y=0.0, double z=0.0); 
24    Vertex (Vertex* other);
25    virtual ~Vertex () {}
26    virtual void dump () ;
27    virtual void saveXml (XmlWriter& xml);
28
29    void   setScalar (double val)             { v_scalar = val ; }
30    double getScalar ()                       { return v_scalar ; }
31
32    void setCoord  (double x, double y, double z);
33    bool isin      (double xmin, double xmax, double ymin, double ymax, 
34                                             double zmin, double zmax);
35    Edge* getParent (int nro); 
36    Vertex* makeSymetric (Vertex* other);
37    void    translate  (Vector* vecteur, double fact=1.0);
38
39    static Vertex* createMiddle (Vertex* left, Vertex* right);
40
41 private :
42     double v_x;
43     double v_y;
44     double v_z;
45
46     double v_scalar;
47 };
48 // ========================================================= Constructeur bis 
49 inline Vertex::Vertex (Vertex* other)
50       : EltBase (other->dad(), EL_VERTEX)
51 {
52    v_x = other->v_x;
53    v_y = other->v_y;
54    v_z = other->v_z;
55    v_scalar = 0;
56 }
57 // ========================================================= dump 
58 inline void Vertex::dump ()
59 {
60    printName (" = ");
61    if (NOT isHere ())
62       {
63       printf ("(*** deleted ***)\n");
64       return;
65       }
66
67    printf ("(%g, %g, %g)", v_x,v_y,v_z);
68    dumpRef ();
69 }
70 // ========================================================= setCoord 
71 inline void Vertex::setCoord (double x, double y, double z)
72 {
73    v_x = x;
74    v_y = y;
75    v_z = z;
76 }
77 // ========================================================= isin 
78 inline bool Vertex::isin  (double xmin, double xmax, double ymin, double ymax, 
79                                              double zmin, double zmax)
80 {
81    bool   rep =   v_x >= xmin && v_x <= xmax
82                && v_y >= ymin && v_y <= ymax
83                && v_z >= zmin && v_z <= zmax;
84    return rep;
85 }
86 END_NAMESPACE_HEXA
87 #endif