[bb] Vector Products by David Bird(Birdie) [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:38

Previous topic - Next topic

BlitzBot

Title : Vector Products
Author : David Bird(Birdie)
Posted : 1+ years ago

Description : A couple of helper functions Dot and cross product.

Code :
Code (blitzbasic) Select
Type vector
Field x#
Field y#
Field z#
End Type

Global CProd.vector=New vector
Global DProd#
;
;Cross and DotProduct functions
Function CrossProduct(x1#,y1#,z1#,x2#,y2#,z2#)
CProdx=(y1*z2)-(z1*y2)
CPrody=(z1*x2)-(x1*z2)
CProdz=(x1*y2)-(y1*x2)
End Function
Function DotProduct#(x1#,y1#,z1#,x2#,y2#,z2#)
DProd=((x1*x2)+(y1*y2)+(z1*z2))
Return DProd
End Function
;Return Cross product answers
Function CproductX#()
Return CProdx#
End Function
Function CproductY#()
Return CPrody#
End Function
Function CproductZ#()
Return CProdz#
End Function
;Return Dot product answers
Function DProduct#()
Return DProd#
End Function


Comments : none...