-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tap.rotate: bringing it back from the dead...
- Loading branch information
Timothy Place
committed
Dec 25, 2015
1 parent
d7c7d51
commit a4c2a05
Showing
8 changed files
with
561 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>BuildMachineOSBuild</key> | ||
<string>15B42</string> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>tap.rotate</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.cycling74.tap-rotate</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.1.4</string> | ||
<key>CFBundleLongVersionString</key> | ||
<string>tap.rotate 6.1.4, Copyright 2013 Cycling '74</string> | ||
<key>CFBundlePackageType</key> | ||
<string>iLaX</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>6.1.4</string> | ||
<key>CFBundleSignature</key> | ||
<string>max2</string> | ||
<key>CFBundleSupportedPlatforms</key> | ||
<array> | ||
<string>MacOSX</string> | ||
</array> | ||
<key>CFBundleVersion</key> | ||
<string>6.1.4</string> | ||
<key>CSResourcesFileMapped</key> | ||
<true/> | ||
<key>DTCompiler</key> | ||
<string>com.apple.compilers.llvm.clang.1_0</string> | ||
<key>DTPlatformBuild</key> | ||
<string>7B1005</string> | ||
<key>DTPlatformVersion</key> | ||
<string>GM</string> | ||
<key>DTSDKBuild</key> | ||
<string>15A278</string> | ||
<key>DTSDKName</key> | ||
<string>macosx10.11</string> | ||
<key>DTXcode</key> | ||
<string>0711</string> | ||
<key>DTXcodeBuild</key> | ||
<string>7B1005</string> | ||
</dict> | ||
</plist> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
iLaXmax2 |
Submodule jamoma2
updated
21 files
+40 −16 | README.md | |
+278 −119 | examples/simple.cpp | |
+14 −2 | examples/simple.xcodeproj/project.pbxproj | |
+20 −9 | includes/Jamoma.h | |
+16 −2 | includes/JamomaAudioObject.h | |
+1 −3 | includes/JamomaDcblock.h | |
+23 −0 | includes/JamomaDelay.h | |
+2 −2 | includes/JamomaGain.h | |
+4 −9 | includes/JamomaLimiter.h | |
+122 −0 | includes/JamomaLimits.h | |
+32 −24 | includes/JamomaLowpassFourPole.h | |
+76 −0 | includes/JamomaLowpassOnePole.h | |
+56 −0 | includes/JamomaMessage.h | |
+58 −162 | includes/JamomaObject.h | |
+197 −0 | includes/JamomaParameter.h | |
+0 −29 | includes/JamomaSymbol.h | |
+52 −0 | includes/JamomaUnitImpulse.h | |
+176 −0 | includes/JamomaUnitTest.h | |
+1 −1 | includes/JamomaValue.h | |
+135 −0 | tests/Dcblocker/JamomaTest_Dcblocker.cpp | |
+744 −0 | tests/Dcblocker/JamomaTest_Dcblocker.xcodeproj/project.pbxproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,266 @@ | ||
/* | ||
* External object for Max/MSP | ||
* Copyright © 2007 by Timothy Place | ||
* | ||
* License: This code is licensed under the terms of the "New BSD License" | ||
* http://creativecommons.org/licenses/BSD/ | ||
*/ | ||
|
||
/* | ||
tap.rotate | ||
perform 3D rotations on sets of coordinates | ||
algorithm provided by stephan moore | ||
*/ | ||
|
||
|
||
#if NOCP | ||
#include "ext.h" | ||
#include "ext_obex.h" | ||
#include "commonsyms.h" | ||
#else | ||
#include "TTClassWrapperMax.h" | ||
#endif | ||
|
||
#define MAX_NUMSETS 128 | ||
|
||
static t_class *rotate_class; // Required: Global pointer for our class | ||
|
||
typedef struct _rotate{ | ||
t_object obj; | ||
void *inlets[3]; // x coords, y coords, z coords, rotation anchor point | ||
void *outlets[3]; // x coords, y coords, z coords | ||
long inletnum; | ||
long numsets; | ||
float x[MAX_NUMSETS]; | ||
float y[MAX_NUMSETS]; | ||
float z[MAX_NUMSETS]; | ||
float rot_x; | ||
float rot_y; | ||
float rot_z; | ||
float rot_x_rad; | ||
float rot_y_rad; | ||
float rot_z_rad; | ||
} t_rotate; | ||
|
||
|
||
// Prototypes for our methods: | ||
void* rotate_new(t_symbol *s, long argc, t_atom *argv); | ||
void rotate_assist(t_rotate *x, void *b, long msg, long arg, char *dst); | ||
void rotate_bang(t_rotate *obj); | ||
void rotate_float(t_rotate *obj, double val); | ||
void rotate_list(t_rotate *x, t_symbol *msg, short argc, t_atom *argv); | ||
void rotate_applyrotation(t_rotate *x, long setnum); | ||
void rotate_cartopol(double real, double imaginary, double *out1, double *out2); | ||
void rotate_poltocar(double magnitude, double phase, double *out1, double *out2); | ||
|
||
|
||
/************************************************************************************/ | ||
// Main() Function | ||
|
||
void ext_main(void* r) | ||
{ | ||
t_class *c = class_new("tap.rotate",(method)rotate_new, (method)0L, sizeof(t_rotate), | ||
(method)0L, A_GIMME, 0); | ||
|
||
#if NOCP | ||
class_addmethod(c, (method)object_obex_dumpout, "dumpout", A_CANT,0); | ||
#else | ||
common_symbols_init(); // Initialize TapTools | ||
#endif | ||
class_addmethod(c, (method)rotate_bang, "bang", 0L); | ||
class_addmethod(c, (method)rotate_float, "float", A_FLOAT, 0L); | ||
class_addmethod(c, (method)rotate_list, "list", A_GIMME, 0L); | ||
class_addmethod(c, (method)rotate_assist, "assist", A_CANT, 0L); | ||
class_addmethod(c, (method)stdinletinfo, "inletinfo", A_CANT, 0); | ||
/* | ||
// ATTRIBUTE: numsets | ||
attr = attr_offset_new("numsets", _sym_long, attrflags, | ||
(method)0, (method)0, calcoffset(t_route, partialmatch)); | ||
class_addattr(c, attr); | ||
*/ | ||
#if NOCP | ||
class_register(CLASS_BOX, c); | ||
rotate_class = c; | ||
#else | ||
class_register(_sym_box, c); rotate_class = c; | ||
#endif | ||
} | ||
|
||
|
||
/************************************************************************************/ | ||
// Object Creation Method | ||
|
||
void *rotate_new(t_symbol *s, long argc, t_atom *argv) | ||
{ | ||
#if NOCP | ||
t_rotate *x = (t_rotate *)object_alloc(rotate_class); | ||
#else | ||
t_rotate *x = (t_rotate *)object_alloc(rotate_class);; | ||
#endif | ||
|
||
if(x){ | ||
object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL)); // dumpout | ||
|
||
x->inlets[2] = proxy_new(x, 3, &x->inletnum); | ||
x->inlets[1] = proxy_new(x, 2, &x->inletnum); | ||
x->inlets[0] = proxy_new(x, 1, &x->inletnum); | ||
x->outlets[2] = outlet_new(x, 0); | ||
x->outlets[1] = outlet_new(x, 0); | ||
x->outlets[0] = outlet_new(x, 0); | ||
x->numsets = 1; | ||
|
||
attr_args_process(x,argc,argv); //handle attribute args | ||
} | ||
return x; | ||
} | ||
|
||
|
||
/************************************************************************************/ | ||
// Methods bound to input/inlets | ||
|
||
// Method for Assistance Messages | ||
void rotate_assist(t_rotate *x, void *b, long msg, long arg, char *dst) | ||
{ | ||
if(msg == 1){ // Inlets | ||
switch(arg){ | ||
case 0: strcpy(dst, "list of x coords"); break; | ||
case 1: strcpy(dst, "list of y coords"); break; | ||
case 2: strcpy(dst, "list of z coords"); break; | ||
case 3: strcpy(dst, "list (x y z) to define rotation"); break; | ||
} | ||
} | ||
else{ // Outlets | ||
switch(arg){ | ||
case 0: strcpy(dst, "Output (list of x coords)"); break; | ||
case 1: strcpy(dst, "Output (list of y coords)"); break; | ||
case 2: strcpy(dst, "Output (list of z coords)"); break; | ||
case 3: strcpy(dst, "dumpout"); break; | ||
} | ||
} | ||
} | ||
|
||
|
||
void rotate_bang(t_rotate *obj) | ||
{ | ||
short i; | ||
double x, y, z; | ||
double x2, y2, z2; | ||
t_atom ax[MAX_NUMSETS], | ||
ay[MAX_NUMSETS], | ||
az[MAX_NUMSETS]; | ||
|
||
for(i=0; i < obj->numsets; i++){ | ||
x = obj->x[i]; | ||
y = obj->y[i]; | ||
z = obj->z[i]; | ||
|
||
// z-rotate | ||
rotate_cartopol(x, y, &x2, &y2); | ||
y2 += obj->rot_z_rad; | ||
rotate_poltocar(x2, y2, &x, &y); | ||
|
||
// y-rotate | ||
rotate_cartopol(z, x, &z2, &x2); | ||
x2 += obj->rot_y_rad; | ||
rotate_poltocar(z2, x2, &z, &x); | ||
|
||
// x-rotate | ||
rotate_cartopol(y, z, &y2, &z2); | ||
z2 += obj->rot_x_rad; | ||
rotate_poltocar(y2, z2, &y, &z); | ||
|
||
atom_setfloat(ax+i, x); | ||
atom_setfloat(ay+i, y); | ||
atom_setfloat(az+i, z); | ||
} | ||
|
||
outlet_anything(obj->outlets[2], _sym_list, obj->numsets, az); | ||
outlet_anything(obj->outlets[1], _sym_list, obj->numsets, ay); | ||
outlet_anything(obj->outlets[0], _sym_list, obj->numsets, ax); | ||
} | ||
|
||
|
||
void rotate_float(t_rotate *obj, double val) | ||
{ | ||
if(obj->inletnum == 0){ // set x coord, trigger output | ||
obj->numsets = 1; | ||
obj->x[0] = val; | ||
rotate_bang(obj); | ||
} | ||
else if(obj->inletnum == 1) | ||
obj->y[0] = val; | ||
else if(obj->inletnum == 2) | ||
obj->z[0] = val; | ||
} | ||
|
||
|
||
// LIST INPUT | ||
void rotate_list(t_rotate *obj, t_symbol *msg, short argc, t_atom *argv) | ||
{ | ||
short i; | ||
|
||
if(obj->inletnum == 0){ // set x coord, trigger output | ||
obj->numsets = argc; | ||
for(i=0; i < argc; i++) | ||
obj->x[i] = atom_getfloat(argv+i); | ||
rotate_bang(obj); | ||
} | ||
else if(obj->inletnum == 1){ // set y coords | ||
for(i=0; i < argc; i++) | ||
obj->y[i] = atom_getfloat(argv+i); | ||
} | ||
else if(obj->inletnum == 2){ // set z coords | ||
for(i=0; i < argc; i++) | ||
obj->z[i] = atom_getfloat(argv+i); | ||
} | ||
else if(obj->inletnum == 3){ // set rotation | ||
if(argc != 3){ | ||
object_error((t_object *)obj, "wrong number of list elements"); | ||
return; | ||
} | ||
obj->rot_x = atom_getfloat(argv+0); | ||
obj->rot_y = atom_getfloat(argv+1); | ||
obj->rot_z = atom_getfloat(argv+2); | ||
obj->rot_x_rad = (obj->rot_x / 180.0) * 3.1415926535897932; | ||
obj->rot_y_rad = (obj->rot_y / 180.0) * 3.1415926535897932; | ||
obj->rot_z_rad = (obj->rot_z / 180.0) * 3.1415926535897932; | ||
} | ||
} | ||
|
||
|
||
void rotate_applyrotation(t_rotate *x, long setnum) | ||
{ | ||
} | ||
|
||
|
||
void rotate_cartopol(double real, double imaginary, double *out1, double *out2) | ||
{ | ||
double magnitude, | ||
phase; | ||
|
||
magnitude = sqrt((real * real) + (imaginary * imaginary)); | ||
|
||
if (real == 0) | ||
real = 0.000001; // prevent divide by zero | ||
phase = atan(imaginary / real); | ||
if ((real < 0) && (imaginary < 0)) // arctangent corrections | ||
phase = phase - 3.1415926535897932; | ||
else if ((real < 0) && (imaginary >= 0)) | ||
phase = phase + 3.1415926535897932; | ||
|
||
*out1 = magnitude; | ||
*out2 = phase; | ||
} | ||
|
||
|
||
void rotate_poltocar(double magnitude, double phase, double *out1, double *out2) | ||
{ | ||
double real, | ||
imaginary; | ||
|
||
real = magnitude * cos(phase); | ||
imaginary = magnitude * sin(phase); | ||
|
||
*out1 = real; | ||
*out2 = imaginary; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="yes"?> | ||
<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?> | ||
|
||
<c74object name="tap.rotate" module="max" category="TapTools, Math"> | ||
|
||
<digest> | ||
Transform a 3D point about an axis | ||
</digest> | ||
|
||
<description> | ||
The <o>tap.rotate</o> object rotates the coordinates of 3d point (or points) around another 3d point. | ||
</description> | ||
|
||
|
||
<!--METADATA--> | ||
<metadatalist> | ||
<metadata name="author">74 Objects</metadata> | ||
<metadata name="tag">Math</metadata> | ||
</metadatalist> | ||
|
||
|
||
<!--SEEALSO--> | ||
<seealsolist> | ||
<seealso name="cartopol"/> | ||
<seealso name="poltocar"/> | ||
</seealsolist> | ||
|
||
|
||
</c74object> |
Oops, something went wrong.