November 28, 2020, 11:10:42 AM

Author Topic: [bb] Vector Products by David Bird(Birdie) [ 1+ years ago ]  (Read 625 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Vector Products
Author : David Bird(Birdie)
Posted : 1+ years ago

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

Code :
Code: BlitzBasic
  1. Type vector
  2.         Field x#
  3.         Field y#
  4.         Field z#
  5. End Type
  6.  
  7. Global CProd.vector=New vector
  8. Global DProd#
  9. ;
  10. ;Cross and DotProduct functions
  11. Function CrossProduct(x1#,y1#,z1#,x2#,y2#,z2#)
  12.         CProdx=(y1*z2)-(z1*y2)
  13.         CPrody=(z1*x2)-(x1*z2)
  14.         CProdz=(x1*y2)-(y1*x2)
  15. End Function
  16. Function DotProduct#(x1#,y1#,z1#,x2#,y2#,z2#)
  17.         DProd=((x1*x2)+(y1*y2)+(z1*z2))
  18.         Return DProd
  19. End Function
  20. ;Return Cross product answers
  21. Function CproductX#()
  22.         Return CProdx#
  23. End Function
  24. Function CproductY#()
  25.         Return CPrody#
  26. End Function
  27. Function CproductZ#()
  28.         Return CProdz#
  29. End Function
  30. ;Return Dot product answers
  31. Function DProduct#()
  32.         Return DProd#
  33. End Function
  34.  


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal