Bezier Intersections

BlitzPlus Forums/BlitzPlus Programming/Bezier Intersections

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

i have the solution here is it:
Function  FindRootsPoly3(A3#,A2#,A1#,A0#)

	Local fc2#,gc2#,hc2#,Rc2#,Sc2#,Tc2#,Uc2#,ic2#,jc2#,kc2#,Lc2#,Mc2#,Nc2#,Pc2#
	  
	fc2 =( (3*A1/A3) - ((A2^2)/(A3^2) ))/ 3
	gc2=(( (2*A2^3)/(A3^3)) - (9*A2*A1/(A3^2)) + (27*A0/A3)) / 27
	hc2 = ((gc2^2)/4) + ((fc2^3)/27)
	
	If hc2>0 Then
				Rc2 = -(gc2/2) + (Sqr(hc2))
				If Rc2<0 Then 
					Sc2 = -(Abs(Rc2)^0.333333)
				Else
					Sc2 = ((Rc2))^0.333333
				EndIf
				Tc2 = -(gc2/2) -( Sqr(hc2))
				If Tc2<0 Then 
					Uc2 = -(Abs(Tc2)^0.333333)
				Else
					Uc2 = (Tc2)^0.333333
				EndIf
				Rx(0) = (Sc2 + Uc2) - (A2/(3*A3))
				Else
				If hc2=0 And gc2=0 And fc2=0 Then
					Rx(0) =-((A0/A3)^0.3333333 )
				Else
					If hc2<0 Or hc2=0 Then
						ic2= Sqr(((gc2^2)/4) - hc2)
						jc2 = (ic2)^0.333333
						kc2 = ACos (- (gc2 / (2*ic2)))
						Lc2 = -jc2
						Mc2 = Cos (kc2/3)
						Nc2 = Sqr( 3) * Sin (kc2/3)
						Pc2 = -(A2/(3*A3))
						Rx(0) = 2*jc2 * Cos(kc2/3) -(A2/(3*A3))
						Rx(1) = Lc2 * (Mc2 + Nc2) + Pc2
						Rx(2) = Lc2 * (Mc2 - Nc2) + Pc2
				   EndIf		
			  EndIf
	EndIf
End Function


this calculates only the real roots
they are Rx(0), Rx(1), Rx(2)


i am using this code in my AiEditor for Racer
my Site

here a pic of this