MCPcopy Create free account
hub / github.com/csound/csound / new_spread_dir

Function new_spread_dir

Opcodes/vbap.c:908–941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

906}
907
908void new_spread_dir(CART_VEC *spreaddir, CART_VEC vscartdir,
909 CART_VEC spread_base, MYFLT azi, MYFLT spread)
910{
911 MYFLT beta,gamma;
912 MYFLT a,b;
913 MYFLT power;
914 ANG_VEC tmp;
915 gamma = ACOS(vscartdir.x * spread_base.x +
916 vscartdir.y * spread_base.y +
917 vscartdir.z * spread_base.z)/PI_F*FL(180.0);
918 if (FABS(gamma) < FL(1.0)) {
919 tmp.azi=azi+FL(90.0);
920 tmp.ele=FL(0.0); tmp.length=FL(1.0);
921 angle_to_cart(tmp, &spread_base);
922 gamma = ACOS(vscartdir.x * spread_base.x +
923 vscartdir.y * spread_base.y +
924 vscartdir.z * spread_base.z)/PI_F*FL(180.0);
925 }
926 beta = FL(180.0) - gamma;
927 b=SIN(spread * PI_F / FL(180.0)) /
928 SIN(beta * PI_F / FL(180.0));
929 a=SIN((FL(180.0)- spread - beta) * PI_F / FL(180.0)) /
930 SIN (beta * PI_F / FL(180.0));
931 spreaddir->x = a * vscartdir.x + b * spread_base.x;
932 spreaddir->y = a * vscartdir.y + b * spread_base.y;
933 spreaddir->z = a * vscartdir.z + b * spread_base.z;
934
935 power=SQRT(spreaddir->x*spreaddir->x +
936 spreaddir->y*spreaddir->y +
937 spreaddir->z*spreaddir->z);
938 spreaddir->x /= power;
939 spreaddir->y /= power;
940 spreaddir->z /= power;
941}
942
943void new_spread_base(CART_VEC spreaddir, CART_VEC vscartdir,
944 MYFLT spread, CART_VEC *spread_base)

Callers 6

vbap_controlFunction · 0.85
vbap_moving_controlFunction · 0.85
vbap_zak_controlFunction · 0.85
vbap_zak_moving_controlFunction · 0.85
vbap1_controlFunction · 0.85
vbap1_moving_controlFunction · 0.85

Calls 1

angle_to_cartFunction · 0.85

Tested by

no test coverage detected