-
Notifications
You must be signed in to change notification settings - Fork 0
/
geometry.go
2536 lines (2031 loc) · 69.4 KB
/
geometry.go
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
package topo
/*
#include <stdlib.h>
#include "geometry_c_api.h"
#cgo CFLAGS: -I ./libs
#cgo linux CXXFLAGS: -I ./libs -std=gnu++14
#cgo darwin CXXFLAGS: -I ./libs -std=gnu++14
#cgo darwin,arm CXXFLAGS: -I ./libs -std=gnu++14
#cgo windows CXXFLAGS: -I ./libs -std=gnu++14
*/
import "C"
import "runtime"
const (
GEOMAXIS1PLACEMENT = int(C.GeomAxis1Placement)
GEOMAXIS2PLACEMENT = int(C.GeomAxis2Placement)
GEOMBSPLINECURVE = int(C.GeomBSplineCurve)
GEOMBSPLINESURFACE = int(C.GeomBSplineSurface)
GEOMBEZIERCURVE = int(C.GeomBezierCurve)
GEOMBEZIERSURFACE = int(C.GeomBezierSurface)
GEOMCARTESIANPOINT = int(C.GeomCartesianPoint)
GEOMCIRCLE = int(C.GeomCircle)
GEOMCONICALSURFACE = int(C.GeomConicalSurface)
GEOMCYLINDRICALSURFACE = int(C.GeomCylindricalSurface)
GEOMDIRECTION = int(C.GeomDirection)
GEOMELEMENTARYSURFACE = int(C.GeomElementarySurface)
GEOMELLIPSE = int(C.GeomEllipse)
GEOMHYPERBOLA = int(C.GeomHyperbola)
GEOMLINE = int(C.GeomLine)
GEOMOFFSETCURVE = int(C.GeomOffsetCurve)
GEOMOFFSETSURFACE = int(C.GeomOffsetSurface)
GEOMPARABOLA = int(C.GeomParabola)
GEOMPLANE = int(C.GeomPlane)
GEOMRECTANGULARTRIMMEDSURFACE = int(C.GeomRectangularTrimmedSurface)
GEOMSPHERICALSURFACE = int(C.GeomSphericalSurface)
GEOMSURFACEOFLINEAREXTRUSION = int(C.GeomSurfaceOfLinearExtrusion)
GEOMSURFACEOFREVOLUTION = int(C.GeomSurfaceOfRevolution)
GEOMSWEPTSURFACE = int(C.GeomSweptSurface)
GEOMTOROIDALSURFACE = int(C.GeomToroidalSurface)
GEOMTRIMMEDCURVE = int(C.GeomTrimmedCurve)
GEOMVECTORWITHMAGNITUDE = int(C.GeomVectorWithMagnitude)
GEOMPLATESURFACE = int(C.GeomPlateSurface)
)
const (
GEOM2DBISECTORBISECANA = int(C.Geom2dBisectorBisecAna)
GEOM2DBISECTORBISECCC = int(C.Geom2dBisectorBisecCC)
GEOM2DBISECTORBISECPC = int(C.Geom2dBisectorBisecPC)
GEOM2DAXISPLACEMENT = int(C.Geom2dAxisPlacement)
GEOM2DBSPLINECURVE = int(C.Geom2dBSplineCurve)
GEOM2DBEZIERCURVE = int(C.Geom2dBezierCurve)
GEOM2DBOUNDEDCURVE = int(C.Geom2dBoundedCurve)
GEOM2DCARTESIANPOINT = int(C.Geom2dCartesianPoint)
GEOM2DCIRCLE = int(C.Geom2dCircle)
GEOM2DCONIC = int(C.Geom2dConic)
GEOM2DDIRECTION = int(C.Geom2dDirection)
GEOM2DELLIPSE = int(C.Geom2dEllipse)
GEOM2DHYPERBOLA = int(C.Geom2dHyperbola)
GEOM2DLINE = int(C.Geom2dLine)
GEOM2DOFFSETCURVE = int(C.Geom2dOffsetCurve)
GEOM2DPARABOLA = int(C.Geom2dParabola)
GEOM2DTRIMMEDCURVE = int(C.Geom2dTrimmedCurve)
GEOM2DVECTORWITHMAGNITUDE = int(C.Geom2dVectorWithMagnitude)
GEOM2DBISECTORCURVE = int(C.Geom2dBisectorCurve)
)
type GeomGeometry struct {
inner *innerGeomGeometry
}
type innerGeomGeometry struct {
geom *C.struct__geom_geometry_t
}
func NewGeomGeometry(geom *C.struct__geom_geometry_t) *GeomGeometry {
g := &GeomGeometry{inner: &innerGeomGeometry{geom: geom}}
runtime.SetFinalizer(g.inner, (*innerGeomGeometry).free)
return g
}
func (g *innerGeomGeometry) free() {
C.geom_geometry_free(g.geom)
g.geom = nil
}
func (g *GeomGeometry) Type() int {
return int(C.geom_geometry_type(g.inner.geom))
}
func (g *GeomGeometry) Copy() *GeomGeometry {
return NewGeomGeometry(C.geom_geometry_copy(g.inner.geom))
}
func (g *GeomGeometry) MirrorWithPoint(p Point3) {
C.geom_apply_mirror_with_point(g.inner.geom, p.val)
}
func (g *GeomGeometry) MirrorWithAxis1(a Axis1) {
C.geom_apply_mirror_with_axis1(g.inner.geom, a.val)
}
func (g *GeomGeometry) MirrorWithAxis2(a Axis2) {
C.geom_apply_mirror_with_axis2(g.inner.geom, a.val)
}
func (g *GeomGeometry) Rotate(a Axis1, ang float64) {
C.geom_apply_rotate(g.inner.geom, a.val, C.double(ang))
}
func (g *GeomGeometry) Scale(p Point3, ang float64) {
C.geom_apply_scale(g.inner.geom, p.val, C.double(ang))
}
func (g *GeomGeometry) TranslateWithVector(v Vector3) {
C.geom_apply_translate_with_vector(g.inner.geom, v.val)
}
func (g *GeomGeometry) TranslateWithPoint(p1, p2 Point3) {
C.geom_apply_translate_with_point(g.inner.geom, p1.val, p2.val)
}
func (g *GeomGeometry) Transform(t Trsf) {
C.geom_apply_transform(g.inner.geom, t.val)
}
func (g *GeomGeometry) MirroredWithPoint(p Point3) *GeomGeometry {
return NewGeomGeometry(C.geom_mirror_with_point(g.inner.geom, p.val))
}
func (g *GeomGeometry) MirroredWithAxis1(a Axis1) *GeomGeometry {
return NewGeomGeometry(C.geom_mirror_with_axis1(g.inner.geom, a.val))
}
func (g *GeomGeometry) MirroredWithAxis2(a Axis2) *GeomGeometry {
return NewGeomGeometry(C.geom_mirror_with_axis2(g.inner.geom, a.val))
}
func (g *GeomGeometry) Rotated(a Axis1, ang float64) *GeomGeometry {
return NewGeomGeometry(C.geom_rotate(g.inner.geom, a.val, C.double(ang)))
}
func (g *GeomGeometry) Scaled(p Point3, ang float64) *GeomGeometry {
return NewGeomGeometry(C.geom_scale(g.inner.geom, p.val, C.double(ang)))
}
func (g *GeomGeometry) TranslatedWithVector(v Vector3) *GeomGeometry {
return NewGeomGeometry(C.geom_translate_with_vector(g.inner.geom, v.val))
}
func (g *GeomGeometry) TranslatedWithPoint(p1, p2 Point3) *GeomGeometry {
return NewGeomGeometry(C.geom_translate_with_point(g.inner.geom, p1.val, p2.val))
}
func (g *GeomGeometry) Transformed(t Trsf) *GeomGeometry {
return NewGeomGeometry(C.geom_transform(g.inner.geom, t.val))
}
func (g *GeomGeometry) AutoCast() interface{} {
switch g.Type() {
case GEOMAXIS1PLACEMENT:
return NewGeomAxis1PlacementFromGeometry(g)
case GEOMAXIS2PLACEMENT:
return NewGeomAxis2PlacementFromGeometry(g)
case GEOMBSPLINECURVE:
return NewGeomBSplineCurveFromGeometry(g)
case GEOMBSPLINESURFACE:
return NewGeomBSplineSurfaceFromGeometry(g)
case GEOMBEZIERCURVE:
return NewGeomBezierCurveFromGeometry(g)
case GEOMBEZIERSURFACE:
return NewGeomBezierSurfaceFromGeometry(g)
case GEOMCARTESIANPOINT:
return NewGeomCartesianPointFromGeometry(g)
case GEOMCIRCLE:
return NewGeomCircleFromGeometry(g)
case GEOMCONICALSURFACE:
return NewGeomConicalSurfaceFromGeometry(g)
case GEOMCYLINDRICALSURFACE:
return NewGeomCylindricalSurfaceFromGeometry(g)
case GEOMDIRECTION:
return NewGeomDirectionFromGeometry(g)
case GEOMELEMENTARYSURFACE:
return NewGeomElementarySurfaceFromGeometry(g)
case GEOMELLIPSE:
return NewGeomEllipseFromGeometry(g)
case GEOMHYPERBOLA:
return NewGeomHyperbolaFromGeometry(g)
case GEOMLINE:
return NewGeomLineFromGeometry(g)
case GEOMOFFSETCURVE:
return NewGeomOffsetCurveFromGeometry(g)
case GEOMOFFSETSURFACE:
return NewGeomOffsetSurfaceFromGeometry(g)
case GEOMPARABOLA:
return NewGeomParabolaFromGeometry(g)
case GEOMPLANE:
return NewGeomPlaneFromGeometry(g)
case GEOMRECTANGULARTRIMMEDSURFACE:
return NewGeomRectangularTrimmedSurfaceFromGeometry(g)
case GEOMSPHERICALSURFACE:
return NewGeomSphericalSurfaceFromGeometry(g)
case GEOMSURFACEOFLINEAREXTRUSION:
return NewGeomSurfaceOfLinearExtrusionFromGeometry(g)
case GEOMSURFACEOFREVOLUTION:
return NewGeomSurfaceOfRevolutionFromGeometry(g)
case GEOMSWEPTSURFACE:
return NewGeomSweptSurfaceFromGeometry(g)
case GEOMTOROIDALSURFACE:
return NewGeomToroidalSurfaceFromGeometry(g)
case GEOMTRIMMEDCURVE:
return NewGeomTrimmedCurveFromGeometry(g)
case GEOMVECTORWITHMAGNITUDE:
return NewGeomVectorWithMagnitudeFromGeometry(g)
case GEOMPLATESURFACE:
return NewGeomPlateSurfaceFromGeometry(g)
}
return nil
}
type GeomTransformation struct {
inner *innerGeomTransformation
}
type innerGeomTransformation struct {
geom *C.struct__geom_transformation_t
}
func NewGeomTransformation(geom *C.struct__geom_transformation_t) *GeomTransformation {
g := &GeomTransformation{inner: &innerGeomTransformation{geom: geom}}
runtime.SetFinalizer(g.inner, (*innerGeomTransformation).free)
return g
}
func (g *innerGeomTransformation) free() {
C.geom_transformation_free(g.geom)
g.geom = nil
}
func (g *GeomTransformation) Copy() *GeomTransformation {
return NewGeomTransformation(C.geom_transformation_copy(g.inner.geom))
}
type GeomAxisPlacement struct {
inner *innerGeomAxisPlacement
}
type innerGeomAxisPlacement struct {
geom *C.struct__geom_axis_placement_t
}
func NewGeomAxisPlacement(geom *C.struct__geom_axis_placement_t) *GeomAxisPlacement {
g := &GeomAxisPlacement{inner: &innerGeomAxisPlacement{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomAxisPlacement).free)
return g
}
func (g *GeomAxisPlacement) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_axis_placement_to_geometry(g.inner.geom))
}
func (g *innerGeomAxisPlacement) free() {
C.geom_axis_placement_free(g.geom)
g.geom = nil
}
func (g *GeomAxisPlacement) Copy() *GeomAxisPlacement {
return NewGeomAxisPlacement(C.geom_axis_placement_copy(g.inner.geom))
}
func NewGeomAxisPlacementFromGeometry(g *GeomGeometry) *GeomAxisPlacement {
if p := C.geom_axis_placement_from_geometry(g.inner.geom); p != nil {
return NewGeomAxisPlacement(p)
}
return nil
}
type GeomAxis1Placement struct {
inner *innerGeomAxis1Placement
}
type innerGeomAxis1Placement struct {
geom *C.struct__geom_axis1_placement_t
}
func NewGeomAxis1Placement(geom *C.struct__geom_axis1_placement_t) *GeomAxis1Placement {
g := &GeomAxis1Placement{inner: &innerGeomAxis1Placement{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomAxis1Placement).free)
return g
}
func (g *GeomAxis1Placement) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_axis1_placement_to_geometry(g.inner.geom))
}
func (g *innerGeomAxis1Placement) free() {
C.geom_axis1_placement_free(g.geom)
g.geom = nil
}
func (g *GeomAxis1Placement) Copy() *GeomAxis1Placement {
return NewGeomAxis1Placement(C.geom_axis1_placement_copy(g.inner.geom))
}
func NewGeomAxis1PlacementFromGeometry(g *GeomGeometry) *GeomAxis1Placement {
if p := C.geom_axis1_placement_from_geometry(g.inner.geom); p != nil {
return NewGeomAxis1Placement(p)
}
return nil
}
type GeomAxis2Placement struct {
inner *innerGeomAxis2Placement
}
type innerGeomAxis2Placement struct {
geom *C.struct__geom_axis2_placement_t
}
func NewGeomAxis2Placement(geom *C.struct__geom_axis2_placement_t) *GeomAxis2Placement {
g := &GeomAxis2Placement{inner: &innerGeomAxis2Placement{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomAxis2Placement).free)
return g
}
func (g *GeomAxis2Placement) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_axis2_placement_to_geometry(g.inner.geom))
}
func (g *innerGeomAxis2Placement) free() {
C.geom_axis2_placement_free(g.geom)
g.geom = nil
}
func (g *GeomAxis2Placement) Copy() *GeomAxis2Placement {
return NewGeomAxis2Placement(C.geom_axis2_placement_copy(g.inner.geom))
}
func NewGeomAxis2PlacementFromGeometry(g *GeomGeometry) *GeomAxis2Placement {
if p := C.geom_axis2_placement_from_geometry(g.inner.geom); p != nil {
return NewGeomAxis2Placement(p)
}
return nil
}
type GeomCurve struct {
inner *innerGeomCurve
}
type innerGeomCurve struct {
geom *C.struct__geom_curve_t
}
func NewGeomCurve(geom *C.struct__geom_curve_t) *GeomCurve {
g := &GeomCurve{inner: &innerGeomCurve{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomCurve).free)
return g
}
func (g *GeomCurve) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_curve_to_geometry(g.inner.geom))
}
func (g *innerGeomCurve) free() {
C.geom_curve_free(g.geom)
g.geom = nil
}
func (g *GeomCurve) Copy() *GeomCurve {
return NewGeomCurve(C.geom_curve_copy(g.inner.geom))
}
func NewGeomCurveFromGeometry(g *GeomGeometry) *GeomCurve {
if p := C.geom_curve_from_geometry(g.inner.geom); p != nil {
return NewGeomCurve(p)
}
return nil
}
type GeomBoundedCurve struct {
inner *innerGeomBoundedCurve
}
type innerGeomBoundedCurve struct {
geom *C.struct__geom_bounded_curve_t
}
func NewGeomBoundedCurve(geom *C.struct__geom_bounded_curve_t) *GeomBoundedCurve {
g := &GeomBoundedCurve{inner: &innerGeomBoundedCurve{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomBoundedCurve).free)
return g
}
func (g *GeomBoundedCurve) Curve() *GeomCurve {
return NewGeomCurve(C.geom_bounded_curve_to_geom_curve(g.inner.geom))
}
func (g *GeomBoundedCurve) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_bounded_curve_to_geometry(g.inner.geom))
}
func (g *innerGeomBoundedCurve) free() {
C.geom_bounded_curve_free(g.geom)
g.geom = nil
}
func (g *GeomBoundedCurve) Copy() *GeomBoundedCurve {
return NewGeomBoundedCurve(C.geom_bounded_curve_copy(g.inner.geom))
}
func NewGeomBoundedCurveFromGeometry(g *GeomGeometry) *GeomBoundedCurve {
if p := C.geom_bounded_curve_from_geometry(g.inner.geom); p != nil {
return NewGeomBoundedCurve(p)
}
return nil
}
type GeomBezierCurve struct {
inner *innerGeomBezierCurve
}
type innerGeomBezierCurve struct {
geom *C.struct__geom_bezier_curve_t
}
func NewGeomBezierCurve(geom *C.struct__geom_bezier_curve_t) *GeomBezierCurve {
g := &GeomBezierCurve{inner: &innerGeomBezierCurve{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomBezierCurve).free)
return g
}
func (g *GeomBezierCurve) Curve() *GeomCurve {
return NewGeomCurve(C.geom_bezier_curve_to_geom_curve(g.inner.geom))
}
func (g *GeomBezierCurve) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_bezier_curve_to_geometry(g.inner.geom))
}
func (g *innerGeomBezierCurve) free() {
C.geom_bezier_curve_free(g.geom)
g.geom = nil
}
func (g *GeomBezierCurve) Copy() *GeomBezierCurve {
return NewGeomBezierCurve(C.geom_bezier_curve_copy(g.inner.geom))
}
func NewGeomBezierCurveFromGeometry(g *GeomGeometry) *GeomBezierCurve {
if p := C.geom_bezier_curve_from_geometry(g.inner.geom); p != nil {
return NewGeomBezierCurve(p)
}
return nil
}
type GeomBSplineCurve struct {
inner *innerGeomBSplineCurve
}
type innerGeomBSplineCurve struct {
geom *C.struct__geom_bspline_curve_t
}
func NewGeomBSplineCurve(geom *C.struct__geom_bspline_curve_t) *GeomBSplineCurve {
g := &GeomBSplineCurve{inner: &innerGeomBSplineCurve{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomBSplineCurve).free)
return g
}
func (g *GeomBSplineCurve) Curve() *GeomCurve {
return NewGeomCurve(C.geom_bspline_curve_to_geom_curve(g.inner.geom))
}
func (g *GeomBSplineCurve) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_bspline_curve_to_geometry(g.inner.geom))
}
func (g *innerGeomBSplineCurve) free() {
C.geom_bspline_curve_free(g.geom)
g.geom = nil
}
func (g *GeomBSplineCurve) Copy() *GeomBSplineCurve {
return NewGeomBSplineCurve(C.geom_bspline_curve_copy(g.inner.geom))
}
func NewGeomBSplineCurveFromGeometry(g *GeomGeometry) *GeomBSplineCurve {
if p := C.geom_bspline_curve_from_geometry(g.inner.geom); p != nil {
return NewGeomBSplineCurve(p)
}
return nil
}
func NewGeomBSplineCurveFromPoints(pts []Point3) *GeomBSplineCurve {
ptr := &pts[0].val
if p := C.geom_bspline_curve_from_points(ptr, C.int(len(pts))); p != nil {
return NewGeomBSplineCurve(p)
}
return nil
}
type GeomTrimmedCurve struct {
inner *innerGeomTrimmedCurve
}
type innerGeomTrimmedCurve struct {
geom *C.struct__geom_trimmed_curve_t
}
func NewGeomTrimmedCurve(geom *C.struct__geom_trimmed_curve_t) *GeomTrimmedCurve {
g := &GeomTrimmedCurve{inner: &innerGeomTrimmedCurve{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomTrimmedCurve).free)
return g
}
func (g *GeomTrimmedCurve) Curve() *GeomCurve {
return NewGeomCurve(C.geom_trimmed_curve_to_geom_curve(g.inner.geom))
}
func (g *GeomTrimmedCurve) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_trimmed_curve_to_geometry(g.inner.geom))
}
func (g *innerGeomTrimmedCurve) free() {
C.geom_trimmed_curve_free(g.geom)
g.geom = nil
}
func (g *GeomTrimmedCurve) Copy() *GeomTrimmedCurve {
return NewGeomTrimmedCurve(C.geom_trimmed_curve_copy(g.inner.geom))
}
func NewGeomTrimmedCurveFromGeometry(g *GeomGeometry) *GeomTrimmedCurve {
if p := C.geom_trimmed_curve_from_geometry(g.inner.geom); p != nil {
return NewGeomTrimmedCurve(p)
}
return nil
}
type GeomConic struct {
inner *innerGeomConic
}
type innerGeomConic struct {
geom *C.struct__geom_conic_t
}
func NewGeomConic(geom *C.struct__geom_conic_t) *GeomConic {
g := &GeomConic{inner: &innerGeomConic{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomConic).free)
return g
}
func (g *GeomConic) Curve() *GeomCurve {
return NewGeomCurve(C.geom_conic_to_geom_curve(g.inner.geom))
}
func (g *GeomConic) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_conic_to_geometry(g.inner.geom))
}
func (g *innerGeomConic) free() {
C.geom_conic_free(g.geom)
g.geom = nil
}
func (g *GeomConic) Copy() *GeomConic {
return NewGeomConic(C.geom_conic_copy(g.inner.geom))
}
func NewGeomConicFromGeometry(g *GeomGeometry) *GeomConic {
if p := C.geom_conic_from_geometry(g.inner.geom); p != nil {
return NewGeomConic(p)
}
return nil
}
type GeomCircle struct {
inner *innerGeomCircle
}
type innerGeomCircle struct {
geom *C.struct__geom_circle_t
}
func NewGeomCircle(geom *C.struct__geom_circle_t) *GeomCircle {
g := &GeomCircle{inner: &innerGeomCircle{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomCircle).free)
return g
}
func (g *GeomCircle) Curve() *GeomCurve {
return NewGeomCurve(C.geom_circle_to_geom_curve(g.inner.geom))
}
func (g *GeomCircle) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_circle_to_geometry(g.inner.geom))
}
func (g *innerGeomCircle) free() {
C.geom_circle_free(g.geom)
g.geom = nil
}
func (g *GeomCircle) Copy() *GeomCircle {
return NewGeomCircle(C.geom_circle_copy(g.inner.geom))
}
func NewGeomCircleFromGeometry(g *GeomGeometry) *GeomCircle {
if p := C.geom_circle_from_geometry(g.inner.geom); p != nil {
return NewGeomCircle(p)
}
return nil
}
type GeomEllipse struct {
inner *innerGeomEllipse
}
type innerGeomEllipse struct {
geom *C.struct__geom_ellipse_t
}
func NewGeomEllipse(geom *C.struct__geom_ellipse_t) *GeomEllipse {
g := &GeomEllipse{inner: &innerGeomEllipse{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomEllipse).free)
return g
}
func (g *GeomEllipse) Curve() *GeomCurve {
return NewGeomCurve(C.geom_ellipse_to_geom_curve(g.inner.geom))
}
func (g *GeomEllipse) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_ellipse_to_geometry(g.inner.geom))
}
func (g *innerGeomEllipse) free() {
C.geom_ellipse_free(g.geom)
g.geom = nil
}
func (g *GeomEllipse) Copy() *GeomEllipse {
return NewGeomEllipse(C.geom_ellipse_copy(g.inner.geom))
}
func NewGeomEllipseFromGeometry(g *GeomGeometry) *GeomEllipse {
if p := C.geom_ellipse_from_geometry(g.inner.geom); p != nil {
return NewGeomEllipse(p)
}
return nil
}
type GeomHyperbola struct {
inner *innerGeomHyperbola
}
type innerGeomHyperbola struct {
geom *C.struct__geom_hyperbola_t
}
func NewGeomHyperbola(geom *C.struct__geom_hyperbola_t) *GeomHyperbola {
g := &GeomHyperbola{inner: &innerGeomHyperbola{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomHyperbola).free)
return g
}
func (g *GeomHyperbola) Curve() *GeomCurve {
return NewGeomCurve(C.geom_hyperbola_to_geom_curve(g.inner.geom))
}
func (g *GeomHyperbola) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_hyperbola_to_geometry(g.inner.geom))
}
func (g *innerGeomHyperbola) free() {
C.geom_hyperbola_free(g.geom)
g.geom = nil
}
func (g *GeomHyperbola) Copy() *GeomHyperbola {
return NewGeomHyperbola(C.geom_hyperbola_copy(g.inner.geom))
}
func NewGeomHyperbolaFromGeometry(g *GeomGeometry) *GeomHyperbola {
if p := C.geom_hyperbola_from_geometry(g.inner.geom); p != nil {
return NewGeomHyperbola(p)
}
return nil
}
type GeomParabola struct {
inner *innerGeomParabola
}
type innerGeomParabola struct {
geom *C.struct__geom_parabola_t
}
func NewGeomParabola(geom *C.struct__geom_parabola_t) *GeomParabola {
g := &GeomParabola{inner: &innerGeomParabola{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomParabola).free)
return g
}
func (g *GeomParabola) Curve() *GeomCurve {
return NewGeomCurve(C.geom_parabola_to_geom_curve(g.inner.geom))
}
func (g *GeomParabola) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_parabola_to_geometry(g.inner.geom))
}
func (g *innerGeomParabola) free() {
C.geom_parabola_free(g.geom)
g.geom = nil
}
func (g *GeomParabola) Copy() *GeomParabola {
return NewGeomParabola(C.geom_parabola_copy(g.inner.geom))
}
func NewGeomParabolaFromGeometry(g *GeomGeometry) *GeomParabola {
if p := C.geom_parabola_from_geometry(g.inner.geom); p != nil {
return NewGeomParabola(p)
}
return nil
}
type GeomLine struct {
inner *innerGeomLine
}
type innerGeomLine struct {
geom *C.struct__geom_line_t
}
func NewGeomLine(geom *C.struct__geom_line_t) *GeomLine {
g := &GeomLine{inner: &innerGeomLine{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomLine).free)
return g
}
func (g *GeomLine) Curve() *GeomCurve {
return NewGeomCurve(C.geom_line_to_geom_curve(g.inner.geom))
}
func (g *GeomLine) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_line_to_geometry(g.inner.geom))
}
func (g *innerGeomLine) free() {
C.geom_line_free(g.geom)
g.geom = nil
}
func (g *GeomLine) Copy() *GeomLine {
return NewGeomLine(C.geom_line_copy(g.inner.geom))
}
func NewGeomLineFromGeometry(g *GeomGeometry) *GeomLine {
if p := C.geom_line_from_geometry(g.inner.geom); p != nil {
return NewGeomLine(p)
}
return nil
}
type GeomOffsetCurve struct {
inner *innerGeomOffsetCurve
}
type innerGeomOffsetCurve struct {
geom *C.struct__geom_offset_curve_t
}
func NewGeomOffsetCurve(geom *C.struct__geom_offset_curve_t) *GeomOffsetCurve {
g := &GeomOffsetCurve{inner: &innerGeomOffsetCurve{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomOffsetCurve).free)
return g
}
func (g *GeomOffsetCurve) Curve() *GeomCurve {
return NewGeomCurve(C.geom_offset_curve_to_geom_curve(g.inner.geom))
}
func (g *GeomOffsetCurve) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_offset_curve_to_geometry(g.inner.geom))
}
func (g *innerGeomOffsetCurve) free() {
C.geom_offset_curve_free(g.geom)
g.geom = nil
}
func (g *GeomOffsetCurve) Copy() *GeomOffsetCurve {
return NewGeomOffsetCurve(C.geom_offset_curve_copy(g.inner.geom))
}
func NewGeomOffsetCurveFromGeometry(g *GeomGeometry) *GeomOffsetCurve {
if p := C.geom_offset_curve_from_geometry(g.inner.geom); p != nil {
return NewGeomOffsetCurve(p)
}
return nil
}
type GeomPoint struct {
inner *innerGeomPoint
}
type innerGeomPoint struct {
geom *C.struct__geom_point_t
}
func NewGeomPoint(geom *C.struct__geom_point_t) *GeomPoint {
g := &GeomPoint{inner: &innerGeomPoint{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomPoint).free)
return g
}
func (g *GeomPoint) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_point_to_geometry(g.inner.geom))
}
func (g *innerGeomPoint) free() {
C.geom_point_free(g.geom)
g.geom = nil
}
func (g *GeomPoint) Copy() *GeomPoint {
return &GeomPoint{inner: &innerGeomPoint{C.geom_point_copy(g.inner.geom)}}
}
func NewGeomPointFromGeometry(g *GeomGeometry) *GeomPoint {
if p := C.geom_point_from_geometry(g.inner.geom); p != nil {
return NewGeomPoint(p)
}
return nil
}
type GeomCartesianPoint struct {
inner *innerGeomCartesianPoint
}
type innerGeomCartesianPoint struct {
geom *C.struct__geom_cartesian_point_t
}
func NewGeomCartesianPoint(geom *C.struct__geom_cartesian_point_t) *GeomCartesianPoint {
g := &GeomCartesianPoint{inner: &innerGeomCartesianPoint{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomCartesianPoint).free)
return g
}
func (g *GeomCartesianPoint) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_cartesian_point_to_geometry(g.inner.geom))
}
func (g *innerGeomCartesianPoint) free() {
C.geom_cartesian_point_free(g.geom)
g.geom = nil
}
func (g *GeomCartesianPoint) Copy() *GeomCartesianPoint {
return NewGeomCartesianPoint(C.geom_cartesian_point_copy(g.inner.geom))
}
func NewGeomCartesianPointFromGeometry(g *GeomGeometry) *GeomCartesianPoint {
if p := C.geom_cartesian_point_from_geometry(g.inner.geom); p != nil {
return NewGeomCartesianPoint(p)
}
return nil
}
type GeomSurface struct {
inner *innerGeomSurface
}
type innerGeomSurface struct {
geom *C.struct__geom_surface_t
}
func NewGeomSurface(geom *C.struct__geom_surface_t) *GeomSurface {
g := &GeomSurface{inner: &innerGeomSurface{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomSurface).free)
return g
}
func (g *GeomSurface) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_surface_to_geometry(g.inner.geom))
}
func (g *innerGeomSurface) free() {
C.geom_surface_free(g.geom)
g.geom = nil
}
func (g *GeomSurface) Copy() *GeomSurface {
return NewGeomSurface(C.geom_surface_copy(g.inner.geom))
}
func NewGeomSurfaceFromGeometry(g *GeomGeometry) *GeomSurface {
if p := C.geom_surface_from_geometry(g.inner.geom); p != nil {
return NewGeomSurface(p)
}
return nil
}
type GeomBoundedSurface struct {
inner *innerGeomBoundedSurface
}
type innerGeomBoundedSurface struct {
geom *C.struct__geom_bounded_surface_t
}
func NewGeomBoundedSurface(geom *C.struct__geom_bounded_surface_t) *GeomBoundedSurface {
g := &GeomBoundedSurface{inner: &innerGeomBoundedSurface{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomBoundedSurface).free)
return g
}
func (g *GeomBoundedSurface) Surface() *GeomSurface {
return NewGeomSurface(C.geom_bounded_surface_to_geom_surface(g.inner.geom))
}
func (g *GeomBoundedSurface) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_bounded_surface_to_geometry(g.inner.geom))
}
func (g *innerGeomBoundedSurface) free() {
C.geom_bounded_surface_free(g.geom)
g.geom = nil
}
func (g *GeomBoundedSurface) Copy() *GeomBoundedSurface {
return NewGeomBoundedSurface(C.geom_bounded_surface_copy(g.inner.geom))
}
func NewGeomBoundedSurfaceFromGeometry(g *GeomGeometry) *GeomBoundedSurface {
if p := C.geom_bounded_surface_from_geometry(g.inner.geom); p != nil {
return NewGeomBoundedSurface(p)
}
return nil
}
type GeomBezierSurface struct {
inner *innerGeomBezierSurface
}
type innerGeomBezierSurface struct {
geom *C.struct__geom_bezier_surface_t
}
func NewGeomBezierSurface(geom *C.struct__geom_bezier_surface_t) *GeomBezierSurface {
g := &GeomBezierSurface{inner: &innerGeomBezierSurface{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomBezierSurface).free)
return g
}
func (g *GeomBezierSurface) Surface() *GeomSurface {
return NewGeomSurface(C.geom_bezier_surface_to_geom_surface(g.inner.geom))
}
func (g *GeomBezierSurface) Geometry() *GeomGeometry {
return NewGeomGeometry(C.geom_bezier_surface_to_geometry(g.inner.geom))
}
func (g *innerGeomBezierSurface) free() {
C.geom_bezier_surface_free(g.geom)
g.geom = nil
}
func (g *GeomBezierSurface) Copy() *GeomBezierSurface {
return NewGeomBezierSurface(C.geom_bezier_surface_copy(g.inner.geom))
}
func NewGeomBezierSurfaceFromGeometry(g *GeomGeometry) *GeomBezierSurface {
if p := C.geom_bezier_surface_from_geometry(g.inner.geom); p != nil {
return NewGeomBezierSurface(p)
}
return nil
}
type GeomBSplineSurface struct {
inner *innerGeomBSplineSurface
}
type innerGeomBSplineSurface struct {
geom *C.struct__geom_bspline_surface_t
}
func NewGeomBSplineSurface(geom *C.struct__geom_bspline_surface_t) *GeomBSplineSurface {
g := &GeomBSplineSurface{inner: &innerGeomBSplineSurface{geom}}
runtime.SetFinalizer(g.inner, (*innerGeomBSplineSurface).free)
return g
}
func (g *GeomBSplineSurface) Surface() *GeomSurface {
return NewGeomSurface(C.geom_bspline_surface_to_geom_surface(g.inner.geom))
}