45 #define bn_cx_copy(ap, bp) {*(ap) = *(bp);}
46 #define bn_cx_neg(cp) { (cp)->re = -((cp)->re);(cp)->im = -((cp)->im);}
47 #define bn_cx_real(cp) (cp)->re
48 #define bn_cx_imag(cp) (cp)->im
50 #define bn_cx_add(ap, bp) { (ap)->re += (bp)->re; (ap)->im += (bp)->im;}
51 #define bn_cx_ampl(cp) hypot((cp)->re, (cp)->im)
52 #define bn_cx_amplsq(cp) ((cp)->re * (cp)->re + (cp)->im * (cp)->im)
53 #define bn_cx_conj(cp) { (cp)->im = -(cp)->im; }
54 #define bn_cx_cons(cp, r, i) { (cp)->re = r; (cp)->im = i; }
55 #define bn_cx_phas(cp) atan2((cp)->im, (cp)->re)
56 #define bn_cx_scal(cp, s) { (cp)->re *= (s); (cp)->im *= (s); }
57 #define bn_cx_sub(ap, bp) { (ap)->re -= (bp)->re; (ap)->im -= (bp)->im;}
59 #define bn_cx_mul(ap, bp) \
60 { register fastf_t a__re, b__re; \
61 (ap)->re = ((a__re=(ap)->re)*(b__re=(bp)->re)) - (ap)->im*(bp)->im; \
62 (ap)->im = a__re*(bp)->im + (ap)->im*b__re; }
65 #define bn_cx_mul2(ap, bp, cp) { \
66 (ap)->re = (cp)->re * (bp)->re - (cp)->im * (bp)->im; \
67 (ap)->im = (cp)->re * (bp)->im + (cp)->im * (bp)->re; }
Header file for the BRL-CAD common definitions.
void bn_cx_sqrt(bn_complex_t *op, const bn_complex_t *ip)
Compute square root of complex number.
void bn_cx_div(bn_complex_t *ap, const bn_complex_t *bp)
Divide one complex by another.
struct bn_complex bn_complex_t