Point Cloud Library (PCL)  1.7.0
opennurbs_defines.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 ////////////////////////////////////////////////////////////////
18 //
19 // Includes all openNURBS toolkit defines and enums.
20 //
21 ////////////////////////////////////////////////////////////////
22 
23 #if !defined(OPENNURBS_DEFINES_INC_)
24 #define OPENNURBS_DEFINES_INC_
25 
26 #if defined (cplusplus) || defined(_cplusplus) || defined(__cplusplus) || defined(ON_CPLUSPLUS)
27 // C++ extern "C" declaration for C linkage
28 
29 #if !defined(ON_CPLUSPLUS)
30 #define ON_CPLUSPLUS
31 #endif
32 #define ON_EXTERNC extern "C"
33 #define ON_BEGIN_EXTERNC extern "C" {
34 #define ON_END_EXTERNC }
35 
36 #else
37 
38 /* C file - no extern declaration required or permitted */
39 
40 #define ON_EXTERNC
41 #define ON_BEGIN_EXTERNC
42 #define ON_END_EXTERNC
43 
44 #endif
45 
46 
47 #if defined(_DEBUG)
48 /* enable OpenNurbs debugging code */
49 #if !defined(ON_DEBUG)
50 #define ON_DEBUG
51 #endif
52 #endif
53 
54 /*
55 // Declarations in header (.H) files look like
56 //
57 // ON_DECL type function():
58 // extern ON_EXTERN_DECL type global_variable;
59 // class ON_CLASS classname {};
60 // ON_TEMPLATE template class ON_CLASS template<T>;
61 //
62 */
63 
64 #if defined(OPENNURBS_EXPORTS)
65 // OPENNURBS_EXPORTS is Microsoft's prefered defined for building an opennurbs DLL.
66 #if !defined(ON_DLL_EXPORTS)
67 #define ON_DLL_EXPORTS
68 #endif
69 #if !defined(ON_COMPILING_OPENNURBS)
70 #define ON_COMPILING_OPENNURBS
71 #endif
72 #endif
73 
74 #if defined(OPENNURBS_IMPORTS)
75 // OPENNURBS_EXPORTS is Microsoft's prefered defined for linking with an opennurbs DLL.
76 #if !defined(ON_DLL_IMPORTS)
77 #define ON_DLL_IMPORTS
78 #endif
79 #endif
80 
81 #if defined(ON_DLL_EXPORTS) && defined(ON_DLL_IMPORTS)
82 #error At most one of ON_DLL_EXPORTS and ON_DLL_IMPORTS can be defined.
83 #endif
84 
85 /* export/import */
86 #if defined(ON_DLL_EXPORTS)
87 
88 #if !defined(ON_COMPILING_OPENNURBS)
89 #error When compiling an OpenNURBS DLL, ON_DLL_EXPORTS must be defined
90 #endif
91 
92 /* compiling OpenNurbs as a Windows DLL - export classes, functions, templates, and globals */
93 #define ON_CLASS __declspec(dllexport)
94 #define ON_DECL __declspec(dllexport)
95 #define ON_EXTERN_DECL __declspec(dllexport)
96 #define ON_DLL_TEMPLATE
97 
98 #elif defined(ON_DLL_IMPORTS)
99 
100 #if defined(ON_COMPILING_OPENNURBS)
101 #error When compiling an OpenNURBS DLL, ON_DLL_IMPORTS must NOT be defined
102 #endif
103 
104 /* using OpenNurbs as a Windows DLL - import classes, functions, templates, and globals */
105 #define ON_CLASS __declspec(dllimport)
106 #define ON_DECL __declspec(dllimport)
107 #define ON_EXTERN_DECL __declspec(dllimport)
108 #define ON_DLL_TEMPLATE extern
109 
110 #else
111 
112 /* compiling or using OpenNurbs as a static library */
113 #define ON_CLASS
114 #define ON_DECL
115 #define ON_EXTERN_DECL
116 
117 #if defined(ON_DLL_TEMPLATE)
118 #undef ON_DLL_TEMPLATE
119 #endif
120 
121 #endif
122 
123 
124 // ON_DEPRECATED is used to mark deprecated functions.
125 #if defined(ON_COMPILER_MSC)
126 #define ON_DEPRECATED __declspec(deprecated)
127 #else
128 #define ON_DEPRECATED
129 #endif
130 
131 #if defined(PI)
132 #define ON_PI PI
133 #else
134 #define ON_PI 3.141592653589793238462643
135 #endif
136 
137 #define ON_DEGREES_TO_RADIANS ON_PI/180.0
138 #define ON_RADIANS_TO_DEGREES 180.0/ON_PI
139 
140 #define ON_SQRT2 1.414213562373095048801689
141 #define ON_SQRT3 1.732050807568877293527446
142 #define ON_SQRT3_OVER_2 0.8660254037844386467637230
143 #define ON_1_OVER_SQRT2 0.7071067811865475244008445
144 #define ON_SIN_PI_OVER_12 0.2588190451025207623488990
145 #define ON_COS_PI_OVER_12 0.9659258262890682867497433
146 
147 #define ON_LOG2 0.6931471805599453094172321
148 #define ON_LOG10 2.302585092994045684017991
149 
150 #define ON_ArrayCount(a) (sizeof(a)/sizeof((a)[0]))
151 
152 #if defined(DBL_MAX)
153 #define ON_DBL_MAX DBL_MAX
154 #else
155 #define ON_DBL_MAX 1.7976931348623158e+308
156 #endif
157 
158 #if defined(DBL_MIN)
159 #define ON_DBL_MIN DBL_MIN
160 #else
161 #define ON_DBL_MIN 2.22507385850720200e-308
162 #endif
163 
164 // ON_EPSILON = 2^-52
165 #if defined(DBL_EPSILON)
166 #define ON_EPSILON DBL_EPSILON
167 #else
168 #define ON_EPSILON 2.2204460492503131e-16
169 #endif
170 #define ON_SQRT_EPSILON 1.490116119385000000e-8
171 
172 #if defined(FLT_EPSILON)
173 #define ON_FLOAT_EPSILON FLT_EPSILON
174 #else
175 #define ON_FLOAT_EPSILON 1.192092896e-07
176 #endif
177 #define ON_SQRT_FLOAT_EPSILON 3.452669830725202719e-4
178 
179 /*
180 // In cases where lazy evaluation of a double value is
181 // performed, b-rep tolerances being a notable example,
182 // this value is used to indicate the value has not been
183 // computed. This value must be < -1.0e308. and > -ON_DBL_MAX
184 //
185 // The reasons ON_UNSET_VALUE is a valid finite number are:
186 //
187 // 1) It needs to round trip through fprintf/sscanf.
188 // 2) It needs to persist unchanged through assigment
189 / and not generate exceptions when assigned.
190 // 3) ON_UNSET_VALUE == ON_UNSET_VALUE needs to be true.
191 // 4) ON_UNSET_VALUE != ON_UNSET_VALUE needs to be false.
192 //
193 // Ideally, it would also have these SNaN attributes
194 // * When used in a calculation, a floating point exception
195 // occures.
196 // * No possibility of a valid calculation would generate
197 // ON_UNSET_VALUE.
198 // * float f = (float)ON_UNSET_VALUE would create an invalid
199 // float and generate an exception.
200 */
201 #define ON_UNSET_VALUE -1.23432101234321e+308
202 
203 /*
204 // ON_UNSET_FLOAT is used to indicate a texture coordinate
205 // value cannot be calculated or is not well defined.
206 // In hindsight, this value should have been ON_FLT_QNAN
207 // because many calculation convert float texture coordinates
208 // to doubles and the "unset"ness attribute is lost.
209 */
210 #define ON_UNSET_FLOAT -1.234321e+38f
211 
212 
213 ON_BEGIN_EXTERNC
214 
215 // IEEE 754 special values
216 extern ON_EXTERN_DECL const double ON_DBL_QNAN;
217 extern ON_EXTERN_DECL const double ON_DBL_PINF;
218 extern ON_EXTERN_DECL const double ON_DBL_NINF;
219 
220 extern ON_EXTERN_DECL const float ON_FLT_QNAN;
221 extern ON_EXTERN_DECL const float ON_FLT_PINF;
222 extern ON_EXTERN_DECL const float ON_FLT_NINF;
223 
224 /*
225 Description:
226 Paramters:
227  x - [out] returned value of x is an SNan
228  (signalling not a number).
229 Remarks:
230  Any time an SNaN passes through an Intel FPU, the result
231  is a QNaN (quiet nan) and the invalid operation excpetion
232  flag is set. If this exception is not masked, then the
233  exception handler is invoked.
234 
235  double x, y;
236  ON_DBL_SNAN(&x);
237  y = x; // y = QNAN and invalid op exception occurs
238  z = sin(x) // z = QNAN and invalid op exception occurs
239 
240  So, if you want to reliably initialize doubles to SNaNs,
241  you must use memcpy() or some other method that does not
242  use the Intel FPU.
243 */
244 ON_DECL
245 void ON_DBL_SNAN( double* x );
246 
247 ON_DECL
248 void ON_FLT_SNAN( float* x );
249 
250 ON_END_EXTERNC
251 
252 /*
253 // In cases where lazy evaluation of a color value is
254 // performed, this value is used to indicate the value
255 // has not been computed.
256 */
257 #define ON_UNSET_COLOR 0xFFFFFFFF
258 
259 /*
260 // In cases when an absolute "zero" tolerance
261 // is required to compare model space coordinates,
262 // ON_ZERO_TOLERANCE is used. The value of
263 // ON_ZERO_TOLERANCE should be no smaller than
264 // ON_EPSILON and should be several orders of
265 // magnitude smaller than ON_SQRT_EPSILON
266 //
267 */
268 //#define ON_ZERO_TOLERANCE 1.0e-12
269 // ON_ZERO_TOLERANCE = 2^-32
270 #define ON_ZERO_TOLERANCE 2.3283064365386962890625e-10
271 
272 /*
273 // In cases when an relative "zero" tolerance is
274 // required for comparing model space coordinates,
275 // (fabs(a)+fabs(b))*ON_RELATIVE_TOLERANCE is used.
276 // ON_RELATIVE_TOLERANCE should be larger than
277 // ON_EPSILON and smaller than no larger than
278 // ON_ZERO_TOLERANCE*2^-10.
279 //
280 */
281 // ON_RELATIVE_TOLERANCE = 2^-42
282 #define ON_RELATIVE_TOLERANCE 2.27373675443232059478759765625e-13
283 
284 /*
285 // Bugs in geometry calculations involving world coordinates
286 // values > ON_MAXIMUM_WORLD_COORDINATE_VALUE
287 // will be a low priority.
288 */
289 // ON_MAXIMUM_VALUE = 2^27
290 #define ON_MAXIMUM_WORLD_COORDINATE_VALUE 1.34217728e8
291 
292 /*
293 // The default test for deciding if a curvature value should be
294 // treated as zero is
295 // length(curvature) <= ON_ZERO_CURVATURE_TOLERANCE.
296 // ON_ZERO_CURVATURE_TOLERANCE must be set so that
297 // ON_ZERO_CURVATURE_TOLERANCE >= sqrt(3)*ON_ZERO_TOLERANCE
298 // so that K.IsTiny() = true implies |K| <= ON_ZERO_CURVATURE_TOLERANCE
299 */
300 #define ON_ZERO_CURVATURE_TOLERANCE 1.0e-8
301 
302 /* default value for angle tolerances = 1 degree */
303 #define ON_DEFAULT_ANGLE_TOLERANCE (ON_PI/180.0)
304 #define ON_DEFAULT_ANGLE_TOLERANCE_COSINE 0.99984769515639123915701155881391
305 #define ON_MINIMUM_ANGLE_TOLERANCE (ON_DEFAULT_ANGLE_TOLERANCE/10.0)
306 
307 // pair of integer indices. This
308 // is intentionally a struct/typedef
309 // rather than a class so that it
310 // can be used in other structs.
312 {
313  int i;
314  int j;
315 };
316 
317 typedef struct tagON_2dex ON_2dex;
318 
319 // triplet of integer indices. This
320 // is intentionally a struct/typedef
321 // rather than a class so that it
322 // can be used in other structs.
324 {
325  int i;
326  int j;
327  int k;
328 };
329 
330 typedef struct tagON_3dex ON_3dex;
331 
332 
333 // quadruplet of integer indices. This
334 // is intentionally a struct/typedef
335 // rather than a class so that it
336 // can be used in other structs.
338 {
339  int i;
340  int j;
341  int k;
342  int l;
343 };
344 
345 typedef struct tagON_4dex ON_4dex;
346 
347 union ON_U
348 {
349  char b[8]; // 8 bytes
350  ON__INT64 h; // 64 bit integer
351  ON__INT32 i; // 32 bit integer
352  int j[2]; // two 32 bit integers
353  void* p;
354  double d;
355 };
356 
357 #if defined(ON_CPLUSPLUS)
358 
359 // OpenNurbs enums
360 class ON_CLASS ON
361 {
362 public:
363  /*
364  Description:
365  Call before using openNURBS to ensure all class definitions
366  are linked.
367  */
368  static void Begin();
369 
370 
371  /*
372  Description:
373  Call when finished with openNURBS.
374  Remarks:
375  Currently does nothing.
376  */
377  static void End();
378 
379  //////////
380  // Version of opennurbs (YYYYMMDDn)
381  static
382  int Version();
383 
384  //////////
385  // McNeel subversion revsion used to build opennurbs
386  static
387  const char* SourceRevision();
388 
389  static
390  const char* DocumentationRevision();
391 
392  static
393  const char* SourceBranch();
394 
395  static
396  const char* DocumentationBranch();
397 
398 
399  //// File open/close for DLL use ///////////////////////////////////////////////
400 
401  static
402  FILE* OpenFile( // like fopen() - needed when OpenNURBS is used as a DLL
403  const char* filename,
404  const char* filemode
405  );
406 
407  static
408  FILE* OpenFile( // like fopen() - needed when OpenNURBS is used as a DLL
409  const wchar_t* filename,
410  const wchar_t* filemode
411  );
412 
413  static
414  int CloseFile( // like fclose() - needed when OpenNURBS is used as a DLL
415  FILE* // pointer returned by OpenFile()
416  );
417 
418  static
419  int CloseAllFiles(); // like _fcloseall() - needed when OpenNURBS is used as a DLL
420 
421  /*
422  Description:
423  Uses the flavor of fstat that is appropriate for the platform.
424  Parameters:
425  filename - [in]
426  fp - [in]
427  filesize - [out] (can be NULL if you do not want filesize)
428  create_time - [out] (can be NULL if you do not want last create time)
429  lastmodify_time - [out] (can be NULL if you do not want last modification time)
430  Returns:
431  True if file exists, can be opened for read, and fstat worked.
432  */
433  static
434  bool GetFileStats( const wchar_t* filename,
435  size_t* filesize,
436  time_t* create_time,
437  time_t* lastmodify_time
438  );
439 
440  static
441  bool GetFileStats( FILE* fp,
442  size_t* filesize,
443  time_t* create_time,
444  time_t* lastmodify_time
445  );
446 
447  /*
448  Returns true if pathname is a directory.
449  */
450  static bool IsDirectory( const wchar_t* pathname );
451  static bool IsDirectory( const char* utf8pathname );
452 
453  /*
454  Returns
455  If the file is an opennurbs file, the version of the file
456  is returned (2,3,4,50,...).
457  If the file is not an opennurbs file, 0 is returned.
458  */
459  static int IsOpenNURBSFile( const wchar_t* pathname );
460  static int IsOpenNURBSFile( const char* utf8pathname );
461  static int IsOpenNURBSFile( FILE* fp );
462 
463  //// Dimension Types ///////////////////////////////////////////////////////////
464  enum eAnnotationType
465  {
466  dtNothing,
467  dtDimLinear,
468  dtDimAligned,
469  dtDimAngular,
470  dtDimDiameter,
471  dtDimRadius,
472  dtLeader,
473  dtTextBlock,
474  dtDimOrdinate,
475  };
476 
477  static eAnnotationType AnnotationType(int); // convert integer to eAnnotationType enum
478 
479 
480  //// Text Display Modes ///////////////////////////////////////////////////////////
481  enum eTextDisplayMode
482  {
483  dtNormal = 0,
484  dtHorizontal = 1,
485  dtAboveLine = 2,
486  dtInLine = 3,
487  };
488 
489  static eTextDisplayMode TextDisplayMode( int);
490 
491  // Defines the current working space.
492  enum active_space
493  {
494  no_space = 0,
495  model_space = 1, // 3d modeling or "world" space
496  page_space = 2 // page/layout/paper/printing space
497  };
498 
499  static active_space ActiveSpace(int); // convert integer to active_space enum
500 
501 
502 
503  //// unit_system ///////////////////////////////////////////////////////////////
504  enum unit_system
505  {
506  // The constant enum values are saved in 3dm files
507  // and must never be changed. The values > 11 were
508  // added 5 April 2006.
509  no_unit_system = 0,
510 
511  // atomic distances
512  angstroms = 12, // 1.0e-10 meters
513 
514  // SI units
515  nanometers = 13, // 1.0e-9 meters
516  microns = 1, // 1.0e-6 meters
517  millimeters = 2, // 1.0e-3 meters
518  centimeters = 3, // 1.0e-2 meters
519  decimeters = 14, // 1.0e-1 meters
520  meters = 4,
521  dekameters = 15, // 1.0e+1 meters
522  hectometers = 16, // 1.0e+2 meters
523  kilometers = 5, // 1.0e+3 meters
524  megameters = 17, // 1.0e+6 meters
525  gigameters = 18, // 1.0e+9 meters
526 
527  // english distances
528  microinches = 6, // 2.54e-8 meters (1.0e-6 inches)
529  mils = 7, // 2.54e-5 meters (0.001 inches)
530  inches = 8, // 0.0254 meters
531  feet = 9, // 0.3408 meters (12 inches)
532  yards = 19, // 0.9144 meters (36 inches)
533  miles = 10, // 1609.344 meters (5280 feet)
534 
535  // printer distances
536  printer_point = 20, // 1/72 inches (computer points)
537  printer_pica = 21, // 1/6 inches (computer picas)
538 
539  // terrestrial distances
540  nautical_mile = 22, // 1852 meters
541  // Approximately 1 minute of arc on a terrestrial great circle.
542  // See http://en.wikipedia.org/wiki/Nautical_mile.
543 
544  // astronomical distances
545  astronomical = 23, // 1.4959787e+11 // http://en.wikipedia.org/wiki/Astronomical_unit
546  // 1.495979e+11 // http://units.nist.gov/Pubs/SP811/appenB9.htm
547  // An astronomical unit (au) is the mean distance from the
548  // center of the earth to the center of the sun.
549  lightyears = 24, // 9.4607304725808e+15 // http://en.wikipedia.org/wiki/Light_year
550  // 9.46073e+15 meters // http://units.nist.gov/Pubs/SP811/appenB9.htm
551  // A light year is the distance light travels in one Julian year.
552  // The speed of light is exactly 299792458 meters/second.
553  // A Julian year is exactly 365.25 * 86400 seconds and is
554  // approximately the time it takes for one earth orbit.
555  parsecs = 25, // 3.08567758e+16 // http://en.wikipedia.org/wiki/Parsec
556  // 3.085678e+16 // http://units.nist.gov/Pubs/SP811/appenB9.htm
557 
558  // Custom unit systems
559  custom_unit_system = 11 // x meters with x defined in ON_3dmUnitsAndTolerances.m_custom_unit_scale
560  };
561 
562  static unit_system UnitSystem(int); // convert integer to unit_system enum
563 
564  /*
565  Description:
566  Scale factor for changing unit "standard" systems.
567  Parameters:
568  us_from - [in]
569  us_to - [in]
570  For example:
571 
572  100.0 = ON::UnitScale( ON::meters, ON::centimeters )
573  2.54 = ON::UnitScale( ON::inches, ON::centimeters )
574  12.0 = ON::UnitScale( ON::feet, ON::inches )
575 
576  Remarks:
577  If you are using custom unit systems, use the version
578  that takes ON_UnitSystem or ON_3dmUnitsAndTolerances
579  parameters.
580  */
581  static double UnitScale(
582  ON::unit_system us_from,
583  ON::unit_system us_to
584  );
585  static double UnitScale(
586  const class ON_UnitSystem& us_from,
587  const class ON_UnitSystem& us_to
588  );
589  static double UnitScale(
590  ON::unit_system us_from,
591  const class ON_UnitSystem& us_to
592  );
593  static double UnitScale(
594  const class ON_UnitSystem& us_from,
595  ON::unit_system us_to
596  );
597  static double UnitScale(
598  const class ON_3dmUnitsAndTolerances& us_from,
599  const class ON_3dmUnitsAndTolerances& us_to
600  );
601 
602 
603  /*
604  Description:
605  Returns the string " : ". This is the string Rhino uses
606  to separate reference model names from the root name for
607  things like layer, block definition, material, linetype,
608  dimstyle and font names.
609  See Also:
610  ON::NameReferenceDelimiterLength()
611  ON::IsNameReferenceDelimiter()
612  */
613  static const wchar_t* NameReferenceDelimiter();
614 
615  /*
616  Description:
617  Returns the number of characters in the string returned
618  by ON::NameReferenceDelimiter().
619  See Also:
620  ON::NameReferenceDelimiterLength()
621  ON::IsNameReferenceDelimiter()
622  */
623  static unsigned int NameReferenceDelimiterLength();
624 
625  /*
626  Description:
627  Test a string to see if its beginning matches the
628  string returned by ON::NameReferenceDelimiter().
629  Parameters:
630  s - [in];
631  string to test.
632  Returns:
633  null:
634  The beginning of the string does not match ON::NameReferenceDelimiter().
635  non-null:
636  The beginning of the string matches ON::NameReferenceDelimiter(). The
637  returned pointer is the first character in s after the last character
638  of the delimiter. Put another way, if the beginning of s matches
639  the string ON::NameReferenceDelimiter(), then the returned pointer is
640  s + ON::NameReferenceDelimiterLength().
641  See Also:
642  ON::NameReferenceDelimiter()
643  ON::NameReferenceDelimiterLength()
644  */
645  static const wchar_t* IsNameReferenceDelimiter(const wchar_t* s);
646 
647  //// distance_display_mode ///////////////////////////////////
648  enum distance_display_mode
649  {
650  decimal = 0,
651  fractional = 1,
652  feet_inches = 2
653  };
654 
655  static distance_display_mode DistanceDisplayMode(int); // convert integer to distance_display_mode enum
656 
657 
658  //// point_style ///////////////////////////////////////////////////////////////
659  enum point_style
660  {
661  unknown_point_style = 0,
662  not_rational = 1,
663  homogeneous_rational = 2,
664  euclidean_rational = 3,
665  intrinsic_point_style = 4, // point format used in definition
666  point_style_count = 5
667  };
668 
669  static point_style PointStyle(int); // convert integer to point_style enum
670 
671  //// knot_style ///////////////////////////////////////////////////////////////
672  enum knot_style // if a knot vector meets the conditions of two styles,
673  { // then the style with the lowest value is used
674  unknown_knot_style = 0, // unknown knot style
675  uniform_knots = 1, // uniform knots (ends not clamped)
676  quasi_uniform_knots = 2, // uniform knots (clamped ends, degree >= 2)
677  piecewise_bezier_knots = 3, // all internal knots have full multiplicity
678  clamped_end_knots = 4, // clamped end knots (with at least 1 interior non-uniform knot)
679  non_uniform_knots = 5, // known to be none of the above
680  knot_style_count = 6
681  };
682 
683  static knot_style KnotStyle(int); // convert integer to knot_style enum
684 
685  //// continuity ////////////////////////////////////////////////////////////////
686  enum continuity
687  {
688  unknown_continuity = 0,
689 
690  // These test for parametric continuity. In particular,
691  // all types of ON_Curves are considered infinitely
692  // continuous at the start/end of the evaluation domain.
693  C0_continuous = 1, // continuous function
694  C1_continuous = 2, // continuous first derivative
695  C2_continuous = 3, // continuous first and second derivative
696  G1_continuous = 4, // continuous unit tangent
697  G2_continuous = 5, // continuous unit tangent and curvature
698 
699  // 20 March 2003 Dale Lear added these.
700  //
701  // Continuity tests using the following enum values
702  // are identical to tests using the preceding enum values
703  // on the INTERIOR of a curve's domain. At the END of
704  // a curve a "locus" test is performed in place of a
705  // parametric test. In particular, at the END of a domain,
706  // all open curves are locus discontinuous. At the END of
707  // a domain, all closed curves are at least C0_locus_continuous.
708  // By convention all ON_Curves are considered
709  // locus continuous at the START of the evaluation domain.
710  // This convention is not strictly correct, but is was
711  // adopted to make iterative kink finding tools easier to
712  // use and so that locus discontinuities are reported once
713  // at the end parameter of a curve rather than twice.
714  C0_locus_continuous = 6, // locus continuous function
715  C1_locus_continuous = 7, // locus continuous first derivative
716  C2_locus_continuous = 8, // locus continuous first and second derivative
717  G1_locus_continuous = 9, // locus continuous unit tangent
718  G2_locus_continuous = 10, // locus continuous unit tangent and curvature
719 
720  Cinfinity_continuous = 11, // analytic discontinuity
721  Gsmooth_continuous = 12 // aesthetic discontinuity
722  };
723 
724  /*
725  Description:
726  Convert int to ON::continuity enum value
727  */
728  static continuity Continuity(int);
729 
730  /*
731  Description:
732  Convert int to ON::continuity enum value and
733  convert the locus flavored values to the parametric
734  flavored values.
735  */
736  static continuity ParametricContinuity(int);
737 
738  /*
739  Description:
740  Convert int to ON::continuity enum value and
741  convert the higher order flavored values to
742  the corresponding C1 or G1 values needed to
743  test piecewise linear curves.
744  */
745  static continuity PolylineContinuity(int);
746 
747  //// curve_style ///////////////////////////////////////////////////////////////
748  enum curve_style
749  {
750  unknown_curve_style = 0,
751  line = 1,
752  circle = 2,
753  ellipse = 3, // with distinct foci (not a circle)
754  parabola = 4,
755  hyperbola = 5,
756  planar_polyline = 6, // not a line segment
757  polyline = 7, // non-planar polyline
758  planar_freeform_curve = 8, // planar but none of the above
759  freeform_curve = 9, // known to be none of the above
760  curve_style_count = 10
761  };
762 
763  static curve_style CurveStyle(int); // convert integer to curve_style enum
764 
765  //// surface_style ///////////////////////////////////////////////////////////////
766  enum surface_style
767  {
768  unknown_surface_style = 0,
769  plane = 1,
770  circular_cylinder = 2, // portion of right circular cylinder
771  elliptical_cylinder = 3, // portion of right elliptical cylinder
772  circular_cone = 4, // portion of right circular cone
773  elliptical_cone = 5, // portion of right elliptical cone
774  sphere = 6, // portion of sphere
775  torus = 7, // portion of torus
776  surface_of_revolution = 8, // portion of surface of revolution that is none of the above
777  ruled_surface = 9, // portion of a ruled surface this is none of the above
778  freeform_surface = 10, // known to be none of the above
779  surface_style_count = 11
780  };
781 
782  static surface_style SurfaceStyle(int); // convert integer to surface_style enum
783 
784  //// sort_algorithm ///////////////////////////////////////////////////////////////
785  enum sort_algorithm
786  {
787  heap_sort = 0,
788  quick_sort = 1
789  };
790 
791  static sort_algorithm SortAlgorithm(int); // convert integer to sort_method enum
792 
793  //// endian-ness ///////////////////////////////////////////////////////////////
794  enum endian {
795  little_endian = 0, // least significant byte first or reverse byte order - Intel x86, ...
796  big_endian = 1 // most significant byte first - Motorola, Sparc, MIPS, ...
797  };
798 
799  static endian Endian(int); // convert integer to endian enum
800  static endian Endian(); // returns endian-ness of current CPU
801 
802  //// archive modes //////////////////////////////////////////////////////////////
803  enum archive_mode
804  {
805  unknown_archive_mode = 0,
806  read = 1, // all read modes have bit 0x0001 set
807  write = 2, // all write modes have bit 0x0002 set
808  readwrite = 3,
809  read3dm = 5,
810  write3dm = 6
811  };
812  static archive_mode ArchiveMode(int); // convert integer to endian enum
813 
814 
815  //// view projections ///////////////////////////////////////////////////////////
816 
817  // The x/y/z_2pt_perspective_view projections are ordinary perspective
818  // projection. Using these values insures the ON_Viewport member
819  // fuctions properly constrain the camera up and camera direction vectors
820  // to preserve the specified perspective vantage.
821  enum view_projection
822  {
823  unknown_view = 0,
824  parallel_view = 1,
825  perspective_view = 2
826  };
827 
828  /*
829  Description:
830  Converts integer into ON::view_projection enum value.
831  Parameters:
832  i - [in]
833  Returns:
834  ON::view_projection enum with same value as i.
835  If i is not an ON::view_projection enum value,
836  then ON::unknow_view is returned.
837  */
838  static view_projection ViewProjection(int i);
839 
840  /*
841  Parameters:
842  projection - [in]
843  Returns:
844  True if projection is ON::perspective_view.
845  */
846  static bool IsPerspectiveProjection( ON::view_projection projection );
847 
848 
849  /*
850  Parameters:
851  projection - [in]
852  Returns:
853  True if projection is ON::parallel_view.
854  */
855  static bool IsParallelProjection( ON::view_projection projection );
856 
857  //// view coordinates ///////////////////////////////////////////////////////////
858 
859  enum coordinate_system
860  {
861  world_cs = 0,
862  camera_cs = 1,
863  clip_cs = 2,
864  screen_cs = 3
865  };
866 
867  static coordinate_system CoordinateSystem(int); // convert integer to coordinate_system enum
868 
869  //// exception types ///////////////////////////////////////////////////////////
870  enum exception_type
871  {
872  unknown_exception = 0,
873  out_of_memory,
874  corrupt_object, // invalid object encountered - continuing would crash or
875  // result in corrupt object being saved in archive.
876  unable_to_write_archive, // write operation failed - out of file space/read only mode/...?
877  unable_to_read_archive, // read operation failed - truncated archive/locked file/... ?
878  unable_to_seek_archive, // seek operation failed - locked file/size out of bounds/... ?
879  unexpected_end_of_archive, // truncated archive
880  unexpected_value_in_archive // corrupt archive?
881  };
882  static exception_type ExceptionType(int); // convert integer to exception_type enum
883 
884  //// layer mode ///////////////////////////////////////////////////////////
885  // OBSOLETE
886  enum layer_mode
887  {
888  normal_layer = 0, // visible, objects on layer can be selected and changed
889  hidden_layer = 1, // not visible, objects on layer cannot be selected or changed
890  locked_layer = 2, // visible, objects on layer cannot be selected or changed
891  layer_mode_count = 3
892  };
893  static layer_mode LayerMode(int); // convert integer to layer_mode enum
894 
895  //// object mode ///////////////////////////////////////////////////////////
896  enum object_mode
897  {
898  normal_object = 0, // object mode comes from layer
899  hidden_object = 1, // not visible, object cannot be selected or changed
900  locked_object = 2, // visible, object cannot be selected or changed
901  idef_object = 3, // object is part of an ON_InstanceDefinition. The
902  // ON_InstanceDefinition m_object_uuid[] array will
903  // contain this object attribute's uuid.
904  object_mode_count = 4
905  };
906  static object_mode ObjectMode(int); // convert integer to object_mode enum
907 
908  //// object display color /////////////////////////////////////////////////////////
909  enum object_color_source
910  {
911  color_from_layer = 0, // use color assigned to layer
912  color_from_object = 1, // use color assigned to object
913  color_from_material = 2, // use diffuse render material color
914  color_from_parent = 3 // for objects with parents (like objects in instance references, use parent linetype)
915  // if no parent, treat as color_from_layer
916  };
917  static object_color_source ObjectColorSource(int); // convert integer to object_color_source enum
918 
919  //// object plot color /////////////////////////////////////////////////////////
920  enum plot_color_source
921  {
922  plot_color_from_layer = 0, // use plot color assigned to layer
923  plot_color_from_object = 1, // use plot color assigned to object
924  plot_color_from_display = 2, // use display color
925  plot_color_from_parent = 3 // for objects with parents (like objects in instance references, use parent plot color)
926  // if no parent, treat as plot_color_from_layer
927  };
928  static plot_color_source PlotColorSource(int); // convert integer to plot_color_source enum
929 
930  //// object plot weight /////////////////////////////////////////////////////////
931  enum plot_weight_source
932  {
933  plot_weight_from_layer = 0, // use plot color assigned to layer
934  plot_weight_from_object = 1, // use plot color assigned to object
935  plot_weight_from_parent = 3 // for objects with parents (like objects in instance references, use parent plot color)
936  // if no parent, treat as plot_color_from_layer
937  };
938  static plot_weight_source PlotWeightSource(int); // convert integer to plot_color_source enum
939 
940  //// object linetype /////////////////////////////////////////////////////////
941  enum object_linetype_source
942  {
943  linetype_from_layer = 0, // use line style assigned to layer
944  linetype_from_object = 1, // use line style assigned to object
945  linetype_from_parent = 3 // for objects with parents (like objects in instance references, use parent linetype)
946  // if not parent, treat as linetype_from_layer.
947  };
948  static object_linetype_source ObjectLinetypeSource(int); // convert integer to object_linetype_source enum
949 
950  //// object material /////////////////////////////////////////////////////////
951  enum object_material_source
952  {
953  material_from_layer = 0, // use material assigned to layer
954  material_from_object = 1, // use material assigned to object
955  material_from_parent = 3 // for objects with parents, like
956  // definition geometry in instance
957  // references and faces in polysurfaces,
958  // this value indicates the material
959  // definition should come from the parent.
960  // If the object does not have an
961  // obvious "parent", then treat
962  // it the same as material_from_layer.
963  };
964  static object_material_source ObjectMaterialSource(int); // convert integer to object_color_source enum
965 
966  //// light style /////////////////////////////////////////////////////////////
967  enum light_style
968  {
969  unknown_light_style = 0,
970  //view_directional_light = 1, // light location and direction in clip coordinates
971  //view_point_light = 2,
972  //view_spot_light = 3,
973  camera_directional_light = 4, // light location and direction in camera coordinates
974  camera_point_light = 5, // +x points to right, +y points up, +z points towards camera
975  camera_spot_light = 6,
976  world_directional_light = 7, // light location and direction in world coordinates
977  world_point_light = 8,
978  world_spot_light = 9,
979  ambient_light = 10, // pure ambient light
980  world_linear_light = 11,
981  world_rectangular_light = 12,
982  light_style_count = 13
983  };
984  static light_style LightStyle(int); // convert integer to light_style enum
985 
986  //// curvature style /////////////////////////////////////////////////////////
987  enum curvature_style
988  {
989  unknown_curvature_style = 0,
990  gaussian_curvature = 1,
991  mean_curvature = 2, // unsigned mean curvature
992  min_curvature = 3, // minimum unsigned radius of curvature
993  max_curvature = 4, // maximum unsigned radius of curvature
994  curvature_style_count = 5
995  };
996  static curvature_style CurvatureStyle(int); // convert integer to curvature_style enum
997 
998  //// view display mode /////////////////////////////////////////////////////////////
999  enum display_mode
1000  {
1001  default_display = 0, // default display
1002  wireframe_display = 1, // wireframe display
1003  shaded_display = 2, // shaded display
1004  renderpreview_display = 3 // render preview display
1005  };
1006  static display_mode DisplayMode(int); // convert integer to display_mode enum
1007 
1008 
1009  enum view_type
1010  {
1011  model_view_type = 0, // standard model space 3d view
1012  page_view_type = 1, // a.k.a "paper space", "plot view", etc.
1013  // A page view must be orthographic,
1014  // the camera frame x,y,z direction must be
1015  // world x,y,z (which means the camera direction
1016  // is always (0,0,-1)).
1017  nested_view_type = 2, // This view is a "model" view that is nested
1018  // in another view. The nesting and parent
1019  // information is saved in ON_3dmView.
1020  };
1021  static view_type ViewType(int); // convert integer to display_mode enum
1022 
1023 
1024  //// texture mapping mode ///////////////////////////////////////////////////
1025  //
1026  // OBSOLETE
1027  enum texture_mode
1028  {
1029  no_texture = 0, // texture disabled
1030  modulate_texture = 1, // modulate with material diffuse color
1031  decal_texture = 2 // decal
1032  };
1033  // OBSOLETE
1034  static texture_mode TextureMode(int); // convert integer to texture_mode enum
1035  // OBSOLETE
1036  //
1037  /////////////////////////////////////////////////////////////////////////////
1038 
1039  //// object_type ///////////////////////////////////////////////////
1040  enum object_type
1041  {
1042  // Use with ON_Object::ObjectType() in situations where
1043  // using a switch() is better than a long string of if else if ...
1044  // if ( ON_Curve::Cast() ) ... else if ( ON_Surface::Cast() ) ...
1045  // ...
1046  unknown_object_type = 0,
1047 
1048  point_object = 1, // some type of ON_Point
1049  pointset_object = 2, // some type of ON_PointCloud, ON_PointGrid, ...
1050  curve_object = 4, // some type of ON_Curve like ON_LineCurve, ON_NurbsCurve, etc.
1051  surface_object = 8, // some type of ON_Surface like ON_PlaneSurface, ON_NurbsSurface, etc.
1052  brep_object = 0x10, // some type of ON_Brep
1053  mesh_object = 0x20, // some type of ON_Mesh
1054  layer_object = 0x40, // some type of ON_Layer
1055  material_object = 0x80, // some type of ON_Material
1056  light_object = 0x100, // some type of ON_Light
1057  annotation_object = 0x200, // some type of ON_Annotation
1058  userdata_object = 0x400, // some type of ON_UserData
1059  instance_definition = 0x800, // some type of ON_InstanceDefinition
1060  instance_reference = 0x1000, // some type of ON_InstanceRef
1061  text_dot = 0x2000, // some type of ON_TextDot
1062  grip_object = 0x4000, // selection filter value - not a real object type
1063  detail_object = 0x8000, // some type of ON_DetailView
1064  hatch_object = 0x10000, // some type of ON_Hatch
1065  morph_control_object = 0x20000, // some type of ON_MorphControl
1066  loop_object = 0x80000, // some type of ON_BrepLoop
1067  polysrf_filter = 0x200000, // selection filter value - not a real object type
1068  edge_filter = 0x400000, // selection filter value - not a real object type
1069  polyedge_filter = 0x800000, // selection filter value - not a real object type
1070  meshvertex_object = 0x01000000, // some type of ON_MeshVertexRef
1071  meshedge_object = 0x02000000, // some type of ON_MeshEdgeRef
1072  meshface_object = 0x04000000, // some type of ON_MeshFaceRef
1073  cage_object = 0x08000000, // some type of ON_NurbsCage
1074  phantom_object = 0x10000000,
1075  clipplane_object = 0x20000000,
1076  beam_object = 0x40000000, // obsolete - use extrusion_object
1077  extrusion_object = 0x40000000, // some type of ON_Extrusion
1078 
1079  any_object = 0xFFFFFFFF
1080 
1081  // Please discuss any changes with Dale Lear
1082  };
1083 
1084  static object_type ObjectType(int); // convert integer to object_type enum
1085 
1086  //// bitmap_type ///////////////////////////////////////////////////
1087  enum bitmap_type
1088  {
1089  unknown_bitmap_type = 0,
1090  windows_bitmap = 1, // BITMAPINFO style
1091  opengl_bitmap = 2, // unpacked OpenGL RGB or RGBA
1092  png_bitmap = 3
1093  };
1094  static bitmap_type BitmapType(int); // convert integer to bitmap_type enum
1095 
1096  enum object_decoration
1097  {
1098  no_object_decoration = 0,
1099  start_arrowhead = 0x08, // arrow head at start
1100  end_arrowhead = 0x10, // arrow head at end
1101  both_arrowhead = 0x18 // arrow heads at start and end
1102  };
1103  static object_decoration ObjectDecoration(int); // convert integer to line_pattern enum
1104 
1105  enum mesh_type
1106  {
1107  default_mesh = 0,
1108  render_mesh = 1,
1109  analysis_mesh = 2,
1110  preview_mesh = 3,
1111  any_mesh = 4
1112  };
1113  static mesh_type MeshType(int); // convert integer to mesh_type enum
1114 
1115 
1116  // Types of object snapping.
1117  // In situations where more than one type of snap applies,
1118  // snaps with higher value take precedence.
1119  // enum values must be a power of 2.
1120  // ON_ObjRef saves these values in files. Do not change
1121  // the values. The reason for the gaps between the enum
1122  // values is to leave room for future snaps with prededence
1123  // falling between existing snaps
1124  enum osnap_mode
1125  {
1126  os_none = 0,
1127  os_near = 2,
1128  os_focus = 8,
1129  os_center = 0x20,
1130  os_vertex = 0x40,
1131  os_knot = 0x80,
1132  os_quadrant = 0x200,
1133  os_midpoint = 0x800,
1134  os_intersection = 0x2000,
1135  os_end = 0x20000,
1136  os_perpendicular = 0x80000,
1137  os_tangent = 0x200000,
1138  os_point = 0x08000000,
1139  os_all_snaps = 0xFFFFFFFF
1140  };
1141  static osnap_mode OSnapMode(int); // convert integer to osnap_mode enum
1142 
1143 
1144  //// Types of Curves ///////////////////////////////////////////////////////////
1145  enum eCurveType
1146  {
1147  ctCurve, // nothing
1148  ctArc,
1149  ctCircle,
1150  ctLine,
1151  ctNurbs,
1152  ctOnsurface,
1153  ctProxy,
1154  ctPolycurve,
1155  ctPolyline,
1156  };
1157 
1158 
1159  //// surface_loft_end_condition //////////////////////////////////////////////
1160  //
1161  // End condition paramter values for ON_Curve::CreateCubicLoft() and
1162  // ON_Surface::CreateCubicLoft().
1163  enum cubic_loft_end_condition
1164  {
1165  cubic_loft_ec_quadratic = 0,
1166  cubic_loft_ec_linear = 1,
1167  cubic_loft_ec_cubic = 2,
1168  cubic_loft_ec_natural = 3,
1169  cubic_loft_ec_unit_tangent = 4,
1170  cubic_loft_ec_1st_derivative = 5,
1171  cubic_loft_ec_2nd_derivative = 6,
1172  cubic_loft_ec_free_cv = 7
1173  };
1174 
1175  /*
1176  Description:
1177  Convert an integer to cubic_loft_end_condition enum.
1178  Parameters:
1179  i - [in]
1180  Returns:
1181  corresponding cubic_loft_end_condition enum value.
1182  Remarks:
1183  If i does not correspond to a cubic_loft_end_condition
1184  enum value, then cubic_loft_ec_quadratic is returned.
1185  */
1186  static
1187  cubic_loft_end_condition CubicLoftEndCondition(int i);
1188 
1189 private:
1190  // prohibit instantiaion
1191  //ON(); // no implementation
1192  //ON( const ON& ); // no implementation
1193  //~ON(); // no implementation
1194 };
1195 
1196 
1197 /*
1198 Description:
1199  Component indices are used to provide a persistent way
1200  to identify portions of complex objects.
1201 
1202 */
1203 class ON_CLASS ON_COMPONENT_INDEX
1204 {
1205 public:
1206 
1207  // Do not change these values; they are stored in 3dm archives
1208  // and provide a persistent way to indentify components of
1209  // complex objects.
1210  enum TYPE
1211  {
1212  invalid_type = 0,
1213 
1214  brep_vertex = 1,
1215  brep_edge = 2,
1216  brep_face = 3,
1217  brep_trim = 4,
1218  brep_loop = 5,
1219 
1220  mesh_vertex = 11,
1221  meshtop_vertex = 12,
1222  meshtop_edge = 13,
1223  mesh_face = 14,
1224 
1225  idef_part = 21,
1226 
1227  polycurve_segment = 31,
1228 
1229  pointcloud_point = 41,
1230 
1231  group_member = 51,
1232 
1233 
1234  extrusion_bottom_profile = 61, // 3d bottom profile curves
1235  // index identifies profile component
1236  extrusion_top_profile = 62, // 3d top profile curves
1237  // index identifies profile component
1238  extrusion_wall_edge = 63, // 3d wall edge curve
1239  // index/2: identifies profile component
1240  // index%2: 0 = start, 1 = end
1241  extrusion_wall_surface = 64, // side wall surfaces
1242  // index: identifies profile component
1243  extrusion_cap_surface = 65, // bottom and top cap surfaces
1244  // index: 0 = bottom, 1 = top
1245  extrusion_path = 66, // extrusion path (axis line)
1246  // index -1 = entire path, 0 = start point, 1 = endpoint
1247 
1248  dim_linear_point = 100,
1249  dim_radial_point = 101,
1250  dim_angular_point = 102,
1251  dim_ordinate_point = 103,
1252  dim_text_point = 104,
1253 
1254  no_type = 0xFFFFFFFF
1255  };
1256 
1257  /*
1258  Description:
1259  Safe conversion of integer value to TYPE enum.
1260  Parameters:
1261  i - [in] integer with value equal to one of the TYPE enums.
1262  Returns:
1263  The TYPE enum with the same numeric value
1264  or ON_COMPONENT_INDEX::invalid_type if no corresponding enum
1265  exists.
1266  */
1267  static
1268  TYPE Type(int i);
1269 
1270  /*
1271  Description:
1272  Dictionary compare on m_type, m_index as ints.
1273  Returns:
1274  < 0: a < b
1275  = 0: a = b
1276  > 0: a > b
1277  */
1278  static
1279  int Compare( const ON_COMPONENT_INDEX* a, const ON_COMPONENT_INDEX* b);
1280 
1281  /*
1282  Description:
1283  Sets m_type = invalid_type and m_index = -1.
1284  */
1285  ON_COMPONENT_INDEX();
1286 
1287  /*
1288  Description:
1289  Sets m_type = type and m_index = index.
1290  */
1291  ON_COMPONENT_INDEX(TYPE type,int index);
1292 
1293  bool operator==(const ON_COMPONENT_INDEX& other) const;
1294  bool operator!=(const ON_COMPONENT_INDEX& other) const;
1295  bool operator<(const ON_COMPONENT_INDEX& other) const;
1296  bool operator<=(const ON_COMPONENT_INDEX& other) const;
1297  bool operator>(const ON_COMPONENT_INDEX& other) const;
1298  bool operator>=(const ON_COMPONENT_INDEX& other) const;
1299 
1300  void Set(TYPE type,int index);
1301 
1302  /*
1303  Description:
1304  Sets m_type = invalid_type and m_index = -1.
1305  */
1306  void UnSet();
1307 
1308  /*
1309  Returns:
1310  True if m_type is set to a TYPE enum value between
1311  brep_vertex and polycurve_segment.
1312  */
1313  bool IsSet() const;
1314 
1315  /*
1316  Returns:
1317  True if m_type is set to one of the mesh or meshtop
1318  TYPE enum values and m_index >= 0.
1319  */
1320  bool IsMeshComponentIndex() const;
1321 
1322  /*
1323  Returns:
1324  True if m_type is set to one of the
1325  brep TYPE enum values and m_index >= 0.
1326  */
1327  bool IsBrepComponentIndex() const;
1328 
1329  /*
1330  Returns:
1331  True if m_type = idef_part and m_index >= 0.
1332  */
1333  bool IsIDefComponentIndex() const;
1334 
1335  /*
1336  Returns:
1337  True if m_type = polycurve_segment and m_index >= 0.
1338  */
1339  bool IsPolyCurveComponentIndex() const;
1340 
1341  /*
1342  Returns:
1343  True if m_type = group_member and m_index >= 0.
1344  */
1345  bool IsGroupMemberComponentIndex() const;
1346 
1347  /*
1348  Returns:
1349  True if m_type = extrusion_bottom_profile or extrusion_top_profile
1350  and m_index >= 0.
1351  */
1352  bool IsExtrusionProfileComponentIndex() const;
1353 
1354  /*
1355  Returns:
1356  True if m_type = extrusion_path and -1 <= m_index <= 1.
1357  */
1358  bool IsExtrusionPathComponentIndex() const;
1359 
1360  /*
1361  Returns:
1362  True if m_type = extrusion_wall_edge and m_index >= 0.
1363  */
1364  bool IsExtrusionWallEdgeComponentIndex() const;
1365 
1366  /*
1367  Returns:
1368  True if m_type = extrusion_wall_surface and m_index >= 0.
1369  */
1370  bool IsExtrusionWallSurfaceComponentIndex() const;
1371 
1372  /*
1373  Returns:
1374  True if m_type = extrusion_wall_surface or extrusion_wall_edge
1375  and m_index >= 0.
1376  */
1377  bool IsExtrusionWallComponentIndex() const;
1378 
1379  /*
1380  Returns:
1381  True if m_type = extrusion_bottom_profile, extrusion_top_profile,
1382  extrusion_wall_edge, extrusion_wall_surface, extrusion_cap_surface
1383  or extrusion_path and m_index is reasonable.
1384  */
1385  bool IsExtrusionComponentIndex() const;
1386 
1387  /*
1388  Returns:
1389  True if m_type = pointcloud_point and m_index >= 0.
1390  */
1391  bool IsPointCloudComponentIndex() const;
1392 
1393  /*
1394  Returns:
1395  True if m_type = dim_... and m_index >= 0.
1396  */
1397  bool IsAnnotationComponentIndex() const;
1398 
1399  TYPE m_type;
1400 
1401  /*
1402  The interpretation of m_index depends on the m_type value.
1403 
1404  m_type m_index interpretation (0 based indices)
1405 
1406  no_type used when context makes it clear what array is being index
1407  brep_vertex ON_Brep.m_V[] array index
1408  brep_edge ON_Brep.m_E[] array index
1409  brep_face ON_Brep.m_F[] array index
1410  brep_trim ON_Brep.m_T[] array index
1411  brep_loop ON_Brep.m_L[] array index
1412  mesh_vertex ON_Mesh.m_V[] array index
1413  meshtop_vertex ON_MeshTopology.m_topv[] array index
1414  meshtop_edge ON_MeshTopology.m_tope[] array index
1415  mesh_face ON_Mesh.m_F[] array index
1416  idef_part ON_InstanceDefinition.m_object_uuid[] array index
1417  polycurve_segment ON_PolyCurve::m_segment[] array index
1418 
1419  extrusion_bottom_profile Use ON_Extrusion::Profile3d() to get 3d profile curve
1420  extrusion_top_profile Use ON_Extrusion::Profile3d() to get 3d profile curve
1421  extrusion_wall_edge Use ON_Extrusion::WallEdge() to get 3d line curve
1422  extrusion_wall_surface Use ON_Extrusion::WallSurface() to get 3d wall surface
1423  extrusion_cap_surface 0 = bottom cap, 1 = top cap
1424  extrusion_path -1 = entire path, 0 = start of path, 1 = end of path
1425 
1426  dim_linear_point ON_LinearDimension2::POINT_INDEX
1427  dim_radial_point ON_RadialDimension2::POINT_INDEX
1428  dim_angular_point ON_AngularDimension2::POINT_INDEX
1429  dim_ordinate_point ON_OrdinateDimension2::POINT_INDEX
1430  dim_text_point ON_TextEntity2 origin point
1431  */
1432  int m_index;
1433 };
1434 
1435 #endif
1436 
1437 ON_BEGIN_EXTERNC
1438 
1439 /*
1440 Description:
1441  Sets Windows code page used to convert UNICODE (wchar_t) strings
1442  to multibyte (char) strings and vice verse.
1443 Parameters:
1444  code_page - [in] code page to use when converting UNICODE strings
1445  to multibyte strings and vice verse.
1446 Returns:
1447  previous value of Windows code page.
1448 Remarks:
1449  For Windows NT/2000/XP, CP_THREAD_ACP will work for all
1450  locales if your app's thread is correctly configured.
1451  For Windows 95/98/ME you have to choose the locale.
1452 
1453  Conversions between UNICODE and multibyte strings happens when
1454  ON_wString converts a char* string to a wchar_t* string and
1455  when and ON_String converts a wchar_t* string to a char* string.
1456 
1457  All pertinant code is in opennurbs_defines.cpp.
1458 
1459 See Also:
1460  ON_GetStringConversionWindowsCodePage
1461  on_WideCharToMultiByte
1462  on_MultiByteToWideChar
1463  ON_wString::operator=(const char*)
1464  ON_String::operator=(const wchar_t*)
1465 */
1466 ON_DECL
1467 unsigned int ON_SetStringConversionWindowsCodePage(
1468  unsigned int code_page
1469  );
1470 
1471 /*
1472 Description:
1473  Gets Windows code page used to convert UNICODE (wchar_t) strings
1474  to multibyte (char) strings and vice verse.
1475 Returns:
1476  Value of Windows code page used to convert strings.
1477 Remarks:
1478  For Windows NT/2000/XP, CP_THREAD_ACP will work for all
1479  locales if your app's thread is correctly configured.
1480  For Windows 95/98/ME you have to choose the locale.
1481 
1482  Conversions between UNICODE and multibyte strings happens when
1483  ON_wString converts a char* string to a wchar_t* string and
1484  when and ON_String converts a wchar_t* string to a char* string.
1485 
1486  All pertinant code is in opennurbs_defines.cpp.
1487 
1488 See Also:
1489  ON_GetStringConversionWindowsCodePage
1490  on_WideCharToMultiByte
1491  on_MultiByteToWideChar
1492  ON_wString::operator=(const char*)
1493  ON_String::operator=(const wchar_t*)
1494 */
1495 ON_DECL
1496 unsigned int ON_GetStringConversionWindowsCodePage();
1497 
1498 
1499 /*
1500 Description:
1501  Sets Windows locale id used in case insensitive string
1502  compares.
1503 Parameters:
1504  locale_id - [in] Windows locale id to use in case insensitive
1505  string compares.
1506  bWin9X - [in] True if OS is Windows 95/98/ME (which has
1507  poor UNICODE support).
1508 Returns:
1509  Previous value of Windows locale id.
1510 Remarks:
1511  All pertinant code is in opennurbs_defines.cpp.
1512 See Also:
1513  ON_GetStringConversionWindowsLocaleID
1514  on_wcsicmp
1515 */
1516 ON_DECL
1517 unsigned int ON_SetStringConversionWindowsLocaleID(
1518  unsigned int locale_id,
1519  ON_BOOL32 bWin9X
1520  );
1521 
1522 /*
1523 Description:
1524  Gets Windows locale id used in case insensitive string
1525  compares.
1526 Returns:
1527  Value of Windows locale id used in case insensitive string
1528  compares.
1529 Remarks:
1530  All pertinant code is in opennurbs_defines.cpp.
1531 See Also:
1532  ON_SetStringConversionWindowsLocaleID
1533  on_wcsicmp
1534 */
1535 ON_DECL
1536 unsigned int ON_GetStringConversionWindowsLocaleID();
1537 
1538 // on_wcsicmp() is a wrapper for case insensitive wide string compare
1539 // and calls one of _wcsicmp() or wcscasecmp() depending on OS.
1540 ON_DECL
1541 int on_wcsicmp( const wchar_t*, const wchar_t* );
1542 
1543 // on_wcsupr() calls _wcsupr() or wcsupr() depending on OS
1544 ON_DECL
1545 wchar_t* on_wcsupr(wchar_t*);
1546 
1547 // on_wcslwr() calls _wcslwr() or wcslwr() depending on OS
1548 ON_DECL
1549 wchar_t* on_wcslwr(wchar_t*);
1550 
1551 // on_wcsrev() calls _wcsrev() or wcsrev() depending on OS
1552 ON_DECL
1553 wchar_t* on_wcsrev(wchar_t*);
1554 
1555 // on_stricmp() is a wrapper for case insensitive string compare
1556 // and calls one of _stricmp(), stricmp(), or strcasecmp()
1557 // depending on OS.
1558 ON_DECL
1559 int on_stricmp(const char*, const char*);
1560 
1561 // on_stricmp() is a wrapper for case insensitive string compare
1562 // and calls one of _strnicmp() or strncasecmp()
1563 // depending on OS.
1564 ON_DECL
1565 int on_strnicmp(const char * s1, const char * s2, int n);
1566 
1567 // on_strupr() calls _strupr() or strupr() depending on OS
1568 ON_DECL
1569 char* on_strupr(char*);
1570 
1571 // on_strlwr() calls _strlwr() or strlwr() depending on OS
1572 ON_DECL
1573 char* on_strlwr(char*);
1574 
1575 // on_strrev() calls _strrev() or strrev() depending on OS
1576 ON_DECL
1577 char* on_strrev(char*);
1578 
1579 /*
1580 Description:
1581  Calls ON_ConvertWideCharToUTF8()
1582 */
1583 ON_DECL
1584 int on_WideCharToMultiByte(
1585  const wchar_t*, // lpWideCharStr,
1586  int, // cchWideChar,
1587  char*, // lpMultiByteStr,
1588  int // cchMultiByte,
1589  );
1590 
1591 /*
1592 Description:
1593  Calls ON_ConvertUTF8ToWideChar()
1594 */
1595 ON_DECL
1596 int on_MultiByteToWideChar(
1597  const char*, // lpMultiByteStr,
1598  int, // cchMultiByte,
1599  wchar_t*, // lpWideCharStr,
1600  int // cchWideChar
1601  );
1602 
1603 /*
1604 Description:
1605  Find the locations in a path the specify the drive, directory,
1606  file name and file extension.
1607 Parameters:
1608  path - [in]
1609  UTF-8 encoded string that is a legitimate path to a file.
1610  drive - [out] (pass null if you don't need the drive)
1611  If drive is not null and the path parameter begins with
1612  an A-Z or a-z followed by a colon ( : ) then the returned
1613  value of *drive will equal the input value of path.
1614  dir - [out] (pass null if you don't need the directory)
1615  If dir is not null and the path parameter contains a
1616  directory specification, then the returned value of *dir
1617  will point to the character in path where the directory
1618  specification begins.
1619  fname - [out] (pass null if you don't need the file name)
1620  If fname is not null and the path parameter contains a
1621  file name specification, then the returned value of *fname
1622  will point to the character in path where the file name
1623  specification begins.
1624  ext - [out] (pass null if you don't need the extension)
1625  If ext is not null and the path parameter contains a
1626  file extension specification, then the returned value of
1627  *ext will point to the '.' character in path where the file
1628  extension specification begins.
1629 Remarks:
1630  This function will treat a front slash ( / ) and a back slash
1631  ( \ ) as directory separators. Because this function parses
1632  file names store in .3dm files and the .3dm file may have been
1633  written on a Windows computer and then read on a another
1634  computer, it looks for a drive dpecification even when the
1635  operating system is not Windows.
1636  This function will not return an directory that does not
1637  end with a trailing slash.
1638  This function will not return an empty filename and a non-empty
1639  extension.
1640  This function parses the path string according to these rules.
1641  It does not check the actual file system to see if the answer
1642  is correct.
1643 See Also:
1644  ON_String::SplitPath
1645 */
1646 ON_DECL void on_splitpath(
1647  const char* path,
1648  const char** drive,
1649  const char** dir,
1650  const char** fname,
1651  const char** ext
1652  );
1653 
1654 /*
1655 Description:
1656  Find the locations in a path the specify the drive, directory,
1657  file name and file extension.
1658 Parameters:
1659  path - [in]
1660  UTF-8, UTF-16 or UTF-32 encoded wchar_t string that is a
1661  legitimate path to a file.
1662  drive - [out] (pass null if you don't need the drive)
1663  If drive is not null and the path parameter begins with
1664  an A-Z or a-z followed by a colon ( : ) then the returned
1665  value of *drive will equal the input value of path.
1666  dir - [out] (pass null if you don't need the directory)
1667  If dir is not null and the path parameter contains a
1668  directory specification, then the returned value of *dir
1669  will point to the character in path where the directory
1670  specification begins.
1671  fname - [out] (pass null if you don't need the file name)
1672  If fname is not null and the path parameter contains a
1673  file name specification, then the returned value of *fname
1674  will point to the character in path where the file name
1675  specification begins.
1676  ext - [out] (pass null if you don't need the extension)
1677  If ext is not null and the path parameter contains a
1678  file extension specification, then the returned value of
1679  *ext will point to the '.' character in path where the file
1680  extension specification begins.
1681 Remarks:
1682  This function will treat a front slash ( / ) and a back slash
1683  ( \ ) as directory separators. Because this function parses
1684  file names store in .3dm files and the .3dm file may have been
1685  written on a Windows computer and then read on a another
1686  computer, it looks for a drive dpecification even when the
1687  operating system is not Windows.
1688  This function will not return an directory that does not
1689  end with a trailing slash.
1690  This function will not return an empty filename and a non-empty
1691  extension.
1692  This function parses the path string according to these rules.
1693  It does not check the actual file system to see if the answer
1694  is correct.
1695 See Also:
1696  ON_wString::SplitPath
1697 */
1698 ON_DECL void on_wsplitpath(
1699  const wchar_t* path,
1700  const wchar_t** drive,
1701  const wchar_t** dir,
1702  const wchar_t** fname,
1703  const wchar_t** ext
1704  );
1705 
1706 ON_END_EXTERNC
1707 
1708 
1709 #endif
bool operator<(const PersonCluster< PointT > &c1, const PersonCluster< PointT > &c2)
double d
void read(std::istream &stream, Type &value)
Function for reading data from a stream.
Definition: region_xy.h:47
void * p
char b[8]
ON__INT32 i
void write(std::ostream &stream, Type value)
Function for writing data to a stream.
Definition: region_xy.h:64
int j[2]
ON__INT64 h