4
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
6
// This program is free software; you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation; either version 2 of the License, or
9
// (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21
// Please report all bugs and problems to <gmsh@geuz.org>.
29
#include "ExtrudeParams.h"
32
class GEdge : public GEntity {
35
std::list<GFace *> l_faces;
39
GEdge(GModel *model, int tag, GVertex *_v0, GVertex *_v1);
42
GVertex *getBeginVertex() const { return v0; }
43
GVertex *getEndVertex() const { return v1; }
45
void addFace(GFace *f);
46
void delFace(GFace *f);
48
virtual int dim() const {return 1;}
49
virtual bool periodic(int dim=0) const = 0;
50
virtual bool continuous(int dim=0) const = 0;
51
virtual void setVisibility(char val, bool recursive=false);
53
/** True if the edge is a seam for the given face. */
54
virtual int isSeam(GFace *face) const {return 0;}
57
SBoundingBox3d bounds() const;
59
// Faces that bound this entity or that this entity bounds.
60
virtual std::list<GFace*> faces() const{return l_faces;}
62
// Get the parameter location for a point in space on the edge.
63
virtual double parFromPoint(const SPoint3 &) const = 0;
65
// Get the point for the given parameter location.
66
virtual GPoint point(double p) const = 0;
68
// Get the closest point on the edge to the given point.
69
virtual GPoint closestPoint(const SPoint3 & queryPoint) =0;
71
// True if the edge contains the given parameter.
72
virtual int containsParam(double pt) const = 0;
74
// Get first derivative of edge at the given parameter.
75
virtual SVector3 firstDer(double par) const = 0;
77
// Get second derivative of edge at the given parameter.
78
// Default implentation using central differences
79
virtual SVector3 secondDer(double par) const ;
80
virtual double curvature (double par) const;
82
// Reparmaterize the point onto the given face.
83
virtual SPoint2 reparamOnFace(GFace *face, double epar,int dir) const ;
85
// Recompute the mesh partitions defined on this edge.
86
void recomputeMeshPartitions();
88
// Delete the mesh partitions defined on this edge.
89
void deleteMeshPartitions();
91
// Returns the minimum number of segments used for meshing the edge
92
virtual int minimumMeshSegments() const {return 1;}
94
// Returns the minimum number of segments used for drawing the edge
95
virtual int minimumDrawSegments() const {return 1;}
97
// Returns a type-specific additional information string
98
virtual std::string getAdditionalInfoString();
100
// tells if the edge is a 3D edge (in opposition with a trimmed curve on a surface)
101
virtual bool is3D() const {return true;}
103
// the length of the model edge
104
inline double length() const {return _length;}
105
inline void setLength(const double l) {_length = l;}
107
// one can impose the mesh size at an edge
108
virtual double prescribedMeshSizeAtVertex() const {return meshAttributes.meshSize;}
110
// Resets the mesh attributes to default values
111
virtual void resetMeshAttributes();
115
double coeffTransfinite;
117
int nbPointsTransfinite;
119
// the extrusion parameters (if any)
120
ExtrudeParams *extrude;
123
std::vector<MLine*> lines;