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
|
package jogamp.opengl.glu.gl2.nurbs;
import jogamp.opengl.glu.nurbs.*;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
import java.lang.reflect.Method;
import javax.media.opengl.GL2;
import javax.media.opengl.glu.GLUnurbs;
/**
* Base object for working with NURBS curves and surfaces
*
* @author Tomas Hrasky
*
*/
public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Curve type - no type
*/
public static final int CT_NONE = 0;
/**
* Curve type - NURBS curve
*/
public static final int CT_NURBSCURVE = 1;
/**
* Curve type - picewise linear curve
*/
public static final int CT_NPWLCURVE = 2;
/**
* Matrixes autoloading
*/
private final boolean autoloadmode;
/**
* Using callback
* private final int callBackFlag;
*/
/**
* Object for error call backs
* private final Object errorCallback;
*/
/**
* List of map definitions
*/
Maplist maplist;
/**
* Indicates validity of data
*/
private int isDataValid;
/**
* Are we in the middle of curve processing
*/
private int inCurve;
/**
* Current curve
*/
private O_curve currentCurve;
/**
* Are we in trim
*/
private boolean inTrim;
/**
* Are we playbacking curve/surface rendering
*/
private boolean playBack;
/**
* Next curve in linked list
*/
private O_curve nextCurve;
/**
* Is curve modified
* private int isCurveModified;
*/
/**
* Object holding rendering settings
*/
private final Renderhints renderhints;
/**
* Display list
* private DisplayList dl;
*/
/**
* Object for subdividing curves and surfaces
*/
private final Subdivider subdivider;
/**
* Object responsible for rendering
* private Backend backend;
*/
/**
* Next picewise linear curve in linked list
* private O_pwlcurve nextPwlcurve;
*/
/**
* Next trimming NURBS curve in linked list
*/
private O_nurbscurve nextNurbscurve;
/**
* Are we in the middle of surface processing
*/
private int inSurface;
/**
* Are there any changes in trimming
* private boolean isTrimModified;
*/
/**
* Are there any changes in surface data
* private boolean isDataSurfaceModified;
*/
/**
* Nurber of trmims of processed surface
*/
private int numTrims;
/**
* Current processed surface
*/
private O_surface currentSurface;
/**
* Next trimming curve
*/
private O_trim nextTrim;
/**
* Nextr surface in linked list
* private O_nurbssurface nextNurbssurface;
*/
/**
* Are there any changes in surface
* private boolean isSurfaceModified;
*/
/**
* Initializes default GLUgl2nurbs object
*/
public GLUgl2nurbsImpl() {
// DONE
maplist = new Maplist();
renderhints = new Renderhints();
subdivider = new Subdivider();
// original code
redefineMaps();
defineMap(GL2.GL_MAP2_NORMAL, 0, 3);
defineMap(GL2.GL_MAP1_NORMAL, 0, 3);
defineMap(GL2.GL_MAP2_TEXTURE_COORD_1, 0, 1);
defineMap(GL2.GL_MAP1_TEXTURE_COORD_1, 0, 1);
defineMap(GL2.GL_MAP2_TEXTURE_COORD_2, 0, 2);
defineMap(GL2.GL_MAP1_TEXTURE_COORD_2, 0, 2);
defineMap(GL2.GL_MAP2_TEXTURE_COORD_3, 0, 3);
defineMap(GL2.GL_MAP1_TEXTURE_COORD_3, 0, 3);
defineMap(GL2.GL_MAP2_TEXTURE_COORD_4, 1, 4);
defineMap(GL2.GL_MAP1_TEXTURE_COORD_4, 1, 4);
defineMap(GL2.GL_MAP2_VERTEX_4, 1, 4);
defineMap(GL2.GL_MAP1_VERTEX_4, 1, 4);
defineMap(GL2.GL_MAP2_VERTEX_3, 0, 3);
defineMap(GL2.GL_MAP1_VERTEX_3, 0, 3);
defineMap(GL2.GL_MAP2_COLOR_4, 0, 4);
defineMap(GL2.GL_MAP1_COLOR_4, 0, 4);
defineMap(GL2.GL_MAP2_INDEX, 0, 1);
defineMap(GL2.GL_MAP1_INDEX, 0, 1);
setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD,
NurbsConsts.N_PATHLENGTH);
setnurbsproperty(GL2.GL_MAP1_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD,
NurbsConsts.N_PATHLENGTH);
setnurbsproperty(GL2.GL_MAP2_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD,
NurbsConsts.N_PATHLENGTH);
setnurbsproperty(GL2.GL_MAP2_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD,
NurbsConsts.N_PATHLENGTH);
setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_PIXEL_TOLERANCE,
(float) 50.0);
setnurbsproperty(GL2.GL_MAP1_VERTEX_4, NurbsConsts.N_PIXEL_TOLERANCE,
(float) 50.0);
setnurbsproperty(GL2.GL_MAP2_VERTEX_3, NurbsConsts.N_PIXEL_TOLERANCE,
(float) 50.0);
setnurbsproperty(GL2.GL_MAP2_VERTEX_4, NurbsConsts.N_PIXEL_TOLERANCE,
(float) 50.0);
setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_ERROR_TOLERANCE,
(float) 0.50);
setnurbsproperty(GL2.GL_MAP1_VERTEX_4, NurbsConsts.N_ERROR_TOLERANCE,
(float) 0.50);
setnurbsproperty(GL2.GL_MAP2_VERTEX_3, NurbsConsts.N_ERROR_TOLERANCE,
(float) 0.50);
setnurbsproperty(GL2.GL_MAP2_VERTEX_4, NurbsConsts.N_ERROR_TOLERANCE,
(float) 0.50);
setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_S_STEPS,
(float) 100.0);
setnurbsproperty(GL2.GL_MAP1_VERTEX_4, NurbsConsts.N_S_STEPS,
(float) 100.0);
setnurbsproperty(GL2.GL_MAP2_VERTEX_3, NurbsConsts.N_S_STEPS,
(float) 100.0);
setnurbsproperty(GL2.GL_MAP2_VERTEX_4, NurbsConsts.N_S_STEPS,
(float) 100.0);
setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD,
NurbsConsts.N_PATHLENGTH);
set_domain_distance_u_rate(100.0);
set_domain_distance_v_rate(100.0);
set_is_domain_distance_sampling(0);
this.autoloadmode = true;
// this.callBackFlag = 0;
// this.errorCallback = null;
}
/**
* Sets domain distance for dom.dist. sampling in u direction
*
* @param d
* distance
*/
private void set_domain_distance_u_rate(final double d) {
// DONE
subdivider.set_domain_distance_u_rate(d);
}
/**
* Sets domain distance for dom.dist. sampling in v direction
*
* @param d
* distance
*/
private void set_domain_distance_v_rate(final double d) {
// DONE
subdivider.set_domain_distance_v_rate(d);
}
/**
* Begins new NURBS curve
*/
public void bgncurve() {
// DONE
final O_curve o_curve = new O_curve();
thread("do_bgncurve", o_curve);
}
/**
* Calls a method with given name and passes argumet
*
* @param name
* name of a method to be called
* @param arg
* parameter to be passed to called method
*/
private void thread(final String name, final Object arg) {
// DONE
final Class<?> partype[] = new Class[1];
partype[0] = arg.getClass();
Method m;
try {
m = this.getClass().getMethod(name, partype);
/* if (dl != null) {
dl.append(this, m, arg);
} else */ {
m.invoke(this, new Object[] { arg });
}
} catch (final Throwable e) {
e.printStackTrace();
}
}
/**
* Calls a method with given name
*
* @param name
* name of a method to be called
*/
private void thread2(final String name) {
// DONE
try {
final Method m = this.getClass().getMethod(name, (Class[]) null);
/* if (dl != null) {
dl.append(this, m, null);
} else */ {
m.invoke(this, (Object[]) null);
}
} catch (final Throwable e) {
e.printStackTrace();
}
}
/**
* Begins a NURBS curve
*
* @param o_curve
* curve object
*/
public void do_bgncurve(final O_curve o_curve) {
if (inCurve > 0) {
do_nurbserror(6);
endcurve();
}
inCurve = 1;
currentCurve = o_curve;
currentCurve.curvetype = CT_NONE;
if (inTrim) {
if (!nextCurve.equals(o_curve)) {
// isCurveModified = 1;
nextCurve = o_curve;
}
} else {
if (!playBack)
bgnrender();
isDataValid = 1;
}
nextCurve = o_curve.next;
// kind of solution of union
// nextPwlcurve = o_curve.o_pwlcurve;
nextNurbscurve = o_curve.o_nurbscurve;
}
/**
* Begins new surface
*
* @param o_surface
* surface object
*/
public void do_bgnsurface(final O_surface o_surface) {
// DONE
if (inSurface > 0) {
do_nurbserror(27);
endsurface();
}
inSurface = 1;
if (!playBack)
bgnrender();
// isTrimModified = false;
// isDataSurfaceModified = false;
isDataValid = 1;
numTrims = 0;
currentSurface = o_surface;
nextTrim = o_surface.o_trim;
// nextNurbssurface = o_surface.o_nurbssurface;
}
/**
* End a curve
*/
public void endcurve() {
// DONE
thread2("do_endcurve");
}
/**
* Ends surface
*/
public void do_endsurface() {
// DONE
if (inTrim) {
do_nurbserror(12);
endtrim();
}
if (inSurface <= 0) {
do_nurbserror(13);
return;
}
inSurface = 0;
// nextNurbssurface = null;
if (isDataValid <= 0) {
return;
}
if (nextTrim != null) {
// isTrimModified = true;
nextTrim = null;
}
// TODO errval ??
if (numTrims > 0) {
// System.out.println("TODO glunurbs.do_endsurface - numtrims > 0");
}
subdivider.beginQuilts(new GL2Backend());
for (O_nurbssurface n = currentSurface.o_nurbssurface; n != null; n = n.next) {
subdivider.addQuilt(n.bezier_patches);
}
subdivider.endQuilts();
subdivider.drawSurfaces();
if (!playBack)
endrender();
}
/**
* Ends a curve
*/
public void do_endcurve() {
// DONE
// // System.out.println("do_endcurve");
if (inCurve <= 0) {
do_nurbserror(7);
return;
}
inCurve = 0;
nextCurve = null;
if (currentCurve.curvetype == CT_NURBSCURVE) {
// nextNurbscurve = null;
// currentCurve.o_nurbscurve=null;
} else {
// nextPwlcurve = null;
// currentCurve.o_pwlcurve=null;
}
if (!inTrim) {
if (isDataValid <= 0) {
return;
}
// TODO errval?
if (currentCurve.curvetype == CT_NURBSCURVE) {
subdivider.beginQuilts(new GL2Backend());
for (O_nurbscurve n = currentCurve.o_nurbscurve; n != null; n = n.next)
subdivider.addQuilt(n.bezier_curves);
subdivider.endQuilts();
subdivider.drawCurves();
if (!playBack)
endrender();
} else {
if (!playBack)
endrender();
do_nurbserror(9);
}
}
}
/**
* Method for handling error codes
*
* @param i
* error code
*/
private void do_nurbserror(final int i) {
// TODO nurberror
// System.out.println("TODO nurbserror " + i);
}
/**
* Begin rendering
*/
private void bgnrender() {
// DONE
if (autoloadmode) {
loadGLMatrices();
}
}
/**
* Load matrices from OpenGL state machine
*/
private void loadGLMatrices() {
// TODO Auto-generated method stub
// System.out.println("TODO glunurbs.loadGLMatrices");
}
/**
* End rendering
*/
private void endrender() {
// DONE
}
/**
* Make a NURBS curve
*
* @param nknots
* number of knots in knot vector
* @param knot
* knot vector
* @param stride
* number of control points coordinates
* @param ctlarray
* control points
* @param order
* order of the curve
* @param realType
* type of the curve
*/
public void nurbscurve(final int nknots, final float[] knot, final int stride,
final float[] ctlarray, final int order, final int realType) {
// DONE
final Mapdesc mapdesc = maplist.locate(realType);
if (mapdesc == null) {
do_nurbserror(35);
isDataValid = 0;
return;
}
if (ctlarray == null) {
do_nurbserror(36);
isDataValid = 0;
return;
}
if (stride < 0) {
do_nurbserror(34);
isDataValid = 0;
return;
}
final Knotvector knots = new Knotvector(nknots, stride, order, knot);
if (!do_check_knots(knots, "curve"))
return;
final O_nurbscurve o_nurbscurve = new O_nurbscurve(realType);
o_nurbscurve.bezier_curves = new Quilt(mapdesc);
final CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray);
o_nurbscurve.bezier_curves.toBezier(knots, ctrlcarr, mapdesc
.getNCoords());
thread("do_nurbscurve", o_nurbscurve);
}
/**
* Check knot vector specification
*
* @param knots
* knot vector
* @param msg
* error message
* @return knot vector is / is not valid
*/
public boolean do_check_knots(final Knotvector knots, final String msg) {
// DONE
final int status = knots.validate();
if (status > 0) {
do_nurbserror(status);
if (renderhints.errorchecking != NurbsConsts.N_NOMSG)
knots.show(msg);
}
return (status > 0) ? false : true;
}
/**
* Draw a curve
*
* @param o_nurbscurve
* NURBS curve object
*/
public void do_nurbscurve(final O_nurbscurve o_nurbscurve) {
// DONE
if (inCurve <= 0) {
bgncurve();
inCurve = 2;
}
if (o_nurbscurve.used) {
do_nurbserror(23);
isDataValid = 0;
return;
} else
o_nurbscurve.used = true;
if (currentCurve.curvetype == CT_NONE) {
currentCurve.curvetype = CT_NURBSCURVE;
} else if (currentCurve.curvetype != CT_NURBSCURVE) {
do_nurbserror(24);
isDataValid = 0;
return;
}
// it was necessary to overcome problem with pointer to pointer here
// if(!o_nurbscurve.equals(nextNurbscurve)){
if (!o_nurbscurve.equals(currentCurve.o_nurbscurve)) {
// isCurveModified = 1;
currentCurve.o_nurbscurve = o_nurbscurve;
// nextNurbscurve=o_nurbscurve;
}
nextNurbscurve = o_nurbscurve.next;
if (!currentCurve.equals(o_nurbscurve.owner)) {
// isCurveModified = 1;
o_nurbscurve.owner = currentCurve;
}
/**
if (o_nurbscurve.owner == null) {
isCurveModified = 1;
} */
if (inCurve == 2) {
endcurve();
}
}
/**
* Draw NURBS surface
*
* @param o_nurbssurface
* NURBS surface object
*/
public void do_nurbssurface(final O_nurbssurface o_nurbssurface) {
// DONE
if (inSurface <= 0) {
bgnsurface();
inSurface = 2;
}
if (o_nurbssurface.used) {
do_nurbserror(25);
isDataValid = 0;
return;
} else
o_nurbssurface.used = true;
// Always true, instances of diff classes are compared: if (!o_nurbssurface.equals(nextNurbscurve)) {
// isSurfaceModified = true;
// nextNurbssurface=o_nurbssurface;
currentSurface.o_nurbssurface = o_nurbssurface;
// }
if (!currentSurface.equals(o_nurbssurface.owner)) {
// isSurfaceModified = true;
o_nurbssurface.owner = currentSurface;
}
// nextNurbssurface = o_nurbssurface.next;
if (inSurface == 2)
endsurface();
}
/**
* (Re)Inicialize maps
*/
public void redefineMaps() {
// DONE
maplist.initialize();
}
/**
* Define a map of given properties
*
* @param type
* map type
* @param rational
* is rational
* @param ncoords
* number of control point coordinates
*/
public void defineMap(final int type, final int rational, final int ncoords) {
// DONE
maplist.define(type, rational, ncoords);
}
/**
* Set NURBS property
*
* @param type
* property type
* @param tag
* property tag
* @param value
* property value
*/
public void setnurbsproperty(final int type, final int tag, final float value) {
// DONE
final Mapdesc mapdesc = maplist.locate(type);
if (mapdesc == null) {
do_nurbserror(35);
return;
}
if (!mapdesc.isProperty(tag)) {
do_nurbserror(26);
return;
}
final Property prop = new Property(type, tag, value);
thread("do_setnurbsproperty2", prop);
}
/**
* Set parameters of existing property
*
* @param prop
* property
*/
public void do_setnurbsproperty2(final Property prop) {
final Mapdesc mapdesc = maplist.find(prop.type);
mapdesc.setProperty(prop.tag, prop.value);
}
/**
* Set given property to rendering hints
*
* @param prop
* property to be set
*/
public void do_setnurbsproperty(final Property prop) {
// DONE
renderhints.setProperty(prop);
// TODO freeproperty?
}
/**
* Sets wheteher we use domain distance sampling
*
* @param i
* domain distance sampling flag
*/
public void set_is_domain_distance_sampling(final int i) {
// DONE
subdivider.set_is_domain_distance_sampling(i);
}
/**
* Begin new surface
*/
public void bgnsurface() {
// DONE
final O_surface o_surface = new O_surface();
// TODO nuid
// System.out.println("TODO glunurbs.bgnsurface nuid");
thread("do_bgnsurface", o_surface);
}
/**
* End current surface
*/
public void endsurface() {
// DONE
thread2("do_endsurface");
}
/**
* End surface trimming
*/
private void endtrim() {
// TODO Auto-generated method stub
// System.out.println("TODO glunurbs.endtrim");
}
/**
* Make NURBS surface
*
* @param sknot_count
* number of knots in s direction
* @param sknot
* knot vector in s direction
* @param tknot_count
* number of knots in t direction
* @param tknot
* knot vector in t direction
* @param s_stride
* number of coords of control points in s direction
* @param t_stride
* number of coords of control points in t direction
* @param ctlarray
* control points
* @param sorder
* order of curve in s direction
* @param torder
* order of curve in t direction
* @param type
* NURBS surface type (rational,...)
*/
public void nurbssurface(final int sknot_count, final float[] sknot, final int tknot_count,
final float[] tknot, final int s_stride, final int t_stride, final float[] ctlarray,
final int sorder, final int torder, final int type) {
// DONE
final Mapdesc mapdesc = maplist.locate(type);
if (mapdesc == null) {
do_nurbserror(35);
isDataValid = 0;
return;
}
if (s_stride < 0 || t_stride < 0) {
do_nurbserror(34);
isDataValid = 0;
return;
}
final Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder,
sknot);
if (!do_check_knots(sknotvector, "surface"))
return;
final Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder,
tknot);
if (!do_check_knots(tknotvector, "surface"))
return;
final O_nurbssurface o_nurbssurface = new O_nurbssurface(type);
o_nurbssurface.bezier_patches = new Quilt(mapdesc);
final CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray);
o_nurbssurface.bezier_patches.toBezier(sknotvector, tknotvector,
ctrlarr, mapdesc.getNCoords());
thread("do_nurbssurface", o_nurbssurface);
}
}
|