Right angled triangles?

So I am to create a wedge parts that has an angle theta of 33 I have the angle how do I work out what the X and Y of the wedge needs to be in order for the angle to be thirty?

local theta = 33
local y = --What?
local z = --What?

I know the angle, and from the angle I need to work out the Z and Y sizes of the wedge part. How do I do this?

You need to have atleast 2 values to be able to resolve this, you currently have 1 which is theta,
Edit: Never mind you have 2 sorry,

What is the 2nd value? What do I need

You already know 2 of the angles, theta (33) and the right angle (90) , you would still need to give atleast a length. either x, y, z

1 Like

Okay so If my Y value is 10 then what will I have to do do get the Z value?

you would have to use trigonometry i suggest u reading about it

Look up how to solve a triangle given 2 angles and 1 side (AAS)

local sin, rad = math.sin, math.rad

local A = 33 -- Angle A
local B = 90 -- Angle B
local C = 180 - A - B -- Angle C

local a = 10 -- Y
local c = a * (sin(rad(C)) / sin(rad(A))) -- Z

print(c)
> ~15.399

Then set wedge size

Wedge.Size = Vector3.new(5, a, c)

1 Like

why are you using math.rad? I thought it used degrees? Because angles.

Also I cannot find any one right triangles they are all just on triangles.

It works on all triangles also math.rad converts degrees to radials which is roblox’s default input system for angles.

1 Like

The formulas for solving triangles use radians not degrees and you don’t need a right triangle one you already have two angles and a side (90 degrees, 33 degrees, and 10 units)

You should be able to just do

z = y/math.tan(math.rad(θ))

I guess that formula works but it’s pretty beefy

sin(180 - A - 90) is the same as cos(A), and sin(A)/cos(A) is just tan(A)

you don’t need to do this part, it isn’t going to affect performance

They probably do it for readability. Writing formulas that use lots of functions in the math library can be rough to read and understand sometimes.

Because in trig you use radians, not degrees.

the only difference is the removal of “math.”
they both still say sin and rad, so all this does it make the line shorter by a tiny bit

It looks more readable to me.

And also maybe they might be testing their code in an online calculator like Desmos, where pasting directly into the input boxes would be beneficial for debugging.

(I do this when working with math in my code to make sure it is correct)

local theta = math.rad(33) --Converts 33 degrees to radians
local y = math.sin(theta)
local z = math.cos(theta)
Wedge.Size = Vector3.new(1,y,z) --Hypotenuse will be of length 1

You can also multiply the size by a scalar if you desire. For example:

local s = 1/z
Wedge.Size = s * Vector3.new(1,y,z) --Z will be of length 1
1 Like

This is a nice website that shows you how:

https://www.omnicalculator.com/math/right-triangle-side-angle:

Quoted from the website:

How to find the sides of a right triangle

  1. Given angle and one leg

Find the missing leg using trigonometric functions:

  • a = b * tan(α)
  • b = a * tan(β)

How do you solve a right angle triangle with only one side?

To solve a triangle with one side, you also need one of the non-right angled angles . If not, it is impossible:

  1. If you have the hypotenuse , multiply it by sin(θ) to get the length of the side opposite to the angle.
  2. Alternatively, multiply the hypotenuse by cos(θ) to get the side adjacent to the angle.
  3. If you have the non-hypotenuse side adjacent to the angle, divide it by cos(θ) to get the length of the hypotenuse .
  4. Alternatively, multiply this length by tan(θ) to get the length of the side opposite to the angle.
  5. If you have an angle and the side opposite to it, you can divide the side length by sin(θ) to get the hypotenuse .
  6. Alternatively, divide the length by tan(θ) to get the length of the side adjacent to the angle.

I’m assuming you want to find the other lengths of the triangle with the hypotenuse (one side), which the second example listed from the website.

1 Like

Thank you, I did know how to do all this once but I have been wrapped up in many other things and have not done any trig in over a year. I am still trying to learn calculus right now.

Thank you everyone who commented trying to help. I have a much firmer understand of trig now than I did a year ago.