WHAT THOSE TRIGONOMETRIC EXPRESSIONS ARE FOR?
|
|
You certainly have seen many times scripting expressions as cos() sin() and/or the even more mysterious asin() acos() and the alike. What are they for? What do they mean? An explanation for those who never found a clear explanation.
|
Before I explain what this file is about, you may want to consider that there is another file on this site which has a considerable amount of scripts all of them dealing with plotting distances, angles, directions, and coordinates of points after such data. Perhaps you may find there additional tools useful to you if you're to arrange online scripts meant to deal with client side trigonometry; such file is TRIGONOMETRIC PLOTTERS FOR THE WEB (click).
The simplest, the first geometrical figure which inscribes an area is a triangle.
This is, arguably, why triangles have always got such a prominent place in geometry: for they are the simplest area: therefore all objects whose amount of sides is higher than 3 (triangle), can contain triangles, for if triangles are the building brick of each area, they can be assembled to build all the other polygons.
By the way the formula to know how many triangles can be inscribed in a polygon until the first perfect saturation is achieved, is:
Sides_Of_Polygon - 2
So a square (4 sides) can include 4-2=2 triangles. An eptagon 8-2=6 square triangles.
As far as the matter of why a squared triangle (namely a triangle whose one angle measures exactly 90 degrees) has been chosen as the king of triangles among all the possible triangles (that is: why right a triangle whose one angle is precisely 90 degrees) is somewhat moot: we may argue it is just a convention, but then we'd wonder: why this convention and not, for instance, assuming as the conventional triangle a triangle whose one angle is, say, 72 degrees? Or maybe 12?
Nobody has a definitive explanation. Pythagoras chose so. Over time we're all to find that such convention is -exactly and indeed- the more convenient: which leaves utterly unresolved the main question: why a spacial disposition of a triangle with a 90 degrees angle was bound to prove itself so appropriate?
No satisfactory answer to this so far.
The main thing I can focus your attention upon is that 90 degrees means perpendicular and what is perpendicular? You may say: what is 90 degrees is perpendicular, and thenceforth enter a tautology (namely something which explains itself taking avail of itself!) in your definition. But perpendicular is most appropriately this: the shorter distance between a point and a line external to such point.
Get a sheet and draw a line, then drop a point. Now connect the point with the line by drawing a new line: you will find many oblique lines stretching from the dot to the line that can connect them, but only and exclusively one among these virtually infinite connections is the shortest of them all: the connection which, from the dot, is perpendicular to the original line you drew.
The only further thing I can say is that the 90 degree convention is what hints, in the triangle, to a cross: namely to a cartesian division of the space in coexistent sides: right and left, up and down (not third dimension, which may lead us to argue one division would have been enough: either up/down or right/left, but no apparent necessity to have both coexisting: for all the remaining pairs of spacial divisions may be yielded by performing a mere spherical rotation of one pair. This tantamount to imply there can be infinite right/left and up/down of... nothing).
None the less, such division could have been attained also by a st. Andrew cross, namely a cross which divides the space in 4 sectors but not by a 90 degree angle. The fact is, methinks: the 90 degree cross prevails on the st.Andrew cross for the former divides all the spaces in perfectly symmetrical areas/sectors.
You may wonder: why these areas have to be equal? Well, there is even a further question before that: why should we pursue divisions of space at all? What's the difference between right and left, and most of all right and left of what? I ignore these things, but I do can say to you that it seems not a mere invention: the biological DNA, in fact, seems to discriminate perfectly some thing which it regards left by some thing which it regards right: in fact the DNA spins (spatially arranges its bio molecules, that is) only rightward, and some of its components are tautomerical: same atoms but different spatial disposition: the DNA discriminates among them, and prefers only some dispositions out of several.
The only reason something can do that is that it reckons something like a reference point. My personal bet is that the only plausible reference point to a biological breed has to be something able to exert a magnetism bigger than the breed (in space and time both) is; and the only objects which meet these requirements are the stars and the planets: I dare say biomolecules are sensitive to gravity (consider that the nervous system and the skin originate from the very same ectodermic embryonal sheet: nature revelas so little that it would be utterly stupid to let any of the little it relinquishes unused: so this can not be casual to the least degree, but the contrary: this must hint to something so deep rooted that nature bound them -the nervous system and the skin- since the beginning of the human eve. Now, what has skin in common with the nervous system? I find the question ill posed, for it resigns nothing; conversely, if we ask ourselves the syllogism what has the nervous system in common with the skin we might deduce: probably it filters, like the skin does. What do they filter? Fresh air to make air conditioning? The nervous system filters something that the skin preceives and hands over... which delivers a shudder to your spine if you consider it for a while. Why persons whose skin has been consumed above some percentage die? No reason for this, for the skin is not a vital organ apparently. None the less, they die. I dare say because the skin filters something still unknown to us and hands it over to the nervous system, and that if this things handed over is not handed over any longer, the nervous system collapses so relevant this thing is to it. It must be something external to the being, because the skin is involved. It must be gravity from the planets and the stars).
Alternatively, it is said in the tautomers this capability to discriminate right from left can be a way to let a molecule act as a key with specific dents. True. But if this may explain something on isolated molecules (pretending we ignore the fact that there exist tautomers that, although identical in component differ just for a position, and this mere difference makes them act like two entirely different products), still explains nothing on the global rightward arrangement of the DNA.
On the whole we can only conclude: if there is something and it is on the left, it might be entirely different a thing than the very same thing, but moved on the... right, although it is the same thing.
|
Aria Giovanni
|
ROUND, UP, DOWN, RIGHT, LEFT, IN, OUT |
|
LEFT, RIGHT, AND A MIRROR IN A M. C. ESCHER DRAWING
|
|
CAN YOU TELL WHETHER THE ROAD'S GOING UP OR DOWN IN THIS M. C. ESCHER DRAWING?
|
BATS OR ANGELS, IN THIS M. C. ESCHER DRAWING?
|
|
TRIANGLES, DARK BIRDS, WHITE HORSES, DARK FISH, OR WHITE BIRDS, IN THIS M. C. ESCHER DRAWING?
|
|
innavoiG airA
|
Now, dealing with square triangles, whatever rule we may device which affects them, is a rule which is going to help us to dissect bigger polygons (whatever area, that is) as well, for each polygon can be divided into a specific amount of triangles. By dividing, I mean the first set of triangles that can be produced attaining full saturation of the polygon, for every triangle (square triangles themselves included) can be transformed into two square triangles if you just draw in it from one of its apex a perpendicular to the other side which fully crosses the triangle in within; but I stressed the first produced set; for, obviously enough, if you start drawing lines also inside the firstly produced triangles, in order to divide them as well, you could easily end up packing inside a polygon an infinite amount of square triangles!
I give as certain that you know the Pythagorean theorem, namely that given two sides of a square triangle which are not the hypotenuse, the hypotenuse is given by:
side1^2 + side2^2 = hypotenuse^2
Conversely, if you know the hypotenuse and one side, the remaining side length is given by:
hypotenuse^2 - side^2 = otherSide^2
In the snippet function above if you pass the hypotenuse, you have to pass it as the first argument and then pass a third argument named isHypotenuse: instances:
pythagorean(3,4) //returns hypotenuse length, sqrt applied.
pythagorean(5,4,0,1) //returns missing side, sqrt applied. Note the third argument must be passed anyway in this latest case (it would have been the rounder: rounds by 10 by default, if you pass 100 rounds by 2 digits, if 1000 rounds by 3 digits and so on... zero tantamount to ten!)
Among the most relevant rules, aside from the above, that we can learn on square triangles, is that there is a ratio in them: if two sides are of a certain length, you can plot the remaining one.
Also, if some angles subtend the triangle of some bigger or lesser amount and you know the length of one side, there are still ratios as well and you can plot out the other sides and angles as well (all this always bearing in mind the underlying implication is that we're positive we're dealing with square triangles).
Sine, cosine, tangent, to name a few, are just some of the conventional names that have been chosen to represent some of these ratios.
|
Let's imagine we're working with a square triangle whose sides have the following names and measurements:
S=10
L=32
H=34.4
(S=shorter side, L=long side, H=hypotenuse, the longest side)
The angles could be conceived/named as follows:
between L and S: α (alpha: the 90 degree one, actually!)
between L and H: β (beta: 17 degrees in our case)
between H and S: γ (gamma: 73 degrees in our case)
What you must bear in mind, is that each of these angles can also be quite legitimately viewed as opposite/adjacent each of the two less long S L sides, while the hypotenuse H, distinguishing itself like the longest side in the triangle, is let undisturbed and plays a role on its own. This outlook is exactly the one implemented for sines cosines and the alike as we're to see.
Anyway, instance:
α is adjacent to L and S, being the square angle the two meeting sides form
β is adjacent to L, opposite to S
γ is adjacent to S, opposite to L
|
Hypotenuse H removed for readability of symbols;
imagine it in place as the side joining γ with β
|
|
There are a lot of possible relations between these values S L H α β γ.
If you know which these relations are, you can work out missing data on triangles.
Consider in fact the case where, in our triangle above, you may know only the length of S and the degrees of angle γ: guess what, you can work out all the rest: in fact, there can be only one triangle with precise measurements, whose smaller side's length is equal to S and whose S adjacent angle γ is a given value.
Do try, for instance, to watch the image above and imagine to enlarge the γ angle, or to make it shrink (namely changing the degrees of γ while segment S remains the same length): the hypotenuse H would be going to meet the side L in different locations, thus enlarging/shrinking the whole triangle. There we go, this mere fact/consideration means and clearly implies that such a relation as the one entertained between [angle γ, side S] and all the alike relations between the other angles and the other sides, in all the combinations you may device out, dictate also all the others relations measurements.
A powerfully consequence ridden observation indeed, don't you think so? Thenceforth the importance of sines cosines and the alike which you might have been wondering thus far.
It has been found, conversely and for instance, that specific ratios between two sides can, alike the reasoning of the example above, be consistent only with specific degrees in square triangles.
Therefore the paramount implication with all this, is that we've found a double representation for angles: they can be represented as degrees, or as a ratio as well. As long as we're in a square triangle, also length can be described in a twofold way: as the ratios they belong to, or as the degrees of angles that are fit to subtend them given the ratio they belong to.
Sines cosines and the alike are therefore a matter of ratios vs degrees. Therefore if you know these formulas, by merely knowing the length of one side and one angle's amplitude, you can find out all the remaining data of the given triangle. And since triangles are the basic components of all the polygons, by sines and cosines and the alike you can eventually plot out all the dimensions of whatever polygon in the world, provided you split it into triangles.
So there we go, such specific degrees of a triangle's angles as they appear associated to ratios of sides, are the group of:
-
Sine: it is the ratio Opposite Side / Hypotenuse which goes associated with a specific amount of degrees in one angle. Which angle? As outlined above, the angle opposite to a picked side involved in the ratio. Therefore we can have more than one Sine, depending on which side is opposite by the angle you chose to calculate the ratio from.
- Cosecant: it is the ratio Hypotenuse / Opposite Side which goes associated with a specific amount of degrees in one angle. Which angle? As outlined above, the angle opposite to a picked side involved in the ratio. Therefore we can have more than one Cosecant, depending on which side is opposite by the angle you chose to calculate the ratio from.
- Cosine: it is the ratio Adjacent / Hypotenuse which goes associated with a specific amount of degrees in one angle. Which angle? As outlined above,the angle adjacent to a picked side involved in the ratio. Therefore we can have more than one sine, depending on which side is adjacent to the angle you chose to calculate the ratio from.
- Secant: it is the ratio Hypotenuse / adjacent which goes associated with a specific amount of degrees in one angle. Which angle? As outlined above, the angle adjacent to a picked side involved in the ratio. Therefore we can have more than one Secant, depending on which side is adjacent to the angle you chose to calculate the ratio from.
- Tangent: it is the ratio Opposite Side / Adjacent which goes associated with a specific amount of degrees in one angle. Which angle? As outlined above, the angle opposite or adjacent to a picked side involved in the ratio. Therefore we can have more than one Tangent, depending on which side is opposite by and adjacent to the angle you chose to calculate the ratio from.
- Cotangent: it is the ratio adjacent / Opposite Side which goes associated with a specific amount of degrees in one angle. Which angle? As outlined above, the angle opposite or adjacent to a picked side involved in the ratio. Therefore we can have more than one Cotangent, depending on which side is opposite by and adjacent to the angle you chose to calculate the ratio from.
Therefore such grouping above is the grouping of the representation of an angle compass not by degrees but by... ratios!
One thing I want you to bear in mind as soon as possible is this: whereas an expression like: sine (or whichever of the above) means a ratio (and we're soon to see which ration: that is, between which sides of a triangle), another expression like: calculating the sine (or whichever of the above) would paradoxically (apparently paradoxically, but certainly confusing enough) mean: compute the ratio out of the given degrees.
So a sine (for instance) is a ratio, and is a side/anotherSide. Calculating it means knowing the degrees, and wanting to get out of them the corresponding ratio. This is why in digital statements meant to compute sines, the argument needed by the function (for instance) cosine are the degrees (not the ratios: the ratios are what is returned as a result):
Math.cos(DEGREES) //yields the corresponding ratio!
Once you know that an angle can be represented as a ratio or by degrees as well, and you've found you can work out ratios from degrees, you have implicitly defined the need of the converse operations; namely those operations that, from a ratio can tell the corresponding degree. Such functions belong to the (until today probably mysterious) set of the arcsine, arccosine and the alike functions.
Such ratios as they appear associated to degrees (the inverse process than above, indeed!), are:
- Arc Sine: it tells an angle from the ratio oppositeSide / Hypotenuse. The angle whose amplitude is given, is the one which opposites the side grabbed as the "opposite" side to that angle.
- Arc Cosine: it tells an angle from the ratio adjacent / Hypotenuse. The angle whose amplitude is given, is the one which is adjacent to the side grabbed as the "adjacent" side to that angle.
- Arc Tangent: it tells an angle from the ratio oppositeSide / adjacent. The angle whose amplitude, is given is the one which opposites the side grabbed as the "opposite" side to that angle and which at the same time results being adjacent to the side grabbed as its "adjacent" one.
- Expressions like Arc-Cosecant, Arc-Secant, Arc-Cotangent are not used, actually. Nothing would prevent them from existing, but as we're to see, they can be deduced also by simply using the already abundant relations drawn above.
Therefore once we see that when we use the digital expressions using the arc-family, what we need is to use the RATIOS as arguments, in order to have the amount of DEGREES returned:
Math.acos(RATIO) //yields the corresponding degrees!
Now, one by one, here is what each of the above precisely are.
For each of them also all the equations that can be derived are reported; in fact, if you say that:
sine=OppositeSideOfAnAngle / Hypotenuse
you've implicitly said as well that:
OppositeSideOfAnAngle= sine(of the angle OPPOSED) * Hypotenuse
Namely if you know a ratio (a sine in this case) and an Hypotenuse, you can know the length of the side which opposes to the angle that sine has been drawn from. It doesn't matter whether you're going to use this or not: what matters is that all these formulas can be derived, so why hiding them from you?
FROM DEGREES TO RATIOS
[by oppositeSide is meant oppositeSide(toSomeAngle)
by adjacent is meant (side)adjacent(toSomeAngle)]
|
SINE It is a ratio. sine=Math.sin(degrees)
|
Returns the following ratio given an angle's degrees:
Opposite Side / Hypotenuse
sine = (oppositeSide / Hypotenuse)
oppositeSide = (sine * Hypotenuse)
Hypotenuse = (oppositeSide / sine)
|
COSINE It is a ratio. cosine=Math.cos(degrees) |
Returns the following ratio given an angle's degrees:
Adjacent / Hypotenuse
cosine = (adjacent / Hypotenuse)
adjacent = (cosine * Hypotenuse)
Hypotenuse = (adjacent / sine)
|
TANGENT It is a ratio. tangent=Math.tan(degrees) |
Returns the following ratio given an angle's degrees:
Opposite Side / Adjacent
tangent = (oppositeSide / adjacent)
oppositeSide = (tangent * adjacent)
adjacent = (oppositeSide / tangent)
|
COSECANT It is the ratio inverse of sine. cosecant=1/(Math.sin(degrees))
|
Returns the following ratio given an angle's degrees:
Hypotenuse / Opposite Side
cosecant = (Hypotenuse / oppositeSide)
Hypotenuse = (cosecant * oppositeSide)
oppositeSide = (Hypotenuse / cosecant)
|
SECANT It is the ratio inverse of cosine. secant=1/(Math.cos(degrees))
|
Returns the following ratio given an angle's degrees:
Hypotenuse / adjacent
secant = (Hypotenuse / adjacent)
Hypotenuse = (secant * adjacent)
adjacent = (Hypotenuse / secant)
|
COTANGENT It is the ratio inverse of tangent. cotangent=1/(Math.tan(degrees))
|
Returns the following ratio given an angle's degrees:
adjacent / Opposite Side
cotangent = (adjacent / oppositeSide)
adjacent = (cotangent * oppositeSide)
oppositeSide = (adjacent / cotangent)
|
FROM RATIOS TO DEGREES
|
ARC SINE It is degrees from ratio (a sine). degrees=Math.asin(ratio) |
Returns an angle's degrees given the following ratio:
oppositeSide / Hypotenuse
arcSine =(oppositeSide / Hypotenuse)
oppositeSide = (arcSine * Hypotenuse)
Hypotenuse = (oppositeSide / arcSine)
|
ARC COSINE It is degrees from ratio (a cosine). degrees=Math.acos(ratio) |
Returns an angle's degrees given the following ratio:
arcCosine = adjacent / Hypotenuse
arcCosine = (adjacent / Hypotenuse)
adjacent = (arcCosine * Hypotenuse)
Hypotenuse = (adjacent / arcCosine)
|
ARC TANGENT It is degrees from ratio (a tangent). degrees=Math.atan(ratio) |
Returns an angle's degrees given the following ratio:
arcTangent = oppositeSide / adjacent
arcTangent = (oppositeSide / adjacent)
oppositeSide = (arcTangent * oppositeSide)
oppositeSide = (oppositeSide / arcTangent)
|
ARC COSECANT It is degrees from inverse of a ratio (a sine). degrees=Math.asin(1/ratio)
|
Returns an angle's degrees given the following ratio:
arcCosecant = Hypotenuse / Opposite Side
arcCosecant = (Hypotenuse / oppositeSide)
Hypotenuse = (arcCosecant * oppositeSide)
oppositeSide = (Hypotenuse / arcCosecant)
|
ARC SECANT It is degrees from inverse of a ratio (a cosine). degrees=Math.acos(1/ratio)
|
Returns an angle's degrees given the following ratio:
arcSecant = Hypotenuse / adjacent
arcSecant = (Hypotenuse / adjacent)
Hypotenuse = (arcSecant * adjacent)
adjacent = (Hypotenuse / arcSecant)
|
ARC COTANGENT It is degrees from inverse of a ratio (a tangent). degrees=Math.atan(1/ratio)
|
Returns an angle's degrees given the following ratio:
arcCotangent = adjacent / Opposite Side
arcCotangent = (adjacent / oppositeSide)
adjacent = (arcCotangent * oppositeSide)
oppositeSide = (adjacent / arcCotangent)
|
BONUS FUN: CALCULATE THEM ON YOUR INPUTS!
|
|
Open a copy of this very same page on a new window (for comparative purposes of multiple threads):
|
MEANING OF SYMMETRY AS RECURSION OF RATIOS
|
|
Perhaps you've heard before that sine and cosine and the alike are recurrent functions, like waves have a max and a min peaks and then repeat such pattern forever: what does it mean?
|
Trigonometric functions are called recursive. What does this mean, and why whenever you see this explanation you see a circle involved?
As far as the presence of a circle is concerned, remember that sine, cosine, tangents, cotangents, arcsine and the alike, all mean ratios (of segments, of lengths) versus angle degrees, and all their possible reciprocal conversions. So, since angles are implied, it makes sense to cross all the 360 possible degrees that describe all the possible angles, and by a whole tour of them see what appens at every particular instance. And since 360 is positively a round trip along all the possible angles, thence the entailment of the circle.
As far as what being recursive means, consider the following image:
I am positive over time you're to get more and more fascinated by sines and trigonometrical functions; two last things we have to stress:
- The amount of degrees related to specific ratios, is not a ratio itself: in other words, such amounts of degrees have been found under a strictly empirical basis; therefore you need the so called Trigonometric Tables if you want to know them manually, whereas computers have such tables obviously included within their engines.
- Most mathematical functions which inside computers are meant to handle trigonometric functions, are suited to accept all degrees only expressed in the so called radians, which is a different unit of measure for measuring angles.
Radians: Given a circumference, a radian is the measure of the angle at the center of the circumference, when such angle is subtended by two radius each of which has a length equal to the arc [an arc is a curved segment on/of the circumference] they subtend.
Read it twice or thrice and positively you're to get it! Otherwise spread your fingers as to signify V for Victory: if you can spread them such that the uppermost space between them is equal to the length of one finger (let's suppose both fingers have equal lengths, ok...?), then the angle the two fingers form at conjunction with your hand is precisely... one radian!
This matter of the radians as the default unit used in trigonometric informatic functions, applies as far as the returned results and the required arguments both are concerned. Therefore to convert between radians and degrees, you may want to keep in mind these constants:
- From RADIANS to DEGREES:
multiply the radians by 57.296 (180/π actually)
or alternatively divide the radians by 0.01745 (π/180 actually)
- From DEGREES to RADIANS:
multiply the degrees by 0.01745
or alternatively divide the degrees by 57.296
VERY IMPORTANT RULES ON TRIANGLES
|
|
Approaching the hard stuff, some rules that may help you.
|
Given what I exposed above, you may not be surprised knowing a lot of rules and formulas have been found over time involving trigonometrical functions.
One important thing I want you to keep in mind is this: in a triangle, no matter whether square or not, the longest side is opposed by the wider angle, the smaller side is opposed by the smaller angle, and consequently the remaining one is opposed by the midway ranging angle.
The importance of such rules is going to be critical in those cases where even dividing a polygon in triangles, you don't know enough data on these triangles to plot out something of them.
Other two relevant rules used to solve triangles (namely finding their sides' lengths and their angles out of limited information) and which apply to whatever type of triangle 8that is, not just square ones) are the following ones: given three sides [a,b,c] and their corresponding angles (by corresponding it is meant the angle opposite the given side) named [A,B,C]
a^2 = b^2 + c^2 + (2*b*c*cos(A))
b^2 = a^2 + c^2 + (2*a*c*cos(B))
c^2 = b^2 + a^2 + (2*b*a*cos(C))
You may note they're actually variations on the pythagorean theorem. By cos(angle) it is meant that if you know the angle, you must draw from that the relative cosine.
Also:
a/sen(A) = b/sen(B) = c/sen(C)
Such formula implies that if you know, for instance, two sides and one angle, you can work out all the rest: instance: if
a/sen(A) = b/sen(B)
then
sen(A)=a*sen(B)/b
This would, for instance, let you find out of two known sides (a,b) and one known angle B the ratio represented by sen(A). Once you have such ratio, you can find the corresponding angle by using such yielded ratio as an argument of the functions meant to transform a ratio into its an angle, namely in this case arcsine(ratio).
This is the way these powerful formulas can be used.
Also:
a/b = sen(A)/sen(B)
b/c = sen(B)/sen(C)
c/a = sen(C)/sen(A)
Now let me introduce you to the test form where I feature the 5 scripts by which you can plot out all the sides and angles of a triangle by knowing either:
- ONE side and TWO angles (both adjacent to the side): name of the function: :
- TWO sides and the INCLUDED angle: name of the function:
- THREE sides: name of the function:
- TWO sides and ONE angle OPPOSITE one of those sides: name of the function:
If you find the names of the functions a bit long, you can change them, but they are descriptive. It is useful to stress that if the only thing of a triangle you know are its three angles, that won't suffice to plot an unique triangle, for given a certain amplitude, the lengths of the segments subtending such amplitudes can be infinite and the only thing they'd have to respect would just be the ratio (sen(A), sen(B), sen(C)).
All these functions return the results as follows: in case something went awry, like unsufficient or wrong arguments, they return false
Otherwise they return an Array of three entries [0], [1], [2] whose each entry is an Array itself holding two entries: the first the length of the side, the second the measurement of the angle opposite that side.
So if as an example you type:
var foo = sides3(30,78,84)
the foo can let you address the amplitude of the first angle of the first side as:
foo[0][1]
The argument named inRadians has to be passed as 1 if you mean to instruct the function to accept inputs in radians and therefore return them in radians as well. My suggestion is to pass angles in degrees, without therefore setting the inRadians argument (or passing it as zero).
Moreover, all functions have a rounder argument which defaults to 10 and which as such rounds by one digit; to round by, say, 4 digit, pass it as 10000, and to exclude decimals pass it as one.
In the test form the first thing you may want to do is to custom the dimensions of a test triangle, to be sure you pass to the test slots for the arguments only data consistent with actual triangles (it is important to understand that you cannot pass to such functions entirely arbitrary values as arguments, but arguments with are consistent data on some triangle you know something about and you want to know more).
Last but not least, if you're wondering what these scripts may be for, you're then wondering what trigonometry is for. Actually, once of its best applications is to work out lengths between points in a polygonal area or to calculate heights.
I consider it extremy useful that now such functions are available for the first time not only in such comprehensive a way but with a scripting language so widely popular and so easily bent to be implemented elsewhere. As you may already know I script entirely alone so if you by chance you find a bug let me know.
Anyway the best way to test if these scripts suit your needs is -guess what- precisely to test them with my test forms.
Have fun.
|
CREATE A STANDARD TRIANGLE |
CUSTOM THE 3 FIELDS BELOW [ to avoid misunderstandings: the following is not necessarily a square triangle! ] |
|
side 1 »
side 2 »
angle (in degrees) in between sides »
|
side 3 »
angle 2 »
angle 3 »
[allow editing even of these? » ]
[instantaneous propagate of all values to forms below? » ]
|
|
|
3 SIDES |
|
|
1 SIDE 2 ANGLES |
To use this function effectively the two angles must be both the ones adjacent to the side, not one adjacent and one opposite.
IIf you know one opposite and one adjacent, remember that to work out the remaining one you just have to subtract 180-(angle1+angle2) This positively yields the third angle, and therefore you can correctly say that you're then using the right (both adjacent, that is) angles and consequently pass them as valid arguments.
|
2 SIDES 1 INCLUDED ANGLE |
To use this function effectively the angle must be one included in between the two sides.
|
2 SIDES 1 OPPOSED ANGLE |
To use this function effectively the angle must be one opposed and not the one in between the sides.
For trigonometric reasons that would be too long to investigate here, there is at least one case when, with such settings, the possible triangles apparently meeting the conditions (that is: having that sides' lengths and one angle of such dimensions) could be as many as 2.
If this happens, the function returns an array of as many as 6 entries instead than just 3: the entries from index 0 to 2 carrying all the references to one triangle (still as 2 entries Arrays), the entries from index 3 to 5 carrying all the references to the second possible triangle (still as 2 entries Arrays): if this occurs, it is unavoidably up to you to choose which triangle looks consistent with your needs. In all other cases the functions returns (if not false) the usual 3 entries array of array.
|
If you want to use these scripts to work out inclinations and length of vectors (that is, graphic representations of physic forces pulling an object), all you have to do is to collect all the data (knowing the length of the segment, whereas in such cases the length of such segments called vectors represents the intensity of the force, and knowing the angle they form in between) by applying onto them first the script:
sides2Angles1In(vectorLenght1, vecorLength2, angle)
and then just repeat it on the supplementary angle (supplementary means the angle that added to the given one forms 180 degrees):
sides2Angles1In(vectorLenght1, vecorLength2, 180-angle)
This procedure will give to you among all the rest (angles and so on) also the length of both the diagonals of the parallelogram that inscribes the triangle!
|