spherical2cartesian s

Converts a set of spherical coordinates into cartesian. S-rate
Author: Sputnki
License: BSD
Github: sptnk/math/spherical2cartesian s.axo

Inlets

frac32buffer radius

frac32buffer inclination: angle with the z axis (0 = 0 degrees; 64 = 180 degrees)

frac32buffer azimuth: angle with the x axis on the xy projection (0 = 0 degrees; 64 = 360 degrees)

Outlets

frac32buffer x coordinate output

frac32buffer y coordinate output

frac32buffer z coordinate output

Audio Rate
int32_t sintheta;
int32_t costheta;
int32_t sinphi;
int32_t cosphi;

SINE2TINTERP((inlet_theta << 4) + (1 << 30), costheta);
SINE2TINTERP(inlet_theta << 4, sintheta);
SINE2TINTERP((inlet_phi << 5) + (1 << 30), cosphi);
SINE2TINTERP(inlet_phi << 5, sinphi);

outlet_x = ___SMMUL(inlet_radius << 2, ___SMMUL(sintheta, cosphi));
outlet_y = ___SMMUL(inlet_radius << 2, ___SMMUL(sintheta, sinphi));
outlet_z = ___SMMUL(inlet_radius << 1, costheta);

Privacy

© 2024 Zrna Research