forked from mcneel/opennurbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opennurbs_defines.h
2949 lines (2510 loc) · 87.7 KB
/
opennurbs_defines.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved.
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
// McNeel & Associates.
//
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
//
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
//
////////////////////////////////////////////////////////////////
*/
////////////////////////////////////////////////////////////////
//
// Includes all openNURBS toolkit defines and enums.
//
////////////////////////////////////////////////////////////////
#if !defined(OPENNURBS_DEFINES_INC_)
#define OPENNURBS_DEFINES_INC_
#if !defined(OPENNURBS_SYSTEM_INC_)
#error Include opennurbs_system.h before opennurbs_defines.h
#endif
#if defined (cplusplus) || defined(_cplusplus) || defined(__cplusplus) || defined(ON_CPLUSPLUS)
// C++ extern "C" declaration for C linkage
#if !defined(ON_CPLUSPLUS)
#define ON_CPLUSPLUS
#endif
#define ON_EXTERNC extern "C"
#define ON_BEGIN_EXTERNC extern "C" {
#define ON_END_EXTERNC }
#define ON_UINT_FROM_ENUM(e) (static_cast<unsigned int>(e))
#define ON_INT_FROM_ENUM(e) ((int)static_cast<unsigned int>(e))
#else
/* C file - no extern declaration required or permitted */
#define ON_EXTERNC
#define ON_BEGIN_EXTERNC
#define ON_END_EXTERNC
#endif
/*
// Declarations in header (.H) files look like
//
// ON_DECL type function():
// extern ON_EXTERN_DECL type global_variable;
// class ON_CLASS classname {};
// ON_TEMPLATE template class ON_CLASS template<T>;
//
*/
#define ON_ENUM_FROM_UNSIGNED_CASE(e) case (unsigned int)e: return(e); break
#define ON_ENUM_TO_STRING_CASE(e) case e: return( ON_String(#e) ); break
#define ON_ENUM_TO_WIDE_STRING_CASE(e) case e: return( ON_wString(#e) ); break
#define ON_ENUM_TO_STRING_CASE_SET(e,s) case e: (s)=ON_String(#e); break
#define ON_ENUM_TO_WIDE_STRING_CASE_SET(e,s) case e: (s)=ON_wString(#e); break
/* export/import */
#if defined(OPENNURBS_EXPORTS)
/* compiling opennurbs as some type of dynamic linking library */
#if defined(ON_COMPILER_MSC)
/* compiling OpenNurbs as a Windows DLL - export classes, functions, templates, and globals */
#define ON_CLASS __declspec(dllexport)
#define ON_DECL __declspec(dllexport)
#define ON_EXTERN_DECL __declspec(dllexport)
#define ON_DLL_TEMPLATE
#elif defined(ON_COMPILER_CLANG)
/* compiling opennurbs as an Apple shared library */
#define ON_CLASS __attribute__ ((visibility ("default")))
#define ON_DECL __attribute__ ((visibility ("default")))
#define ON_EXTERN_DECL __attribute__ ((visibility ("default")))
#else
#error fill in your compiler dynamic linking decorations
#endif
#elif defined(OPENNURBS_IMPORTS)
/* dynamically linking with opennurbs in some way */
#if defined(ON_COMPILER_MSC)
/* using OpenNurbs as a Windows DLL - import classes, functions, templates, and globals */
#define ON_CLASS __declspec(dllimport)
#define ON_DECL __declspec(dllimport)
#define ON_EXTERN_DECL __declspec(dllimport)
#define ON_DLL_TEMPLATE extern
#elif defined(ON_COMPILER_CLANG)
/* using opennurbs as an Apple shared library */
#define ON_CLASS __attribute__ ((visibility ("default")))
#define ON_DECL __attribute__ ((visibility ("default")))
#define ON_EXTERN_DECL __attribute__ ((visibility ("default")))
#else
#error fill in your compiler dynamic linking decorations
#endif
#else
/* compiling or using OpenNurbs as a static library */
#define ON_CLASS
#define ON_DECL
#define ON_EXTERN_DECL
#if defined(ON_DLL_TEMPLATE)
#undef ON_DLL_TEMPLATE
#endif
#endif
// ON_DEPRECATED is used to mark deprecated functions.
#if defined(ON_COMPILER_MSC)
#define ON_DEPRECATED __declspec(deprecated)
#define ON_DEPRECATED_MSG(s) [[deprecated(s)]]
#if defined(OPENNURBS_IN_RHINO)
#define ON_WIP_SDK
#define ON_INTERNAL_SDK
#else
#define ON_WIP_SDK [[deprecated("Do not use! This function is a work in progress and will change.")]]
#define ON_INTERNAL_SDK [[deprecated("Do not use! This function is internal.")]]
#endif
#elif defined(ON_COMPILER_CLANG)
#define ON_DEPRECATED __attribute__((deprecated))
#define ON_DEPRECATED_MSG(s) [[deprecated(s)]]
#if defined(OPENNURBS_IN_RHINO)
#define ON_WIP_SDK
#define ON_INTERNAL_SDK
#else
#define ON_WIP_SDK [[deprecated("Do not use! This function is a work in progress and will change.")]]
#define ON_INTERNAL_SDK [[deprecated("Do not use! This function is internal.")]]
#endif
#else
#define ON_DEPRECATED
#define ON_DEPRECATED_MSG(s)
#define ON_WIP_SDK
#define ON_INTERNAL_SDK
#endif
#if defined(PI)
/* double precision ON_PI = 3.141592653589793238462643. ON_PI radians = 180 degrees */
#define ON_PI PI
#else
/* double precision ON_PI = 3.141592653589793238462643. ON_PI radians = 180 degrees */
#define ON_PI 3.141592653589793238462643
#endif
/* double precision ON_2PI = 2.0*ON_PI. ON_2PI radians = 360 degrees. */
#define ON_2PI (2.0*ON_PI)
/* double precision ON_HALFPI = 0.5*ON_PI. ON_HALFPI radians = 90 degrees. */
#define ON_HALFPI (0.5*ON_PI)
/* angle_in_degrees = ON_DEGREES_TO_RADIANS*angle_in_radians */
#define ON_DEGREES_TO_RADIANS (ON_PI/180.0)
/* angle_in_radians = ON_RADIANS_TO_DEGREES*angle_in_degrees */
#define ON_RADIANS_TO_DEGREES (180.0/ON_PI)
/*
Parameters:
angle_in_radians - [in]
Angle measure in radians
Returns:
Angle measure in degrees
*/
ON_DECL
double ON_DegreesFromRadians(
double angle_in_radians
);
/*
Parameters:
angle_in_degrees - [in]
Angle measure in degrees
Returns:
Angle measure in radians
*/
ON_DECL
double ON_RadiansFromDegrees(
double angle_in_degrees
);
#define ON_SQRT2 1.414213562373095048801689
#define ON_SQRT3 1.732050807568877293527446
#define ON_SQRT3_OVER_2 0.8660254037844386467637230
#define ON_1_OVER_SQRT2 0.7071067811865475244008445
#define ON_SIN_PI_OVER_12 0.2588190451025207623488990
#define ON_COS_PI_OVER_12 0.9659258262890682867497433
#define ON_LOG2 0.6931471805599453094172321
#define ON_LOG10 2.302585092994045684017991
#define ON_ArrayCount(a) (sizeof(a)/sizeof((a)[0]))
#if defined(DBL_MAX)
#define ON_DBL_MAX DBL_MAX
#else
#define ON_DBL_MAX 1.7976931348623158e+308
#endif
#if defined(DBL_MIN)
#define ON_DBL_MIN DBL_MIN
#else
#define ON_DBL_MIN 2.22507385850720200e-308
#endif
// ON_EPSILON = 2^-52
#if defined(DBL_EPSILON)
#define ON_EPSILON DBL_EPSILON
#else
#define ON_EPSILON 2.2204460492503131e-16
#endif
#define ON_SQRT_EPSILON 1.490116119385000000e-8
#if defined(FLT_EPSILON)
#define ON_FLOAT_EPSILON FLT_EPSILON
#else
#define ON_FLOAT_EPSILON 1.192092896e-07
#endif
#define ON_SQRT_FLOAT_EPSILON 3.452669830725202719e-4
#if defined(UINT_MAX)
#define ON_UINT_MAX UINT_MAX
#else
#define ON_UINT_MAX (~(0U))
#endif
/*
// In cases where lazy evaluation of a double value is
// performed, b-rep tolerances being a notable example,
// this value is used to indicate the value has not been
// computed. This value must be < -1.0e308. and > -ON_DBL_MAX
//
// The reasons ON_UNSET_VALUE is a valid finite number are:
//
// 1) It needs to round trip through fprintf/sscanf.
// 2) It needs to persist unchanged through assigment
/ and not generate exceptions when assigned.
// 3) ON_UNSET_VALUE == ON_UNSET_VALUE needs to be true.
// 4) ON_UNSET_VALUE != ON_UNSET_VALUE needs to be false.
//
// Ideally, it would also have these SNaN attributes
// * When used in a calculation, a floating point exception
// occures.
// * No possibility of a valid calculation would generate
// ON_UNSET_VALUE.
// * float f = (float)ON_UNSET_VALUE would create an invalid
// float and generate an exception.
*/
#define ON_UNSET_POSITIVE_VALUE 1.23432101234321e+308
#define ON_UNSET_VALUE -ON_UNSET_POSITIVE_VALUE
/*
// ON_UNSET_FLOAT is used to indicate a texture coordinate
// value cannot be calculated or is not well defined.
// In hindsight, this value should have been ON_FLT_QNAN
// because many calculation convert float texture coordinates
// to doubles and the "unset"ness attribute is lost.
*/
#define ON_UNSET_POSITIVE_FLOAT 1.234321e+38f
#define ON_UNSET_FLOAT -ON_UNSET_POSITIVE_FLOAT
// When unsigned int values are used in a context where
// 0 is a valid index and there needs to be a value that
// indicates the index is not set, use ON_UNSET_UINT_INDEX.
#define ON_UNSET_UINT_INDEX 0xFFFFFFFFU
// When signed int values are used in a context where
// 0 and small negative values are valid indices and there needs
// to be a value that indicates the index is not set,
// use ON_UNSET_INT_INDEX. This value is INT_MIN+1
#define ON_UNSET_INT_INDEX ((const int)-2147483647)
ON_BEGIN_EXTERNC
// IEEE 754 special values
extern ON_EXTERN_DECL const double ON_DBL_QNAN;
extern ON_EXTERN_DECL const double ON_DBL_PINF;
extern ON_EXTERN_DECL const double ON_DBL_NINF;
extern ON_EXTERN_DECL const float ON_FLT_QNAN;
extern ON_EXTERN_DECL const float ON_FLT_PINF;
extern ON_EXTERN_DECL const float ON_FLT_NINF;
/*
The ON_PTR_SEMAPHORE* values are used in rare cases
when a special signal must be passed as a pointer argument.
The values must be a multiple of 8 to suppress runtime pointer alignment checks.
The values must never be a valid user heap or stack pointer value.
*/
#define ON_PTR_SEMAPHORE1 ((ON__UINT_PTR)8)
#define ON_PTR_SEMAPHORE2 ((ON__UINT_PTR)16)
#define ON_PTR_SEMAPHORE3 ((ON__UINT_PTR)24)
#define ON_PTR_SEMAPHORE4 ((ON__UINT_PTR)32)
#define ON_PTR_SEMAPHORE_MAX ((ON__UINT_PTR)32)
/*
Description:
Paramters:
x - [out] returned value of x is an SNan
(signalling not a number).
Remarks:
Any time an SNaN passes through an Intel FPU, the result
is a QNaN (quiet nan) and the invalid operation excpetion
flag is set. If this exception is not masked, then the
exception handler is invoked.
double x, y;
ON_DBL_SNAN(&x);
y = x; // y = QNAN and invalid op exception occurs
z = sin(x) // z = QNAN and invalid op exception occurs
So, if you want to reliably initialize doubles to SNaNs,
you must use memcpy() or some other method that does not
use the Intel FPU.
*/
ON_DECL
void ON_DBL_SNAN( double* x );
ON_DECL
void ON_FLT_SNAN( float* x );
/*
Returns:
ON_UNSET_FLOAT, if x = ON_UNSET_VALUE.
ON_UNSET_POSITIVE_FLOAT, if x = ON_UNSET_POSITIVE_VALUE.
(float)x, otherwise.
*/
ON_DECL
float ON_FloatFromDouble(
double x
);
/*
Returns:
ON_UNSET_VALUE, if x = ON_UNSET_FLOAT.
ON_UNSET_POSITIVE_VALUE, if x = ON_UNSET_POSITIVE_FLOAT.
(double)x, otherwise.
*/
ON_DECL
double ON_DoubleFromFloat(
float x
);
/*
Returns:
A nonzero runtime unsigned that is incremented every call to ON_NextContentSerialNumber().
This value is useful as a "content serial number" that can be used to detect
when the content of an object has changed.
*/
ON__UINT64 ON_NextContentSerialNumber();
ON_END_EXTERNC
#if defined(ON_CPLUSPLUS)
ON_DECL
bool ON_IsNullPtr(const void* ptr);
ON_DECL
bool ON_IsNullPtr(const ON__UINT_PTR ptr);
ON_DECL
bool ON_IsNullPtr(const ON__INT_PTR ptr);
#endif
/*
// In cases where lazy evaluation of a color value is
// performed, this value is used to indicate the value
// has not been computed.
*/
#define ON_UNSET_COLOR 0xFFFFFFFF
/*
// In cases when an absolute "zero" tolerance
// is required to compare model space coordinates,
// ON_ZERO_TOLERANCE is used. The value of
// ON_ZERO_TOLERANCE should be no smaller than
// ON_EPSILON and should be several orders of
// magnitude smaller than ON_SQRT_EPSILON
//
*/
//#define ON_ZERO_TOLERANCE 1.0e-12
// ON_ZERO_TOLERANCE = 2^-32
#define ON_ZERO_TOLERANCE 2.3283064365386962890625e-10
/*
// In cases when an relative "zero" tolerance is
// required for comparing model space coordinates,
// (fabs(a)+fabs(b))*ON_RELATIVE_TOLERANCE is used.
// ON_RELATIVE_TOLERANCE should be larger than
// ON_EPSILON and smaller than no larger than
// ON_ZERO_TOLERANCE*2^-10.
//
*/
// ON_RELATIVE_TOLERANCE = 2^-42
#define ON_RELATIVE_TOLERANCE 2.27373675443232059478759765625e-13
/*
// Bugs in geometry calculations involving world coordinates
// values > ON_MAXIMUM_WORLD_COORDINATE_VALUE
// will be a low priority.
*/
// ON_MAXIMUM_VALUE = 2^27
#define ON_MAXIMUM_WORLD_COORDINATE_VALUE 1.34217728e8
/*
// Any 3d coordinate value >= ON_NONSENSE_WORLD_COORDINATE_VALUE
// will be adjusted as needed. Any calculation creating 3d coordinates
// with values >= ON_NONSENSE_WORLD_COORDINATE_VALUE should be
// inspected for bugs.
*/
// ON_NONSENSE_WORLD_COORDINATE_VALUE = 1.0e100
#define ON_NONSENSE_WORLD_COORDINATE_VALUE 1.0e100
/*
// The default test for deciding if a curvature value should be
// treated as zero is
// length(curvature) <= ON_ZERO_CURVATURE_TOLERANCE.
// ON_ZERO_CURVATURE_TOLERANCE must be set so that
// ON_ZERO_CURVATURE_TOLERANCE >= sqrt(3)*ON_ZERO_TOLERANCE
// so that K.IsTiny() = true implies |K| <= ON_ZERO_CURVATURE_TOLERANCE
*/
#define ON_ZERO_CURVATURE_TOLERANCE 1.0e-8
#define ON_RELATIVE_CURVATURE_TOLERANCE 0.05
/* default value for angle tolerances = 1 degree */
#define ON_DEFAULT_ANGLE_TOLERANCE_RADIANS (ON_PI/180.0)
#define ON_DEFAULT_ANGLE_TOLERANCE_DEGREES (ON_DEFAULT_ANGLE_TOLERANCE_RADIANS * 180.0/ON_PI)
#define ON_DEFAULT_ANGLE_TOLERANCE ON_DEFAULT_ANGLE_TOLERANCE_RADIANS
#define ON_DEFAULT_ANGLE_TOLERANCE_COSINE 0.99984769515639123915701155881391
#define ON_MINIMUM_ANGLE_TOLERANCE (ON_DEFAULT_ANGLE_TOLERANCE/10.0)
#define ON_DEFAULT_DISTANCE_TOLERANCE_MM 0.01
/*
*/
ON_DECL
ON__UINT64 ON_SecondsSinceJanOne1970UTC();
union ON_U
{
char b[8]; // 8 bytes
ON__INT64 h; // 64 bit integer
ON__INT32 i; // 32 bit integer
int j[2]; // two 32 bit integers
void* p;
double d;
};
#if defined(ON_CPLUSPLUS)
// pair of integer indices. This
// is intentionally a struct/typedef
// rather than a class so that it
// can be used in other structs.
class ON_CLASS ON_2dex
{
public:
ON_2dex() = default;
~ON_2dex() = default;
ON_2dex(const ON_2dex&) = default;
ON_2dex& operator=(const ON_2dex&) = default;
public:
// do not initialize i, j for performance reasons
int i;
int j;
ON_2dex(int i, int j);
static const ON_2dex Unset; // (ON_UNSET_INT_INDEX, ON_UNSET_INT_INDEX);
static const ON_2dex Zero; // (0, 0)
};
class ON_CLASS ON_2udex
{
public:
ON_2udex() = default;
~ON_2udex() = default;
ON_2udex(const ON_2udex&) = default;
ON_2udex& operator=(const ON_2udex&) = default;
public:
// do not initialize i, j for performance reasons
unsigned int i;
unsigned int j;
ON_2udex(unsigned int i, unsigned int j);
static int DictionaryCompare(
const ON_2udex* lhs,
const ON_2udex* rhs
);
static int CompareFirstIndex(
const ON_2udex* lhs,
const ON_2udex* rhs
);
static int CompareSecondIndex(
const ON_2udex* lhs,
const ON_2udex* rhs
);
static const ON_2udex Unset; // (ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX);
static const ON_2udex Zero; // (0, 0)
};
class ON_CLASS ON_3dex
{
public:
ON_3dex() = default;
~ON_3dex() = default;
ON_3dex(const ON_3dex&) = default;
ON_3dex& operator=(const ON_3dex&) = default;
public:
// do not initialize i, j, k for performance reasons
int i;
int j;
int k;
ON_3dex(int i, int j, int k);
static const ON_3dex Unset; // (ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX);
static const ON_3dex Zero; // (0, 0, 0)
};
class ON_CLASS ON_3udex
{
public:
ON_3udex() = default;
~ON_3udex() = default;
ON_3udex(const ON_3udex&) = default;
ON_3udex& operator=(const ON_3udex&) = default;
public:
// do not initialize i, j, k for performance reasons
unsigned int i;
unsigned int j;
unsigned int k;
ON_3udex(unsigned int i, unsigned int j, unsigned int k);
static const ON_3udex Unset; // (ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX);
static const ON_3udex Zero; // (0, 0, 0)
static int DictionaryCompare(
const ON_3udex* lhs,
const ON_3udex* rhs
);
static int CompareFirstIndex(
const ON_3udex* lhs,
const ON_3udex* rhs
);
static int CompareSecondIndex(
const ON_3udex* lhs,
const ON_3udex* rhs
);
static int CompareThirdIndex(
const ON_3udex* lhs,
const ON_3udex* rhs
);
static int CompareFirstAndSecondIndex(
const ON_3udex* lhs,
const ON_3udex* rhs
);
};
// quadruplet of integer indices.
class ON_CLASS ON_4dex
{
public:
ON_4dex() = default;
~ON_4dex() = default;
ON_4dex(const ON_4dex&) = default;
ON_4dex& operator=(const ON_4dex&) = default;
int operator[](int i) const;
int& operator[](int i);
public:
// do not initialize i, j, k, l for performance reasons
int i;
int j;
int k;
int l;
ON_4dex(int i, int j, int k, int l);
static const ON_4dex Unset; // (ON_UNSET_INT_INDEX, ON_UNSET_INT_INDEX, ON_UNSET_INT_INDEX, ON_UNSET_INT_INDEX);
static const ON_4dex Zero; // (0, 0, 0, 0)
};
class ON_CLASS ON_4udex
{
public:
ON_4udex() = default;
~ON_4udex() = default;
ON_4udex(const ON_4udex&) = default;
ON_4udex& operator=(const ON_4udex&) = default;
public:
// do not initialize i, j, k, l for performance reasons
unsigned int i;
unsigned int j;
unsigned int k;
unsigned int l;
ON_4udex(unsigned int i, unsigned int j, unsigned int k, unsigned int l);
static const ON_4udex Unset; // (ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX);
static const ON_4udex Zero; // (0, 0, 0, 0)
};
enum class ON_StringMapType : int
{
Identity = 0,
UpperCase = 1,
LowerCase = 2
};
enum class ON_StringMapOrdinalType : int
{
Identity = 0,
UpperOrdinal = 1,
LowerOrdinal = 2,
MinimumOrdinal = 3
};
enum class ON_DateFormat : int
{
Unset = 0,
Omit = 1,
///<summary>
/// February 1st, 2001 = 2001-2-1
///</summary>
YearMonthDay = 2,
///<summary>
/// February 1st, 2001 = 2001-1-2
///</summary>
YearDayMonth = 3,
///<summary>
/// February 1st, 2001 = 2-1-2001
///</summary>
MonthDayYear = 4,
///<summary>
/// February 1st, 2001 = 1-2-2001
///</summary>
DayMonthYear = 5,
///<summary>
/// February 1st, 2001 = 2001-32
///</summary>
YearDayOfYear = 6
};
enum class ON_TimeFormat : int
{
Unset = 0,
Omit = 1,
HourMinute12 = 2,
HourMinuteSecond12 = 3,
HourMinute24 = 4,
HourMinuteSecond24 = 5
};
ON_DECL
ON_StringMapOrdinalType ON_StringMapOrdinalTypeFromStringMapType(
ON_StringMapType map_type
);
///<summary>
/// ON_ChainDirection is used to specify directions when building
/// chains of components like edges or faces.
///</summary>
enum class ON_ChainDirection : unsigned char
{
Unset = 0,
///<summary>
/// Search for chain links before the current link.
///</summary>
Previous = 1,
///<summary>
/// Search for chain links after the current link.
///</summary>
Next = 2,
///<summary>
/// Search for chain links before and after the current link.
///</summary>
Both = 3
};
///<summary>
///Style of color gradient
///</summary>
enum class ON_GradientType : int
{
///<summary>No gradient</summary>
None = 0,
///<summary>Linear (or axial) gradient between two points</summary>
Linear = 1,
///<summary>Radial (or spherical) gradient using a center point and a radius</summary>
Radial = 2,
///<summary>Disabled linear gradient. Useful for keeping gradient information around, but not having it displayed</summary>
LinearDisabled = 3,
///<summary>Disabled radial gradient. Useful for keeping gradient information around, but not having it displayed</summary>
RadialDisabled = 4
};
// OpenNurbs enums
class ON_CLASS ON
{
public:
/*
Description:
Call before using openNURBS to ensure all class definitions
are linked.
*/
static void Begin();
/*
Description:
Call when finished with openNURBS.
Remarks:
Currently does nothing.
*/
static void End();
/*
Returns:
0: not initialized
1: in the body of ON:Begin()
2: ON::Begin() has finished.
*/
static unsigned int LibraryStatus();
/*
Set the library status
*/
static void SetLibraryStatus(unsigned int status);
/*
Returns:
The value of OPENNURBS_VERSION_NUMBER, which is defined in opennurbs_version.h.
Remarks:
The high bit of this number is set. Do not cast the result as an int.
*/
static
unsigned int Version();
/*
Returns:
The value of OPENNURBS_VERSION_MAJOR, which is defined in opennurbs_version.h
(0 to 63).
*/
static
unsigned int VersionMajor();
/*
Returns:
63 = maximum major version number that opennurbs version number utilities can handle.
*/
static
unsigned int VersionMajorMaximum();
/*
Returns:
The value of OPENNURBS_VERSION_MINOR, which is defined in opennurbs_version.h
(0 to 127).
*/
static
unsigned int VersionMinor();
/*
Returns:
127 = maximum minor version number that opennurbs version number utilities can handle.
*/
static
unsigned int VersionMinorMaximum();
/*
Returns:
The value of OPENNURBS_VERSION_YEAR, which is defined in opennurbs_version.h
> 2014.
*/
static
unsigned int VersionYear();
/*
Returns:
The value of OPENNURBS_VERSION_MONTH, which is defined in opennurbs_version.h
1 to 12.
*/
static
unsigned int VersionMonth();
/*
Returns:
The value of OPENNURBS_VERSION_DAY_OF_MONTH, which is defined in opennurbs_version.h
(1 to 31).
*/
static
unsigned int VersionDayOfMonth();
/*
Returns:
The value of OPENNURBS_VERSION_HOUR, which is defined in opennurbs_version.h
(0 to 23).
*/
static
unsigned int VersionHour();
/*
Returns:
The value of OPENNURBS_VERSION_MINUTE, which is defined in opennurbs_version.h
(0 to 59).
*/
static
unsigned int VersionMinute();
/*
Returns:
The value of OPENNURBS_VERSION_BRANCH, which is defined in opennurbs_version.h
0: developer build
1: Windows Commercial build
2: Mac Commercial build
3: Windows BETA build
4: Mac Beta build
5: Windows WIP build
6: Mac WIP build
*/
static
unsigned int VersionBranch();
/*
Description:
Get the opennurbs version number as a quartet of values.
Parameters:
version_quartet - [out]
version_quartet[0] = ON::VersionMajor()
version_quartet[1] = ON::VersionMinor()
version_quartet[2] = (year - 2000)*1000 + day_of_year
version_quartet[3] = (hour*1000 + minute*10 + OPENNURBS_VERSION_BRANCH)
Returns:
The value of OPENNURBS_VERSION_NUMBER, which is defined in opennurbs_version.h.
Remarks:
The high bit of the returned value is set. Do not cast the result as an int.
*/
static
unsigned int VersionGetQuartet(
unsigned int version_quartet[4]
);
/*
Returns:
The value of OPENNURBS_VERSION_QUARTET_STRING, which is defined in opennurbs_version.h.
Remarks:
The high bit of this number is set. Do not cast the result as an int.
*/
static
const char* VersionQuartetAsString();
/*
Returns:
The value of OPENNURBS_VERSION_QUARTET_WSTRING, which is defined in opennurbs_version.h.
Remarks:
The high bit of this number is set. Do not cast the result as an int.
*/
static
const wchar_t* VersionQuartetAsWideString();
/*
Returns:
Empty string or the git hash of the revison of the source code used to build this application.
The git hash is a hexadecimal number represented in UTF-8 string.
Remarks:
Developer builds return "".
Build system builds return the git revsion hash.
*/
static const char* SourceGitRevisionHash();
/*
Returns:
Empty string or the name of the git branch containing the source code used to build this application.
Remarks:
Developer builds return "".
Build system builds return the git branch name or "".
*/
static const char* SourceGitBranchName();
/*
Returns:
A string that identifies the McNeel version control system source code to build this application.
Remarks:
Developer builds return "".
Build system builds return the git <branch name> @ <git revision hash> or "".
*/
static const char* SourceIdentification();
//// File open/close for DLL use ///////////////////////////////////////////////
static
FILE* OpenFile( // like fopen() - needed when OpenNURBS is used as a DLL
const char* filename,
const char* filemode
);
static
FILE* OpenFile( // like fopen() - needed when OpenNURBS is used as a DLL
const wchar_t* filename,
const wchar_t* filemode
);
static
int CloseFile( // like fclose() - needed when OpenNURBS is used as a DLL
FILE* // pointer returned by OpenFile()
);
static
int CloseAllFiles(); // like _fcloseall() - needed when OpenNURBS is used as a DLL
/*
Description:
Uses the flavor of fstat that is appropriate for the platform.
Parameters:
filename - [in]
fp - [in]
filesize - [out] (can be nullptr if you do not want filesize)
create_time - [out] (can be nullptr if you do not want last create time)
lastmodify_time - [out] (can be nullptr if you do not want last modification time)
Returns:
True if file exists, can be opened for read, and fstat worked.
*/
static
bool GetFileStats( const wchar_t* filename,
size_t* filesize,
time_t* create_time,
time_t* lastmodify_time
);
static
bool GetFileStats( FILE* fp,
size_t* filesize,
time_t* create_time,
time_t* lastmodify_time
);
/*
Returns true if pathname is a directory.
*/
static bool IsDirectory( const wchar_t* pathname );
static bool IsDirectory( const char* utf8pathname );
/*
Returns
If the file is an opennurbs file, the version of the file
is returned (2,3,4,50,...).
If the file is not an opennurbs file, 0 is returned.
*/
static int IsOpenNURBSFile( const wchar_t* pathname );
static int IsOpenNURBSFile( const char* utf8pathname );
static int IsOpenNURBSFile( FILE* fp );
#pragma region RH_C_SHARED_ENUM [ON::RuntimeEnvironment] [Rhino.RuntimeEnvironment] [byte]
/////////////////////////////////////////////////////////////////
/// <summary>
/// ON::RuntimeEnvironment identifies a runtime environment (operating system).