# Math CHOP formula?

Wondering if anyone knows what kind of formula I would use to get the same functionality as the Math Chops ‘FROM RANGE/TO RANGE’ page…I’m trying to do the exact same thing but with code.

Hi,

[url]http://zugakousaku.com/src/article.php?ref=lab-00044[/url]

but it’s japanese so here you are, hope that helps.

From Range min = A
From Range max = B
To Range min = C
To Range max = D
Input Value = E
Scaled Value = F

F = (E-A)*( (D-C)/(B-A) )+C;

fig.
A --E— B
C —F-------- D

Awesome. Thank you.
You must be good at math Itaru cause I remember you figuring out the 16 bit DMX conversion using the modulo function as well.

I’m in the process of writing a GLSL shader network that will be used to delete/filter CHOP data but without the usual hit taken if done on the CPU and this will help greatly.

I have come up with a lot of different ways to solve different math problems like this using line geometry and chop inputs and measuring angles/transforming/scaling and whatnot but that doesn’t always translate to being able to write out a formula like this for the problem being solved.

I really feel like I’m close to understanding some of the core graphics related stuff like matrix operations and vectors but there is still a lot I have to learn. I am really interested in, yet rather confused about the use of matrix’s (matrices…?) in Touch. I have come to the conclusion that Touch is essentially one big matrix as it relates to geometry objects, SOP’s, 2D texture arrays, etc. I have been studying vector math and trying to learn as much as possible but when it comes to actually plugging some of these formulas into TD as a matrix I’m lost.

Part of it may be not completely understanding the math itself but I would really be interested in seeing some kind of visual example that uses a bunch of matrix operations and vector math and sort of explains the basics of how the data is organized. I’m interested in knowing how you would use the following commands for instance;

MATRIX-
rotate
mlookat
mlookatup
scale
rotaxis
invert

VECTOR-
vangle
vlength
vsize
normalize

I just don’t understand how it’s laid out. Even an example like taking a bunch of 3d points and showing how one would take those and arrange them into a matrix to do some kind of math operation on all of them as either 3D or 2D vectors…or an example of setting up a matrix that will translate, scale, and rotate one object to another objects coordinate space.

If anyone could provide an example of some of this stuff or point me towards some kind of awesome tutorial that would help me understand it a little better (especially as it relates to TD) it would be much appreciated.

~Matt

Hello. I’m interested into that kind of information too. I’m not aware of any resource on the subject which would be enough easy to understand for beginners but also digging into some practical aspects of 3D maths into a friendly-visual way.

Perhaps, the way to go is to learn about openGL in general. Here’s a site which presents some useful informations on the subject:
opengl-tutorial.org/

Hi Matt and ab30,

Actually I’m not good at math at all. Maybe I’m just good at googling a little bit. So, sorry to say but I don’t have clear idea for Matrix & Vector things etc. I used to try to understand math and OpenGL. I tried some tutorial from here.
[url]http://nehe.gamedev.net/[/url]

Having some knowledge about OpenGL is sometimes actually useful and I tried to use OpenFrameworks, Cocoa and did few iOS project etc. But In the end of the day I found myself much comfortable with graphical programming tool like Max, QuartzComposer and of course, TouchDesigner. When I use these tool, as you probably know, It’s always the best searching&reading forum and wiki. Derivative’s wiki and forum is really great. When I’ve got a project or idea I usually try to find solution from wiki or forum if there is not, I ask to google and I always try to stay away from difficult math or OpenGL things as much as possible.

That’s funny when the guy on the forum that figures out other peoples math problems says he is not good at math but rather googling. Perhaps being good at googling can also cause one to be just as good at math

I find that the internet is a pretty awesome place for learning as well. I think the main reason for that is because there are so many different examples/tutorials available that if you don’t understand the way one is presented you just skip to the next one. You can try out a few classes real quick and figure out what teacher explains it in a way that you actually understand.

I have stumbled onto a few different college websites for computer sciences and math where it looks like there are instructors that post all of the learning material for an entire course online.

hehe, but it’s true and I totally agre. internet is great!

I found some good stuff :mrgreen:

Check out these two software demos that show you visually about matrix types

songho.ca/opengl/files/matrixModelView.zip

songho.ca/opengl/files/matrixProjection.zip