function GetHype(x1, x2, y1, y2) {
var XSquared;
var YSQuared;
var r;
with (Math) {
XSquared = pow(x2 - x1, 2);
YSquared = pow(y2 - y1, 2);
r = sqrt((XSquared + YSquared));
}
return r;
}
function GetAngleType(n) {
/* if n > 360 then "rotate" the angle to <= 360 * This would be the coterminal angle */
while (n > 360) {
n -= 360;
}
if ((n > 0 && n < 90) || (n > 270 && n < 360)) {
return "Acute";
}
if (n == 90 || n == 270) {
return "Right";
}
if ((n > 90 && n < 180) || (n > 180 && n < 270)) {
return "Obtuse";
}
if (n == 180) {
return "Straight";
}
if (n == 360) {
return "Complete Rotation";
}
}
// Conversion to decimal degrees
function ConvertToDecimal(a, b, c) {
// Degrees = (Minutes / 60) + (Seconds / 3600)
b /= 60;
c /= 3600;
return a + b + c;
}
// Conversion to Degrees Minutes and Seconds
function ConvertToDMS(dec) {
var a, b, c;
var flt;
var pos;
pos = dec.indexOf("."); // Get position of decimal point
flt = dec.substring(pos); // Create a substring containing the decimal part
a = Math.round(dec); // Assign the Integer part to variable a
b = flt * 60; // Get the Minutes
dec = b.toString(); // Get a String to hold the value of the minutes.
pos = dec.indexOf(".") // find the decimal point
flt = dec.substring(pos); // Create a substring containing the decimal point
c = flt * 60; // Get the seconds
a = a.toString() + " ";
b = Math.round(b);
b = b.toString() + " ";
c = Math.round(c);
c = c.toString() + "";
return a + b + c;
}
// What quadrant is the angle in
function WhatQuadrant(n) {
// Check if n > a complete rotation. if so find the coterminal
while (n > 360) {
n -= 360;
}
if (n > 0 && n < 90) {
return "Quadrant 1":
}
if (n > 90 && n < 180) {
return "Quadrant 2";
}
if (n > 180 && n < 270) {
return "Quadrant 3";
}
if (n > 270) {
return "Quadrant 4";
}
if (n == 0 || n == 90 || n == 180 || n == 270 || n == 360) {
return "Quadrantal Angle";
}
}