Season 00 Day 008 Stream – Math Crash Course – Trigonometry and Matrix Mult
Trig is the study and solution of triangles…or all angles
Starting with Trigonometry as it is a basic and good place to start vs. starting with linear algebra that creates lots of extra wasted calculations.
“You hear me mention custom nodes…doesn’t mean you don’t have to use custom nodes unless you need performance, but the math part is important for foundations”
Trigonometry
- Right triangle is where we start (triangle with 90 degree corner)
- degree vs. radian
- Also the “Why” of when unitConversion nodes show up as you connect a translate value to rotation.
- unitConversion nodes are normal maya nodes with some basic math (conversion factors) and change the type of the connection at the output (
- Scene used to display the functions is available at:
http://www.cultofrig.com/resources/re…
Maya 2016 and up.
- degree vs. radian
- Back to radians
- Radius of the circle R=1 means 1/2 is PI 3.14 so full raius is 2 PI R
- when you see radians the start of the circle is 0, end is 2 PI, half circle is 1/2 PI
- Degrees
- Circle is broken in to 360 values , 0, 90, 180, 270, 360
- The relationship between the two is PI = 180 so if you need to convert them 3.14/180 to convert so when you look in the unitConversion node you see this math happening.
When you create triangles from a unit circle you always get hypontus of 1, simplifying calculations.
function of an angle (works in radians always works between [-1,1]
- Sin
- Cos
- Tangent ( can be infinite)
Each function has an inverse
- arc sin
- arc cos
- arc Tangent
What do these do?
If we say the we get the Sin of the triangle leg, the Arc Sin will give us the Angle.
Given any axis, if you are rotating around Z for example , clockwise will be negative. This isn’t great so flip the mesh around so that the rotation will be positive.
*Do follow along in Maya with the example scene and also create with Raf.
- Build some primitives named
- sine
- cosine
- We will rotate the HY transform node (from the example file) and on its rotation to create an expression
skip from 30:00 to here to see 35.32 to see the expression work
in expression editor type sine.ty = sin(hy.rz) and click create
Rotate the hy node to see the SINE node translate up and down. Because the connection creates a unitConversion by default you can change the value in the unitConversion node to 1 to allow it to pass through to the SIN() in the expression with no rad/deg convert.
Next we create the cosine transform expression cosine.tx = cos(hy.rz) so we now have our nodes translating up and down and left and right as we rotate the HY node.
Behind the scenes in Maya when you take a “vector” and rotate it with Matrix Math.
If we connect the translate X from cosine and translate Y from sine to a new transform you can see that the new Transform (say a new sphere) you will get the same action as if a parent constraint on the new sphere following the HY node.
The combination of the Sin and Cos create a translation the spears to be a rotation.
Soh Cah Toa
For any giving angle there are two sides, (legs) adjacent, opposite and hypotenuse
S(?) = 0/h C(?)=a/h T(?)=o/a
Law of Sin and Law of Cosin 55:30
a/sinA = b/sinB = c/sinC
Law of cosines is the foundation for IK solvers like the 2 bone solver
“I mention all of this because when ever you are using Matrices because this is what you are doing under the hood a lot”
Matrix:
Linear field of numbers with sides
Vector for example is a single column Matrix.
What happens when the Matrix is not normal? 1:15
QA:
Why is this important?
Get involved:
Scene used to display the functions is available at:
http://www.cultofrig.com/resources/re…
Maya 2016 and up.
Follow me on twitter for announcements and news
https://twitter.com/ThE_JacO
Check out the calendar for up-to-date information and times
http://cultofrig.com/streamcalendar
Follow the Streams live on Twitch
https://www.twitch.tv/cultofrig/
And keep up to date with news on the website
http://www.cultofrig.com