mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2026-02-07 20:49:19 +00:00
Merge pull request #1891 from RAMilewski/master
Fix trigonometry alias problem
This commit is contained in:
commit
ffa493b74d
1 changed files with 253 additions and 103 deletions
|
|
@ -13,7 +13,7 @@ _BOSL2_TRIGONOMETRY = is_undef(_BOSL2_STD) && (is_undef(BOSL2_NO_STD_WARNING) ||
|
|||
echo("Warning: triginometry.scad included without std.scad; dependencies may be missing\nSet BOSL2_NO_STD_WARNING = true to mute this warning.") true : true;
|
||||
|
||||
|
||||
// Section: 2D General Triangle Functions
|
||||
// Section: General Triangle Functions
|
||||
|
||||
|
||||
// Function: law_of_cosines()
|
||||
|
|
@ -25,10 +25,10 @@ _BOSL2_TRIGONOMETRY = is_undef(_BOSL2_STD) && (is_undef(BOSL2_NO_STD_WARNING) ||
|
|||
// c = law_of_cosines(a, b, C=);
|
||||
// Description:
|
||||
// Applies the Law of Cosines for an arbitrary triangle. Given three side lengths, returns the
|
||||
// angle in degrees for the corner opposite of the third side. Given two side lengths, and the
|
||||
// angle between them, returns the length of the third side.
|
||||
// Figure(2D):
|
||||
// stroke([[-50,0], [10,60], [50,0]], closed=true);
|
||||
// reference angle in degrees for the corner opposite of the third side. Given two side lengths, and the
|
||||
// reference angle between them, returns the length of the third side.
|
||||
// Figure(2D;NoAxes;VPD=200;VPT=[0,25,20]):
|
||||
// stroke([[-50,0], [10,60], [50,0]], closed=true, width=2);
|
||||
// color("black") {
|
||||
// translate([ 33,35]) text(text="a", size=8, halign="center", valign="center");
|
||||
// translate([ 0,-6]) text(text="b", size=8, halign="center", valign="center");
|
||||
|
|
@ -44,7 +44,7 @@ _BOSL2_TRIGONOMETRY = is_undef(_BOSL2_STD) && (is_undef(BOSL2_NO_STD_WARNING) ||
|
|||
// b = The length of the second side.
|
||||
// c = The length of the third side.
|
||||
// ---
|
||||
// C = The angle in degrees of the corner opposite of the third side.
|
||||
// C = The reference angle in degrees of the corner opposite of the third side.
|
||||
function law_of_cosines(a, b, c, C) =
|
||||
// Triangle Law of Cosines:
|
||||
// c^2 = a^2 + b^2 - 2*a*b*cos(C)
|
||||
|
|
@ -62,11 +62,11 @@ function law_of_cosines(a, b, c, C) =
|
|||
// b = law_of_sines(a, A, B=);
|
||||
// Description:
|
||||
// Applies the Law of Sines for an arbitrary triangle. Given two triangle side lengths and the
|
||||
// angle between them, returns the angle of the corner opposite of the second side. Given a side
|
||||
// length, the opposing angle, and a second angle, returns the length of the side opposite of the
|
||||
// second angle.
|
||||
// Figure(2D):
|
||||
// stroke([[-50,0], [10,60], [50,0]], closed=true);
|
||||
// reference angle between them, returns the reference angle of the corner opposite of the second side. Given a side
|
||||
// length, the opposing reference angle, and a second reference angle, returns the length of the side opposite of the
|
||||
// second reference angle.
|
||||
// Figure(2D;NoAxes;VPD=200;VPT=[0,25,0]):
|
||||
// stroke([[-50,0], [10,60], [50,0]], closed=true, width=2);
|
||||
// color("black") {
|
||||
// translate([ 33,35]) text(text="a", size=8, halign="center", valign="center");
|
||||
// translate([ 0,-6]) text(text="b", size=8, halign="center", valign="center");
|
||||
|
|
@ -79,10 +79,10 @@ function law_of_cosines(a, b, c, C) =
|
|||
// }
|
||||
// Arguments:
|
||||
// a = The length of the first side.
|
||||
// A = The angle in degrees of the corner opposite of the first side.
|
||||
// A = The reference angle in degrees of the corner opposite of the first side.
|
||||
// b = The length of the second side.
|
||||
// ---
|
||||
// B = The angle in degrees of the corner opposite of the second side.
|
||||
// B = The reference angle in degrees of the corner opposite of the second side.
|
||||
function law_of_sines(a, A, b, B) =
|
||||
// Triangle Law of Sines:
|
||||
// a/sin(A) = b/sin(B) = c/sin(C)
|
||||
|
|
@ -93,117 +93,152 @@ function law_of_sines(a, A, b, B) =
|
|||
|
||||
|
||||
|
||||
// Section: 2D Right Triangle Functions
|
||||
// Section: Right Triangle Functions
|
||||
// This is a set of functions to make it easier to perform trig calculations on right triangles.
|
||||
// In general, all these functions are named using these abbreviations:
|
||||
// - **ang**: The reference reference angle size in degrees.
|
||||
// - **hyp**: The length of the Hypotenuse.
|
||||
// - **adj**: The length of the side adjacent to the angle.
|
||||
// - **opp**: The length of the side opposite to the angle.
|
||||
// - **ang**: The angle size in degrees.
|
||||
// - **adj**: The length of the side adjacent to the reference reference angle.
|
||||
// - **opp**: The length of the side opposite to the reference reference angle.
|
||||
// .
|
||||
// If you know two of those, and want to know the value of a third, you will need to call a
|
||||
// function named like `AAA_BBB_to_CCC()`. For example, if you know the length of the hypotenuse,
|
||||
// and the length of the side adjacent to the angle, and want to learn the length of the side
|
||||
// opposite to the angle, you will call `opp = hyp_adj_to_opp(hyp,adj);`.
|
||||
// Figure(2D):
|
||||
// and the length of the side adjacent to the reference reference angle, and want to learn the length of the side
|
||||
// opposite to the reference reference angle, you will call `opp = hyp_adj_to_opp(hyp,adj);`.
|
||||
// Figure(2D;NoAxes;VPD=250:VPT=[10,25,0]):
|
||||
// color("brown") {
|
||||
// stroke([[40,0], [40,10], [50,10]]);
|
||||
// left(50) stroke(arc(r=37,angle=30));
|
||||
// }
|
||||
// color("lightgreen") stroke([[-50,0], [50,60], [50,0]], closed=true);
|
||||
// color("lightgreen") stroke([[-50,0], [50,60], [50,0]], closed=true, width=2);
|
||||
// color("black") {
|
||||
// translate([ 62,25]) text(text="opp", size=8, halign="center", valign="center");
|
||||
// translate([ 0,-6]) text(text="adj", size=8, halign="center", valign="center");
|
||||
// translate([ 0,-7]) text(text="adj", size=8, halign="center", valign="center");
|
||||
// translate([ 0,40]) text(text="hyp", size=8, halign="center", valign="center");
|
||||
// translate([-25, 5]) text(text="ang", size=7, halign="center", valign="center");
|
||||
// }
|
||||
|
||||
|
||||
// Function: hyp_opp_to_adj()
|
||||
// Alias: opp_hyp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the lengths of the hypotenuse and the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = hyp_opp_to_adj(hyp,opp);
|
||||
// adj = opp_hyp_to_adj(opp,hyp);
|
||||
// Description:
|
||||
// Given the lengths of the hypotenuse and opposite side of a right triangle, returns the length
|
||||
// of the adjacent side.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// Example:
|
||||
// hyp = hyp_opp_to_adj(5,3); // Returns: 4
|
||||
// adj = hyp_opp_to_adj(5,3); // Returns: 4
|
||||
function hyp_opp_to_adj(hyp,opp) =
|
||||
assert(is_finite(hyp+opp) && hyp>=0 && opp>=0,
|
||||
"Triangle side lengths should be a positive numbers." )
|
||||
sqrt(hyp*hyp-opp*opp);
|
||||
|
||||
|
||||
// Function: opp_hyp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the lengths of the opposite side and the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = opp_hyp_to_adj(opp,hyp);
|
||||
// Description:
|
||||
// Given the lengths of the opposite side and hypotenuse of a right triangle, returns the length
|
||||
// of the adjacent side.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// adj = opp_hyp_to_adj(3,5); // Returns: 4
|
||||
function opp_hyp_to_adj(opp,hyp) = hyp_opp_to_adj(hyp,opp);
|
||||
|
||||
|
||||
// Function: hyp_ang_to_adj()
|
||||
// Alias: ang_hyp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the length of the hypotenuse and the angle.
|
||||
// Synopsis: Returns the adjacent side length from the length of the hypotenuse and the reference reference angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = hyp_ang_to_adj(hyp,ang);
|
||||
// adj = ang_hyp_to_adj(ang,hyp);
|
||||
// Description:
|
||||
// Given the length of the hypotenuse and the angle of the primary corner of a right triangle,
|
||||
// Given the length of the hypotenuse and the reference reference angle of a right triangle,
|
||||
// returns the length of the adjacent side.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// Example:
|
||||
// adj = hyp_ang_to_adj(8,60); // Returns: 4
|
||||
function hyp_ang_to_adj(hyp,ang) =
|
||||
assert(is_finite(hyp) && hyp>=0, "Triangle side length should be a positive number." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The reference angle should be an acute reference angle." )
|
||||
hyp*cos(ang);
|
||||
|
||||
// Function: ang_hyp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the reference reference angle and the length of the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = ang_hyp_to_adj(ang,hyp);
|
||||
// Description:
|
||||
// Given the reference reference angle and the length of the hypotenuse of a right triangle,
|
||||
// returns the length of the adjacent side.
|
||||
// Arguments:
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// adj = ang_hyp_to_adj(60,8); // Returns: 4
|
||||
function ang_hyp_to_adj(ang,hyp) = hyp_ang_to_adj(hyp, ang);
|
||||
|
||||
|
||||
// Function: opp_ang_to_adj()
|
||||
// Alias: ang_opp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the length of the opposite side and the angle.
|
||||
// Synopsis: Returns the adjacent side length from the length of the opposite side and the reference reference angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = opp_ang_to_adj(opp,ang);
|
||||
// adj = ang_opp_to_adj(ang,opp);
|
||||
// Description:
|
||||
// Given the angle of the primary corner of a right triangle, and the length of the side opposite of it,
|
||||
// Given the length of the opposite side and the reference reference angle of a right triangle,
|
||||
// returns the length of the adjacent side.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// Example:
|
||||
// adj = opp_ang_to_adj(8,30); // Returns: 4
|
||||
// adj = opp_ang_to_adj(8,45); // Returns: 8
|
||||
function opp_ang_to_adj(opp,ang) =
|
||||
assert(is_finite(opp) && opp>=0, "Triangle side length should be a positive number." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The reference angle should be an acute reference angle." )
|
||||
opp/tan(ang);
|
||||
|
||||
// Function: ang_opp_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the reference reference angle and the length of the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// adj = ang_opp_to_adj(ang,opp);
|
||||
// Description:
|
||||
// Given the reference reference angle of a right triangle, and the length of the side opposite of it,
|
||||
// returns the length of the adjacent side.
|
||||
// Arguments:
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// Example:
|
||||
// adj = ang_opp_to_adj(45,8); // Returns: 8
|
||||
function ang_opp_to_adj(ang,opp) = opp_ang_to_adj(opp,ang);
|
||||
|
||||
|
||||
// Function: hyp_adj_to_opp()
|
||||
// Alias: adj_hyp_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the lengths of the hypotenuse and the adjacent side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = hyp_adj_to_opp(hyp,adj);
|
||||
// opp = adj_hyp_to_opp(adj,hyp);
|
||||
// Description:
|
||||
// Given the length of the hypotenuse and the adjacent side, returns the length of the opposite side.
|
||||
// Given the lengths of the hypotenuse and the adjacent side, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// Example:
|
||||
// opp = hyp_adj_to_opp(5,4); // Returns: 3
|
||||
function hyp_adj_to_opp(hyp,adj) =
|
||||
|
|
@ -211,68 +246,106 @@ function hyp_adj_to_opp(hyp,adj) =
|
|||
"Triangle side lengths should be a positive numbers." )
|
||||
sqrt(hyp*hyp-adj*adj);
|
||||
|
||||
|
||||
|
||||
// Function: adj_hyp_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the lengths of the adjacent side and the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = adj_hyp_to_opp(adj,hyp);
|
||||
// Description:
|
||||
// Given the lengths of the adjacent side and the hypotenuse, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// opp = adj_hyp_to_opp(4,5); // Returns: 3
|
||||
|
||||
function adj_hyp_to_opp(adj,hyp) = hyp_adj_to_opp(hyp,adj);
|
||||
|
||||
|
||||
|
||||
// Function: hyp_ang_to_opp()
|
||||
// Alias: ang_hyp_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the length of the hypotenuse and the angle.
|
||||
// Synopsis: Returns the opposite side length from the length of the hypotenuse and the reference reference angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = hyp_ang_to_opp(hyp,ang);
|
||||
// opp = ang_hyp_to_opp(ang,hyp);
|
||||
// Description:
|
||||
// Given the length of the hypotenuse of a right triangle, and the angle of the corner, returns the length of the opposite side.
|
||||
// Given the length of the hypotenuse of a right triangle and the reference reference angle, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// Example:
|
||||
// opp = hyp_ang_to_opp(8,30); // Returns: 4
|
||||
function hyp_ang_to_opp(hyp,ang) =
|
||||
assert(is_finite(hyp)&&hyp>=0, "Triangle side length should be a positive number." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The reference angle should be an acute reference angle." )
|
||||
hyp*sin(ang);
|
||||
|
||||
|
||||
// Function: ang_hyp_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the reference reference angle and the length of the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = ang_hyp_to_opp(ang,hyp);
|
||||
// Description:
|
||||
// Given the the reference reference angle and the length of the hypotenuse of a right triangle, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// opp = ang_hyp_to_opp(30,8); // Returns: 4
|
||||
function ang_hyp_to_opp(ang,hyp) = hyp_ang_to_opp(hyp,ang);
|
||||
|
||||
|
||||
// Function: adj_ang_to_opp()
|
||||
// Alias: ang_adj_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the length of the adjacent side and the angle.
|
||||
// Synopsis: Returns the opposite side length from the length of the adjacent side and the reference reference angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = adj_ang_to_opp(adj,ang);
|
||||
// opp = ang_adj_to_opp(ang,adj);
|
||||
// Description:
|
||||
// Given the length of the adjacent side of a right triangle, and the angle of the corner, returns the length of the opposite side.
|
||||
// Given the length of the adjacent side of a right triangle, and the reference reference angle, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// Example:
|
||||
// opp = adj_ang_to_opp(8,45); // Returns: 8
|
||||
function adj_ang_to_opp(adj,ang) =
|
||||
assert(is_finite(adj)&&adj>=0, "Triangle side length should be a positive number." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The reference angle should be an acute reference angle." )
|
||||
adj*tan(ang);
|
||||
|
||||
// Function: ang_adj_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the reference reference angle and the length of the adjacent side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// opp = ang_adj_to_opp(ang,adj);
|
||||
// Description:
|
||||
// Given the reference reference angle and the length of the adjacent side of a right triangle, returns the length of the opposite side.
|
||||
// Arguments:
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// Example:
|
||||
// opp = ang_adj_to_opp(45,8); // Returns: 8
|
||||
function ang_adj_to_opp(ang,adj) = adj_ang_to_opp(adj,ang);
|
||||
|
||||
|
||||
// Function: adj_opp_to_hyp()
|
||||
// Alias: opp_adj_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the lengths of the adjacent and opposite sides.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = adj_opp_to_hyp(adj,opp);
|
||||
// hyp = opp_adj_to_hyp(opp,adj);
|
||||
// Description:
|
||||
// Given the length of the adjacent and opposite sides of a right triangle, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// Example:
|
||||
// hyp = adj_opp_to_hyp(3,4); // Returns: 5
|
||||
function adj_opp_to_hyp(adj,opp) =
|
||||
|
|
@ -280,68 +353,104 @@ function adj_opp_to_hyp(adj,opp) =
|
|||
"Triangle side lengths should be a positive numbers." )
|
||||
norm([opp,adj]);
|
||||
|
||||
|
||||
// Function: opp_adj_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the lengths of the opposite and adjacent sides.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = opp_adj_to_hyp(opp,adj);
|
||||
// Description:
|
||||
// Given the length of the opposite and adjacent sides of a right triangle, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// Example:
|
||||
// hyp = opp_adj_to_hyp(4,3); // Returns: 5
|
||||
function opp_adj_to_hyp(opp,adj) = adj_opp_to_hyp(adj,opp);
|
||||
|
||||
|
||||
// Function: adj_ang_to_hyp()
|
||||
// Alias: ang_adj_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the length of the adjacent and the angle.
|
||||
// Synopsis: Returns the hypotenuse length from the length of the adjacent side and the reference reference angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = adj_ang_to_hyp(adj,ang);
|
||||
// hyp = ang_adj_to_hyp(ang,adj);
|
||||
// Description:
|
||||
// For a right triangle, given the length of the adjacent side, and the corner angle, returns the length of the hypotenuse.
|
||||
// For a right triangle, given the length of the adjacent side, and the reference reference angle, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// Example:
|
||||
// hyp = adj_ang_to_hyp(4,60); // Returns: 8
|
||||
function adj_ang_to_hyp(adj,ang) =
|
||||
assert(is_finite(adj) && adj>=0, "Triangle side length should be a positive number." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The reference angle should be an acute reference angle." )
|
||||
adj/cos(ang);
|
||||
|
||||
|
||||
// Function: ang_adj_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the reference reference angle and length of the adjacent side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = ang_adj_to_hyp(ang,adj);
|
||||
// Description:
|
||||
// For a right triangle, given the reference reference angle and length of the adjacent side, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// Example:
|
||||
// hyp = ang_adj_to_hyp(60,4); // Returns: 8
|
||||
function ang_adj_to_hyp(ang,adj) = adj_ang_to_hyp(adj,ang);
|
||||
|
||||
|
||||
// Function: opp_ang_to_hyp()
|
||||
// Alias: ang_opp_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the length of the opposite side and the angle.
|
||||
// Synopsis: Returns the hypotenuse length from the length of the opposite side and the reference reference angle.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = opp_ang_to_hyp(opp,ang);
|
||||
// hyp = ang_opp_to_hyp(ang,opp);
|
||||
// Description:
|
||||
// For a right triangle, given the length of the opposite side, and the corner angle, returns the length of the hypotenuse.
|
||||
// For a right triangle, given the length of the opposite side, and the reference reference angle, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// ang = The angle in degrees of the primary corner of the right triangle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// Example:
|
||||
// hyp = opp_ang_to_hyp(4,30); // Returns: 8
|
||||
function opp_ang_to_hyp(opp,ang) =
|
||||
assert(is_finite(opp) && opp>=0, "Triangle side length should be a positive number." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The angle should be an acute angle." )
|
||||
assert(is_finite(ang) && ang>-90 && ang<90, "The reference angle should be an acute reference angle." )
|
||||
opp/sin(ang);
|
||||
|
||||
// Function: ang_opp_to_hyp()
|
||||
// Synopsis: Returns the hypotenuse length from the reference reference angle and the length of the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// hyp = ang_opp_to_hyp(ang,opp);
|
||||
// Description:
|
||||
// For a right triangle, given the reference reference angle and the length of the opposite side, returns the length of the hypotenuse.
|
||||
// Arguments:
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// Example:
|
||||
// hyp = opp_ang_to_hyp(30,4); // Returns: 8
|
||||
function ang_opp_to_hyp(ang,opp) = opp_ang_to_hyp(opp,ang);
|
||||
|
||||
|
||||
|
||||
// Function: hyp_adj_to_ang()
|
||||
// Alias: adj_hyp_to_ang()
|
||||
// Synopsis: Returns the angle from the lengths of the hypotenuse and the adjacent side.
|
||||
// Synopsis: Returns the reference reference angle from the lengths of the hypotenuse and the adjacent side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = hyp_adj_to_ang(hyp,adj);
|
||||
// ang = adj_hyp_to_ang(adj,hyp);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the hypotenuse and the adjacent sides, returns the angle of the corner.
|
||||
// For a right triangle, given the lengths of the hypotenuse and the adjacent side, returns the reference reference angle.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// Example:
|
||||
// ang = hyp_adj_to_ang(8,4); // Returns: 60 degrees
|
||||
function hyp_adj_to_ang(hyp,adj) =
|
||||
|
|
@ -349,22 +458,34 @@ function hyp_adj_to_ang(hyp,adj) =
|
|||
"Triangle side lengths should be positive numbers." )
|
||||
acos(adj/hyp);
|
||||
|
||||
|
||||
// Function: adj_hyp_to_ang()
|
||||
// Synopsis: Returns the reference angle from the lengths of the adjacent side and the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = adj_hyp_to_ang(adj,hyp);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the adjacent side and the hypotenuse, returns the reference reference angle.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// ang = adj_hyp_to_ang(4,8); // Returns: 60 degrees
|
||||
function adj_hyp_to_ang(adj,hyp) = hyp_adj_to_ang(hyp,adj);
|
||||
|
||||
|
||||
// Function: hyp_opp_to_ang()
|
||||
// Alias: opp_hyp_to_ang()
|
||||
// Synopsis: Returns the angle from the lengths of the hypotenuse and the opposite side.
|
||||
// Synopsis: Returns the reference reference angle from the lengths of the hypotenuse and the opposite side.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = hyp_opp_to_ang(hyp,opp);
|
||||
// ang = opp_hyp_to_ang(opp,hyp);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the hypotenuse and the opposite sides, returns the angle of the corner.
|
||||
// For a right triangle, given the lengths of the hypotenuse and the opposite sides, returns the reference reference angle.
|
||||
// Arguments:
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// Example:
|
||||
// ang = hyp_opp_to_ang(8,4); // Returns: 30 degrees
|
||||
function hyp_opp_to_ang(hyp,opp) =
|
||||
|
|
@ -372,22 +493,33 @@ function hyp_opp_to_ang(hyp,opp) =
|
|||
"Triangle side lengths should be positive numbers." )
|
||||
asin(opp/hyp);
|
||||
|
||||
// Function: opp_hyp_to_ang()
|
||||
// Synopsis: Returns the reference reference angle from the lengths of the opposite side and the hypotenuse.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = opp_hyp_to_ang(opp,hyp);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the opposite side and the hypotenuse, returns the reference reference angle.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// hyp = The length of the hypotenuse of the right triangle.
|
||||
// Example:
|
||||
// ang = opp_hyp_to_ang(4,8); // Returns: 30 degrees
|
||||
function opp_hyp_to_ang(opp,hyp) = hyp_opp_to_ang(hyp,opp);
|
||||
|
||||
|
||||
// Function: adj_opp_to_ang()
|
||||
// Alias: opp_adj_to_ang()
|
||||
// Synopsis: Returns the angle from the lengths of the adjacent and opposite sides.
|
||||
// Synopsis: Returns the reference angle from the lengths of the adjacent and opposite sides.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp()
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = adj_opp_to_ang(adj,opp);
|
||||
// ang = opp_adj_to_ang(opp,adj);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the adjacent and opposite sides, returns the angle of the corner.
|
||||
// For a right triangle, given the lengths of the adjacent and opposite sides, returns the reference angle of the corner.
|
||||
// Arguments:
|
||||
// adj = The length of the side of the right triangle that is adjacent to the primary angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the primary angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// Example:
|
||||
// ang = adj_opp_to_ang(sqrt(3)/2,0.5); // Returns: 30 degrees
|
||||
function adj_opp_to_ang(adj,opp) =
|
||||
|
|
@ -395,8 +527,26 @@ function adj_opp_to_ang(adj,opp) =
|
|||
"Triangle side lengths should be positive numbers." )
|
||||
atan2(opp,adj);
|
||||
|
||||
|
||||
// Function: opp_adj_to_ang()
|
||||
// Synopsis: Returns the reference reference angle from the lengths of the opposite and adjacent sides.
|
||||
// Topics: Geometry, Trigonometry, Triangles
|
||||
// See Also: adj_ang_to_hyp(), adj_ang_to_opp(), adj_opp_to_ang(), adj_opp_to_hyp(), hyp_adj_to_ang(), hyp_adj_to_opp(), hyp_ang_to_adj(), hyp_ang_to_opp(), hyp_opp_to_adj(), hyp_opp_to_ang(), opp_ang_to_adj(), opp_ang_to_hyp(), ang_adj_to_hyp(), ang_adj_to_opp(), opp_adj_to_ang(), opp_adj_to_hyp(), adj_hyp_to_ang(), adj_hyp_to_opp(), ang_hyp_to_adj(), ang_hyp_to_opp(), opp_hyp_to_adj(), opp_hyp_to_ang(), ang_opp_to_adj(), ang_opp_to_hyp()
|
||||
// Usage:
|
||||
// ang = opp_adj_to_ang(opp,adj);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the opposite and adjacent sides, returns the reference reference angle.
|
||||
// Arguments:
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference reference angle.
|
||||
// Example:
|
||||
// ang = opp_adj_to_ang(0.5,sqrt(3)/2); // Returns: 30 degrees
|
||||
function opp_adj_to_ang(opp,adj) = adj_opp_to_ang(adj,opp);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||
|
|
|
|||
Loading…
Reference in a new issue