OpendTect  6.3
polygonsurface.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
6 Author: Y.C. Liu
7 Date: July 2008
8 ________________________________________________________________________
9 
10 -*/
11 
12 #include "geometrymod.h"
13 #include "refcount.h"
14 #include "rowcolsurface.h"
15 
16 namespace Geometry
17 {
18 /*<!Simple geometry for polygonsurface, for polygon plane, only three
19  directions are defined, i.e. along XY, XZ or YZ planes. So normals are
20  given by Coord3(0,0,1), Coord3(0,1,0) and Coord3(1,0,0) respectively.
21  For Rcol variable rc, rc.r() represents polygonidx, rc.c() represents the
22  knots on the corresponding polygon. */
23 
25 {
26 public:
28  ~PolygonSurface();
29  bool isEmpty() const { return !polygons_.size(); }
30  Element* clone() const;
31  enum ChangeTag {PolygonChange=__mUndefIntVal+1,PolygonInsert,
32  PolygonRemove};
33 
34  bool insertPolygon(const Coord3& firstpos,
35  const Coord3& normal,int polygon=0,
36  int firstknot=0);
37  bool removePolygon(int polygon);
38 
39  bool insertKnot(const RowCol&,const Coord3&);
40  bool removeKnot(const RowCol&);
41 
42  int nrPolygons() const { return polygons_.size(); }
43  StepInterval<int> rowRange() const;
44  virtual StepInterval<int> colRange() const
45  { return RowColSurface::colRange(); }
46  StepInterval<int> colRange(int polygon) const;
47 
48  bool setKnot(const RowCol&,const Coord3&);
49  Coord3 getKnot(const RowCol&) const;
50  bool isKnotDefined(const RowCol&) const;
51 
52  void setBezierCurveSmoothness(int nrpoints_on_segment);
53  int getBezierCurveSmoothness() const {return beziernrpts_;}
54  void getCubicBezierCurve(int plg,TypeSet<Coord3>& pts,
55  const float zscale) const;
56  /*<The Bezier Curve smoothes the polygon, nrknotsinsert
57  on each edge will affect the smoothness. */
58  void getAllKnots(TypeSet<Coord3>&) const;
59  /*<Only get all the picked positions on the surface. */
60 
61  Coord3 getPolygonNormal(int polygonnr) const;
62  Coord3 getPolygonConcaveDir(int polygonnr) const;
63 
64  void getExceptionEdges(int plg,TypeSet<int>& edges) const;
65  void getPolygonConcaveTriangles(int plg,TypeSet<int>&) const;
66  /*<the TypeSet has all the triangles which are concave
67  relative to the polygon. ret v0, v1, v2 the 1st
68  triangle; v3, v4, v5 the 2nd. */
69 
70  void addUdfPolygon(int polygnr,int firstknotnr,int nrknots);
71  void addEditPlaneNormal(const Coord3& normal);
72 
73  char bodyDimension() const;
74  /*<Return dim==3, it is a real body, otherwise,
75  dim==2 a surface, dim==1 a line, dim==0 a point.*/
76 
77 protected:
78 
79  bool linesegmentsIntersecting(const Coord3& v0,
80  const Coord3& v1,const Coord3& p0,
81  const Coord3& p1) const;
82  bool includesEdge(const TypeSet<int> edges,
83  int v0,int v1) const;
87  /*<assume each polygon is made by connecting
88  the pts in order. */
92 };
93 
94 };
#define mExpClass(module)
Definition: commondefs.h:157
ChangeTag
Definition: polygonsurface.h:31
int beziernrpts_
Definition: polygonsurface.h:91
virtual StepInterval< int > colRange() const
ObjectSet< TypeSet< Coord3 > > polygons_
Definition: polygonsurface.h:86
TypeSet< Coord3 > polygonnormals_
Definition: polygonsurface.h:89
int nrPolygons() const
Definition: polygonsurface.h:42
Set of pointers to objects.
Definition: commontypes.h:28
#define __mUndefIntVal
Almost MAXINT so unlikely, but not MAXINT to avoid that.
Definition: undefval.h:23
3D point or vector
Definition: commontypes.h:57
Set of (small) copyable elements.
Definition: commontypes.h:26
Definition: rowcolsurface.h:24
int firstpolygon_
Definition: polygonsurface.h:84
Definition: geomelement.h:35
IdxPair used for its row() and col().
Definition: rowcol.h:23
Definition: polygonsurface.h:31
virtual StepInterval< int > colRange() const
Definition: polygonsurface.h:44
TypeSet< Coord3 > concavedirs_
Definition: polygonsurface.h:90
bool isEmpty() const
Definition: polygonsurface.h:29
Definition: polygonsurface.h:24
int getBezierCurveSmoothness() const
Definition: polygonsurface.h:53
Definition: arraytesselator.h:19
TypeSet< int > firstknots_
Definition: polygonsurface.h:85

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017