MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_crossProduct_

Function UArray_crossProduct_

libs/basekit/source/UArray_math.c:435–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435void UArray_crossProduct_(UArray *self, const UArray *other) {
436 if (self->itemType == CTYPE_float32_t &&
437 other->itemType == CTYPE_float32_t && self->size > 2 &&
438 other->size > 2) {
439 float32_t *a = (float32_t *)self->data;
440 float32_t *b = (float32_t *)other->data;
441
442 float32_t i = (a[1] * b[2]) - (a[2] * b[1]);
443 float32_t j = (a[2] * b[0]) - (a[0] * b[2]);
444 float32_t k = (a[0] * b[1]) - (a[1] * b[0]);
445
446 a[0] = i;
447 a[1] = j;
448 a[2] = k;
449
450 UArray_changed(self);
451
452 return;
453 }
454}
455
456double UArray_distanceTo_(const UArray *self, const UArray *other) {
457 if (self->itemType == CTYPE_float32_t &&

Callers

nothing calls this directly

Calls 1

UArray_changedFunction · 0.85

Tested by

no test coverage detected