PDA

View Full Version : A common solution of NURBS-Intersection



Curve-X
04-14-2015, 03:36 PM
Dear All,

I believe most of you are familiar with NURBS, and the only known algorithm to calculate the points of NURBS curve is De Boor's algorithm. However, if I tell you that I have developed a second algorithm which is easier and faster than De Boor's basis function. Would you believe me? Ok, I like skeptics, welcome to visit my NURBS-X site (https://sites.google.com/site/nurbsintersection/) to review my KNOTS-Equations.

Also, I invite you to run and play my demo program. If you are lucky, you may find some inconsistent in between gluNurbsCurve() function and my code.

Enclosed are two pieces of sample data of NURBS-X for your review,
1746

Blue NURBS -- Nonuniform, degree: 3, Ring-mode: ON;
Control points: 8;
P00(186.00, 249.00), P01(275.00, 386.00), P02(426.00, 390.00), P03(551.00, 226.00), P04(387.00, 76.00), P05(186.00, 249.00),
P06(275.00, 386.00), P07(426.00, 390.00)
Knots vector: 12;
{ 0.00, 4.00, 11.00, 14.00, 20.00, 22.00, 30.00, 37.00, 40.00, 46.00, 48.00, 56.00 }
Control points of poly-Bezier: 16;
VALID (266.477272727272750, 352.113636363636370), (316.181818181818190, 387.090909090909120), (398.545454545454500, 389.272727272727250),
VALID (454.292613636363630, 343.693181818181810), (472.875000000000000, 328.500000000000000), (488.500000000000000, 308.000000000000000),
VALID (497.141176470588280, 288.070588235294110), (531.705882352941220, 208.352941176470580), (454.529411764705860, 137.764705882352930),
VALID (370.869281045751560, 145.830936819172110), (297.666666666666630, 152.888888888888890), (219.500000000000000, 220.166666666666660),
VALID (223.306249999999980, 282.306249999999980), (224.937500000000000, 308.937500000000000), (241.625000000000000, 334.625000000000000),
(266.477272727272750, 352.113636363636370)

Red NURBS -- Nonuniform, degree: 3, Ring-mode: ON;
Control points: 6;
P00(354.00, 447.00), P01(173.00, 122.00), P02(644.00, 133.00), P03(354.00, 447.00), P04(173.00, 122.00), P05(644.00, 133.00),
Knots vector: 10;
{ 0.00, 4.00, 11.00, 14.00, 20.00, 27.00, 30.00, 36.00, 43.00, 46.00 }
Control points of poly-Bezier: 10;
VALID (247.687500000000000, 203.937500000000000), (261.312500000000000, 124.062500000000000), (437.937500000000000, 128.187500000000000),
VALID (482.850961538461550, 184.754807692307680), (535.250000000000000, 250.750000000000000), (408.375000000000000, 388.125000000000000),
VALID (314.881250000000020, 329.806249999999980), (274.812500000000000, 304.812500000000000), (240.875000000000000, 243.875000000000000),
(247.687500000000000, 203.937500000000000)

The intersection point(s) of above two NURBS: 4;
X00(404.197238488264820, 146.702292035788730), X01(423.721697751867510, 151.095773025961530), X02(492.109495267221400, 201.875621102866860),
X03(246.831393124961490, 216.481309267226320)
The t value(s) of X point(s) of Blue NURBS: 4;
t00 = 28.918030605813776, t01 = 28.250598086390966, t02 = 25.172451154011242,
t03 = 34.489521193382622
The t value(s) of X point(s) of Red NURBS: 4;
t00 = 17.984975658770232, t01 = 18.385399566502024, t02 = 20.561485861489590,
t03 = 29.700240939770431

1747

Blue NURBS -- Nonuniform, degree: 3, Ring-mode: ON;
Control points: 8;
P00(186.00, 249.00), P01(275.00, 386.00), P02(426.00, 390.00), P03(551.00, 226.00), P04(387.00, 76.00), P05(186.00, 249.00),
P06(275.00, 386.00), P07(426.00, 390.00)
Knots vector: 12;
{ 0.00, 7.00, 16.00, 21.00, 27.00, 29.00, 38.00, 47.00, 52.00, 58.00, 60.00, 69.00 }
Control points of poly-Bezier: 16;
VALID (286.834965034965080, 364.281118881118860), (333.076923076923090, 387.538461538461550), (402.769230769230770, 389.384615384615360),
VALID (453.280542986425360, 346.434389140271490), (470.117647058823540, 332.117647058823540), (484.823529411764750, 312.823529411764700),
VALID (493.873796791443850, 294.310160427807430), (534.600000000000020, 211.000000000000000), (460.800000000000070, 143.500000000000000),
VALID (384.573913043478340, 143.597826086956500), (308.347826086956560, 143.695652173913030), (229.695652173913030, 211.391304347826090),
VALID (227.352018633540350, 275.200465838509330), (226.050000000000010, 310.649999999999980), (248.300000000000010, 344.899999999999980),
(286.834965034965080, 364.281118881118860)

Red NURBS -- Nonuniform, degree: 4, Ring-mode: ON;
Control points: 7;
P00(354.00, 447.00), P01(173.00, 122.00), P02(644.00, 133.00), P03(354.00, 447.00), P04(173.00, 122.00), P05(644.00, 133.00),
P06(354.00, 447.00)
Knots vector: 12;
{ 0.00, 8.00, 12.00, 17.00, 18.00, 22.00, 27.00, 28.00, 32.00, 37.00, 38.00, 42.00 }
Control points of poly-Bezier: 13;
VALID (322.785298701298700, 155.409194805194830), (387.023636363636400, 129.914545454545480), (489.518181818181860, 143.972727272727300), (499.590909090909070, 202.530303030303030),
VALID (467.872005772005760, 249.002837902837880), (428.223376623376620, 307.093506493506480), (323.275324675324670, 346.301298701298720), (251.914935064935070, 256.109740259740250),
VALID (278.503679653679630, 194.242496392496410), (283.821428571428560, 181.869047619047620), (293.057142857142880, 170.628571428571430), (306.725714285714280, 161.782857142857150),
(322.785298701298760, 155.409194805194830)

The intersection point(s) of above two NURBS: 4;
X00(421.270641314339170, 148.742442683961540), X01(465.277462410283420, 170.694847000818920), X02(356.892886717538770, 146.484741116540140),
X03(291.036913889591910, 175.621511438426750)
The t value(s) of X point(s) of Blue NURBS: 4;
t00 = 36.528816602195725, t01 = 34.527804092949403, t02 = 39.090739868211536,
t03 = 41.875627248010879
The t value(s) of X point(s) of Red NURBS: 4;
t00 = 19.401931606705986, t01 = 20.255665018432271, t02 = 18.491462001548200,
t03 = 27.404866767799422


Enjoy your surfing,
Hunt Chang :biggrin-new: