gvector:cross
 List of: Scheme Extensions Subjects: Mathematics Contents: Kernel
Action: Gets the cross product of two gvectors.

Filename: kern/kern_scm/gvec_scm.cxx

Syntax: (gvector:cross gvector1 gvector2)

Arg Types: gvector1 gvector

gvector2 gvector

Returns: gvector

Description: If the i, j, k components of vector a are <a1, a2, a3>, and the i, j, k components of vector b are <b1, b2, b3>, the cross product a x b is:

|a2 a3 |
|a1 a3 |
|a1 a2 |

a x b = |
|i - |
|j + |
|k

|b2 b3 |
|b1 b3 |
|b1 b2 |

a x b =
[(a2)(b3)-(b2)(a3)]i

- [(a1)(b3)-(b1)(a3)]j

+ [(a1)(b2)-(b1)(a2)]k

The resulting cross product vector is perpendicular to both input vectors. The cross product a x b is not the same as the cross product b x a; they point in opposite directions (180 degrees from one another).

gvector1 specifies the first vector.

gvector2 specifies the second vector.

Example: ; gvector:cross

; Compute the cross product of two gvectors.

(gvector:cross (gvector 2 2 2) (gvector 5 3 8))

;; #[gvector 10 -6 -4]

(gvector:cross (gvector 5 3 8) (gvector 2 2 2))

;; #[gvector -10 6 4]
PDF/KERN/13SCF.PDF
HTM/DATA/KERN/KERN/13SCF/0076.HTM