MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Tolerance.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGTolerance_HH_
6 #define _MGTolerance_HH_
7 
11 #include "mg/MGCL.h"
13 class MGIfstream;
14 class MGOfstream;
15 class MGEReal;
16 
17 // MGTolerance.h
18 
19 #define MG_MAX_TOL_STACK_SIZE 10
20 
21 // Defines tolerance.
22 //
23 
25 
46 class MG_DLL_DECLR MGTolerance {
47 private:
48  MGTolerance();
49  MGTolerance(const MGTolerance&);
50  MGTolerance& operator=(const MGTolerance&);
51 
52 public:
53 
55 MG_DLL_DECLR friend std::ostream& operator << (std::ostream&, const MGTolerance& );
56 
57 
59 
62 MG_DLL_DECLR friend bool MGMZero (double data);
63 
64 
66 
69 MG_DLL_DECLR friend bool MGAEqual (double data1, double data2);
70 
71 
73 
75 MG_DLL_DECLR friend bool MGAZero(double data);
76 
78 MG_DLL_DECLR friend bool MGREqual (double data1, double data2);
79 
81 
83 MG_DLL_DECLR friend bool MGREqual2(double data1, double data2);
84 
86 
89 MG_DLL_DECLR friend bool MGREqual_base(double data1, double data2, double base_length);
90 MG_DLL_DECLR friend bool MGREqual_base(MGEReal data1, MGEReal data2, const MGEReal& base_length);
91 
93 
95 MG_DLL_DECLR friend bool MGRZero(double data);
96 
98 
103 MG_DLL_DECLR friend bool MGRZero2(double data, double base_length);
104 MG_DLL_DECLR friend bool MGRZero2(double data, const MGEReal& base_length);
105 
107 
110 MG_DLL_DECLR friend bool MGRight_angle(double cos_data);
111 
113 
117 MG_DLL_DECLR friend bool MGZero_angle (double data);
118 
120  ~MGTolerance();
121 
123 
125 
127 static MGTolerance& instance();
128 
129 //Update. 更新
130 
132 int stack_length() const{return m_count;};
133 
136 
138 
140 static double set_mach_zero( double );
141 
143 
145 static double set_wc_zero( double );
146 
148 
150 static double set_rc_zero( double );
151 
153 
155 static double set_angle_zero( double );
156 
158 
160 static double set_line_zero( double );
161 
163 
165 static double set_max_knot_ratio( double );
166 
168 static void push( );
169 
171 static void pop( );
172 
173 //Reference. 参照
174 
175 
177 static double mach_zero() {return instance().m_mach_zero;};
178 
180 static double wc_zero() {return instance().m_wc_zero;};
181 
183 static double wc_zero_sqr(){return instance().m_wc_zero_sqr;};
184 
186 static double rc_zero() {return instance().m_rc_zero;};
187 
189 static double rc_zero_sqr(){return instance().m_rc_zero_sqr;};
190 
192 static double angle_zero(){return instance().m_angle_zero;};
193 
195 static double line_zero(){return instance().m_line_zero;};
196 
198 static double max_knot_ratio(){return instance().m_max_knot_ratio;};
199 
201 int dump_size() const;
202 
204 int dump(MGOfstream& ) const;
205 
207 int restore(MGIfstream& );
208 
209 private:
210 
212 
213  double m_mach_zero;
214  double m_wc_zero;
216  double m_wc_zero_sqr;
219  double m_rc_zero;
221  double m_rc_zero_sqr;
224  double m_angle_zero;
226  double m_line_zero;
228  double m_max_knot_ratio;
230 
237  int m_count;
238  double m_mach_zero_stack[MG_MAX_TOL_STACK_SIZE];
239  double m_wc_zero_stack[ MG_MAX_TOL_STACK_SIZE ];
240  double m_rc_zero_stack[ MG_MAX_TOL_STACK_SIZE ];
241  double m_angle_zero_stack[ MG_MAX_TOL_STACK_SIZE ];
242  double m_line_zero_stack[ MG_MAX_TOL_STACK_SIZE ];
243  double m_max_knot_ratio_stack[ MG_MAX_TOL_STACK_SIZE ];
244 
245 };
246 
247 
249 
251 extern MG_DLL_DECLR double MGAngle(double ca
252  , double);
253  // end of BASE group
255 #endif
int stack_length() const
Return currently used tolerance stack length.
Definition: Tolerance.h:132
MG_DLL_DECLR double MGAngle(double ca, double)
Compute radian angle from cosine and sine value.
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
std::ostream & operator<<(std::ostream &ostrm, const MGisect &is)
Debug Function.
Definition: isect.h:95
MGTolerance is a class to hold various tolerance data used in MGCL.
Definition: Tolerance.h:46
#define MG_MAX_TOL_STACK_SIZE
Definition: Tolerance.h:19
static double rc_zero_sqr()
Return square of relative zero.
Definition: Tolerance.h:189
static double wc_zero_sqr()
Return square of world zero.
Definition: Tolerance.h:183
MGEReal is extended real number to define infinity.
Definition: EReal.h:22
static double mach_zero()
Return machine zero.
Definition: Tolerance.h:177
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
static double rc_zero()
Return relative zero.
Definition: Tolerance.h:186
static double angle_zero()
Return angle zero.
Definition: Tolerance.h:192
static double max_knot_ratio()
Return maximum knot ratio.
Definition: Tolerance.h:198
int max_stack_size() const
Return maximum tolerance stack size.
Definition: Tolerance.h:135
static double line_zero()
Return line zero.
Definition: Tolerance.h:195
static double wc_zero()
Return world zero.
Definition: Tolerance.h:180