Geom Software - C++ Programming and Geometry Libraries
Fade2.5D Documentation pages v1.84
Visualizer3.h
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 
18 #pragma once
19 
20 
21 #include "common.h"
22 #if GEOM_PSEUDO3D==GEOM_TRUE
23 
24 #include "Point2.h"
25 #include "Segment2.h"
26 #include "VertexPair2.h"
27 #include "Edge2.h"
28 namespace GEOM_FADE25D
29 {
30 
31 
34 class CLASS_DECLSPEC Visualizer3
35 {
36 public:
37  static const char * const CLIGHTBLUE;
38  static const char * const CDARKBLUE;
39  static const char * const CYELLOW;
40  static const char * const CPINK;
41  static const char * const CBLACK;
42  static const char * const CLIGHTBROWN;
43  static const char * const CDARKBROWN;
44  static const char * const CORANGE;
45  static const char * const CPURPLE;
46  static const char * const CGRAY;
47  static const char * const CLIGHTGRAY;
48  static const char * const CRED;
49  static const char * const CGREEN;
50  static const char * const CWHITE;
51  static const char * const CRIMSON;
52  static const char * const CDARKORANGE;
53  static const char * const CGOLDENROD;
54  static const char * const COLIVE;
55  static const char * const CLAWNGREEN;
56  static const char * const CGREENYELLOW;
57  static const char * const CPALEGREEN;
58  static const char * const CMEDSPRINGGREEN;
59  static const char * const CLIGHTSEAGREAN;
60  static const char * const CCYAN;
61  static const char * const CSTEELBLUE;
62  static const char * const MIDNIGHTBLUE;
63  static const char * const CWHEAT;
64  static const char * getColor(int i);
65  static const char * getNextColor();
66  static const char * getNextColorAndName(const char*&);
67  explicit Visualizer3(const char* name);
68  ~Visualizer3();
69  void closeFile();
70  void writeNormals(const std::vector<Triangle2*>& vT,double scale);
71  void writePoints(const std::vector<Point2*>& vPoints,unsigned linewidth,const char* color) ;
72  void writePoints(const std::vector<Point2>& vPoints,unsigned linewidth,const char* color) ;
73 
74  void writePoint(const Point2& p,unsigned linewidth,const char* color);
75  void writeSegment(const Point2& src,const Point2& trg,const char* color,bool bWithEndPoints=false);
76  void writeSegments(const std::vector<Segment2>& vSegments,const char* color,bool bWithEndPoints=false);
77  void writeSegments(const std::vector<Edge2>& vSegments,const char* color,bool bWithEndPoints=false);
78  void writeVertexPairs(const std::vector<VertexPair2>& vVertexPairs,const char* color);
79  void writeCubes(const std::vector<Point2>& vPoints,const char* color);
80  void writeTriangles(const std::vector<Triangle2*>& vT,const char* color,bool bWithNormals=false);
81  void writeTriangles(const std::vector<Point2>& vTriangleCorners,const char* color,bool bWithNNV);
82  void writeTriangle(const Triangle2& t,const char* color);
83  void writeTriangle(const Point2& p0,const Point2& p1,const Point2& p2,const char* color);
84  void writeBall(Point2& p,double radius);
85  void setBackfaces(bool bWithBackfaces_);
86 private:
87  void startList(size_t numPoints,size_t numTriangles,bool bWithEdges);
88  void endList();
89  std::ofstream* pOutFile;
90  static int nextColor;
91  bool bWithBackfaces;
92 };
93 
94 } // NAMESPACE FADE25D
95 
96 #elif GEOM_PSEUDO3D==GEOM_FALSE
97 #else
98 #error GEOM_PSEUDO3D is not defined
99 #endif
100 
Triangle.
Definition: Triangle2.h:48
Visualizer3 is a 3D scene writer for the Geomview viewer.
Definition: Visualizer3.h:34
Definition: Bbox2.h:23
Point.
Definition: Point2.h:40