MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
drawParam.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGDrawParam_HH_
6 #define _MGDrawParam_HH_
7 
8 #include <iosfwd>
9 #include "mg/MGCL.h"
10 
11 class MGObject;
12 class MGContext;
13 class MGOfstream;
14 class MGIfstream;
15 class mgTLInputParam;
16 
17 #define MAXDIVNUM 64
18 #define SURFACE_TOL_BY_CURVE 1.5
20 
22 
28 
53 class MG_DLL_DECLR MGDrawParam{
54 
55 public:
56 
58 
60  double curve_tolerance=-1.,
61  double surface_tolerance=-1.,
62  double maximum_edge_length=-1.,
63  double span_length_wire=20,
64  int line_desity_wire_face=1
65 );
67 
70  const MGObject& obj,
71  double span_length_wire=20
72 );
73 
76  const MGContext& contx,
77  double span_length_wire=20
78 );
79 
82  const mgTLInputParam& tlpara
83 );
84 
86 
87 MG_DLL_DECLR friend std::ostream& operator<< (std::ostream& out, const MGDrawParam& para);
88 
89 // Serialization fucntion.
90 MG_DLL_DECLR friend MGOfstream& operator<< (MGOfstream& buf, const MGDrawParam& para);
91 MG_DLL_DECLR friend MGIfstream& operator>> (MGIfstream& buf, MGDrawParam& para);
92 
93 double span_length_wire()const{return m_span_length_wire;};
94 int line_desity_wire_face()const{return m_line_desity_wire_face;};
95 double curve_tolerance_tess()const{return m_curve_tolerance_tess;};
96 double surface_tolerance_tess()const{return m_surface_tolerance_tess;};
97 double maximum_edge_length_tess()const{return m_maximum_edge_length_tess;};
98 
99 void set_line_density(int line_density=1){m_line_desity_wire_face=line_density;};
100 void set_span_length(double span_length){m_span_length_wire=span_length;};
101 void set_maximum_edge_length_tess(double maximum_edge_length){
102  m_maximum_edge_length_tess=maximum_edge_length;};
103 
104 private:
105 
106 //Build m_curve_tolerance_tess and m_surface_tolerance_tess.
107 void build_crv_srf_tolerance(
108  double curve_tolerance,//Maximum deviation allowed to approximate curves.
109  double surface_tolerance//Maximum deviation allowed to approximate surfaces.
110 );
111 
113 double m_span_length_wire;//The maximum length of the one line segment to approximate
114  //curves by a polyline.
115 int m_line_desity_wire_face;//Indicates how many wires be drawn for the inner lines of
117 double m_curve_tolerance_tess;//The maximum deviation from a curve allowed for the tessellaiton
120 double m_surface_tolerance_tess;//The maximum deviation allowed of a traiangle from surfaces
122 double m_maximum_edge_length_tess;//The maximum length of a triangle of the tessellation.
123 
124 };
125 
128  const MGObject& obj,
129  double span_length
130 );
131  // end of BASE group
133 
134 #endif
void set_maximum_edge_length_tess(double maximum_edge_length)
Definition: drawParam.h:101
void set_span_length(double span_length)
Definition: drawParam.h:100
double compute_curve_tolerance(const MGObject &obj, double span_length)
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
MGDrawParam(double curve_tolerance=-1., double surface_tolerance=-1., double maximum_edge_length=-1., double span_length_wire=20, int line_desity_wire_face=1)
A class that contains all the necessary input parameters to make tessellation.
Definition: TLInputParam.h:24
std::ostream & operator<<(std::ostream &ostrm, const MGisect &is)
Debug Function.
Definition: isect.h:95
Is an abstract class which represents a whole geometry and a topology.
Definition: Object.h:42
MGContext defines the attributes of a document.
Definition: Context.h:33
Defines parameters to draw MGObject, maily to approximate by lines and facets.
Definition: drawParam.h:53
double span_length_wire() const
Definition: drawParam.h:93
double curve_tolerance_tess() const
Definition: drawParam.h:95
double surface_tolerance_tess() const
Definition: drawParam.h:96
double maximum_edge_length_tess() const
Definition: drawParam.h:97
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
void set_line_density(int line_density=1)
Definition: drawParam.h:99
int line_desity_wire_face() const
Definition: drawParam.h:94