BIP basic code?

BlitzMax Forums/BlitzMax Programming/BIP basic code?

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.

The rest of my vector module if you need it:
(my site appears to be down at the moment so I'm posting source).
Strict
Rem
bbdoc: Pert.Vector2D
End Rem
Module Pert.Vector2D
ModuleInfo "Module: Perturbatio's 2D Vector Mod"
ModuleInfo "Version: 0.02"
ModuleInfo "Author: Kris Kelly (Perturbatio)"
ModuleInfo "License: Public Domain"


Import BRL.Math

Rem
bbdoc: 2D Vector Type
End Rem
Type TVector2D Final 
	Field X : Double
	Field Y : Double
End Type


Rem
bbdoc: Returns the magnitude of a 2D vector
about: Accepts a 2D vector of type TVector2D and returns the magnitude
End Rem
Function GetVecLen2D:Double(Vec : TVector2D Var)
	Return Sqr((Vec.X * Vec.X) + (Vec.Y * Vec.Y))
End Function

Rem
bbdoc: Returns the magnitude of a 2D vector squared
about: Accepts a 2D vector of type TVector2D and returns the magnitude squared
End Rem
Function GetVecLenSqr2D:Double(Vec : TVector2D)
   Return (Vec.x * Vec.x) + (Vec.y * Vec.y)
End Function


Rem
bbdoc: Returns the dot product
about: Accepts two 2D vectors of type TVector2D and returns the dot product
End Rem
Function GetDot2D:Double(Vec1 : TVector2D, Vec2 : TVector2D)
	Return (Vec1.X * Vec2.X) + (Vec1.Y * Vec2.Y)
End Function


Rem
bbdoc: Returns a Vector multiplied by a scalar valeu
about: Accepts a 2D vector of type TVector2D and returns the magnitude
End Rem
Function MultVec2D:TVector2D(Vec : TVector2D, value:Double)
	Local tempVec : TVector2D = New TVector2D
		tempVec.X = Vec.X * value
		tempVec.Y = Vec.Y * value
		'DebugLog tempVec.X
		'DebugLog tempVec.Y
	Return tempVec
End Function


Rem
bbdoc: Normalizes the vector passed to it.
about: Accepts a 2D vector of type TVector2D and normalizes it.
End Rem
Function NormVec2D(Vec : TVector2D Var)
	Local Mag:Int = GetVecLen2D(Vec)
	
	If Mag = 0 Then Return
	Vec.X = Vec.X/Mag
	Vec.Y = Vec.Y/Mag
End Function


Rem
bbdoc: Returns a vector which is the sum of two other vectors.
about: Accepts two 2D vectors of type TVector2D and returns the result as a TVector2D
End Rem
Function AddVec2D:TVector2D(Vec1 : TVector2D, Vec2 : TVector2D)
	Local tempVec : TVector2D = New TVector2D
		tempVec.X = Vec1.X + Vec2.X 
		tempVec.Y = Vec1.Y + Vec2.Y
	Return tempVec
End Function


Rem
bbdoc: Returns a vector which is the result of subtracting one from the other
about: Subtracts Vec2 from Vec1 and returns the result in a TVector2D
End Rem
Function SubVec2D:TVector2D(Vec1 : TVector2D Var, Vec2 : TVector2D Var)
	Local tempVec : TVector2D = New TVector2D		
		tempVec.X = Vec1.X - Vec2.X 
		tempVec.Y = Vec1.Y - Vec2.Y
	Return tempVec
End Function