Fade2.5D Documentation pages v2.16.7
Delaunay Features
Visualizer3.h
Go to the documentation of this file.
1 // Copyright (C) Geom Software e.U, Bernhard Kornberger, Graz/Austria
2 //
3 // This file is part of the Fade2D library. The student license is free
4 // of charge and covers personal non-commercial research. Licensees
5 // holding a commercial license may use this file in accordance with
6 // the Commercial License Agreement.
7 //
8 // This software is provided AS IS with NO WARRANTY OF ANY KIND,
9 // INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
10 // FOR A PARTICULAR PURPOSE.
11 //
12 // Please contact the author if any conditions of this licensing are
13 // not clear to you.
14 //
15 // Author: Bernhard Kornberger, bkorn (at) geom.at
16 // http://www.geom.at
17 
19 #pragma once
20 
21 
22 
23 #include "common.h"
24 #if GEOM_PSEUDO3D==GEOM_TRUE
25 
26 #include "Point2.h"
27 #include "Segment2.h"
28 #include "VertexPair2.h"
29 #include "Edge2.h"
30 namespace GEOM_FADE25D
31 {
44 class CLASS_DECLSPEC Visualizer3
45 {
46 public:
47  static const char * const CLIGHTBLUE;
48  static const char * const CDARKBLUE;
49  static const char * const CYELLOW;
50  static const char * const CPINK;
51  static const char * const CBLACK;
52  static const char * const CLIGHTBROWN;
53  static const char * const CDARKBROWN;
54  static const char * const CORANGE;
55  static const char * const CPURPLE;
56  static const char * const CGRAY;
57  static const char * const CLIGHTGRAY;
58  static const char * const CRED;
59  static const char * const CGREEN;
60  static const char * const CWHITE;
61  static const char * const CRIMSON;
62  static const char * const CDARKORANGE;
63  static const char * const CGOLDENROD;
64  static const char * const COLIVE;
65  static const char * const CLAWNGREEN;
66  static const char * const CGREENYELLOW;
67  static const char * const CPALEGREEN;
68  static const char * const CMEDSPRINGGREEN;
69  static const char * const CLIGHTSEAGREAN;
70  static const char * const CCYAN;
71  static const char * const CSTEELBLUE;
72  static const char * const MIDNIGHTBLUE;
73  static const char * const CWHEAT;
74 
75 
81  static const char * getColor(int i);
82 
87  static const char * getNextColor();
88 
94  static const char * getNextColorAndName(const char*& colorName);
95 
100  static int getNextColorNum();
101 
111  explicit Visualizer3(const char* name);
114 
120  void closeFile();
121 
131  void writeNormals(const std::vector<Triangle2*>& vT,double scale);
132 
143  void writePoints(const std::vector<Point2*>& vPoints,unsigned linewidth,const char* color) ;
144 
155  void writePoints(const std::vector<Point2>& vPoints,unsigned linewidth,const char* color) ;
156 
167  void writePoint(const Point2& p,unsigned linewidth,const char* color);
168 
180  void writeSegment(const Point2& src,const Point2& trg,const char* color,bool bWithEndPoints=false);
181 
192  void writeSegments(const std::vector<Segment2>& vSegments,const char* color,bool bWithEndPoints=false);
193 
204  void writeSegments(const std::vector<Edge2>& vEdge2,const char* color,bool bWithEndPoints=false);
205 
214  void writeVertexPairs(const std::vector<VertexPair2>& vVertexPairs,const char* color);
215 
224  void writeCubes(const std::vector<Point2>& vPoints,const char* color);
225 
236  void writeTriangles(const std::vector<Triangle2*>& vT,const char* color,bool bWithNormals=false);
237 
248  void writeTriangles(const std::vector<Point2>& vTriangleCorners,const char* color,bool bWithNNV);
249 
258  void writeTriangle(const Triangle2& t,const char* color);
259 
270  void writeTriangle(const Point2& p0,const Point2& p1,const Point2& p2,const char* color);
271 
280  void writeBall(const Point2& p,double radius);
281 
289  void setBackfaces(bool bWithBackfaces);
290 private:
291  Visualizer3(const Visualizer3&);
292  Visualizer3& operator=(const Visualizer3&);
293  void startList(size_t numPoints,size_t numTriangles,bool bWithEdges);
294  void endList();
295  std::ofstream* pOutFile;
296  static int nextColor;
297  bool bWithBackfaces;
298 };
299 
300 } // NAMESPACE FADE25D
301 
302 #elif GEOM_PSEUDO3D==GEOM_FALSE
303 #else
304 #error GEOM_PSEUDO3D is not defined
305 #endif
306 
Represents a 2.5D point.
Definition: Point2.h:61
Represents a triangle in a triangulation.
Definition: Triangle2.h:59
Visualizer3 is a 3D scene writer for the Geomview viewer.
Definition: Visualizer3.h:45
void writePoints(const std::vector< Point2 * > &vPoints, unsigned linewidth, const char *color)
Write points to the output file.
void writePoint(const Point2 &p, unsigned linewidth, const char *color)
Write a single point to the output file.
Visualizer3(const char *name)
Constructor.
static const char * getNextColor()
Returns the next color in the sequence.
void closeFile()
Closes the output file.
void writeSegments(const std::vector< Segment2 > &vSegments, const char *color, bool bWithEndPoints=false)
Write multiple segments to the output file.
void writeTriangles(const std::vector< Point2 > &vTriangleCorners, const char *color, bool bWithNNV)
Write triangles using corner points to the output file.
static int getNextColorNum()
Returns the color index for the next color.
void writeTriangles(const std::vector< Triangle2 * > &vT, const char *color, bool bWithNormals=false)
Write triangles to the output file.
void writeNormals(const std::vector< Triangle2 * > &vT, double scale)
Write normals to the output file.
void writeBall(const Point2 &p, double radius)
Write a ball (point with radius) to the output file.
void writePoints(const std::vector< Point2 > &vPoints, unsigned linewidth, const char *color)
Write points to the output file (overloaded)
static const char * getNextColorAndName(const char *&colorName)
Returns the next color and its name.
void writeCubes(const std::vector< Point2 > &vPoints, const char *color)
Write cubes to the output file.
void writeSegments(const std::vector< Edge2 > &vEdge2, const char *color, bool bWithEndPoints=false)
Write multiple edge segments to the output file.
void writeVertexPairs(const std::vector< VertexPair2 > &vVertexPairs, const char *color)
Write vertex pairs to the output file.
void writeSegment(const Point2 &src, const Point2 &trg, const char *color, bool bWithEndPoints=false)
Write a segment to the output file.
void writeTriangle(const Point2 &p0, const Point2 &p1, const Point2 &p2, const char *color)
Write a triangle to the output file using 3 points.
static const char * getColor(int i)
Returns a color by index.
void writeTriangle(const Triangle2 &t, const char *color)
Write a single triangle to the output file.
void setBackfaces(bool bWithBackfaces)
Set whether to show backfaces in a different color.