Pythagorean Identity
basically, the pythagorean identity establishes that:
sin^2(?) + cos^2(?) = 1 (? being the angle measure / radians)
Which, if you, on a graphic calculator like desmos, were to graph
r = sin^2(?) + cos^2(?) (r standing for radius)
you would end up with a circle with radius 1
With that said, you could manipulate it so that you end up with a circle of any radius, for example, if you wanted a circle with radius a or radius 5, you could do:
r = asin^2(?) + acos^2(?)
r = 5sin^2(?) + 5cos^2(?)
Making the Code
local sPos = Vector3.new(1,0,2)
local function stud (theta)
local pos = Vector3.new(5*math.sin(theta),0, 5*math.cos(theta))
local finPos = sPos + pos
print((finPos - sPos).magnitude,"::",pos,"::",finPos,"::",math.deg(theta))
end
for i = 1, 360 do
stud(math.rad(i))
end
Or more simplfied:
local humanoid =
local theta = math.rad(69)
local sPos = Vector3.new(1,0,2)
local pos = Vector3.new(5*math.sin(theta),0,5*math.cos(theta))
local finPos = sPos + pos
print((finPos - sPos).magnitude)
humanoid:MoveTo(finPos)
Note that I did not do 5*math.sin(theta)^2 or 5*math.cos(theta) in that script
explanation
This is probably the part of the answer I'm going to be lambasted for due to incorrect terminology,so i recommend skipping this part, if you already know the math behind it. But nevertheless, I digress. Put simply, this works, because, essentially, and point on a circle is reachable with a right triangle.
For a certain angle measure ?, the hypotenuse is the radius of the circle(r), as it reaches from the center to the edge of the circle. the vertical side would be r* sin(?) and the horizontal side would be r*cos(?).
This, on a circle with radius 1 would mean that the hypotenuse is 1, the vertical side is sin(?) and the horizontal side is cos(?), using pythagorean theorem gives us the famous equation of
sin^2(?) + cos^2(?) = 1
Useful Links
Here is the part of the answer where you see people explain the concept far better than i did
MathBits
Khan Academy
Hopefully this helped!
2 comments
possibly try using pythagorean identity
I'm sorry, but I'm not really understanding this properly. Can you elaborate?