diff --git a/TapTools/externals/tap.rotate.mxo/Contents/Info.plist b/TapTools/externals/tap.rotate.mxo/Contents/Info.plist new file mode 100644 index 00000000..4317f6f1 --- /dev/null +++ b/TapTools/externals/tap.rotate.mxo/Contents/Info.plist @@ -0,0 +1,46 @@ + + + + + BuildMachineOSBuild + 15B42 + CFBundleDevelopmentRegion + English + CFBundleExecutable + tap.rotate + CFBundleIdentifier + com.cycling74.tap-rotate + CFBundleInfoDictionaryVersion + 6.1.4 + CFBundleLongVersionString + tap.rotate 6.1.4, Copyright 2013 Cycling '74 + CFBundlePackageType + iLaX + CFBundleShortVersionString + 6.1.4 + CFBundleSignature + max2 + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 6.1.4 + CSResourcesFileMapped + + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 7B1005 + DTPlatformVersion + GM + DTSDKBuild + 15A278 + DTSDKName + macosx10.11 + DTXcode + 0711 + DTXcodeBuild + 7B1005 + + diff --git a/TapTools/externals/tap.rotate.mxo/Contents/MacOS/tap.rotate b/TapTools/externals/tap.rotate.mxo/Contents/MacOS/tap.rotate new file mode 100755 index 00000000..bdded7e8 Binary files /dev/null and b/TapTools/externals/tap.rotate.mxo/Contents/MacOS/tap.rotate differ diff --git a/TapTools/externals/tap.rotate.mxo/Contents/PkgInfo b/TapTools/externals/tap.rotate.mxo/Contents/PkgInfo new file mode 100644 index 00000000..0febb6eb --- /dev/null +++ b/TapTools/externals/tap.rotate.mxo/Contents/PkgInfo @@ -0,0 +1 @@ +iLaXmax2 \ No newline at end of file diff --git a/source/jamoma2 b/source/jamoma2 index 6fab3152..21035c39 160000 --- a/source/jamoma2 +++ b/source/jamoma2 @@ -1 +1 @@ -Subproject commit 6fab31528771e4b302d37648d1ef4e8a49ef4047 +Subproject commit 21035c39ef426a8025e542c760ec23c013674828 diff --git a/source/tap.fourpole~/tap.fourpole~.xcodeproj/project.pbxproj b/source/tap.fourpole~/tap.fourpole~.xcodeproj/project.pbxproj index a6530d1c..71b3a589 100644 --- a/source/tap.fourpole~/tap.fourpole~.xcodeproj/project.pbxproj +++ b/source/tap.fourpole~/tap.fourpole~.xcodeproj/project.pbxproj @@ -34,7 +34,6 @@ 22EF264E1B6916800013FA2E /* JamomaLowpassFourPole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JamomaLowpassFourPole.h; sourceTree = ""; }; 22EF264F1B6916800013FA2E /* JamomaObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JamomaObject.h; sourceTree = ""; }; 22EF26501B6916800013FA2E /* JamomaSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JamomaSample.h; sourceTree = ""; }; - 22EF26511B6916800013FA2E /* JamomaSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JamomaSymbol.h; sourceTree = ""; }; 22EF26521B6916800013FA2E /* JamomaValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JamomaValue.h; sourceTree = ""; }; 22EF26531B6916800013FA2E /* JamomaWhiteNoise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JamomaWhiteNoise.h; sourceTree = ""; }; 22EF26621B69168A0013FA2E /* example.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = example.cpp; sourceTree = ""; }; @@ -167,7 +166,6 @@ 22EF264E1B6916800013FA2E /* JamomaLowpassFourPole.h */, 22EF264F1B6916800013FA2E /* JamomaObject.h */, 22EF26501B6916800013FA2E /* JamomaSample.h */, - 22EF26511B6916800013FA2E /* JamomaSymbol.h */, 22EF26521B6916800013FA2E /* JamomaValue.h */, 22EF26531B6916800013FA2E /* JamomaWhiteNoise.h */, ); diff --git a/source/tap.rotate/tap.rotate.cpp b/source/tap.rotate/tap.rotate.cpp new file mode 100644 index 00000000..3939c6db --- /dev/null +++ b/source/tap.rotate/tap.rotate.cpp @@ -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; +} diff --git a/source/tap.rotate/tap.rotate.maxref.xml b/source/tap.rotate/tap.rotate.maxref.xml new file mode 100644 index 00000000..d727def9 --- /dev/null +++ b/source/tap.rotate/tap.rotate.maxref.xml @@ -0,0 +1,29 @@ + + + + + + + Transform a 3D point about an axis + + + + The tap.rotate object rotates the coordinates of 3d point (or points) around another 3d point. + + + + + + 74 Objects + Math + + + + + + + + + + + diff --git a/source/tap.rotate/tap.rotate.xcodeproj/project.pbxproj b/source/tap.rotate/tap.rotate.xcodeproj/project.pbxproj new file mode 100644 index 00000000..dfc89cd4 --- /dev/null +++ b/source/tap.rotate/tap.rotate.xcodeproj/project.pbxproj @@ -0,0 +1,218 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 44; + objects = { + +/* Begin PBXBuildFile section */ + 2273EE4D1A03F19E0057B483 /* commonsyms.c in Sources */ = {isa = PBXBuildFile; fileRef = 2273EE4C1A03F19E0057B483 /* commonsyms.c */; }; + 22DFD5061A0C2BC3001C00BD /* tap.rotate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22DFD5051A0C2BC3001C00BD /* tap.rotate.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 2273EE491A03F14F0057B483 /* max.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = max.xcconfig; path = ../max.xcconfig; sourceTree = ""; }; + 2273EE4C1A03F19E0057B483 /* commonsyms.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = commonsyms.c; path = "../../max-sdk/source/c74support/max-includes/common/commonsyms.c"; sourceTree = ""; }; + 22DFD5051A0C2BC3001C00BD /* tap.rotate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tap.rotate.cpp; sourceTree = ""; }; + 2FBBEAE508F335360078DB84 /* tap.rotate.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = tap.rotate.mxo; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2FBBEADC08F335360078DB84 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 089C166AFE841209C02AAC07 /* iterator */ = { + isa = PBXGroup; + children = ( + 2273EE491A03F14F0057B483 /* max.xcconfig */, + 2273EE4C1A03F19E0057B483 /* commonsyms.c */, + 22DFD5051A0C2BC3001C00BD /* tap.rotate.cpp */, + 19C28FB4FE9D528D11CA2CBB /* Products */, + ); + name = iterator; + sourceTree = ""; + }; + 19C28FB4FE9D528D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 2FBBEAE508F335360078DB84 /* tap.rotate.mxo */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 2FBBEAD708F335360078DB84 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 2FBBEAD608F335360078DB84 /* max-external */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2FBBEAE008F335360078DB84 /* Build configuration list for PBXNativeTarget "max-external" */; + buildPhases = ( + 2FBBEAD708F335360078DB84 /* Headers */, + 2FBBEAD808F335360078DB84 /* Resources */, + 2FBBEADA08F335360078DB84 /* Sources */, + 2FBBEADC08F335360078DB84 /* Frameworks */, + 2FBBEADF08F335360078DB84 /* Rez */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "max-external"; + productName = iterator; + productReference = 2FBBEAE508F335360078DB84 /* tap.rotate.mxo */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 089C1669FE841209C02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + }; + buildConfigurationList = 2FBBEACF08F335010078DB84 /* Build configuration list for PBXProject "tap.rotate" */; + compatibilityVersion = "Xcode 3.0"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 089C166AFE841209C02AAC07 /* iterator */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2FBBEAD608F335360078DB84 /* max-external */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2FBBEAD808F335360078DB84 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXRezBuildPhase section */ + 2FBBEADF08F335360078DB84 /* Rez */ = { + isa = PBXRezBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXRezBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2FBBEADA08F335360078DB84 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2273EE4D1A03F19E0057B483 /* commonsyms.c in Sources */, + 22DFD5061A0C2BC3001C00BD /* tap.rotate.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 2FBBEAD008F335010078DB84 /* Development */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2273EE491A03F14F0057B483 /* max.xcconfig */; + buildSettings = { + }; + name = Development; + }; + 2FBBEAD108F335010078DB84 /* Deployment */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2273EE491A03F14F0057B483 /* max.xcconfig */; + buildSettings = { + }; + name = Deployment; + }; + 2FBBEAE108F335360078DB84 /* Development */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2273EE491A03F14F0057B483 /* max.xcconfig */; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + COPY_PHASE_STRIP = NO; + GCC_OPTIMIZATION_LEVEL = 0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + /Users/tim/Code/TapTools/Core/DSP/extensions/GeneratorLib/build, + /Users/tim/Code/TapTools/Core/DSP/library/build, + /Users/tim/Code/TapTools/Core/Foundation/library/build, + ); + OTHER_LDFLAGS = ( + "$(C74_SYM_LINKER_FLAGS)", + "$(C74_SYM_LINKER_FLAGS_MSP)", + ); + }; + name = Development; + }; + 2FBBEAE208F335360078DB84 /* Deployment */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2273EE491A03F14F0057B483 /* max.xcconfig */; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + COPY_PHASE_STRIP = YES; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + /Users/tim/Code/TapTools/Core/DSP/extensions/GeneratorLib/build, + /Users/tim/Code/TapTools/Core/DSP/library/build, + /Users/tim/Code/TapTools/Core/Foundation/library/build, + ); + OTHER_LDFLAGS = ( + "$(C74_SYM_LINKER_FLAGS)", + "$(C74_SYM_LINKER_FLAGS_MSP)", + ); + }; + name = Deployment; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2FBBEACF08F335010078DB84 /* Build configuration list for PBXProject "tap.rotate" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2FBBEAD008F335010078DB84 /* Development */, + 2FBBEAD108F335010078DB84 /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; + }; + 2FBBEAE008F335360078DB84 /* Build configuration list for PBXNativeTarget "max-external" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2FBBEAE108F335360078DB84 /* Development */, + 2FBBEAE208F335360078DB84 /* Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; + }; +/* End XCConfigurationList section */ + }; + rootObject = 089C1669FE841209C02AAC07 /* Project object */; +}