@@ -22,7 +22,6 @@ static const float matrix_identity[16] = {
22
22
23
23
#define MATRIX_SIZE (sizeof(float) * 16)
24
24
25
-
26
25
//=============================================================================
27
26
// utilities
28
27
@@ -205,8 +204,6 @@ void matrix_project_vector3(float mx[], float* x, float* y, float* z) {
205
204
* z = mx_out [11 ];
206
205
}
207
206
208
-
209
-
210
207
//=============================================================================
211
208
// Erlang NIF stuff from here down.
212
209
@@ -241,7 +238,6 @@ nif_close(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
241
238
}
242
239
}
243
240
244
-
245
241
//-----------------------------------------------------------------------------
246
242
// add two matrices together. result is stored in a new matrix
247
243
@@ -304,7 +300,6 @@ nif_subtract(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
304
300
return result ;
305
301
}
306
302
307
-
308
303
//-----------------------------------------------------------------------------
309
304
// multiply two matrices together. result is stored in a new matrix
310
305
@@ -336,7 +331,6 @@ nif_multiply(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
336
331
return result ;
337
332
}
338
333
339
-
340
334
//-----------------------------------------------------------------------------
341
335
// multiply two matrices together. result is stored in a new matrix
342
336
@@ -449,8 +443,6 @@ nif_divide_scalar(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
449
443
return result ;
450
444
}
451
445
452
-
453
-
454
446
//-----------------------------------------------------------------------------
455
447
// calculate the scalar determinant
456
448
@@ -522,7 +514,6 @@ nif_adjugate(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
522
514
return result ;
523
515
}
524
516
525
-
526
517
//-----------------------------------------------------------------------------
527
518
// project a 2d vector by a matrix
528
519
static ERL_NIF_TERM
@@ -592,79 +583,6 @@ nif_project_vector2s(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
592
583
return result ;
593
584
}
594
585
595
- //-----------------------------------------------------------------------------
596
- // project a 2d vector by a matrix
597
- // static ERL_NIF_TERM
598
- // nif_project_vector3(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
599
- // ErlNifBinary mx_term;
600
- // float * mx;
601
- // float x, y, z;
602
-
603
- // // get the a matrix
604
- // if ( !enif_inspect_binary(env, argv[0], &mx_term) ) {return enif_make_badarg(env);}
605
- // if ( mx_term.size != MATRIX_SIZE ) {return enif_make_badarg(env);}
606
- // mx = (float*) mx_term.data;
607
-
608
- // // get the x, y, z of the vector
609
- // if ( !get_float_num(env, argv[1], &x) ) {return enif_make_badarg(env);}
610
- // if ( !get_float_num(env, argv[2], &y) ) {return enif_make_badarg(env);}
611
- // if ( !get_float_num(env, argv[3], &z) ) {return enif_make_badarg(env);}
612
-
613
- // // project the vector
614
- // matrix_project_vector3( mx, &x, &y, &z );
615
-
616
- // // return the result
617
- // return enif_make_tuple3(
618
- // env,
619
- // enif_make_double(env, x),
620
- // enif_make_double(env, y),
621
- // enif_make_double(env, z)
622
- // );
623
- // }
624
-
625
- //-----------------------------------------------------------------------------
626
- // project a packed 2d vector binary by a matrix
627
- // typedef struct { float x; float y; float z; } vector3_f;
628
- // static ERL_NIF_TERM
629
- // nif_project_vector3s(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
630
- // ERL_NIF_TERM result;
631
- // ErlNifBinary mx_term;
632
- // ErlNifBinary v_in_term;
633
- // float * mx;
634
- // int vector_count;
635
- // vector3_f* v_in;
636
- // vector3_f* v_out;
637
- // float x, y, z;
638
-
639
- // // get the matrix
640
- // if ( !enif_inspect_binary(env, argv[0], &mx_term) ) {return enif_make_badarg(env);}
641
- // if ( mx_term.size != MATRIX_SIZE ) {return enif_make_badarg(env);}
642
- // mx = (float*) mx_term.data;
643
-
644
- // // get the vectors
645
- // if ( !enif_inspect_binary(env, argv[1], &v_in_term) ) {return enif_make_badarg(env);}
646
- // if ( (v_in_term.size % (sizeof(float)*3)) != 0 ) {return enif_make_badarg(env);}
647
- // vector_count = v_in_term.size / (sizeof(float)*3);
648
- // v_in = (vector3_f*)v_in_term.data;
649
-
650
- // // allocate the outgoing vector binary
651
- // v_out = (vector3_f*)enif_make_new_binary(env, v_in_term.size, &result);
652
-
653
- // // fill in the answers
654
- // for ( int i = 0; i < vector_count; i++ ) {
655
- // x = v_in[i].x;
656
- // y = v_in[i].y;
657
- // z = v_in[i].z;
658
- // matrix_project_vector3( mx, &x, &y, &z );
659
- // v_out[i].x = x;
660
- // v_out[i].y = y;
661
- // v_out[i].z = z;
662
- // }
663
-
664
- // // return the resulting binary
665
- // return result;
666
- // }
667
-
668
586
//=============================================================================
669
587
// erl housekeeping. This is the list of functions available to the erl side
670
588
0 commit comments