need interpolation algorithm... not cosine

BlitzMax Forums/BlitzMax Programming/need interpolation algorithm... not cosine

Here is what you might want. I did this by drawing 1/2 of an oval with a diameter equal to the distance between the points, then rotated and transformed the oval to match the position and angle of the points.
SuperStrict

Type TPoint
	Field x:Float
	Field y:Float
End Type

Local Point1:TPoint = New TPoint 'first point
Point1.x = 50
Point1.y = 300

Local Point2:TPoint = New TPoint 'second point
Point2.x = 750
Point2.y = 150

Local ArcDirection:Int = -1 'arc up or down
Local MidPoint:TPoint = New TPoint 'a point half way between point 1 and point 2
MidPoint.x = (Point2.x-Point1.x)/2+Point1.x
MidPoint.y = (Point2.y-Point1.y)/2+Point1.y

Local Angle:Float = ATan2(Point2.y-Midpoint.y,Point2.x-Midpoint.x) 'The angle of the first point with the middle point
Local Distx:Float = Sqr((MidPoint.x-Point1.x)^2+(MidPoint.y-Point1.y)) 'Distance point1 is from midpoint

Local Maxy:Float = 200 'How far to arc

Graphics 800,600

Cls
For Local a:Int = 180 To 0 Step -10 '0 is at point 2, 180 is at point 1, 180/step will give the number of steps :)
	Local Point:TPoint = New TPoint 'The point to be plotted
	Point.x = Cos(a) * Distx 'Find where the x,y coordinate is on in the arc
	Point.y = Sin(a) * Maxy
	Local PointAngle:Float = ATan2(Point.y,Point.x)*ArcDirection + Angle 'now rotate the arc to the proper angle
	Local PointDist:Float = Sqr(Point.x^2+Point.y^2)
	
	
	DrawOval (Cos(PointAngle)*PointDist + Midpoint.x)-5,(Sin(PointAngle)*PointDist + Midpoint.y)-5,10,10
Next
Flip
WaitKey()


ArcDirection is the direction you want the path to curve. 1 is down and -1 is up.
Angle is the angle between where the path starts and ends.
MaxY is how far out the path will move

This probably isn't the most efficient way to do this, but it might be a place to start.