mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2026-02-07 20:49:19 +00:00
Update trigonometry.scad
Fix missed reference angle changes.
This commit is contained in:
parent
eb2db9ce38
commit
b6dd763e79
1 changed files with 91 additions and 91 deletions
|
|
@ -25,8 +25,8 @@ _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.
|
||||
// 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") {
|
||||
|
|
@ -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,9 +62,9 @@ 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.
|
||||
// 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") {
|
||||
|
|
@ -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)
|
||||
|
|
@ -96,15 +96,15 @@ function law_of_sines(a, A, b, B) =
|
|||
// 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 angle size in degrees.
|
||||
// - **ang**: The reference reference angle size in degrees.
|
||||
// - **hyp**: The length of the Hypotenuse.
|
||||
// - **adj**: The length of the side adjacent to the reference angle.
|
||||
// - **opp**: The length of the side opposite to the reference angle.
|
||||
// - **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 reference angle, and want to learn the length of the side
|
||||
// opposite to the reference angle, you will call `opp = hyp_adj_to_opp(hyp,adj);`.
|
||||
// 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]]);
|
||||
|
|
@ -130,7 +130,7 @@ function law_of_sines(a, A, b, B) =
|
|||
// 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 reference angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference reference angle.
|
||||
// Example:
|
||||
// adj = hyp_opp_to_adj(5,3); // Returns: 4
|
||||
function hyp_opp_to_adj(hyp,opp) =
|
||||
|
|
@ -149,7 +149,7 @@ function hyp_opp_to_adj(hyp,opp) =
|
|||
// 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 angle.
|
||||
// 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
|
||||
|
|
@ -157,35 +157,35 @@ function opp_hyp_to_adj(opp,hyp) = hyp_opp_to_adj(hyp,opp);
|
|||
|
||||
|
||||
// Function: hyp_ang_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(), 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);
|
||||
// Description:
|
||||
// Given the length of the hypotenuse and the reference angle 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 reference angle of the right triangle in degrees
|
||||
// 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 angle and the length of the hypotenuse.
|
||||
// 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 angle and the length of the hypotenuse of a right triangle,
|
||||
// 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 angle of the right triangle in degrees
|
||||
// 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
|
||||
|
|
@ -193,36 +193,36 @@ function ang_hyp_to_adj(ang,hyp) = hyp_ang_to_adj(hyp, ang);
|
|||
|
||||
|
||||
// Function: opp_ang_to_adj()
|
||||
// Synopsis: Returns the adjacent side length from the length of the opposite side and the reference 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(), 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);
|
||||
// Description:
|
||||
// Given the length of the opposite side and the reference angle of a right triangle,
|
||||
// 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 reference angle.
|
||||
// ang = The 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.
|
||||
// ang = The reference reference angle of the right triangle in degrees
|
||||
// Example:
|
||||
// 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 angle and the length of the opposite side.
|
||||
// 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 angle of a right triangle, and the length of the side opposite of it,
|
||||
// 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 angle of the right triangle in degrees
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference angle.
|
||||
// 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);
|
||||
|
|
@ -238,7 +238,7 @@ function ang_opp_to_adj(ang,opp) = opp_ang_to_adj(opp,ang);
|
|||
// 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 reference 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) =
|
||||
|
|
@ -257,7 +257,7 @@ function hyp_adj_to_opp(hyp,adj) =
|
|||
// 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 angle.
|
||||
// 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
|
||||
|
|
@ -267,34 +267,34 @@ function adj_hyp_to_opp(adj,hyp) = hyp_adj_to_opp(hyp,adj);
|
|||
|
||||
|
||||
// Function: hyp_ang_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the length of the hypotenuse and the reference 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(), 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);
|
||||
// Description:
|
||||
// Given the length of the hypotenuse of a right triangle and the reference angle, 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 reference angle of the right triangle in degrees
|
||||
// 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 angle and the length of the hypotenuse.
|
||||
// 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 angle and the length of the hypotenuse of a right triangle, returns the length of the opposite side.
|
||||
// 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 angle of the right triangle in degrees
|
||||
// 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
|
||||
|
|
@ -302,34 +302,34 @@ function ang_hyp_to_opp(ang,hyp) = hyp_ang_to_opp(hyp,ang);
|
|||
|
||||
|
||||
// Function: adj_ang_to_opp()
|
||||
// Synopsis: Returns the opposite side length from the length of the adjacent side and the reference 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(), 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);
|
||||
// Description:
|
||||
// Given the length of the adjacent side of a right triangle, and the reference angle, 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 reference angle.
|
||||
// ang = The 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.
|
||||
// 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 angle and the length of the adjacent side.
|
||||
// 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 angle and the length of the adjacent side of a right triangle, returns the length of the opposite side.
|
||||
// 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 angle of the right triangle in degrees
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference angle.
|
||||
// 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);
|
||||
|
|
@ -344,8 +344,8 @@ function ang_adj_to_opp(ang,adj) = adj_ang_to_opp(adj,ang);
|
|||
// 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 reference angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference 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) =
|
||||
|
|
@ -363,77 +363,77 @@ function adj_opp_to_hyp(adj,opp) =
|
|||
// 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 angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference angle.
|
||||
// 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()
|
||||
// Synopsis: Returns the hypotenuse length from the length of the adjacent side and the reference 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(), 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);
|
||||
// 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 reference angle.
|
||||
// ang = The 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.
|
||||
// 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 angle and length of the adjacent side.
|
||||
// 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 angle and length of the adjacent side, returns the length of the hypotenuse.
|
||||
// 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 angle of the right triangle in degrees
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference angle.
|
||||
// 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()
|
||||
// Synopsis: Returns the hypotenuse length from the length of the opposite side and the reference 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(), 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);
|
||||
// Description:
|
||||
// For a right triangle, given the length of the opposite side, and the reference 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 reference angle.
|
||||
// ang = The 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.
|
||||
// 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 angle and the length of the opposite side.
|
||||
// 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 angle and the length of the opposite side, returns the length of the hypotenuse.
|
||||
// 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 angle of the right triangle in degrees
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference angle.
|
||||
// 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);
|
||||
|
|
@ -441,16 +441,16 @@ function ang_opp_to_hyp(ang,opp) = opp_ang_to_hyp(opp,ang);
|
|||
|
||||
|
||||
// Function: hyp_adj_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(), 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);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the hypotenuse and the adjacent side, returns the reference angle.
|
||||
// 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 reference 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) =
|
||||
|
|
@ -460,15 +460,15 @@ function hyp_adj_to_ang(hyp,adj) =
|
|||
|
||||
|
||||
// Function: adj_hyp_to_ang()
|
||||
// Synopsis: Returns the angle from the lengths of the adjacent side and the hypotenuse.
|
||||
// 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 angle.
|
||||
// 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 angle.
|
||||
// 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
|
||||
|
|
@ -476,16 +476,16 @@ function adj_hyp_to_ang(adj,hyp) = hyp_adj_to_ang(hyp,adj);
|
|||
|
||||
|
||||
// Function: hyp_opp_to_ang()
|
||||
// Synopsis: Returns the reference 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(), 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);
|
||||
// Description:
|
||||
// For a right triangle, given the lengths of the hypotenuse and the opposite sides, returns the reference angle.
|
||||
// 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 reference 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) =
|
||||
|
|
@ -494,15 +494,15 @@ function hyp_opp_to_ang(hyp,opp) =
|
|||
asin(opp/hyp);
|
||||
|
||||
// Function: opp_hyp_to_ang()
|
||||
// Synopsis: Returns the reference angle from the lengths of the opposite side and the hypotenuse.
|
||||
// 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 angle.
|
||||
// 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 angle.
|
||||
// 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
|
||||
|
|
@ -510,16 +510,16 @@ function opp_hyp_to_ang(opp,hyp) = hyp_opp_to_ang(hyp,opp);
|
|||
|
||||
|
||||
// Function: adj_opp_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(), 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);
|
||||
// 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 reference angle.
|
||||
// opp = The length of the side of the right triangle that is opposite from the reference 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) =
|
||||
|
|
@ -529,16 +529,16 @@ function adj_opp_to_ang(adj,opp) =
|
|||
|
||||
|
||||
// Function: opp_adj_to_ang()
|
||||
// Synopsis: Returns the reference angle from the lengths of the opposite and adjacent sides.
|
||||
// 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 angle.
|
||||
// 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 angle.
|
||||
// adj = The length of the side of the right triangle that is adjacent to the reference angle.
|
||||
// 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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue