Extracting values from a moving triangle
Hi there.
I'm pretty new to Jitter and would like to know if it is possible to create a triangle and move around one of its corners, while extracting the degree values from the three different angles.
And is it possible to draw lines inside that triangle and get the values of their length as an output?
If this doesn't work in Max, would you know of other ways / programming languages to do this?
Any help is much appreciated.
Josef
"if it is possible to create a triangle and move around one of its corners, while extracting the degree values from the three different angles."
Yes, i can imagine it's not trivial for a beginner though. Have a look at the last patch in the thread here to see how you can get the angle from two vectors.
https://cycling74.com/forums/patch-is-broken-in-8-but-works-fine-in-6
"And is it possible to draw lines inside that triangle and get the values of their length as an output?"
Yes, you can get the length of a vector inside Gen with "length". It's unclear to me what you mean by drawing lines "inside" of a triangle. I assume you want them cutoff at the edges? Also possible ofcourse, you need to find the intersectionpoint between two lines and implement that.
Are you familiar with Amazingmaxstuff on youtube? Great tutorials focussed on Jitter and i think there's some videos related to beginners as well.
https://www.youtube.com/c/AmazingMaxStuff/videos
if "extracting" means that you code the required calculations yourself, then it is absolutely possible.
"if "extracting" means that you code the required calculations yourself, then it is absolutely possible."
Above statement first ofcourse but there are ways to create a triangle without knowing or setting the angles beforehand.
Thanks a lot!
I should explain better what I need.
I'd like to create a fixed isosceles triangle with a middle line, like this:
Then I want to be able to move along the middle line and choose any point on it, let's say the middle:
Automatically a line should cross that middle point the bottom left corner, through the point, and further till it reaches the other side line. Now a line should be drawn vertically down till the middle line:
The ratio between the two lines a and b should be calculated
Then the new point on the middle line where a touches it, should be used to repeat the same process:
And on the other side a vertical line should be drawn from the middle point (red) on the middle line till the top side, and down to the bottom left corner:
Now I want to make the following calculation: A=(c/d)/(a/b), B=(a/b)/(e/f) and then X=A/B
I'd like to continue in both directions also creating more lines in the same manner and calculating the ratio's of those line in the same way.
Maybe this isn't something for MAX, but if it is, I'd like to know how to do it.
Cheers, Josef
Sure, i think you want to look at vector projection and point/line-intersection. It's a lot of math though!