Advertisement
2_2002-2004 Math/ Dates #124017

Finding points on a circle using only degrees (Sine/Cosine)!

This tutorial shows how to find a point on a circle (with any radius), using only the degree of the point. It teaches the use of Sine and Cosine in doing so. A great tutorial if you are going to be manipulating circles!

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Now, I understand that some people may not know how to use Cosine and Sine to find the coordinates of dots on a circle, so I will explain it to the best of my ability. Here is a quick explanation. Now, you know that coordinates are shown in (X, Y), well, Cosine (Cos) finds the X and Sine (Sin) finds the Y. So really, you could think of Sine and Cosine as (Cosine, Sine). Don't get confused yet, lol, I will explain this further. Now, Cosine can be used to find the coordinates of a certain point by using the degrees of that point. Here is a quick example:
Cosine(Point_Degree) * Radius_Length = The X coordinate of that Point. And:
Sine(Point_Degree) * Radius_Length = The Y coordinate of that Point. Here is an example of finding the (X, Y) of a point with the degree measurement of 100°, and the circle has a radius of 5. To find the X:
Cos(100) * 5,
and to find the Y:
Sin(100) * 5.
Simple enough, right? I hope this little tutorial helps you understand the use of Sine and Cosine in finding the coordinates of a point on a circle.
I've also included my CSS code to demonstrate this tutorial.
<%
option explicit
'--------------------------------------------------------------------------------------
' Title : Print This Page Script
' Function: To print a section of a page
' In	 : Page URL (?ref=)
' Out  : Formatted page for prining
' By  : Peter Graves (ICQ - 116613728)
'
' Example : /print/thisscript.asp?ref=http://www.myweb.com/mypage.asp
'
' Notes : Could probably be improved, but for now it works
'
' To use : In your documents that you want to print wrap the content in
'   <sp> and </sp>  
'--------------------------------------------------------------------------------------
Dim RefPage, objXMLHTTP, HTMLPage
RefPage = Request.QueryString("ref")
if Len(RefPage) = 0 or not Left(RefPage,7) = "http://" then
	response.write "<h1>Invalid reference page - " & RefPage & "</h1>"
	response.end
end if
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
	objXMLHTTP.Open "GET", RefPage, False
	objXMLHTTP.Send
	HTMLPage = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
%>
<html>
<head>
<title><%=GetPageTitle(HTMLPage)%></title>
<link href="/include/style.css" rel="stylesheet" type="text/css">
</head>
<body onLoad="JavaScript:print();">
<%=GetPageBody(HTMLPage)%>
<%=RefPage%>
</body>
</html>
<%
Function GetPageBody(HTMLstring)
dim tag1, tag2, temp1, temp2
tag1 = "<sp>"
tag2 = "</sp>"
temp1 = Split(HTMLstring,tag1)
If not uBound(temp1) = 1 Then
	Response.Write "An Error Occured - please notify the webmaster about this page - " & RefPage
	response.end
End If
temp2 = Split(temp1(1),tag2)
If not uBound(temp2) = 1 Then
	Response.Write "An Error Occured - please notify the webmaster about this page - " & RefPage
	response.end	
End If
GetPageBody = temp2(0)
End Function
Function GetPageTitle(HTMLstring)
dim tag1, tag2, temp1, temp2
tag1 = "<title>"
tag2 = "</title>"
temp1 = split (HTMLstring, tag1)
temp2 = split (temp1(1), tag2)
GetPageTitle = temp2(0)
End Function
%>
Original Comments (3)
Recovered from Wayback Machine